Fix some logic
This commit is contained in:
@@ -85,7 +85,7 @@ function DialogInner({control}: {control: Dialog.DialogControlProps}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const emailValue = email ?? currentAccount.email
|
const emailValue = email || currentAccount.email
|
||||||
|
|
||||||
if (!emailValue) {
|
if (!emailValue) {
|
||||||
const message = _(
|
const message = _(
|
||||||
@@ -109,6 +109,7 @@ function DialogInner({control}: {control: Dialog.DialogControlProps}) {
|
|||||||
if (isWeb) {
|
if (isWeb) {
|
||||||
try {
|
try {
|
||||||
await purchase()
|
await purchase()
|
||||||
|
// TODO handle errors the same for both platforms, throw and display
|
||||||
control.close()
|
control.close()
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
setError(
|
setError(
|
||||||
|
|||||||
@@ -145,54 +145,44 @@ function Core({
|
|||||||
<PurchaseHeader />
|
<PurchaseHeader />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{hasActiveSubscriptions ||
|
{(hasActiveSubscriptions || hasInactiveSubscriptions) && (
|
||||||
(hasInactiveSubscriptions && (
|
// TODO need a divider here if PurchaseHeader is present
|
||||||
<>
|
<>
|
||||||
<Divider />
|
{hasActiveSubscriptions && (
|
||||||
|
<View style={[a.gap_sm]}>
|
||||||
|
<Text
|
||||||
|
style={[a.text_md, a.font_bold, t.atoms.text_contrast_medium]}>
|
||||||
|
<Trans>My subscriptions</Trans>
|
||||||
|
</Text>
|
||||||
|
|
||||||
{hasActiveSubscriptions && (
|
<View style={[a.gap_lg]}>
|
||||||
<View style={[a.gap_sm]}>
|
<View style={[a.gap_sm]}>
|
||||||
<Text
|
{activeSubscriptions.map(sub => (
|
||||||
style={[
|
<Subscription key={sub.purchasedAt} subscription={sub} />
|
||||||
a.text_md,
|
))}
|
||||||
a.font_bold,
|
|
||||||
t.atoms.text_contrast_medium,
|
|
||||||
]}>
|
|
||||||
<Trans>My subscriptions</Trans>
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<View style={[a.gap_lg]}>
|
|
||||||
<View style={[a.gap_sm]}>
|
|
||||||
{activeSubscriptions.map(sub => (
|
|
||||||
<Subscription key={sub.purchasedAt} subscription={sub} />
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)}
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
{hasInactiveSubscriptions && (
|
{hasInactiveSubscriptions && (
|
||||||
<View style={[a.gap_sm]}>
|
<View style={[a.gap_sm]}>
|
||||||
<Text
|
<Text
|
||||||
style={[
|
style={[a.text_md, a.font_bold, t.atoms.text_contrast_medium]}>
|
||||||
a.text_md,
|
<Trans>Past subscriptions</Trans>
|
||||||
a.font_bold,
|
</Text>
|
||||||
t.atoms.text_contrast_medium,
|
|
||||||
]}>
|
|
||||||
<Trans>Past subscriptions</Trans>
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<View style={[a.gap_lg]}>
|
<View style={[a.gap_lg]}>
|
||||||
<View style={[a.gap_sm]}>
|
<View style={[a.gap_sm]}>
|
||||||
{inactiveSubscriptions.map(sub => (
|
{inactiveSubscriptions.map(sub => (
|
||||||
<Subscription key={sub.purchasedAt} subscription={sub} />
|
<Subscription key={sub.purchasedAt} subscription={sub} />
|
||||||
))}
|
))}
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)}
|
</View>
|
||||||
</>
|
)}
|
||||||
))}
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user