Skip to content

Commit 59c55fd

Browse files
committed
Fix sign in button to fixed width
1 parent 22cfa90 commit 59c55fd

File tree

6 files changed

+30
-14
lines changed

6 files changed

+30
-14
lines changed

ios/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/Components/dydxMarketPositionViewPresenter.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ class dydxMarketPositionViewPresenter: HostedViewPresenter<dydxMarketPositionVie
4545
}
4646
}
4747

48+
viewModel?.onboardAction = {
49+
Router.shared?.navigate(to: RoutingRequest(path: "/onboard"), animated: true, completion: { /* [weak self] */ _, _ in
50+
})
51+
}
52+
4853
attachChildren(workers: childPresenters)
4954
}
5055

ios/dydx/dydxViews/dydxViews/_v4/MarketInfo/Components/Position/dydxMarketPositionView.swift

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,27 @@ public class dydxMarketPositionViewModel: PlatformViewModel {
7575
public override func createView(parentStyle: ThemeStyle = ThemeStyle.defaultStyle, styleKey: String? = nil) -> PlatformView {
7676
PlatformView(viewModel: self, parentStyle: parentStyle, styleKey: styleKey) { [weak self] style in
7777
guard let self = self else { return AnyView(PlatformView.nilView) }
78+
guard self.isSignedIn else {
79+
return PlatformButtonViewModel(
80+
content: Text(DataLocalizer.localize(path: "APP.GENERAL.SIGN_IN_TO_VIEW")).wrappedViewModel,
81+
action: { self.onboardAction?() }
82+
)
83+
.createView(parentStyle: parentStyle)
84+
.frame(width: UIScreen.main.bounds.width - 16)
85+
.wrappedInAnyView()
86+
}
7887

7988
return AnyView(
8089
VStack(spacing: 24) {
8190
// check size to determine if there is current position data to display
8291
VStack {
83-
if self.isSignedIn {
84-
if self.hasOpenPosition {
85-
self.createCollection(parentStyle: style)
86-
self.createButtons(parentStyle: style)
87-
self.createList(parentStyle: style)
88-
} else {
89-
PlaceholderViewModel(text: DataLocalizer.localize(path: "APP.GENERAL.PLACEHOLDER_NO_POSITIONS"))
90-
.createView()
91-
}
92+
if self.hasOpenPosition {
93+
self.createCollection(parentStyle: style)
94+
self.createButtons(parentStyle: style)
95+
self.createList(parentStyle: style)
9296
} else {
93-
PlatformButtonViewModel(
94-
content: Text(DataLocalizer.localize(path: "APP.GENERAL.SIGN_IN_TO_VIEW")).wrappedViewModel,
95-
action: { self.onboardAction?() }
96-
)
97-
.createView(parentStyle: parentStyle)
97+
PlaceholderViewModel(text: DataLocalizer.localize(path: "APP.GENERAL.PLACEHOLDER_NO_POSITIONS"))
98+
.createView()
9899
}
99100
}
100101

ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFillsView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ public class dydxPortfolioFillsViewModel: PlatformListViewModel {
2020
content: Text(DataLocalizer.localize(path: "APP.GENERAL.SIGN_IN_TO_VIEW")).wrappedViewModel,
2121
action: { self.onboardAction?() }
2222
)
23+
.createView()
24+
.frame(width: UIScreen.main.bounds.width - 16)
25+
.wrappedViewModel
2326
}
2427
return PlaceholderViewModel(
2528
text: DataLocalizer.localize(path: "APP.TRADE.TRADES_EMPTY_STATE")

ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioFundingView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ public class dydxPortfolioFundingViewModel: PlatformListViewModel {
156156
content: Text(DataLocalizer.localize(path: "APP.GENERAL.SIGN_IN_TO_VIEW")).wrappedViewModel,
157157
action: { self.onboardAction?() }
158158
)
159+
.createView()
160+
.frame(width: UIScreen.main.bounds.width - 16)
161+
.wrappedViewModel
159162
}
160163
return PlaceholderViewModel(
161164
text: DataLocalizer.localize(path: "APP.TRADE.FUNDING_EMPTY_STATE")

ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioOrdersView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ public class dydxPortfolioOrdersViewModel: PlatformListViewModel {
192192
content: Text(DataLocalizer.localize(path: "APP.GENERAL.SIGN_IN_TO_VIEW")).wrappedViewModel,
193193
action: { self.onboardAction?() }
194194
)
195+
.createView()
196+
.frame(width: UIScreen.main.bounds.width - 16)
197+
.wrappedViewModel
195198
}
196199
return PlaceholderViewModel(
197200
text: DataLocalizer.localize(path: "APP.TRADE.ORDER_EMPTY_STATE")

ios/dydx/dydxViews/dydxViews/_v4/Portfolio/Components/Sections/dydxPortfolioPositionsView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ public class dydxPortfolioPositionsViewModel: PlatformViewModel {
403403
action: { self.onboardAction?() }
404404
)
405405
.createView(parentStyle: parentStyle)
406+
.frame(width: UIScreen.main.bounds.width - 16)
406407
.wrappedInAnyView()
407408
}
408409

0 commit comments

Comments
 (0)