@@ -11,10 +11,13 @@ import PlatformUI
1111import Utilities
1212
1313public class dydxMarketPositionViewModel : PlatformViewModel {
14- @Published public var emptyText : String ?
15-
1614 @Published public var closeAction : ( ( ) -> Void ) ?
1715 @Published public var editMarginAction : ( ( ) -> Void ) ?
16+ @Published public var onboardAction : ( ( ) -> Void ) ?
17+
18+ @Published public var isSignedIn : Bool = false
19+ @Published public var hasOpenPosition : Bool = false
20+
1821 @Published public var unrealizedPNLAmount : SignedAmountViewModel ?
1922 @Published public var unrealizedPNLPercent : String = " "
2023 @Published public var realizedPNLAmount : SignedAmountViewModel ?
@@ -77,13 +80,21 @@ public class dydxMarketPositionViewModel: PlatformViewModel {
7780 VStack ( spacing: 24 ) {
7881 // check size to determine if there is current position data to display
7982 VStack {
80- if let emptyText = self . emptyText {
81- PlaceholderViewModel ( text: emptyText)
82- . createView ( )
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+ }
8392 } else {
84- self . createCollection ( parentStyle: style)
85- self . createButtons ( parentStyle: style)
86- self . createList ( parentStyle: style)
93+ PlatformButtonViewModel (
94+ content: Text ( DataLocalizer . localize ( path: " APP.GENERAL.SIGN_IN_TO_VIEW " ) ) . wrappedViewModel,
95+ action: { self . onboardAction ? ( ) }
96+ )
97+ . createView ( parentStyle: parentStyle)
8798 }
8899 }
89100
0 commit comments