-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
160 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
dydx/dydxPresenters/dydxPresenters/_v4/Profile/Components/dydxProfileHelpViewPresenter.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// dydxProfileHelpViewPresenter.swift | ||
// dydxPresenters | ||
// | ||
// Created by Rui Huang on 24/01/2025. | ||
// | ||
|
||
import Utilities | ||
import dydxViews | ||
import PlatformParticles | ||
import RoutingKit | ||
import ParticlesKit | ||
import PlatformUI | ||
|
||
protocol dydxProfileHelpViewPresenterProtocol: HostedViewPresenterProtocol { | ||
var viewModel: dydxProfileHelpViewModel? { get } | ||
} | ||
|
||
class dydxProfileHelpViewPresenter: HostedViewPresenter<dydxProfileHelpViewModel>, dydxProfileHelpViewPresenterProtocol { | ||
override init() { | ||
super.init() | ||
|
||
viewModel = dydxProfileHelpViewModel() | ||
|
||
viewModel?.helpAction = { | ||
Router.shared?.navigate(to: RoutingRequest(path: "/help"), animated: true, completion: nil) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
dydx/dydxViews/dydxViews/_v4/Profile/Components/dydxProfileHelpView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// | ||
// dydxProfileHelpView.swift | ||
// dydxUI | ||
// | ||
// Created by Rui Huang on 24/01/2025. | ||
// Copyright © 2025 dYdX Trading Inc. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import PlatformUI | ||
import Utilities | ||
|
||
public class dydxProfileHelpViewModel: PlatformViewModel { | ||
@Published public var helpAction: (() -> Void)? | ||
|
||
public init() { } | ||
|
||
public static var previewValue: dydxProfileHelpViewModel { | ||
let vm = dydxProfileHelpViewModel() | ||
return vm | ||
} | ||
|
||
public override func createView(parentStyle: ThemeStyle = ThemeStyle.defaultStyle, styleKey: String? = nil) -> PlatformView { | ||
PlatformView(viewModel: self, parentStyle: parentStyle, styleKey: styleKey) { [weak self] _ in | ||
guard let self = self else { return AnyView(PlatformView.nilView) } | ||
|
||
let view = HStack(spacing: 8) { | ||
PlatformIconViewModel(type: .asset(name: "icon_tutorial", bundle: Bundle.dydxView), | ||
clip: .noClip, | ||
size: CGSize(width: 24, height: 24), | ||
templateColor: .textTertiary) | ||
.createView() | ||
|
||
Text(DataLocalizer.localize(path: "APP.HEADER.HELP")) | ||
.themeFont(fontSize: .medium) | ||
.themeColor(foreground: .textPrimary) | ||
.lineLimit(1) | ||
|
||
Spacer() | ||
} | ||
.padding(.horizontal, 16) | ||
.padding(.vertical, 22) | ||
.themeColor(background: .layer3) | ||
.cornerRadius(12, corners: .allCorners) | ||
.frame(maxWidth: .infinity) | ||
.onTapGesture { | ||
self.helpAction?() | ||
} | ||
|
||
return AnyView(view) | ||
} | ||
} | ||
} | ||
|
||
#if DEBUG | ||
struct dydxProfileHelpView_Previews_Dark: PreviewProvider { | ||
@StateObject static var themeSettings = ThemeSettings.shared | ||
|
||
static var previews: some View { | ||
ThemeSettings.applyDarkTheme() | ||
ThemeSettings.applyStyles() | ||
return dydxProfileHelpViewModel.previewValue | ||
.createView() | ||
.themeColor(background: .layer0) | ||
.environmentObject(themeSettings) | ||
// .edgesIgnoringSafeArea(.bottom) | ||
.previewLayout(.sizeThatFits) | ||
} | ||
} | ||
|
||
struct dydxProfileHelpView_Previews_Light: PreviewProvider { | ||
@StateObject static var themeSettings = ThemeSettings.shared | ||
|
||
static var previews: some View { | ||
ThemeSettings.applyLightTheme() | ||
ThemeSettings.applyStyles() | ||
return dydxProfileHelpViewModel.previewValue | ||
.createView() | ||
.themeColor(background: .layer0) | ||
.environmentObject(themeSettings) | ||
// .edgesIgnoringSafeArea(.bottom) | ||
.previewLayout(.sizeThatFits) | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters