-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Feat: Invoice collection account selector page #41511
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
lakchote
merged 12 commits into
Expensify:main
from
hungvu193:feat/invoice-collection-acount-selector-page
May 6, 2024
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8424a1c
add initial account selector page
hungvu193 aa998bc
add selection screen
hungvu193 4daaa7f
sync with main
hungvu193 45f2288
update selected bank account
hungvu193 6f72680
address comment and linting
hungvu193 a011dc5
remove redundant variable
hungvu193 cf2cd2f
add spacing for selection screen prop
hungvu193 056648c
minor improvement
hungvu193 3a1be63
remove unnecessary depedencies
hungvu193 5a33115
update typo..
hungvu193 6029043
Merge remote-tracking branch 'origin/main' into feat/invoice-collecti…
hungvu193 fa7ba27
add shouldBeBlocked for AccessOrNotFoundWrapper
hungvu193 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| import React from 'react'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import type {PolicyAccessVariant} from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
| import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
| import type {TranslationPaths} from '@src/languages/types'; | ||
| import type {PolicyFeatureName} from '@src/types/onyx/Policy'; | ||
| import HeaderWithBackButton from './HeaderWithBackButton'; | ||
| import ScreenWrapper from './ScreenWrapper'; | ||
| import SelectionList from './SelectionList'; | ||
| import type RadioListItem from './SelectionList/RadioListItem'; | ||
|
hungvu193 marked this conversation as resolved.
|
||
| import type TableListItem from './SelectionList/TableListItem'; | ||
| import type {ListItem, SectionListDataType} from './SelectionList/types'; | ||
| import type UserListItem from './SelectionList/UserListItem'; | ||
|
|
||
| type SelectorType = ListItem & { | ||
| value: string; | ||
| }; | ||
|
|
||
| type SelectionScreenProps = { | ||
|
hungvu193 marked this conversation as resolved.
|
||
| /** Used to set the testID for tests */ | ||
| displayName: string; | ||
|
hungvu193 marked this conversation as resolved.
|
||
|
|
||
| /** Title of the selection component */ | ||
| title: TranslationPaths; | ||
|
|
||
| /** Custom content to display in the header */ | ||
| headerContent?: React.ReactNode; | ||
|
|
||
| /** Sections for the section list */ | ||
| sections: Array<SectionListDataType<SelectorType>>; | ||
|
|
||
| /** Default renderer for every item in the list */ | ||
| listItem: typeof RadioListItem | typeof UserListItem | typeof TableListItem; | ||
|
|
||
| /** Item `keyForList` to focus initially */ | ||
| initiallyFocusedOptionKey?: string | null | undefined; | ||
|
|
||
| /** Callback to fire when a row is pressed */ | ||
| onSelectRow: (selection: SelectorType) => void; | ||
|
|
||
| /** Callback to fire when back button is pressed */ | ||
| onBackButtonPress: () => void; | ||
|
|
||
| /** The current policyID */ | ||
|
hungvu193 marked this conversation as resolved.
|
||
| policyID: string; | ||
|
|
||
| /** Defines which types of access should be verified */ | ||
| accessVariants?: PolicyAccessVariant[]; | ||
|
|
||
| /** The current feature name that the user tries to get access to */ | ||
| featureName?: PolicyFeatureName; | ||
|
|
||
| /** Whether or not to block user from accessing the page */ | ||
| shouldBeBlocked?: boolean; | ||
| }; | ||
|
|
||
| function SelectionScreen({ | ||
| displayName, | ||
| title, | ||
| headerContent, | ||
| sections, | ||
| listItem, | ||
| initiallyFocusedOptionKey, | ||
| onSelectRow, | ||
| onBackButtonPress, | ||
| policyID, | ||
| accessVariants, | ||
| featureName, | ||
| shouldBeBlocked, | ||
| }: SelectionScreenProps) { | ||
| const {translate} = useLocalize(); | ||
| return ( | ||
| <AccessOrNotFoundWrapper | ||
|
hungvu193 marked this conversation as resolved.
|
||
| policyID={policyID} | ||
| accessVariants={accessVariants} | ||
| featureName={featureName} | ||
| shouldBeBlocked={shouldBeBlocked} | ||
| > | ||
| <ScreenWrapper | ||
| includeSafeAreaPaddingBottom={false} | ||
| testID={displayName} | ||
| > | ||
| <HeaderWithBackButton | ||
| title={translate(title)} | ||
| onBackButtonPress={onBackButtonPress} | ||
| /> | ||
| <SelectionList | ||
| onSelectRow={onSelectRow} | ||
| headerContent={headerContent} | ||
| sections={sections} | ||
| ListItem={listItem} | ||
| showScrollIndicator | ||
| shouldShowTooltips={false} | ||
| initiallyFocusedOptionKey={initiallyFocusedOptionKey} | ||
| /> | ||
| </ScreenWrapper> | ||
| </AccessOrNotFoundWrapper> | ||
| ); | ||
| } | ||
|
|
||
| export type {SelectorType}; | ||
|
|
||
| SelectionScreen.displayName = 'SelectionScreen'; | ||
| export default SelectionScreen; | ||
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
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
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.