-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix Rules revamp regressions on Collect workspaces #98236
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
Open
Krishna2323
wants to merge
7
commits into
Expensify:main
Choose a base branch
from
Krishna2323:krishna2323/rules-revamp-fixes-97641-97922-97839
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
49ae910
Fix Collect rules gating, accounting guard, tab restore and landscape…
Krishna2323 48e65ae
Gate Collect category rules to upgrade and center the empty state
Krishna2323 93829fd
Clear the field requirements draft on unmount
Krishna2323 84d9256
update comments.
Krishna2323 586c403
Split tab doc comments into sentences
Krishna2323 6b7e863
Route Collect tag approver through the upgrade flow
Krishna2323 20ab5dd
update comment and remove dead ref code.
Krishna2323 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,21 @@ | ||
| import Button from '@components/ButtonComposed'; | ||
| import FixedFooter from '@components/FixedFooter'; | ||
| import {ModalActions} from '@components/Modal/Global/ModalContext'; | ||
| import ScrollView from '@components/ScrollView'; | ||
| import WorkspaceEmptyStateSection from '@components/WorkspaceEmptyStateSection'; | ||
|
|
||
| import useConfirmModal from '@hooks/useConfirmModal'; | ||
| import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import usePolicyData from '@hooks/usePolicyData'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
|
|
||
| import {enablePolicyCategories, openPolicyCategoriesPage} from '@libs/actions/Policy/Category'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import {hasAccountingConnections} from '@libs/PolicyUtils'; | ||
|
|
||
| import CONST from '@src/CONST'; | ||
| import ROUTES from '@src/ROUTES'; | ||
|
|
||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
|
|
@@ -24,8 +30,25 @@ function RuleCategoriesDisabledEmptyState({policyID}: RuleCategoriesDisabledEmpt | |
| const {translate} = useLocalize(); | ||
| const illustrations = useMemoizedLazyIllustrations(['FolderOpen']); | ||
| const policyData = usePolicyData(policyID); | ||
| const {showConfirmModal} = useConfirmModal(); | ||
| const isConnectedToAccounting = hasAccountingConnections(policyData.policy); | ||
|
|
||
| const enableCategories = async () => { | ||
| // Accounting owns Categories while a connection is active, same as the Categories toggle on More features. | ||
| if (isConnectedToAccounting) { | ||
| const {action} = await showConfirmModal({ | ||
| title: translate('workspace.moreFeatures.connectionsWarningModal.featureEnabledTitle'), | ||
| prompt: translate('workspace.moreFeatures.connectionsWarningModal.featureEnabledText'), | ||
| confirmText: translate('workspace.moreFeatures.connectionsWarningModal.manageSettings'), | ||
| cancelText: translate('common.cancel'), | ||
| }); | ||
| if (action !== ModalActions.CONFIRM) { | ||
| return; | ||
| } | ||
| Navigation.navigate(ROUTES.POLICY_ACCOUNTING.getRoute(policyID)); | ||
| return; | ||
| } | ||
|
|
||
| const enableCategories = () => { | ||
| enablePolicyCategories(policyData, true, false); | ||
|
|
||
| // The categories collection is empty while the feature is disabled, and enabling it only merges the | ||
|
|
@@ -35,14 +58,15 @@ function RuleCategoriesDisabledEmptyState({policyID}: RuleCategoriesDisabledEmpt | |
|
|
||
| return ( | ||
| <View style={[styles.flex1]}> | ||
| <WorkspaceEmptyStateSection | ||
| shouldStyleAsCard={false} | ||
| icon={illustrations.FolderOpen} | ||
| title={translate('workspace.rules.categoriesDisabledEmptyState.title')} | ||
| subtitle={translate('workspace.rules.categoriesDisabledEmptyState.subtitle')} | ||
| containerStyle={[styles.flex1, styles.justifyContentCenter]} | ||
| /> | ||
| <FixedFooter style={[styles.mtAuto, styles.pt5]}> | ||
| <ScrollView contentContainerStyle={[styles.flexGrow1, styles.justifyContentCenter, styles.alignItemsCenter]}> | ||
| <WorkspaceEmptyStateSection | ||
| shouldStyleAsCard={false} | ||
| icon={illustrations.FolderOpen} | ||
| title={translate('workspace.rules.categoriesDisabledEmptyState.title')} | ||
| subtitle={translate('workspace.rules.categoriesDisabledEmptyState.subtitle')} | ||
| /> | ||
| </ScrollView> | ||
| <FixedFooter style={[styles.pt5]}> | ||
|
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. no more mtAuto?
Contributor
Author
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. Not needed anymore. The content is now inside a |
||
| <Button | ||
| variant={CONST.BUTTON_VARIANT.SUCCESS} | ||
| size={CONST.BUTTON_SIZE.LARGE} | ||
|
|
||
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.