-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat: Subscription settings UI #42990
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
Merged
amyevans
merged 20 commits into
Expensify:main
from
MrMuzyk:feat/subsription-settings-ui
Jun 7, 2024
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5ae57d9
feat: subscription settings ui
MrMuzyk af7b6df
Merge branch 'main' into feat/subsription-settings-ui
MrMuzyk 7881f60
feat: disable auto renew page
MrMuzyk 2f96052
fix: translations and cut corporate karma
MrMuzyk 7da4c58
fix: cr fixes
MrMuzyk 690d095
fix: translations
MrMuzyk b2c9f6f
Merge branch 'main' of https://github.com/Expensify/App into feat/sub…
MrMuzyk 2ca5e3c
fix: remove memo
MrMuzyk a5ad54a
fix: whitespaces before comments
MrMuzyk 06b74cc
fix: cr fixes
MrMuzyk f866282
fix: add new const for feedback survey options
MrMuzyk 8139378
Merge branch 'main' of https://github.com/Expensify/App into feat/sub…
MrMuzyk e72b647
Merge branch 'main' of https://github.com/Expensify/App into feat/sub…
MrMuzyk 09b9538
fix: cr fixes
MrMuzyk 9157519
Merge branch 'main' of https://github.com/Expensify/App into feat/sub…
MrMuzyk 4d7d132
fix: adjusted section displaying
MrMuzyk 11add28
Merge branch 'main' of https://github.com/Expensify/App into feat/sub…
MrMuzyk f3cba59
fix: small cr fixes
MrMuzyk 6c5d56c
fix: update auto renewal date
MrMuzyk 551789b
fix: date
MrMuzyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| import React, {useState} from 'react'; | ||
| import type {StyleProp, ViewStyle} from 'react-native'; | ||
| import {View} from 'react-native'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useTheme from '@hooks/useTheme'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import CONST from '@src/CONST'; | ||
| import type {TranslationPaths} from '@src/languages/types'; | ||
| import FixedFooter from './FixedFooter'; | ||
| import FormAlertWithSubmitButton from './FormAlertWithSubmitButton'; | ||
| import SingleOptionSelector from './SingleOptionSelector'; | ||
| import Text from './Text'; | ||
|
|
||
| type FeedbackSurveyProps = { | ||
| /** Title of the survey */ | ||
| title: string; | ||
|
|
||
| /** Description of the survey */ | ||
| description: string; | ||
|
|
||
| /** Callback to be called when the survey is submitted */ | ||
| onSubmit: (reason: Option) => void; | ||
|
|
||
| /** Styles for the option row element */ | ||
| optionRowStyles?: StyleProp<ViewStyle>; | ||
| }; | ||
|
|
||
| type Option = { | ||
| key: string; | ||
| label: TranslationPaths; | ||
| }; | ||
|
|
||
| const OPTIONS: Option[] = [ | ||
| {key: CONST.FEEDBACK_SURVEY_OPTIONS.TOO_LIMITED.ID, label: CONST.FEEDBACK_SURVEY_OPTIONS.TOO_LIMITED.TRANSLATION_KEY}, | ||
| {key: CONST.FEEDBACK_SURVEY_OPTIONS.TOO_EXPENSIVE.ID, label: CONST.FEEDBACK_SURVEY_OPTIONS.TOO_EXPENSIVE.TRANSLATION_KEY}, | ||
| {key: CONST.FEEDBACK_SURVEY_OPTIONS.INADEQUATE_SUPPORT.ID, label: CONST.FEEDBACK_SURVEY_OPTIONS.INADEQUATE_SUPPORT.TRANSLATION_KEY}, | ||
| {key: CONST.FEEDBACK_SURVEY_OPTIONS.BUSINESS_CLOSING.ID, label: CONST.FEEDBACK_SURVEY_OPTIONS.BUSINESS_CLOSING.TRANSLATION_KEY}, | ||
| ]; | ||
|
|
||
| function FeedbackSurvey({title, description, onSubmit, optionRowStyles}: FeedbackSurveyProps) { | ||
| const {translate} = useLocalize(); | ||
| const styles = useThemeStyles(); | ||
| const theme = useTheme(); | ||
|
|
||
| const selectCircleStyles: StyleProp<ViewStyle> = {borderColor: theme.border}; | ||
| const [reason, setReason] = useState<Option>(); | ||
| const [shouldShowReasonError, setShouldShowReasonError] = useState(false); | ||
|
|
||
| const handleOptionSelect = (option: Option) => { | ||
| setShouldShowReasonError(false); | ||
| setReason(option); | ||
| }; | ||
|
|
||
| const handleSubmit = () => { | ||
| if (!reason) { | ||
| setShouldShowReasonError(true); | ||
| return; | ||
| } | ||
|
|
||
| onSubmit(reason); | ||
| }; | ||
|
|
||
| return ( | ||
| <View style={[styles.flexGrow1, styles.justifyContentBetween]}> | ||
| <View style={styles.mh5}> | ||
| <Text style={styles.textHeadline}>{title}</Text> | ||
| <Text style={[styles.mt1, styles.mb3, styles.textNormalThemeText]}>{description}</Text> | ||
| <SingleOptionSelector | ||
| options={OPTIONS} | ||
| optionRowStyles={[styles.mb7, optionRowStyles]} | ||
| selectCircleStyles={selectCircleStyles} | ||
| selectedOptionKey={reason?.key} | ||
| onSelectOption={handleOptionSelect} | ||
| /> | ||
| </View> | ||
| <FixedFooter> | ||
| <FormAlertWithSubmitButton | ||
| isAlertVisible={shouldShowReasonError} | ||
| onSubmit={handleSubmit} | ||
| message="common.error.pleaseCompleteForm" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error message here was left hardcoded, it needed translate function. #44075 |
||
| buttonText={translate('common.submit')} | ||
| /> | ||
| </FixedFooter> | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| FeedbackSurvey.displayName = 'FeedbackSurvey'; | ||
|
|
||
| export default FeedbackSurvey; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/pages/settings/Subscription/DisableAutoRenewSurveyPage/index.native.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import React from 'react'; | ||
| import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
|
|
||
| function DisableAutoRenewSurveyPage() { | ||
| return ( | ||
| <ScreenWrapper | ||
| testID={DisableAutoRenewSurveyPage.displayName} | ||
| includeSafeAreaPaddingBottom | ||
| shouldEnableMaxHeight | ||
| > | ||
| <FullPageNotFoundView shouldShow /> | ||
|
MrMuzyk marked this conversation as resolved.
|
||
| </ScreenWrapper> | ||
| ); | ||
| } | ||
|
|
||
| DisableAutoRenewSurveyPage.displayName = 'DisableAutoRenewSurveyPage'; | ||
|
|
||
| export default DisableAutoRenewSurveyPage; | ||
43 changes: 43 additions & 0 deletions
43
src/pages/settings/Subscription/DisableAutoRenewSurveyPage/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import React from 'react'; | ||
| import FeedbackSurvey from '@components/FeedbackSurvey'; | ||
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import ScrollView from '@components/ScrollView'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
|
|
||
| function DisableAutoRenewSurveyPage() { | ||
| const {translate} = useLocalize(); | ||
| const styles = useThemeStyles(); | ||
|
|
||
| const handleSubmit = () => { | ||
| // TODO API call to submit feedback will be implemented in next phase | ||
| }; | ||
|
|
||
| return ( | ||
| <ScreenWrapper | ||
| testID={DisableAutoRenewSurveyPage.displayName} | ||
| includeSafeAreaPaddingBottom={false} | ||
| shouldEnablePickerAvoiding={false} | ||
| shouldEnableMaxHeight | ||
| > | ||
| <HeaderWithBackButton | ||
| title={translate('subscription.subscriptionSettings.disableAutoRenew')} | ||
| onBackButtonPress={Navigation.goBack} | ||
| /> | ||
| <ScrollView contentContainerStyle={[styles.flexGrow1, styles.pt3]}> | ||
| <FeedbackSurvey | ||
| title={translate('subscription.subscriptionSettings.helpUsImprove')} | ||
| description={translate('subscription.subscriptionSettings.whatsMainReason')} | ||
| onSubmit={handleSubmit} | ||
| optionRowStyles={styles.flex1} | ||
| /> | ||
| </ScrollView> | ||
| </ScreenWrapper> | ||
| ); | ||
| } | ||
|
|
||
| DisableAutoRenewSurveyPage.displayName = 'DisableAutoRenewSurveyPage'; | ||
|
|
||
| export default DisableAutoRenewSurveyPage; |
5 changes: 5 additions & 0 deletions
5
src/pages/settings/Subscription/SubscriptionSettings/index.native.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| function SubscriptionSettings() { | ||
| return null; | ||
| } | ||
|
|
||
| export default SubscriptionSettings; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.