Skip to content

Commit

Permalink
Merge pull request Expensify#43122 from MrMuzyk/feat/subscription-siz…
Browse files Browse the repository at this point in the history
…e-action

feat: subscription size action
  • Loading branch information
amyevans authored Jun 11, 2024
2 parents fb276f4 + 46731c6 commit 1470f6e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3266,7 +3266,7 @@ export default {
eachMonth:
'Each month, your subscription covers up to the number of active members set above. Any time you increase your subscription size, you’ll start a new 12-month subscription at that new size.',
note: 'Note: An active member is anyone who has created, edited, submitted, approved, reimbursed, or exported expense data tied to your company workspace.',
confirmDetails: 'Confirm your new annual subscription details',
confirmDetails: 'Confirm your new annual subscription details:',
subscriptionSize: 'Subscription size',
activeMembers: ({size}) => `${size} active members/month`,
subscriptionRenews: 'Subscription renews',
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3773,7 +3773,7 @@ export default {
eachMonth:
'Cada mes, tu suscripción cubre hasta el número de miembros activos establecido anteriormente. Cada vez que aumentes el tamaño de tu suscripción, iniciarás una nueva suscripción de 12 meses con ese nuevo tamaño.',
note: 'Nota: Un miembro activo es cualquiera que haya creado, editado, enviado, aprobado, reembolsado, o exportado datos de gastos vinculados al espacio de trabajo de tu empresa.',
confirmDetails: 'Confirma los datos de tu nueva suscripción anual',
confirmDetails: 'Confirma los datos de tu nueva suscripción anual:',
subscriptionSize: 'Tamaño de suscripción',
activeMembers: ({size}) => `${size} miembros activos/mes`,
subscriptionRenews: 'Renovación de la suscripción',
Expand Down
35 changes: 17 additions & 18 deletions src/pages/settings/Subscription/SubscriptionDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useThemeIllustrations from '@hooks/useThemeIllustrations';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';

type SubscriptionVariant = ValueOf<typeof CONST.SUBSCRIPTION.TYPE>;

Expand Down Expand Up @@ -45,33 +47,30 @@ function SubscriptionDetails() {
setSelectedOption(option);
};

// This section is only shown when the subscription is annual
// An onPress action is going to be assigned to these buttons in phase 2
let subscriptionSizeSection: React.JSX.Element | null = null;
const onSubscriptionSizePress = () => {
Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION_SIZE);
};

if (privateSubscription?.type === CONST.SUBSCRIPTION.TYPE.ANNUAL) {
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
const subscriptionSizeSection: React.JSX.Element | null =
selectedOption === CONST.SUBSCRIPTION.TYPE.ANNUAL ? (
<>
<MenuItemWithTopDescription
description={translate('subscription.details.subscriptionSize')}
shouldShowRightIcon
onPress={onSubscriptionSizePress}
wrapperStyle={styles.sectionMenuItemTopDescription}
style={styles.mt5}
title={`${privateSubscription?.userCount ?? ''}`}
/>
<Text style={styles.mt2}>
<Text style={styles.h4}>{translate('subscription.details.headsUpTitle')}</Text>
<Text style={styles.textLabelSupporting}>{translate('subscription.details.headsUpBody')}</Text>
</Text>
{!privateSubscription?.userCount && (
<Text style={styles.mt2}>
<Text style={styles.h4}>{translate('subscription.details.headsUpTitle')}</Text>
<Text style={styles.textLabelSupporting}>{translate('subscription.details.headsUpBody')}</Text>
</Text>
)}
</>
);
}
) : null;

return (
<Section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import FormProvider from '@components/Form/FormProvider';
import InputWrapper from '@components/Form/InputWrapper';
import Text from '@components/Text';
import TextInput from '@components/TextInput';
import useAutoFocusInput from '@hooks/useAutoFocusInput';
import useLocalize from '@hooks/useLocalize';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
Expand All @@ -17,10 +18,11 @@ type SizeProps = SubStepProps;
function Size({onNext}: SizeProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const {inputCallbackRef} = useAutoFocusInput();

const defaultValues = {
// TODO this is temporary and default value will be replaced in next phase once data in ONYX is ready
[INPUT_IDS.SUBSCRIPTION_SIZE]: '0',
[INPUT_IDS.SUBSCRIPTION_SIZE]: '',
};

return (
Expand All @@ -35,6 +37,7 @@ function Size({onNext}: SizeProps) {
<Text style={[styles.textNormalThemeText, styles.mb5]}>{translate('subscription.subscriptionSize.yourSize')}</Text>
<InputWrapper
InputComponent={TextInput}
ref={inputCallbackRef}
inputID={INPUT_IDS.SUBSCRIPTION_SIZE}
label={translate('subscription.subscriptionSize.subscriptionSize')}
aria-label={translate('subscription.subscriptionSize.subscriptionSize')}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2819,7 +2819,7 @@ const styles = (theme: ThemeColors) =>
},

sectionSelectCircle: {
backgroundColor: colors.productDark200,
backgroundColor: theme.highlightBG,
},

qrShareSection: {
Expand Down

0 comments on commit 1470f6e

Please sign in to comment.