@@ -22,7 +22,7 @@ import { useFirebaseConfig } from 'src/modules/remote-config/plugins/useFirebase
2222import { WalletAvatar } from 'src/ui/components/WalletAvatar' ;
2323import { useWalletsMetaByChunks } from 'src/ui/shared/requests/useWalletsMetaByChunks' ;
2424
25- type PremiumStatusKind = 'active' | 'expiring' | 'expired' ;
25+ type PremiumStatusKind = 'active' | 'expiring' | 'expired' | 'none' ;
2626
2727export function PremiumPage ( ) {
2828 useBackgroundKind ( whiteBackgroundKind ) ;
@@ -44,37 +44,42 @@ export function PremiumPage() {
4444 suspense : false ,
4545 } ) ;
4646
47- const premiumInfo = walletsMeta ?. at ( 0 ) ?. membership . premium ;
48- const expireDate = premiumInfo ?. expirationTime ;
47+ const membershipInfo = walletsMeta ?. at ( 0 ) ?. membership ;
48+ const hasActivePremium = Boolean ( membershipInfo ?. premium ) ;
49+ const activePremiumExpirationDate = membershipInfo ?. premium ?. expirationTime ;
50+ const previousPremiumExpirationDate =
51+ membershipInfo ?. expiredPremium ?. expirationTime ;
4952
50- const isMoreThan7Days = useMemo (
53+ const isMoreThan7DaysLeft = useMemo (
5154 ( ) =>
52- expireDate ? dayjs ( expireDate ) . isAfter ( dayjs ( ) . add ( 7 , 'day' ) ) : false ,
53- [ expireDate ]
55+ activePremiumExpirationDate
56+ ? dayjs ( activePremiumExpirationDate ) . isAfter ( dayjs ( ) . add ( 7 , 'day' ) )
57+ : false ,
58+ [ activePremiumExpirationDate ]
5459 ) ;
5560
56- const isUnlimited = premiumInfo && ! expireDate ;
61+ const isUnlimited = hasActivePremium && ! activePremiumExpirationDate ;
5762
5863 const kind : PremiumStatusKind = isUnlimited
5964 ? 'active'
60- : expireDate
61- ? isMoreThan7Days
65+ : previousPremiumExpirationDate
66+ ? isMoreThan7DaysLeft
6267 ? 'active'
6368 : 'expiring'
64- : 'expired' ;
65-
66- const formattedDate = expireDate
67- ? dayjs ( expireDate ) . format ( 'MMMM D, YYYY' )
68- : '' ;
69+ : previousPremiumExpirationDate != null
70+ ? 'expired'
71+ : 'none' ;
6972
7073 const formattedDateInfo = isUnlimited
7174 ? 'Lifetime'
72- : expireDate
75+ : activePremiumExpirationDate
7376 ? kind === 'active'
74- ? `Until ${ formattedDate } `
77+ ? `Until ${ dayjs ( activePremiumExpirationDate ) . format ( 'MMMM D, YYYY' ) } `
7578 : kind === 'expiring'
76- ? `${ dayjs ( expireDate ) . fromNow ( true ) } left`
79+ ? `${ dayjs ( activePremiumExpirationDate ) . fromNow ( true ) } left`
7780 : ''
81+ : kind === 'expired'
82+ ? `On ${ dayjs ( previousPremiumExpirationDate ) . format ( 'MMMM D, YYYY' ) } `
7883 : '' ;
7984
8085 return (
@@ -118,67 +123,73 @@ export function PremiumPage() {
118123 borderRadius = { 24 }
119124 borderWidth = { 6 }
120125 />
121- < VStack gap = { 8 } style = { { justifyItems : 'center' } } >
122- < HStack gap = { 8 } alignItems = "center" justifyContent = "center" >
123- < UIText
124- kind = "headline/h2"
125- style = { {
126- background :
127- 'linear-gradient(90deg, #6C6CF9 0%, #FF7583 100%)' ,
128- backgroundClip : 'text' ,
129- WebkitBackgroundClip : 'text' ,
130- WebkitTextFillColor : 'transparent' ,
131- } }
132- >
133- Premium
134- </ UIText >
135- { kind === 'active' ? (
136- < UIText
137- kind = "small/accent"
138- color = "var(--always-white)"
139- style = { {
140- padding : '4px 12px' ,
141- borderRadius : 16 ,
142- backgroundColor : 'var(--positive-500)' ,
143- } }
144- >
145- Active
146- </ UIText >
147- ) : kind === 'expiring' ? (
126+ { kind !== 'none' ? (
127+ < VStack gap = { 8 } style = { { justifyItems : 'center' } } >
128+ < HStack gap = { 8 } alignItems = "center" justifyContent = "center" >
148129 < UIText
149- kind = "small/accent"
150- color = "var(--always-white)"
130+ kind = "headline/h2"
151131 style = { {
152- padding : '4px 12px' ,
153- borderRadius : 16 ,
154- backgroundColor : 'var(--notice-500)' ,
132+ background :
133+ 'linear-gradient(90deg, #6C6CF9 0%, #FF7583 100%)' ,
134+ backgroundClip : 'text' ,
135+ WebkitBackgroundClip : 'text' ,
136+ WebkitTextFillColor : 'transparent' ,
155137 } }
156138 >
157- Expiring
139+ Premium
158140 </ UIText >
159- ) : (
160- < UIText
161- kind = "small/accent"
162- color = "var(--always-white)"
163- style = { {
164- padding : '4px 12px' ,
165- borderRadius : 16 ,
166- backgroundColor : 'var(--negative-500)' ,
167- } }
168- >
169- Expired
170- </ UIText >
171- ) }
172- </ HStack >
173- < UIText
174- kind = "small/regular"
175- color = "var(--neutral-700)"
176- title = { formattedDate }
177- style = { { height : 20 } }
178- >
179- { formattedDateInfo }
180- </ UIText >
181- </ VStack >
141+ { kind === 'active' ? (
142+ < UIText
143+ kind = "small/accent"
144+ color = "var(--always-white)"
145+ style = { {
146+ padding : '4px 12px' ,
147+ borderRadius : 16 ,
148+ backgroundColor : 'var(--positive-500)' ,
149+ } }
150+ >
151+ Active
152+ </ UIText >
153+ ) : kind === 'expiring' ? (
154+ < UIText
155+ kind = "small/accent"
156+ color = "var(--always-white)"
157+ style = { {
158+ padding : '4px 12px' ,
159+ borderRadius : 16 ,
160+ backgroundColor : 'var(--notice-500)' ,
161+ } }
162+ >
163+ Expiring
164+ </ UIText >
165+ ) : kind === 'expired' ? (
166+ < UIText
167+ kind = "small/accent"
168+ color = "var(--always-white)"
169+ style = { {
170+ padding : '4px 12px' ,
171+ borderRadius : 16 ,
172+ backgroundColor : 'var(--negative-500)' ,
173+ } }
174+ >
175+ Expired
176+ </ UIText >
177+ ) : null }
178+ </ HStack >
179+ < UIText
180+ kind = "small/regular"
181+ color = "var(--neutral-700)"
182+ title = {
183+ kind === 'expiring'
184+ ? dayjs ( activePremiumExpirationDate ) . format ( 'MMMM D, YYYY' )
185+ : undefined
186+ }
187+ style = { { height : 20 } }
188+ >
189+ { formattedDateInfo }
190+ </ UIText >
191+ </ VStack >
192+ ) : null }
182193 { isConfigLoading || ! config ?. premium_page_feedback_link ? null : (
183194 < Button
184195 as = { UnstyledAnchor }
@@ -198,7 +209,11 @@ export function PremiumPage() {
198209 < Button kind = "primary" size = { 48 } >
199210 < HStack gap = { 8 } alignItems = "center" justifyContent = "center" >
200211 < ZerionIcon style = { { width : 20 , height : 20 } } />
201- < UIText kind = "body/accent" > Renew Premium</ UIText >
212+ { kind !== 'none' ? (
213+ < UIText kind = "body/accent" > Renew Premium</ UIText >
214+ ) : (
215+ < UIText kind = "body/accent" > Get Premium for 99$/year</ UIText >
216+ ) }
202217 </ HStack >
203218 </ Button >
204219 < Button
0 commit comments