Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions src/pages/workspace/tags/ImportTagsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import usePolicy from '@hooks/usePolicy';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
import * as PolicyUtils from '@libs/PolicyUtils';
import NotFoundPage from '@pages/ErrorPage/NotFoundPage';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
Expand All @@ -16,8 +17,13 @@ function ImportTagsPage({route}: ImportTagsPageProps) {
const policyID = route.params.policyID;
const policy = usePolicy(policyID);
const backTo = route.params.backTo;
const hasAccountingConnections = PolicyUtils.hasAccountingConnections(policy);
const isQuickSettingsFlow = !!backTo;

if (hasAccountingConnections) {
return <NotFoundPage />;
}

return (
<AccessOrNotFoundWrapper
policyID={policyID}
Expand Down
11 changes: 6 additions & 5 deletions src/pages/workspace/tags/WorkspaceTagsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,9 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) {
const hasVisibleTags = tagList.some((tag) => tag.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || isOffline);

const threeDotsMenuItems = useMemo(() => {
const menuItems: PopoverMenuItem[] = [
{
const menuItems: PopoverMenuItem[] = [];
if (!PolicyUtils.hasAccountingConnections(policy)) {
menuItems.push({
icon: Expensicons.Table,
text: translate('spreadsheet.importSpreadsheet'),
onSelected: () => {
Expand All @@ -308,8 +309,8 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) {
: ROUTES.WORKSPACE_TAGS_IMPORT.getRoute(policyID),
);
},
},
];
});
}

if (hasVisibleTags) {
menuItems.push({
Expand All @@ -330,7 +331,7 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) {
}

return menuItems;
}, [translate, hasVisibleTags, isOffline, policyID, isQuickSettingsFlow, backTo]);
}, [policy, hasVisibleTags, translate, isOffline, isQuickSettingsFlow, policyID, backTo]);

const getHeaderText = () => (
<View style={[styles.ph5, styles.pb5, styles.pt3, shouldUseNarrowLayout ? styles.workspaceSectionMobile : styles.workspaceSection]}>
Expand Down