Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Payment card / Subscription] Implement “Subscription details” section (UI) #42975

Merged
merged 18 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ function SubscriptionDetails() {

const [account] = useOnyx(ONYXKEYS.ACCOUNT);

// This section is only shown when the subscription is annual
let subscripitionSizeSection = null;
JKobrynski marked this conversation as resolved.
Show resolved Hide resolved

if (privateSubscription?.type === CONST.SUBSCRIPTION.TYPE.ANNUAL) {
subscripitionSizeSection = privateSubscription?.userCount ? (
<MenuItemWithTopDescription
description={translate('subscription.details.subscriptionSize')}
title={`${privateSubscription?.userCount}`}
wrapperStyle={styles.sectionMenuItemTopDescription}
style={styles.mt5}
/>
) : (
<Text style={styles.mt5}>
<Text style={styles.h4}>{translate('subscription.details.headsUpTitle')}</Text>
<Text style={styles.textLabelSupporting}>{translate('subscription.details.headsUpBody')}</Text>
</Text>
);
}

return (
<Section
title={translate('subscription.details.title')}
Expand Down Expand Up @@ -53,19 +72,7 @@ function SubscriptionDetails() {
isDisabled
/>
)}
{privateSubscription?.userCount ? (
<MenuItemWithTopDescription
description={translate('subscription.details.subscriptionSize')}
title={`${privateSubscription?.userCount}`}
wrapperStyle={styles.sectionMenuItemTopDescription}
style={styles.mt5}
/>
) : (
<Text style={styles.mt5}>
<Text style={styles.h4}>{translate('subscription.details.headsUpTitle')}</Text>
<Text style={styles.textLabelSupporting}>{translate('subscription.details.headsUpBody')}</Text>
</Text>
)}
{subscripitionSizeSection}
</>
)}
</Section>
Expand Down
37 changes: 21 additions & 16 deletions src/pages/settings/Subscription/SubscriptionDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,32 @@ function SubscriptionDetails() {
setSelectedOption(option);
};

const subscriptionSizeSection = privateSubscription?.userCount ? (
<MenuItemWithTopDescription
description={translate('subscription.details.subscriptionSize')}
title={`${privateSubscription?.userCount}`}
wrapperStyle={styles.sectionMenuItemTopDescription}
style={styles.mt5}
/>
) : (
<>
// This section is only shown when the subscription is annual
let subscriptionSizeSection = null;
JKobrynski marked this conversation as resolved.
Show resolved Hide resolved

if (privateSubscription?.type === CONST.SUBSCRIPTION.TYPE.ANNUAL) {
subscriptionSizeSection = privateSubscription?.userCount ? (
<MenuItemWithTopDescription
amyevans marked this conversation as resolved.
Show resolved Hide resolved
description={translate('subscription.details.subscriptionSize')}
shouldShowRightIcon
title={`${privateSubscription?.userCount}`}
wrapperStyle={styles.sectionMenuItemTopDescription}
style={styles.mt5}
/>
<Text style={styles.mt2}>
<Text style={styles.h4}>{translate('subscription.details.headsUpTitle')}</Text>
<Text style={styles.textLabelSupporting}>{translate('subscription.details.headsUpBody')}</Text>
</Text>
</>
);
) : (
<>
<MenuItemWithTopDescription
description={translate('subscription.details.subscriptionSize')}
shouldShowRightIcon
wrapperStyle={styles.sectionMenuItemTopDescription}
style={styles.mt5}
/>
<Text style={styles.mt2}>
<Text style={styles.h4}>{translate('subscription.details.headsUpTitle')}</Text>
<Text style={styles.textLabelSupporting}>{translate('subscription.details.headsUpBody')}</Text>
</Text>
</>
);
}

return (
<Section
Expand Down
Loading