From e8852a2791957fa3b65d7827fd8e5cb715c1e27e Mon Sep 17 00:00:00 2001 From: Sam Newby Date: Mon, 27 Oct 2025 16:45:08 -0400 Subject: [PATCH 1/8] Adds updated positions tab --- .../dydxViews/Shared/PlaceholderView.swift | 35 +- .../Position/dydxMarketPositionView.swift | 406 +++++------------- .../_v4/MarketInfo/dydxMarketInfoView.swift | 2 - 3 files changed, 137 insertions(+), 306 deletions(-) diff --git a/ios/dydx/dydxViews/dydxViews/Shared/PlaceholderView.swift b/ios/dydx/dydxViews/dydxViews/Shared/PlaceholderView.swift index a9d053f5..132c0585 100644 --- a/ios/dydx/dydxViews/dydxViews/Shared/PlaceholderView.swift +++ b/ios/dydx/dydxViews/dydxViews/Shared/PlaceholderView.swift @@ -11,9 +11,20 @@ import Utilities public class PlaceholderViewModel: PlatformViewModel { @Published public var text: String? + @Published public var subText: String? + @Published public var icon: PlatformIconViewModel.IconType? + private let useUpdatedStyle: Bool - public init(text: String? = nil) { + public init( + text: String? = nil, + subText: String? = nil, + icon: PlatformIconViewModel.IconType? = nil, + useUpdatedStyle: Bool = false + ) { self.text = text + self.subText = subText + self.icon = icon + self.useUpdatedStyle = useUpdatedStyle } public static var previewValue: PlaceholderViewModel { @@ -26,6 +37,28 @@ public class PlaceholderViewModel: PlatformViewModel { PlatformView(viewModel: self, parentStyle: parentStyle, styleKey: styleKey) { [weak self] style in guard let self = self else { return AnyView(PlatformView.nilView) } + if useUpdatedStyle { + return VStack(alignment: .center) { + if let icon = self.icon { + PlatformIconViewModel( + type: icon, + size: .init(width: 24, height: 24), + templateColor: .textTertiary + ) + .createView(parentStyle: parentStyle) + .opacity(0.75) + } + Text(self.text ?? "") + .themeColor(foreground: .textTertiary) + .themeFont(fontType: .plus, fontSize: .small) + Text(self.subText ?? "") + .themeColor(foreground: .textTertiary) + .themeFont(fontSize: .smaller) + .opacity(0.75) + } + .wrappedInAnyView() + } + let main = Text(self.text ?? "") .themeFont(fontSize: .small) .themeColor(foreground: .textTertiary) diff --git a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift index 1d5c13a3..d7d5d00f 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift @@ -47,6 +47,8 @@ public class dydxMarketPositionViewModel: PlatformViewModel { @Published public var contentChanged: (() -> Void)? + let columns = [GridItem(.flexible(), alignment: .leading), GridItem(.flexible(), alignment: .leading)] + public init() { } public static var previewValue: dydxMarketPositionViewModel { @@ -72,6 +74,96 @@ public class dydxMarketPositionViewModel: PlatformViewModel { return vm } + private var closeButton: any View { + if let closeAction = self.closeAction { + return Button( + action: closeAction, + label: { + HStack { + PlatformIconViewModel( + type: .system(name: "xmark"), + size: .init(width: 12, height: 12), + templateColor: .colorRed + ) + .createView() + Text(DataLocalizer.localize(path: "APP.GENERAL.CLOSE")) + .themeColor(foreground: .colorRed) + .themeFont(fontSize: .small) + } + } + ) + .padding(16) + .frame(maxWidth: .infinity) + .background(ThemeColor.SemanticColor.colorRed.color.opacity(0.08)) + .clipShape(RoundedRectangle(cornerRadius: 16)) + } else { + return EmptyView() + } + } + + private func headerText(_ textKey: String) -> Text { + Text(DataLocalizer.localize(path: textKey)) + .themeColor(foreground: .textTertiary) + .themeFont(fontSize: .smaller) + } + + private func valueText(_ text: String?) -> Text { + Text(text ?? "-") + .themeColor(foreground: .textPrimary) + .themeFont(fontSize: .medium) + } + + private func defaultStat(_ textKey: String, _ value: String?) -> some View { + VStack(alignment: .leading) { + headerText(textKey) + valueText(value) + } + } + + private func createCollection(parentStyle: ThemeStyle) -> some View { + VStack(spacing: 16) { + LazyVGrid(columns: columns, spacing: 16) { + VStack(alignment: .leading) { + headerText("APP.GENERAL.LEVERAGE") + valueText(leverage) + } + closeButton + .wrappedInAnyView() + defaultStat("APP.GENERAL.VALUE", amount) + defaultStat("APP.GENERAL.SIZE", "\(size ?? "-") \(token?.symbol ?? "")") + VStack(alignment: .leading) { + headerText("APP.TRADE.UNREALIZED_PNL") + unrealizedPNLAmount? + .createView() + .themeFont(fontSize: .medium) + } + VStack(alignment: .leading) { + headerText("APP.TRADE.REALIZED_PNL") + realizedPNLAmount? + .createView() + .themeFont(fontSize: .medium) + } + defaultStat("APP.GENERAL.MARGIN", margin) + defaultStat("APP.TRADE.LIQUIDATION", liquidationPrice) + defaultStat("APP.GENERAL.AVG_ENTRY", openPrice) + defaultStat("APP.TRADE.AVG_CLOSE", closePrice) + VStack(alignment: .leading) { + headerText("APP.TRADE.FUNDING_PAYMENTS_SHORT") + funding? + .createView() + .themeFont(fontSize: .medium) + } + } + } + } + + private func createPendingPositionsHeader(parentStyle: ThemeStyle) -> some View { + Text(localizerPathKey: "APP.TRADE.UNOPENED_ISOLATED_POSITIONS") + .themeFont(fontSize: .larger) + .themeColor(foreground: .textSecondary) + .leftAligned() + } + public override func createView(parentStyle: ThemeStyle = ThemeStyle.defaultStyle, styleKey: String? = nil) -> PlatformView { PlatformView(viewModel: self, parentStyle: parentStyle, styleKey: styleKey) { [weak self] style in guard let self = self else { return AnyView(PlatformView.nilView) } @@ -87,15 +179,19 @@ public class dydxMarketPositionViewModel: PlatformViewModel { return AnyView( VStack(spacing: 24) { - // check size to determine if there is current position data to display - VStack { + VStack(spacing: 16) { if self.hasOpenPosition { - self.createCollection(parentStyle: style) - self.createButtons(parentStyle: style) - self.createList(parentStyle: style) - } else { - PlaceholderViewModel(text: DataLocalizer.localize(path: "APP.GENERAL.PLACEHOLDER_NO_POSITIONS")) + PlaceholderViewModel( + text: emptyText, + subText: DataLocalizer.localize(path: "APP.TRADE.POSITIONS_SHOW_HERE"), + icon: .system(name: "briefcase.fill"), + useUpdatedStyle: true + ) .createView() + .padding(.vertical, 20) + } else { + self.createCollection(parentStyle: style) + self.tpSlGroupViewModel?.createView(parentStyle: parentStyle) } } @@ -111,302 +207,6 @@ public class dydxMarketPositionViewModel: PlatformViewModel { ) } } - - private var unrealizedView: AnyView { - VStack(alignment: .leading, spacing: 6) { - Text(DataLocalizer.localize(path: "APP.TRADE.UNREALIZED_PNL")) - .themeFont(fontType: .plus, fontSize: .small) - .themeColor(foreground: .textTertiary) - VStack(alignment: .leading, spacing: 2) { - self.unrealizedPNLAmount? - .createView(parentStyle: .defaultStyle.themeFont(fontSize: .large)) - Text(self.unrealizedPNLPercent) - .themeFont(fontSize: .smaller) - .themeColor(foreground: .textSecondary) - } - } - .wrappedInAnyView() - } - - private var realizedView: AnyView { - VStack(alignment: .leading, spacing: 6) { - Text(DataLocalizer.localize(path: "APP.TRADE.REALIZED_PNL")) - .themeFont(fontType: .plus, fontSize: .small) - .themeColor(foreground: .textTertiary) - realizedPNLAmount? - .createView(parentStyle: .defaultStyle.themeFont(fontSize: .large)) - } - .wrappedInAnyView() - } - - private var marginView: AnyView? { - guard let marginMode = marginMode, let margin = margin else { return nil } - return VStack(alignment: .leading, spacing: 6) { - Text(DataLocalizer.localize(path: "APP.GENERAL.MARGIN_WITH_MODE", params: ["MODE": marginMode])) - .themeFont(fontType: .plus, fontSize: .small) - .themeColor(foreground: .textTertiary) - Text(margin) - .themeFont(fontSize: .medium) - .themeColor(foreground: .textSecondary) - .lineLimit(1) - .minimumScaleFactor(0.5) - Spacer(minLength: 0) - } - .wrappedInAnyView() - } - - private var statsRow: some View { - let views = [unrealizedView, realizedView, marginView].compactMap { $0 } - return Group { - // left aligned - if views.count == 2 { - HStack(alignment: .top, spacing: 12) { - ForEach(views.indices, id: \.self) { index in - views[index] - .padding(.vertical, 8) - if index < views.count - 1 { - DividerModel().createView() - } - } - Spacer() - } - } else { - // even spacing - HStack(alignment: .top, spacing: 0) { - ForEach(views.indices, id: \.self) { index in - Spacer() - views[index] - .padding(.vertical, 8) - Spacer() - if index < views.count - 1 { - DividerModel().createView() - } - } - } - } - } - .padding(.horizontal, 8) - .wrappedInAnyView() - } - - private func createCollection(parentStyle: ThemeStyle) -> some View { - VStack(spacing: 12) { - HStack { - createPositionTab(parentStyle: parentStyle) - - VStack(alignment: .leading, spacing: 16) { - let value = HStack { - Text(leverage ?? "-") - leverageIcon?.createView(parentStyle: parentStyle) - } - self.createCollectionItem(parentStyle: parentStyle, title: DataLocalizer.localize(path: "APP.GENERAL.LEVERAGE"), valueViewModel: value.wrappedViewModel) - .frame(minWidth: 0, maxWidth: .infinity) - .frame(height: 58) - - DividerModel().createView(parentStyle: parentStyle) - - self.createCollectionItem(parentStyle: parentStyle, title: DataLocalizer.localize(path: "APP.TRADE.LIQUIDATION_PRICE"), stringValue: liquidationPrice) - .frame(minWidth: 0, maxWidth: .infinity) - .frame(height: 58) - } - .frame(minWidth: 0, maxWidth: .infinity) - } - - statsRow - } - .padding(.bottom, 8) - - } - - private func createPositionTab(parentStyle: ThemeStyle) -> some View { - Group { - VStack(alignment: .leading, spacing: 0) { - HStack { - PlatformIconViewModel(type: .url(url: logoUrl), - clip: .defaultCircle, - size: CGSize(width: 36, height: 36), - backgroundColor: .colorWhite) - .createView(parentStyle: parentStyle) - - Spacer(minLength: 4) - - VStack(alignment: .trailing, spacing: 2) { - Text(size ?? "") - .lineLimit(1) - .minimumScaleFactor(0.5) - Text(amount ?? "") - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - .lineLimit(1) - .minimumScaleFactor(0.5) - } - } - - Spacer() - - HStack(spacing: 0) { - side?.createView(parentStyle: parentStyle.themeFont(fontSize: .small)) - Spacer(minLength: 4) - if let marginMode = marginMode { - Text(marginMode) - .padding(.horizontal, 6) - .padding(.vertical, 4) - .themeFont(fontSize: .small) - .themeColor(foreground: .textSecondary) - .themeColor(background: .layer7) - .clipShape(.rect(cornerRadius: 4)) - } - } - } - .padding(16) - } - .frame(width: 162, height: 142) - .themeGradient(background: .layer3, gradientType: gradientType) - .cornerRadius(12) - } - - private func createCollectionItem(parentStyle: ThemeStyle, title: String?, stringValue: String?) -> some View { - VStack(spacing: 0) { - VStack(alignment: .leading, spacing: 6) { - Text(title ?? "") - .themeFont(fontType: .plus, fontSize: .small) - .themeColor(foreground: .textTertiary) - .fixedSize(horizontal: true, vertical: false) - .leftAligned() - Text(stringValue ?? "-") - .themeFont(fontSize: .medium) - .themeColor(foreground: .textSecondary) - .lineLimit(1) - .minimumScaleFactor(0.5) - } - Spacer() - } - .padding(.horizontal, 8) - } - - private func createCollectionItem(parentStyle: ThemeStyle, title: String?, valueViewModel: PlatformViewModel?) -> some View { - VStack(spacing: 0) { - VStack(alignment: .leading, spacing: 6) { - Text(title ?? "") - .themeFont(fontType: .plus, fontSize: .small) - .themeColor(foreground: .textTertiary) - .fixedSize(horizontal: true, vertical: false) - .leftAligned() - valueViewModel?.createView(parentStyle: parentStyle, styleKey: nil) - .fixedSize(horizontal: true, vertical: false) - .leftAligned() - } - Spacer() - } - - .padding(.horizontal, 8) - } - - private func createButtons(parentStyle: ThemeStyle) -> some View { - var closePositionButton: AnyView? - var editMarginButton: AnyView? - - if let closeAction = self.closeAction { - let content = HStack { - Spacer() - Text(DataLocalizer.localize(path: "APP.TRADE.CLOSE_POSITION")) - .themeFont(fontType: .plus, fontSize: .medium) - .themeColor(foreground: ThemeSettings.negativeColor) - Spacer() - } - - closePositionButton = PlatformButtonViewModel(content: content.wrappedViewModel, state: .destructive) { - closeAction() - } - .createView(parentStyle: parentStyle) - .wrappedInAnyView() - } - - if let editMarginAction = self.editMarginAction { - let content = HStack(spacing: 0) { - Spacer() - HStack(spacing: 8) { - PlatformIconViewModel(type: .asset(name: "icon_edit", bundle: Bundle.dydxView), - size: CGSize(width: 20, height: 20), - templateColor: .textSecondary) - .createView() - Text(DataLocalizer.localize(path: "APP.TRADE.EDIT_MARGIN")) - .themeFont(fontSize: .medium) - .themeColor(foreground: .textSecondary) - } - Spacer() - } - .padding(8) - .frame(minHeight: 50) - .themeColor(background: .layer3) - .cornerRadius(10, corners: .allCorners) - - editMarginButton = PlatformButtonViewModel(content: content.wrappedViewModel, type: .iconType) { - editMarginAction() - } - .createView(parentStyle: parentStyle) - .wrappedInAnyView() - } - - return VStack(spacing: 10) { - self.tpSlGroupViewModel?.createView(parentStyle: parentStyle) - HStack(spacing: 10) { - closePositionButton - editMarginButton - } - } - .padding(.bottom, 16) - } - - private func createList(parentStyle: ThemeStyle) -> some View { - VStack { - HStack { - Text(DataLocalizer.localize(path: "APP.TRADE.AVERAGE_OPEN")) - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - - Spacer() - - Text(openPrice ?? "-") - .themeFont(fontSize: .medium) - .themeColor(foreground: .textSecondary) - } - - DividerModel().createView(parentStyle: parentStyle) - - HStack { - Text(DataLocalizer.localize(path: "APP.TRADE.AVERAGE_CLOSE")) - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - - Spacer() - - Text(closePrice ?? "-") - .themeFont(fontSize: .medium) - .themeColor(foreground: .textSecondary) - } - - DividerModel().createView(parentStyle: parentStyle) - - HStack { - Text(DataLocalizer.localize(path: "APP.TRADE.NET_FUNDING")) - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - - Spacer() - - funding?.createView(parentStyle: parentStyle.themeFont(fontSize: .medium)) - } - } - .padding(.horizontal, 8) - } - - private func createPendingPositionsHeader(parentStyle: ThemeStyle) -> some View { - Text(localizerPathKey: "APP.TRADE.UNOPENED_ISOLATED_POSITIONS") - .themeFont(fontSize: .larger) - .themeColor(foreground: .textSecondary) - .leftAligned() - } } #if DEBUG diff --git a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/dydxMarketInfoView.swift b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/dydxMarketInfoView.swift index 8665ce79..6d1c2fc1 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/dydxMarketInfoView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/dydxMarketInfoView.swift @@ -69,8 +69,6 @@ public class dydxMarketInfoViewModel: PlatformViewModel { self.createPositionSection(parentStyle: style) Spacer(minLength: 24) -// self.createConfigsSection(parentStyle: style) - // for tab bar scroll adjstment overlap Spacer(minLength: 128) } From 07eee6c874e93ab7bb2346f1d2dcdaba2a507ace Mon Sep 17 00:00:00 2001 From: Sam Newby Date: Tue, 28 Oct 2025 09:36:24 -0400 Subject: [PATCH 2/8] Updates TP/SL button Styles --- .../PlatformUIJedio.xcodeproj/project.pbxproj | 10 +-- .../project.pbxproj | 10 +-- .../circle_stack.imageset/Contents.json | 21 +++++ .../circle_stack.imageset/circle_stack.svg | 6 ++ .../Position/dydxMarketPositionView.swift | 26 ++++-- .../Position/dydxMarketTpSlGroupView.swift | 83 ++++++++++++------- ...ydxTakeProfitStopLossStatusViewModel.swift | 61 +++----------- 7 files changed, 119 insertions(+), 98 deletions(-) create mode 100644 ios/dydx/dydxViews/dydxViews/Media.xcassets/circle_stack.imageset/Contents.json create mode 100644 ios/dydx/dydxViews/dydxViews/Media.xcassets/circle_stack.imageset/circle_stack.svg diff --git a/ios/PlatformUIJedio/PlatformUIJedio.xcodeproj/project.pbxproj b/ios/PlatformUIJedio/PlatformUIJedio.xcodeproj/project.pbxproj index 10329ed1..35a05c17 100644 --- a/ios/PlatformUIJedio/PlatformUIJedio.xcodeproj/project.pbxproj +++ b/ios/PlatformUIJedio/PlatformUIJedio.xcodeproj/project.pbxproj @@ -1185,10 +1185,7 @@ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; @@ -1262,10 +1259,7 @@ LDPLUSPLUS = ""; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/ios/StatsigInjections/StatsigInjections.xcodeproj/project.pbxproj b/ios/StatsigInjections/StatsigInjections.xcodeproj/project.pbxproj index bbcdb3d3..9c40aa16 100644 --- a/ios/StatsigInjections/StatsigInjections.xcodeproj/project.pbxproj +++ b/ios/StatsigInjections/StatsigInjections.xcodeproj/project.pbxproj @@ -362,10 +362,7 @@ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; @@ -439,10 +436,7 @@ LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/ios/dydx/dydxViews/dydxViews/Media.xcassets/circle_stack.imageset/Contents.json b/ios/dydx/dydxViews/dydxViews/Media.xcassets/circle_stack.imageset/Contents.json new file mode 100644 index 00000000..5a4a1690 --- /dev/null +++ b/ios/dydx/dydxViews/dydxViews/Media.xcassets/circle_stack.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "circle_stack.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/dydx/dydxViews/dydxViews/Media.xcassets/circle_stack.imageset/circle_stack.svg b/ios/dydx/dydxViews/dydxViews/Media.xcassets/circle_stack.imageset/circle_stack.svg new file mode 100644 index 00000000..e8016a26 --- /dev/null +++ b/ios/dydx/dydxViews/dydxViews/Media.xcassets/circle_stack.imageset/circle_stack.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift index d7d5d00f..efe232aa 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift @@ -123,9 +123,14 @@ public class dydxMarketPositionViewModel: PlatformViewModel { private func createCollection(parentStyle: ThemeStyle) -> some View { VStack(spacing: 16) { LazyVGrid(columns: columns, spacing: 16) { - VStack(alignment: .leading) { - headerText("APP.GENERAL.LEVERAGE") - valueText(leverage) + HStack(alignment: .top) { + VStack(alignment: .leading) { + headerText("APP.GENERAL.LEVERAGE") + valueText(leverage) + } + side?.createView( + parentStyle: parentStyle.themeFont(fontType: .plus, fontSize: .smallest) + ) } closeButton .wrappedInAnyView() @@ -143,7 +148,18 @@ public class dydxMarketPositionViewModel: PlatformViewModel { .createView() .themeFont(fontSize: .medium) } - defaultStat("APP.GENERAL.MARGIN", margin) + HStack(alignment: .top) { + VStack(alignment: .leading) { + headerText("APP.GENERAL.MARGIN") + valueText(margin) + } + Text(marginMode ?? "") + .themeColor(foreground: .textSecondary) + .themeFont(fontType: .plus, fontSize: .smallest) + .padding(.horizontal, 4) + .padding(.vertical, 2) + .border(borderWidth: 1, cornerRadius: 6, borderColor: ThemeColor.SemanticColor.layer4.color) + } defaultStat("APP.TRADE.LIQUIDATION", liquidationPrice) defaultStat("APP.GENERAL.AVG_ENTRY", openPrice) defaultStat("APP.TRADE.AVG_CLOSE", closePrice) @@ -184,7 +200,7 @@ public class dydxMarketPositionViewModel: PlatformViewModel { PlaceholderViewModel( text: emptyText, subText: DataLocalizer.localize(path: "APP.TRADE.POSITIONS_SHOW_HERE"), - icon: .system(name: "briefcase.fill"), + icon: .asset(name: "circle_stack", bundle: .dydxView), useUpdatedStyle: true ) .createView() diff --git a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketTpSlGroupView.swift b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketTpSlGroupView.swift index 1723152c..9e56d55a 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketTpSlGroupView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketTpSlGroupView.swift @@ -28,19 +28,45 @@ public class dydxMarketTpSlGroupViewModel: PlatformViewModel { PlatformView(viewModel: self, parentStyle: parentStyle, styleKey: styleKey) { [weak self] style in guard let self = self else { return AnyView(PlatformView.nilView) } - let view = HStack(spacing: 12) { + if self.takeProfitStatusViewModel == nil && self.stopLossStatusViewModel == nil { + return Button(action: takeProfitStopLossAction ?? {}) { + HStack { + PlatformIconViewModel( + type: .system(name: "plus"), + size: .init(width: 16, height: 16), + templateColor: .textTertiary + ).createView() + Text(DataLocalizer.localize(path: "APP.TRADE.SET_TAKE_PROFIT_STOP_LOSS_TRIGGERS")) + .themeColor(foreground: .textTertiary) + .themeFont(fontSize: .small) + } + } + .padding(12) + .frame(maxWidth: .infinity) + .themeColor(background: .layer1) + .cornerRadius(12, corners: .allCorners) + .wrappedInAnyView() + } + + let view = HStack(spacing: 20) { if self.takeProfitStatusViewModel != nil { self.takeProfitStatusViewModel?.createView(parentStyle: style) } else { - self.createAddButton(label: DataLocalizer.localize(path: "APP.TRADE.TAKE_PROFIT"), - style: style) + self.createAddButton( + label: DataLocalizer.localize(path: "APP.TRADE.TAKE_PROFIT"), + buttonLabel: DataLocalizer.localize(path: "APP.TRADE.ADD_TP"), + style: style + ) } if self.stopLossStatusViewModel != nil { self.stopLossStatusViewModel?.createView(parentStyle: parentStyle) } else { - self.createAddButton(label: DataLocalizer.localize(path: "APP.TRADE.STOP_LOSS"), - style: style) + self.createAddButton( + label: DataLocalizer.localize(path: "APP.TRADE.STOP_LOSS"), + buttonLabel: DataLocalizer.localize(path: "APP.TRADE.ADD_SL"), + style: style + ) } } .frame(maxHeight: .infinity) @@ -49,33 +75,32 @@ public class dydxMarketTpSlGroupViewModel: PlatformViewModel { } } - private func createAddButton(label: String, style: ThemeStyle) -> some View { - let content = HStack { - Text(label) - .multilineTextAlignment(.leading) - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - .frame(maxWidth: 60) - + private func createAddButton(label: String, buttonLabel: String, style: ThemeStyle) -> some View { + HStack { + VStack(alignment: .leading) { + Text(label) + .themeColor(foreground: .textTertiary) + .themeFont(fontSize: .smaller) + Text("--") + .themeColor(foreground: .textTertiary) + .themeFont(fontSize: .smaller) + } Spacer() - - PlatformIconViewModel(type: .system(name: "plus"), - size: CGSize(width: 14, height: 14), - templateColor: .textSecondary) - .createView(parentStyle: style) - .frame(width: 24, height: 24) - .themeColor(background: .layer5) - .clipShape(Circle()) - } + Button(action: takeProfitStopLossAction ?? {}) { + HStack { + PlatformIconViewModel( + type: .system(name: "plus"), + size: .init(width: 12, height: 12), + templateColor: .textTertiary + ).createView(parentStyle: style) + Text(buttonLabel) + .themeColor(foreground: .textTertiary) + .themeFont(fontSize: .smaller) + } + } .padding(8) - .themeColor(background: .layer3) - .cornerRadius(10, corners: .allCorners) - .wrappedViewModel - - return PlatformButtonViewModel(content: content, type: .iconType) { [weak self] in - self?.takeProfitStopLossAction?() + .border(borderWidth: 1, cornerRadius: 6, borderColor: ThemeColor.SemanticColor.layer3.color) } - .createView(parentStyle: style) } } diff --git a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxTakeProfitStopLossStatusViewModel.swift b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxTakeProfitStopLossStatusViewModel.swift index dbfbbf95..85404302 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxTakeProfitStopLossStatusViewModel.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxTakeProfitStopLossStatusViewModel.swift @@ -31,65 +31,30 @@ public class dydxTakeProfitStopLossStatusViewModel: PlatformViewModel { dydxTakeProfitStopLossStatusViewModel(triggerSide: .stopLoss, triggerPriceText: "0.000001") } - private func createTitleValueRow(titleStringKey: String, value: String?) -> AnyView? { - guard let value = value else { return nil } - return HStack(spacing: 8) { - Text(DataLocalizer.shared?.localize(path: titleStringKey, params: nil) ?? "") - .multilineTextAlignment(.leading) - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - .frame(width: 60) - - Spacer() - - Text(value) - .themeFont(fontType: .base, fontSize: .small) - .themeColor(foreground: .textPrimary) - .minimumScaleFactor(0.5) - .lineLimit(1) - } - .wrappedInAnyView() - } - public override func createView(parentStyle: ThemeStyle = ThemeStyle.defaultStyle, styleKey: String? = nil) -> PlatformView { PlatformView(viewModel: self, parentStyle: parentStyle, styleKey: styleKey) { [weak self] style in guard let self = self else { return AnyView(PlatformView.nilView) } - let content = VStack(spacing: 8) { - HStack(spacing: 8) { + return HStack { + VStack(alignment: .leading) { Text(DataLocalizer.shared?.localize(path: self.triggerSide.titleStringKey, params: nil) ?? "") - .themeFont(fontSize: .small) .themeColor(foreground: .textTertiary) - .frame(width: 60) - - Spacer() - + .themeFont(fontSize: .smaller) Text(self.triggerPriceText ?? "") - .themeFont(fontType: .base, fontSize: .large) .themeColor(foreground: .textPrimary) - .truncationMode(.middle) - .minimumScaleFactor(0.5) - .lineLimit(1) + .themeFont(fontSize: .medium) } - if self.limitPrice != nil || self.amount != nil { - DividerModel().createView(parentStyle: style) - .padding(.horizontal, -8) - - VStack(spacing: 4) { - self.createTitleValueRow(titleStringKey: "APP.TRADE.LIMIT_ORDER_SHORT", value: self.limitPrice) - self.createTitleValueRow(titleStringKey: "APP.GENERAL.AMOUNT", value: self.amount) - } + Spacer() + Button(action: self.action ?? {}) { + PlatformIconViewModel( + type: .system(name: "pencil"), + size: .init(width: 12, height: 12), + templateColor: .textTertiary + ).createView(parentStyle: style) } - } .padding(8) - .themeColor(background: .layer3) - .cornerRadius(10, corners: .allCorners) - - return PlatformButtonViewModel(content: content.wrappedViewModel, type: .iconType) {[weak self] in - self?.action?() - } - .createView(parentStyle: style) - .wrappedInAnyView() + .border(borderWidth: 1, cornerRadius: 6, borderColor: ThemeColor.SemanticColor.layer3.color) + }.wrappedInAnyView() } } } From 52a23ec475a93a61e90f3ce2d4bcaa930d33111f Mon Sep 17 00:00:00 2001 From: Sam Newby Date: Tue, 28 Oct 2025 10:17:50 -0400 Subject: [PATCH 3/8] Updates orders list --- .../dydxPortfolioOrdersViewPresenter.swift | 4 +- .../dydxViews/Shared/PlaceholderView.swift | 3 + .../_v4/MarketInfo/dydxMarketInfoView.swift | 1 + .../Sections/dydxPortfolioOrdersView.swift | 182 +++++++----------- 4 files changed, 75 insertions(+), 115 deletions(-) diff --git a/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioOrdersViewPresenter.swift b/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioOrdersViewPresenter.swift index e774922d..ddabce7d 100644 --- a/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioOrdersViewPresenter.swift +++ b/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioOrdersViewPresenter.swift @@ -80,9 +80,9 @@ class dydxPortfolioOrdersViewPresenter: HostedViewPresenter PlatformView { - PlatformView(viewModel: self, parentStyle: parentStyle, styleKey: styleKey) { [weak self] style in - guard let self = self else { return AnyView(PlatformView.nilView) } - - let icon = self.createLogo(parentStyle: style) - - let main = self.createMain(parentStyle: style) - - let cell = PlatformTableViewCellViewModel(logo: icon.wrappedViewModel, - main: main.wrappedViewModel, - trailing: PlatformView.nilViewModel, - edgeInsets: EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16)) - .createView(parentStyle: parentStyle) - .onTapGesture { [weak self] in - self?.handler?.onTapAction?() - } - - if self.canCancel { - let rightCellSwipeAccessoryView = PlatformIconViewModel(type: .asset(name: "action_cancel", bundle: Bundle.dydxView), size: .init(width: 16, height: 16)) - .createView(parentStyle: style, styleKey: styleKey) - .tint(ThemeColor.SemanticColor.layer2.color) - - let rightCellSwipeAccessory = CellSwipeAccessory(accessoryView: AnyView(rightCellSwipeAccessoryView)) { - self.handler?.onCloseAction?() - } - return AnyView(cell.swipeActions(leftCellSwipeAccessory: nil, rightCellSwipeAccessory: rightCellSwipeAccessory)) - } else { - return AnyView(cell) + private func headerView(style: ThemeStyle = ThemeStyle.defaultStyle) -> some View { + HStack(spacing: 8) { + Text(DataLocalizer.localize(path: "APP.TRADE.LIMIT_ORDER")) + .themeFont(fontSize: .small) + self.sideText.createView(parentStyle: style.themeFont(fontSize: .small)) + Spacer() + HStack(spacing: 16) { + PlatformButtonViewModel( + content: PlatformIconViewModel( + type: .system(name: "pencil"), + size: .init(width: 16, height: 16), + templateColor: .textTertiary + ), + type: .iconType, + action: self.handler?.onTapAction ?? {} + ).createView(parentStyle: style) + PlatformButtonViewModel( + content: PlatformIconViewModel( + type: .system(name: "xmark"), + size: .init(width: 16, height: 16), + templateColor: .colorRed + ), + type: .iconType, + action: self.handler?.onCloseAction ?? {} + ).createView(parentStyle: style) } } + .padding(16) + .overlay(alignment: .bottom) { + Rectangle() + .frame(maxWidth: .infinity, minHeight: 2, maxHeight: 2) + .themeColor(foreground: .layer2) + } } - private func createLogo(parentStyle: ThemeStyle) -> some View { - HStack(spacing: 4) { - if let date = date { - IntervalTextModel(date: date) - .createView(parentStyle: parentStyle - .themeFont(fontSize: .smaller) - .themeColor(foreground: .textTertiary)) - .frame(width: 32) - } else { - Text("-") - .themeFont(fontSize: .smaller) - .themeColor(foreground: .textTertiary) - .frame(width: 32) - } - - ZStack { - PlatformIconViewModel(type: .url(url: logoUrl), - clip: .defaultCircle, - size: CGSize(width: 32, height: 32), - backgroundColor: .colorWhite) - .createView(parentStyle: parentStyle) - - Group { - orderStatus.createView(parentStyle: parentStyle) - .rightAligned() - .topAligned() - } - .frame(width: 42, height: 42) - } + private func detailView(_ labelKey: String, _ value: () -> Content) -> some View { + VStack(alignment: .leading, spacing: 2) { + Text(DataLocalizer.localize(path: labelKey)) + .themeColor(foreground: .textTertiary) + .themeFont(fontSize: .smaller) + value() } - } - private func createMain(parentStyle: ThemeStyle) -> some View { - VStack(alignment: .leading, spacing: 0) { - HStack { - Text(status ?? "") - .themeFont(fontSize: .small) - - Spacer() - - HStack(spacing: 2) { - sideText - .createView(parentStyle: parentStyle.themeFont(fontSize: .small)) - - Text("@") - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - - Text(price ?? "") - .themeFont(fontType: .number, fontSize: .small) - .lineLimit(1) - .minimumScaleFactor(0.5) - } + private func orderDetailsView(style: ThemeStyle = ThemeStyle.defaultStyle) -> some View { + HStack(alignment: .center, spacing: 16) { + detailView("APP.TRADE.LIMIT_PRICE") { + Text(triggerPrice ?? "").themeFont(fontSize: .medium) } - - HStack { - HStack(spacing: 2) { - Text(filledSize ?? "") - Text("/") - Text(size ?? "") - token?.createView(parentStyle: parentStyle.themeFont(fontSize: .smallest)) + detailView("APP.TRADE.ORDERBOOK_ORDER_SIZE") { + Text(size ?? "").themeFont(fontSize: .medium) + } + detailView("APP.TRADE.AMOUNT_FILLED") { + HStack { + Text(filledSize ?? "").themeFont(fontSize: .medium) + orderStatus.createView() } - .themeFont(fontType: .number, fontSize: .smaller) - .themeColor(foreground: .textTertiary) - .lineLimit(1) - .minimumScaleFactor(0.5) + } + } + .padding(.horizontal, 16) + .padding(.vertical, 12) + } - Spacer() + public override func createView(parentStyle: ThemeStyle = ThemeStyle.defaultStyle, styleKey: String? = nil) -> PlatformView { + PlatformView(viewModel: self, parentStyle: parentStyle, styleKey: styleKey) { [weak self] style in + guard let self = self else { return AnyView(PlatformView.nilView) } - Text(type ?? "") - .themeFont(fontSize: .smaller) - .themeColor(foreground: .textTertiary) + return VStack(alignment: .leading) { + self.headerView(style: style) + self.orderDetailsView(style: style) } + .themeColor(background: .layer1) + .cornerRadius(16, corners: .allCorners) + .wrappedInAnyView() } - } } @@ -197,15 +164,18 @@ public class dydxPortfolioOrdersViewModel: PlatformListViewModel { .wrappedViewModel } return PlaceholderViewModel( - text: DataLocalizer.localize(path: "APP.TRADE.ORDER_EMPTY_STATE") + text: DataLocalizer.localize(path: "APP.TRADE.ORDER_EMPTY_STATE"), + subText: DataLocalizer.localize(path: "APP.TRADE.ORDER_SHOW_HERE"), + icon: .system(name: "square.stack.fill"), + useUpdatedStyle: true ) } public init(items: [PlatformViewModel] = [], contentChanged: (() -> Void)? = nil) { super.init(items: items, - intraItemSeparator: true, - firstListItemTopSeparator: true, - lastListItemBottomSeparator: true, + intraItemSeparator: false, + firstListItemTopSeparator: false, + lastListItemBottomSeparator: false, contentChanged: contentChanged) } @@ -217,20 +187,6 @@ public class dydxPortfolioOrdersViewModel: PlatformListViewModel { ] return vm } - - public override var header: PlatformViewModel? { - guard items.count > 0 else { return nil } - return HStack { - Text(DataLocalizer.localize(path: "APP.GENERAL.STATUS_FILL")) - Spacer() - Text(DataLocalizer.localize(path: "APP.GENERAL.PRICE_TYPE")) - } - .padding(.horizontal, 16) - .padding(.bottom, 16) - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - .wrappedViewModel - } } #if DEBUG From 68c063a1ac7226cca5ec82cde360f773e13a2b65 Mon Sep 17 00:00:00 2001 From: Sam Newby Date: Tue, 28 Oct 2025 12:20:39 -0400 Subject: [PATCH 4/8] Updates trades list style --- .../Utilities/_Extensions/Date+Utils.swift | 3 +- .../Sections/dydxPortfolioFillsView.swift | 26 ++---- .../Sections/dydxPortfolioOrdersView.swift | 3 +- .../_v4/Portfolio/Shared/SharedFillView.swift | 88 ++++++++----------- 4 files changed, 44 insertions(+), 76 deletions(-) diff --git a/ios/Utilities/Utilities/_Extensions/Date+Utils.swift b/ios/Utilities/Utilities/_Extensions/Date+Utils.swift index 2b4b85a2..50b926ed 100644 --- a/ios/Utilities/Utilities/_Extensions/Date+Utils.swift +++ b/ios/Utilities/Utilities/_Extensions/Date+Utils.swift @@ -163,8 +163,7 @@ public extension Date { var englishDatetimeString: String { let formatter = type(of: self).localFormatter - formatter.dateStyle = .short - formatter.timeStyle = .short + formatter.dateFormat = "HH:mm MMMM dd, yyyy" return formatter.string(from: self) } diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFillsView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFillsView.swift index 1b7ac122..f178319c 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFillsView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFillsView.swift @@ -25,14 +25,17 @@ public class dydxPortfolioFillsViewModel: PlatformListViewModel { .wrappedViewModel } return PlaceholderViewModel( - text: DataLocalizer.localize(path: "APP.TRADE.TRADES_EMPTY_STATE") + text: DataLocalizer.localize(path: "APP.TRADE.TRADES_EMPTY_STATE"), + subText: DataLocalizer.localize(path: "APP.TRADE.TRADES_SHOW_HERE"), + icon: .system(name: "rectangle.stack.fill"), + useUpdatedStyle: true ) } public init(items: [PlatformViewModel] = [], contentChanged: (() -> Void)? = nil) { super.init(items: items, intraItemSeparator: true, - firstListItemTopSeparator: true, + firstListItemTopSeparator: false, lastListItemBottomSeparator: true, contentChanged: contentChanged) self.width = UIScreen.main.bounds.width - 16 @@ -46,25 +49,6 @@ public class dydxPortfolioFillsViewModel: PlatformListViewModel { ] return vm } - - public override var header: PlatformViewModel? { - guard items.count > 0 else { return nil } - return HStack { - HStack { - Text(DataLocalizer.localize(path: "APP.GENERAL.TIME")) - Spacer() - } - .frame(width: 80) - Text(DataLocalizer.localize(path: "APP.GENERAL.TYPE_AMOUNT")) - Spacer() - Text(DataLocalizer.localize(path: "APP.GENERAL.PRICE_FEE")) - } - .padding(.horizontal, 16) - .padding(.bottom, 16) - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - .wrappedViewModel - } } #if DEBUG diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioOrdersView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioOrdersView.swift index a6b63f48..ad640d10 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioOrdersView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioOrdersView.swift @@ -98,7 +98,8 @@ public class dydxPortfolioOrderItemViewModel: PlatformViewModel { ).createView(parentStyle: style) } } - .padding(16) + .padding(.horizontal, 16) + .padding(.vertical, 12) .overlay(alignment: .bottom) { Rectangle() .frame(maxWidth: .infinity, minHeight: 2, maxHeight: 2) diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift index 13131053..28622e92 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift @@ -72,7 +72,7 @@ public class SharedFillViewModel: PlatformViewModel { PlatformTableViewCellViewModel(logo: icon.wrappedViewModel, main: main.wrappedViewModel, trailing: trailing.wrappedViewModel, - edgeInsets: EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16)) + edgeInsets: EdgeInsets(top: 8, leading: 16, bottom: 8, trailing: 16)) .createView(parentStyle: parentStyle) .onTapGesture { [weak self] in self?.handler?.onTapAction?() @@ -82,74 +82,58 @@ public class SharedFillViewModel: PlatformViewModel { } private func createLogo(parentStyle: ThemeStyle) -> some View { - HStack { - IntervalTextModel(date: date) - .createView(parentStyle: parentStyle - .themeFont(fontSize: .smaller) - .themeColor(foreground: .textTertiary)) - .frame(width: 32) - - ZStack { - PlatformIconViewModel(type: .url(url: logoUrl), - clip: .defaultCircle, - size: CGSize(width: 32, height: 32), - backgroundColor: .colorWhite) - .createView(parentStyle: parentStyle) - - Group { - OrderStatusModel(status: .green) - .createView(parentStyle: parentStyle) - .rightAligned() - .topAligned() - } - .frame(width: 42, height: 42) + ZStack { + PlatformIconViewModel(type: .url(url: logoUrl), + clip: .defaultCircle, + size: CGSize(width: 32, height: 32), + backgroundColor: .colorWhite) + .createView(parentStyle: parentStyle) + + Group { + OrderStatusModel(status: .green) + .createView(parentStyle: parentStyle) + .rightAligned() + .topAligned() } + .frame(width: 42, height: 42) } .layoutPriority(1) } private func createMain(parentStyle: ThemeStyle) -> some View { - VStack(alignment: .leading, spacing: 0) { - Text(type ?? "") - .themeFont(fontSize: .small) - .lineLimit(1) - - HStack { + VStack(alignment: .leading, spacing: 2) { + HStack(spacing: 2) { + sideText.createView(parentStyle: parentStyle) Text(size ?? "") - .themeFont(fontType: .number, fontSize: .smaller) - .themeColor(foreground: .textTertiary) - .lineLimit(1) - - token?.createView(parentStyle: parentStyle.themeFont(fontSize: .smallest)) + .themeFont(fontSize: .medium) + Text(token?.symbol ?? "") + .themeFont(fontSize: .medium) } + Text(date?.englishDatetimeString ?? "") + .themeColor(foreground: .textTertiary) + .themeFont(fontSize: .smallest) } .layoutPriority(1) } private func createTrailing(parentStyle: ThemeStyle) -> some View { - VStack(alignment: .trailing) { - HStack(spacing: 2) { - sideText.createView(parentStyle: parentStyle.themeFont(fontSize: .small)) - - Text("@") - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - + HStack { + VStack(alignment: .trailing, spacing: 2) { Text(price ?? "") - .themeFont(fontType: .number, fontSize: .small) - .lineLimit(1) - } - - HStack(spacing: 2) { - Text(feeLiquidity ?? "") + .themeFont(fontSize: .small) + .themeColor(foreground: .textPrimary) + Text(type ?? "") .themeFont(fontSize: .smaller) - - Text(fee ?? "") - .themeFont(fontType: .number, fontSize: .smaller) .themeColor(foreground: .textTertiary) - .lineLimit(1) } - + if handler?.onTapAction != nil { + PlatformIconViewModel( + type: .system(name: "square.and.arrow.up"), + size: .init(width: 16, height: 16), + templateColor: .textTertiary + ) + .createView(parentStyle: parentStyle) + } } .minimumScaleFactor(0.5) } From d4c47f4a52d250909e42cf7cff442c5943db598d Mon Sep 17 00:00:00 2001 From: Sam Newby Date: Tue, 28 Oct 2025 12:58:25 -0400 Subject: [PATCH 5/8] Updates funding tab to new style --- .../dydxPortfolioFundingViewPresenter.swift | 2 +- .../Position/dydxMarketPositionView.swift | 47 ++++------- .../Position/dydxMarketTpSlGroupView.swift | 4 +- .../Sections/dydxPortfolioFundingView.swift | 78 ++++++------------- .../Sections/dydxPortfolioOrdersView.swift | 13 +++- .../_v4/Portfolio/Shared/SharedFillView.swift | 2 +- 6 files changed, 55 insertions(+), 91 deletions(-) diff --git a/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFundingViewPresenter.swift b/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFundingViewPresenter.swift index 7124dcbb..af52a02f 100644 --- a/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFundingViewPresenter.swift +++ b/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFundingViewPresenter.swift @@ -68,7 +68,7 @@ class dydxPortfolioFundingViewPresenter: HostedViewPresenter= 0.0 { item.amount = SignedAmountViewModel(text: amount, sign: .plus, coloringOption: .signOnly) diff --git a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift index efe232aa..1a59fbeb 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift @@ -114,45 +114,34 @@ public class dydxMarketPositionViewModel: PlatformViewModel { } private func defaultStat(_ textKey: String, _ value: String?) -> some View { - VStack(alignment: .leading) { - headerText(textKey) - valueText(value) + defaultStat(headerText(textKey), valueText(value)) + } + + private func defaultStat(_ header: Header, _ value: Value) -> some View { + VStack(alignment: .leading, spacing: 2) { + header + value } } private func createCollection(parentStyle: ThemeStyle) -> some View { VStack(spacing: 16) { LazyVGrid(columns: columns, spacing: 16) { - HStack(alignment: .top) { - VStack(alignment: .leading) { - headerText("APP.GENERAL.LEVERAGE") - valueText(leverage) - } + let leverageHeader = HStack { + headerText("APP.GENERAL.LEVERAGE") side?.createView( parentStyle: parentStyle.themeFont(fontType: .plus, fontSize: .smallest) ) } + defaultStat(leverageHeader, valueText(leverage)) closeButton .wrappedInAnyView() defaultStat("APP.GENERAL.VALUE", amount) defaultStat("APP.GENERAL.SIZE", "\(size ?? "-") \(token?.symbol ?? "")") - VStack(alignment: .leading) { - headerText("APP.TRADE.UNREALIZED_PNL") - unrealizedPNLAmount? - .createView() - .themeFont(fontSize: .medium) - } - VStack(alignment: .leading) { - headerText("APP.TRADE.REALIZED_PNL") - realizedPNLAmount? - .createView() - .themeFont(fontSize: .medium) - } - HStack(alignment: .top) { - VStack(alignment: .leading) { - headerText("APP.GENERAL.MARGIN") - valueText(margin) - } + defaultStat(headerText("APP.TRADE.UNREALIZED_PNL"), unrealizedPNLAmount?.createView().themeFont(fontSize: .medium)) + defaultStat(headerText("APP.TRADE.REALIZED_PNL"), realizedPNLAmount?.createView().themeFont(fontSize: .medium)) + let marginHeader = HStack { + headerText("APP.GENERAL.MARGIN") Text(marginMode ?? "") .themeColor(foreground: .textSecondary) .themeFont(fontType: .plus, fontSize: .smallest) @@ -160,15 +149,11 @@ public class dydxMarketPositionViewModel: PlatformViewModel { .padding(.vertical, 2) .border(borderWidth: 1, cornerRadius: 6, borderColor: ThemeColor.SemanticColor.layer4.color) } + defaultStat(marginHeader, valueText(margin)) defaultStat("APP.TRADE.LIQUIDATION", liquidationPrice) defaultStat("APP.GENERAL.AVG_ENTRY", openPrice) defaultStat("APP.TRADE.AVG_CLOSE", closePrice) - VStack(alignment: .leading) { - headerText("APP.TRADE.FUNDING_PAYMENTS_SHORT") - funding? - .createView() - .themeFont(fontSize: .medium) - } + defaultStat(headerText("APP.TRADE.FUNDING_PAYMENTS_SHORT"), funding?.createView().themeFont(fontSize: .medium)) } } } diff --git a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketTpSlGroupView.swift b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketTpSlGroupView.swift index 9e56d55a..0af3948b 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketTpSlGroupView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketTpSlGroupView.swift @@ -34,10 +34,10 @@ public class dydxMarketTpSlGroupViewModel: PlatformViewModel { PlatformIconViewModel( type: .system(name: "plus"), size: .init(width: 16, height: 16), - templateColor: .textTertiary + templateColor: .textSecondary ).createView() Text(DataLocalizer.localize(path: "APP.TRADE.SET_TAKE_PROFIT_STOP_LOSS_TRIGGERS")) - .themeColor(foreground: .textTertiary) + .themeColor(foreground: .textSecondary) .themeFont(fontSize: .small) } } diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFundingView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFundingView.swift index 2b44fb6a..aee7226b 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFundingView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFundingView.swift @@ -44,7 +44,7 @@ public enum FundingStatus { public class dydxPortfolioFundingItemViewModel: PlatformViewModel { - public init(amount: SignedAmountViewModel? = nil, rate: SignedAmountViewModel? = nil, time: String? = nil, sideText: SideTextViewModel = SideTextViewModel(), status: FundingStatus = .paid, position: String? = nil, token: TokenTextViewModel? = TokenTextViewModel(), logoUrl: URL? = nil, onTapAction: (() -> Void)? = nil) { + public init(amount: SignedAmountViewModel? = nil, rate: SignedAmountViewModel? = nil, time: Date? = nil, sideText: SideTextViewModel = SideTextViewModel(), status: FundingStatus = .paid, position: String? = nil, token: TokenTextViewModel? = TokenTextViewModel(), logoUrl: URL? = nil, onTapAction: (() -> Void)? = nil) { self.amount = amount self.rate = rate self.time = time @@ -58,7 +58,7 @@ public class dydxPortfolioFundingItemViewModel: PlatformViewModel { public var amount: SignedAmountViewModel? public var rate: SignedAmountViewModel? - public var time: String? + public var time: Date? public var sideText = SideTextViewModel() public var status: FundingStatus = .paid public var position: String? @@ -69,7 +69,7 @@ public class dydxPortfolioFundingItemViewModel: PlatformViewModel { public static var previewValue: dydxPortfolioFundingItemViewModel { let item = dydxPortfolioFundingItemViewModel(amount: .previewValue, rate: .previewValue, - time: "2mo", + time: Date(), sideText: .previewValue, status: .paid, position: "$2300.0", @@ -97,43 +97,33 @@ public class dydxPortfolioFundingItemViewModel: PlatformViewModel { .onTapGesture { [weak self] in self?.onTapAction?() } - // .padding(.vertical, -4) ) } } private func createLogo(parentStyle: ThemeStyle) -> some View { - HStack { - Text(time ?? "") - .themeFont(fontSize: .smaller) - .themeColor(foreground: .textTertiary) - .frame(width: 32) - - let mainIcon = PlatformIconViewModel(type: .url(url: logoUrl), clip: .defaultCircle) - let overlayIcon = PlatformIconViewModel(type: .asset(name: status.statusIcon, bundle: Bundle.dydxView), - clip: .circle(background: .layer0, spacing: 4), - size: CGSize(width: 12, height: 12), - templateColor: status.templateColor) - PlatformOverlayIconViewModel(mainIcon: mainIcon, - overlayIcon: overlayIcon) - .createView(parentStyle: parentStyle) - } + let mainIcon = PlatformIconViewModel(type: .url(url: logoUrl), clip: .defaultCircle) + let overlayIcon = PlatformIconViewModel(type: .asset(name: status.statusIcon, bundle: Bundle.dydxView), + clip: .circle(background: .layer0, spacing: 4), + size: CGSize(width: 12, height: 12), + templateColor: status.templateColor) + return PlatformOverlayIconViewModel(mainIcon: mainIcon, + overlayIcon: overlayIcon) + .createView(parentStyle: parentStyle) } private func createMain(parentStyle: ThemeStyle) -> some View { - VStack(alignment: .leading, spacing: 0) { - Text(status.directionText) - .themeFont(fontSize: .small) - - HStack { - sideText.createView(parentStyle: parentStyle.themeFont(fontSize: .smaller)) - + VStack(alignment: .leading) { + HStack(spacing: 2) { Text(position ?? "") - .themeFont(fontType: .number, fontSize: .smaller) - .themeColor(foreground: .textTertiary) - - token?.createView(parentStyle: parentStyle.themeFont(fontSize: .smallest)) + .themeFont(fontSize: .medium) + Text(token?.symbol ?? "") + .themeFont(fontSize: .medium) + sideText.createView(parentStyle: parentStyle.themeFont(fontSize: .medium)) } + Text(time?.englishDatetimeString ?? "") + .themeColor(foreground: .textTertiary) + .themeFont(fontSize: .smallest) } } @@ -161,14 +151,17 @@ public class dydxPortfolioFundingViewModel: PlatformListViewModel { .wrappedViewModel } return PlaceholderViewModel( - text: DataLocalizer.localize(path: "APP.TRADE.FUNDING_EMPTY_STATE") + text: DataLocalizer.localize(path: "APP.TRADE.FUNDING_EMPTY_STATE"), + subText: DataLocalizer.localize(path: "APP.TRADE.FUNDING_SHOW_HERE"), + icon: .system(name: "xmark.rectangle.portrait.fill"), + useUpdatedStyle: true ) } public init(items: [PlatformViewModel] = [], contentChanged: (() -> Void)? = nil) { super.init(items: items, intraItemSeparator: true, - firstListItemTopSeparator: true, + firstListItemTopSeparator: false, lastListItemBottomSeparator: true, contentChanged: contentChanged) self.width = UIScreen.main.bounds.width - 16 @@ -182,27 +175,6 @@ public class dydxPortfolioFundingViewModel: PlatformListViewModel { ] return vm } - - public override var header: PlatformViewModel? { - guard items.count > 0 else { return nil } - return HStack { - HStack { - Text(DataLocalizer.localize(path: "APP.GENERAL.TIME")) - Spacer() - } - .frame(width: 80) - Text(DataLocalizer.localize(path: "APP.GENERAL.TYPE") + " / " + - DataLocalizer.localize(path: "APP.GENERAL.POSITION")) - Spacer() - Text(DataLocalizer.localize(path: "APP.GENERAL.AMOUNT") + " / " + - DataLocalizer.localize(path: "APP.TRADE.RATE")) - } - .padding(.horizontal, 16) - .padding(.bottom, 16) - .themeFont(fontSize: .small) - .themeColor(foreground: .textTertiary) - .wrappedViewModel - } } #if DEBUG diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioOrdersView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioOrdersView.swift index ad640d10..b65f62b7 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioOrdersView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioOrdersView.swift @@ -74,6 +74,7 @@ public class dydxPortfolioOrderItemViewModel: PlatformViewModel { private func headerView(style: ThemeStyle = ThemeStyle.defaultStyle) -> some View { HStack(spacing: 8) { Text(DataLocalizer.localize(path: "APP.TRADE.LIMIT_ORDER")) + .themeColor(foreground: .textPrimary) .themeFont(fontSize: .small) self.sideText.createView(parentStyle: style.themeFont(fontSize: .small)) Spacer() @@ -119,14 +120,20 @@ public class dydxPortfolioOrderItemViewModel: PlatformViewModel { private func orderDetailsView(style: ThemeStyle = ThemeStyle.defaultStyle) -> some View { HStack(alignment: .center, spacing: 16) { detailView("APP.TRADE.LIMIT_PRICE") { - Text(triggerPrice ?? "").themeFont(fontSize: .medium) + Text(triggerPrice ?? "") + .themeColor(foreground: .textPrimary) + .themeFont(fontSize: .medium) } detailView("APP.TRADE.ORDERBOOK_ORDER_SIZE") { - Text(size ?? "").themeFont(fontSize: .medium) + Text("\(size ?? "") \(token?.symbol ?? "")") + .themeColor(foreground: .textPrimary) + .themeFont(fontSize: .medium) } detailView("APP.TRADE.AMOUNT_FILLED") { HStack { - Text(filledSize ?? "").themeFont(fontSize: .medium) + Text(filledSize ?? "") + .themeColor(foreground: .textPrimary) + .themeFont(fontSize: .medium) orderStatus.createView() } } diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift index 28622e92..8bcbcca8 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift @@ -72,7 +72,7 @@ public class SharedFillViewModel: PlatformViewModel { PlatformTableViewCellViewModel(logo: icon.wrappedViewModel, main: main.wrappedViewModel, trailing: trailing.wrappedViewModel, - edgeInsets: EdgeInsets(top: 8, leading: 16, bottom: 8, trailing: 16)) + edgeInsets: EdgeInsets(top: 8, leading: 8, bottom: 8, trailing: 8)) .createView(parentStyle: parentStyle) .onTapGesture { [weak self] in self?.handler?.onTapAction?() From fabd10e45cf0428b6f9ac9f2c3122b856a3b407c Mon Sep 17 00:00:00 2001 From: Sam Newby Date: Tue, 28 Oct 2025 13:00:52 -0400 Subject: [PATCH 6/8] Ensures text has correct color --- .../Components/Sections/dydxPortfolioFundingView.swift | 2 ++ .../dydxViews/_v4/Portfolio/Shared/SharedFillView.swift | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFundingView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFundingView.swift index aee7226b..24948327 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFundingView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFundingView.swift @@ -116,8 +116,10 @@ public class dydxPortfolioFundingItemViewModel: PlatformViewModel { VStack(alignment: .leading) { HStack(spacing: 2) { Text(position ?? "") + .themeColor(foreground: .textPrimary) .themeFont(fontSize: .medium) Text(token?.symbol ?? "") + .themeColor(foreground: .textPrimary) .themeFont(fontSize: .medium) sideText.createView(parentStyle: parentStyle.themeFont(fontSize: .medium)) } diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift index 8bcbcca8..656af0e5 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift @@ -105,8 +105,10 @@ public class SharedFillViewModel: PlatformViewModel { HStack(spacing: 2) { sideText.createView(parentStyle: parentStyle) Text(size ?? "") + .themeColor(foreground: .textPrimary) .themeFont(fontSize: .medium) Text(token?.symbol ?? "") + .themeColor(foreground: .textPrimary) .themeFont(fontSize: .medium) } Text(date?.englishDatetimeString ?? "") From b205747e25b4069463363614247f092e8cacda7e Mon Sep 17 00:00:00 2001 From: Sam Newby Date: Wed, 29 Oct 2025 12:48:06 -0400 Subject: [PATCH 7/8] Style Updates --- .../dydxPortfolioFillsViewPresenter.swift | 2 +- .../dydxPortfolioFundingViewPresenter.swift | 2 +- .../dydxPortfolioOrdersViewPresenter.swift | 2 +- .../dydxViews/Shared/OrderStatus.swift | 4 ++-- .../Position/dydxMarketPositionView.swift | 4 ++-- .../Sections/dydxPortfolioFundingView.swift | 7 ++----- .../dydxPortfolioSectionsView.swift | 20 ++++++++++--------- .../_v4/Portfolio/Shared/SharedFillView.swift | 9 +++------ 8 files changed, 23 insertions(+), 27 deletions(-) diff --git a/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFillsViewPresenter.swift b/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFillsViewPresenter.swift index 062285c2..c289fd33 100644 --- a/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFillsViewPresenter.swift +++ b/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFillsViewPresenter.swift @@ -29,7 +29,7 @@ class dydxPortfolioFillsViewPresenter: HostedViewPresenter some View { VStack(alignment: .leading) { - HStack(spacing: 2) { - Text(position ?? "") - .themeColor(foreground: .textPrimary) - .themeFont(fontSize: .medium) - Text(token?.symbol ?? "") + HStack(spacing: 3) { + Text("\(position ?? "") \(token?.symbol ?? "")") .themeColor(foreground: .textPrimary) .themeFont(fontSize: .medium) sideText.createView(parentStyle: parentStyle.themeFont(fontSize: .medium)) diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/dydxPortfolioSectionsView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/dydxPortfolioSectionsView.swift index 2e05b319..ca40c375 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/dydxPortfolioSectionsView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/dydxPortfolioSectionsView.swift @@ -53,16 +53,18 @@ public class dydxPortfolioSectionsViewModel: PlatformViewModel { HStack { ScrollViewReader { proxy in ScrollView(.horizontal, showsIndicators: false) { - TabGroupModel(items: items, - selectedItems: selectedItems, - currentSelection: self.sectionIndex, - onSelectionChanged: { [weak self] idx in - - withAnimation { - proxy.scrollTo(idx, anchor: .center) - } + TabGroupModel( + items: items, + selectedItems: selectedItems, + currentSelection: self.sectionIndex, + onSelectionChanged: { [weak self] idx in + withAnimation { + proxy.scrollTo(idx, anchor: .center) + } self?.onSelectionChanged?(idx) - }) + }, + spacing: 0 + ) .createView(parentStyle: style) .overlay( Rectangle() diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift index 656af0e5..51cd5c2f 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift @@ -102,12 +102,9 @@ public class SharedFillViewModel: PlatformViewModel { private func createMain(parentStyle: ThemeStyle) -> some View { VStack(alignment: .leading, spacing: 2) { - HStack(spacing: 2) { + HStack(spacing: 4) { sideText.createView(parentStyle: parentStyle) - Text(size ?? "") - .themeColor(foreground: .textPrimary) - .themeFont(fontSize: .medium) - Text(token?.symbol ?? "") + Text("\(size ?? "") \(token?.symbol ?? "")") .themeColor(foreground: .textPrimary) .themeFont(fontSize: .medium) } @@ -130,7 +127,7 @@ public class SharedFillViewModel: PlatformViewModel { } if handler?.onTapAction != nil { PlatformIconViewModel( - type: .system(name: "square.and.arrow.up"), + type: .asset(name: "icon_link", bundle: .dydxView), size: .init(width: 16, height: 16), templateColor: .textTertiary ) From baf2956157695487c91689850542764521d4701d Mon Sep 17 00:00:00 2001 From: Sam Newby Date: Wed, 29 Oct 2025 13:29:06 -0400 Subject: [PATCH 8/8] Moves data formatting to presenter --- .../Components/dydxPortfolioFillsViewPresenter.swift | 2 +- .../Components/dydxPortfolioFundingViewPresenter.swift | 2 +- .../Trade/TradeStatus/dydxTradeStatusViewBuilder.swift | 6 +++--- .../Components/Sections/dydxPortfolioFundingView.swift | 8 ++++---- .../dydxViews/_v4/Portfolio/Shared/SharedFillView.swift | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFillsViewPresenter.swift b/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFillsViewPresenter.swift index c289fd33..60c43f5a 100644 --- a/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFillsViewPresenter.swift +++ b/ios/dydx/dydxPresenters/dydxPresenters/_v4/Portfolio/Components/dydxPortfolioFillsViewPresenter.swift @@ -80,7 +80,7 @@ class dydxPortfolioFillsViewPresenter: HostedViewPresenter= 0.0 { item.amount = SignedAmountViewModel(text: amount, sign: .plus, coloringOption: .signOnly) diff --git a/ios/dydx/dydxPresenters/dydxPresenters/_v4/Trade/TradeStatus/dydxTradeStatusViewBuilder.swift b/ios/dydx/dydxPresenters/dydxPresenters/_v4/Trade/TradeStatus/dydxTradeStatusViewBuilder.swift index e516a5d2..fb9281f7 100644 --- a/ios/dydx/dydxPresenters/dydxPresenters/_v4/Trade/TradeStatus/dydxTradeStatusViewBuilder.swift +++ b/ios/dydx/dydxPresenters/dydxPresenters/_v4/Trade/TradeStatus/dydxTradeStatusViewBuilder.swift @@ -171,7 +171,7 @@ private class dydxTradeStatusViewPresenter: HostedViewPresenter Void)? = nil) { + public init(amount: SignedAmountViewModel? = nil, rate: SignedAmountViewModel? = nil, time: String? = nil, sideText: SideTextViewModel = SideTextViewModel(), status: FundingStatus = .paid, position: String? = nil, token: TokenTextViewModel? = TokenTextViewModel(), logoUrl: URL? = nil, onTapAction: (() -> Void)? = nil) { self.amount = amount self.rate = rate self.time = time @@ -58,7 +58,7 @@ public class dydxPortfolioFundingItemViewModel: PlatformViewModel { public var amount: SignedAmountViewModel? public var rate: SignedAmountViewModel? - public var time: Date? + public var time: String? public var sideText = SideTextViewModel() public var status: FundingStatus = .paid public var position: String? @@ -69,7 +69,7 @@ public class dydxPortfolioFundingItemViewModel: PlatformViewModel { public static var previewValue: dydxPortfolioFundingItemViewModel { let item = dydxPortfolioFundingItemViewModel(amount: .previewValue, rate: .previewValue, - time: Date(), + time: Date().englishDatetimeString, sideText: .previewValue, status: .paid, position: "$2300.0", @@ -120,7 +120,7 @@ public class dydxPortfolioFundingItemViewModel: PlatformViewModel { .themeFont(fontSize: .medium) sideText.createView(parentStyle: parentStyle.themeFont(fontSize: .medium)) } - Text(time?.englishDatetimeString ?? "") + Text(time ?? "") .themeColor(foreground: .textTertiary) .themeFont(fontSize: .smallest) } diff --git a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift index 51cd5c2f..b715ea33 100644 --- a/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift +++ b/ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Shared/SharedFillView.swift @@ -21,7 +21,7 @@ public class SharedFillViewModel: PlatformViewModel { public var onTapAction: (() -> Void)? } - public init(type: String? = nil, amount: String? = nil, date: Date? = nil, price: String? = nil, fee: String? = nil, feeLiquidity: String? = nil, sideText: SideTextViewModel = SideTextViewModel(), token: TokenTextViewModel? = TokenTextViewModel(), logoUrl: URL? = nil, onTapAction: (() -> Void)? = nil) { + public init(type: String? = nil, amount: String? = nil, date: String? = nil, price: String? = nil, fee: String? = nil, feeLiquidity: String? = nil, sideText: SideTextViewModel = SideTextViewModel(), token: TokenTextViewModel? = TokenTextViewModel(), logoUrl: URL? = nil, onTapAction: (() -> Void)? = nil) { self.type = type self.size = amount self.date = date @@ -36,7 +36,7 @@ public class SharedFillViewModel: PlatformViewModel { @Published public var type: String? @Published public var size: String? - @Published public var date: Date? + @Published public var date: String? @Published public var price: String? @Published public var fee: String? @Published public var feeLiquidity: String? @@ -50,7 +50,7 @@ public class SharedFillViewModel: PlatformViewModel { public static var previewValue: SharedFillViewModel { let vm = SharedFillViewModel(type: "Market Order", amount: "0.017 ETH", - date: Date(), + date: Date().englishDatetimeString, price: "$1,203.8", fee: "$0.0", feeLiquidity: "Taker", @@ -108,7 +108,7 @@ public class SharedFillViewModel: PlatformViewModel { .themeColor(foreground: .textPrimary) .themeFont(fontSize: .medium) } - Text(date?.englishDatetimeString ?? "") + Text(date ?? "") .themeColor(foreground: .textTertiary) .themeFont(fontSize: .smallest) }