Skip to content

Commit

Permalink
Update workspace naming from Overview to Profile
Browse files Browse the repository at this point in the history
  • Loading branch information
narefyev91 committed Feb 8, 2024
1 parent caefc6e commit 30f8e5d
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@ const CONST = {
GUIDES_CALL_TASK_IDS: {
CONCIERGE_DM: 'NewExpensifyConciergeDM',
WORKSPACE_INITIAL: 'WorkspaceHome',
WORKSPACE_OVERVIEW: 'WorkspaceOverview',
WORKSPACE_PROFILE: 'WorkspaceProfile',
WORKSPACE_CARD: 'WorkspaceCorporateCards',
WORKSPACE_REIMBURSE: 'WorkspaceReimburseReceipts',
WORKSPACE_BILLS: 'WorkspacePayBills',
Expand Down
18 changes: 9 additions & 9 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,17 +436,17 @@ const ROUTES = {
route: 'workspace/:policyID/invite-message',
getRoute: (policyID: string) => `workspace/${policyID}/invite-message` as const,
},
WORKSPACE_OVERVIEW: {
route: 'workspace/:policyID/overview',
getRoute: (policyID: string) => `workspace/${policyID}/overview` as const,
WORKSPACE_PROFILE: {
route: 'workspace/:policyID/profile',
getRoute: (policyID: string) => `workspace/${policyID}/profile` as const,
},
WORKSPACE_OVERVIEW_CURRENCY: {
route: 'workspace/:policyID/overview/currency',
getRoute: (policyID: string) => `workspace/${policyID}/overview/currency` as const,
WORKSPACE_PROFILE_CURRENCY: {
route: 'workspace/:policyID/profile/currency',
getRoute: (policyID: string) => `workspace/${policyID}/profile/currency` as const,
},
WORKSPACE_OVERVIEW_NAME: {
route: 'workspace/:policyID/overview/name',
getRoute: (policyID: string) => `workspace/${policyID}/overview/name` as const,
WORKSPACE_PROFILE_NAME: {
route: 'workspace/:policyID/profile/name',
getRoute: (policyID: string) => `workspace/${policyID}/profile/name` as const,
},
WORKSPACE_AVATAR: {
route: 'workspace/:policyID/avatar',
Expand Down
6 changes: 3 additions & 3 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const SCREENS = {

WORKSPACE: {
INITIAL: 'Workspace_Initial',
OVERVIEW: 'Workspace_Overview',
PROFILE: 'Workspace_Profile',
CARD: 'Workspace_Card',
REIMBURSE: 'Workspace_Reimburse',
RATE_AND_UNIT: 'Workspace_RateAndUnit',
Expand All @@ -204,8 +204,8 @@ const SCREENS = {
MEMBERS: 'Workspace_Members',
INVITE: 'Workspace_Invite',
INVITE_MESSAGE: 'Workspace_Invite_Message',
CURRENCY: 'Workspace_Overview_Currency',
NAME: 'Workspace_Overview_Name',
CURRENCY: 'Workspace_Profile_Currency',
NAME: 'Workspace_Profile_Name',
},

EDIT_REQUEST: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/IFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function getNewDotURL(url: string): string {

if (pathname === 'policy') {
const workspaceID = params.policyID || '';
const section = urlObj.hash.slice(1) || 'overview';
const section = urlObj.hash.slice(1) || 'profile';

return `workspace/${workspaceID}/${section}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ export default {
travel: 'Travel',
members: 'Members',
plan: 'Plan',
overview: 'Overview',
profile: 'Profile',
bankAccount: 'Bank account',
connectBankAccount: 'Connect bank account',
testTransactions: 'Test transactions',
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ export default {
travel: 'Viajes',
members: 'Miembros',
plan: 'Plan',
overview: 'Descripción',
profile: 'Perfil',
bankAccount: 'Cuenta bancaria',
connectBankAccount: 'Conectar cuenta bancaria',
testTransactions: 'Transacciones de prueba',
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.INVITE]: () => require('../../../pages/workspace/WorkspaceInvitePage').default as React.ComponentType,
[SCREENS.WORKSPACE.INVITE_MESSAGE]: () => require('../../../pages/workspace/WorkspaceInviteMessagePage').default as React.ComponentType,
[SCREENS.WORKSPACE.NAME]: () => require('../../../pages/workspace/WorkspaceNamePage').default as React.ComponentType,
[SCREENS.WORKSPACE.CURRENCY]: () => require('../../../pages/workspace/WorkspaceOverviewCurrencyPage').default as React.ComponentType,
[SCREENS.WORKSPACE.CURRENCY]: () => require('../../../pages/workspace/WorkspaceProfileCurrencyPage').default as React.ComponentType,
[SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType,
[SCREENS.GET_ASSISTANCE]: () => require('../../../pages/GetAssistancePage').default as React.ComponentType,
[SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default as React.ComponentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Screens = Partial<Record<keyof CentralPaneNavigatorParamList, () => React.C

const workspaceSettingsScreens = {
[SCREENS.SETTINGS.WORKSPACES]: () => require('../../../../../pages/workspace/WorkspacesListPage').default as React.ComponentType,
[SCREENS.WORKSPACE.OVERVIEW]: () => require('../../../../../pages/workspace/WorkspaceOverviewPage').default as React.ComponentType,
[SCREENS.WORKSPACE.PROFILE]: () => require('../../../../../pages/workspace/WorkspaceProfilePage').default as React.ComponentType,
[SCREENS.WORKSPACE.CARD]: () => require('../../../../../pages/workspace/card/WorkspaceCardPage').default as React.ComponentType,
[SCREENS.WORKSPACE.REIMBURSE]: () => require('../../../../../pages/workspace/reimburse/WorkspaceReimbursePage').default as React.ComponentType,
[SCREENS.WORKSPACE.BILLS]: () => require('../../../../../pages/workspace/bills/WorkspaceBillsPage').default as React.ComponentType,
Expand Down
6 changes: 3 additions & 3 deletions src/libs/Navigation/AppNavigator/getPartialStateDiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ type GetPartialStateDiffReturnType = {
* This function returns partial additive diff between the two states.
*
* Example: Let's start with state A on route /r/123. If the screen is wide we will have a HOME opened on bottom tab and REPORT on central pane.
* Now let's say we want to navigate to /workspace/345/overview. We will generate state B from this path.
* State B will have WORKSPACE_INITIAL on the bottom tab and WORKSPACE_OVERVIEW on the central pane.
* Now we will generate partial diff between state A and state B. The diff will tell us that we need to push WORKSPACE_INITIAL on the bottom tab and WORKSPACE_OVERVIEW on the central pane.
* Now let's say we want to navigate to /workspace/345/profile. We will generate state B from this path.
* State B will have WORKSPACE_INITIAL on the bottom tab and WORKSPACE_PROFILE on the central pane.
* Now we will generate partial diff between state A and state B. The diff will tell us that we need to push WORKSPACE_INITIAL on the bottom tab and WORKSPACE_PROFILE on the central pane.
*
* Then we can generate actions from this diff and dispatch them to the linkTo function.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {CentralPaneName} from '@libs/Navigation/types';
import SCREENS from '@src/SCREENS';

const CENTRAL_PANE_TO_RHP_MAPPING: Partial<Record<CentralPaneName, string[]>> = {
[SCREENS.WORKSPACE.OVERVIEW]: [SCREENS.WORKSPACE.NAME, SCREENS.WORKSPACE.CURRENCY],
[SCREENS.WORKSPACE.PROFILE]: [SCREENS.WORKSPACE.NAME, SCREENS.WORKSPACE.CURRENCY],
[SCREENS.WORKSPACE.REIMBURSE]: [SCREENS.WORKSPACE.RATE_AND_UNIT],
[SCREENS.WORKSPACE.MEMBERS]: [SCREENS.WORKSPACE.INVITE, SCREENS.WORKSPACE.INVITE_MESSAGE],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const TAB_TO_CENTRAL_PANE_MAPPING: Record<BottomTabName, CentralPaneName[]> = {
[SCREENS.HOME]: [SCREENS.REPORT],
[SCREENS.ALL_SETTINGS]: [SCREENS.SETTINGS.WORKSPACES],
[SCREENS.WORKSPACE.INITIAL]: [
SCREENS.WORKSPACE.OVERVIEW,
SCREENS.WORKSPACE.PROFILE,
SCREENS.WORKSPACE.CARD,
SCREENS.WORKSPACE.REIMBURSE,
SCREENS.WORKSPACE.BILLS,
Expand Down
6 changes: 3 additions & 3 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
[SCREENS.REPORT]: ROUTES.REPORT_WITH_ID.route,

[SCREENS.SETTINGS.WORKSPACES]: ROUTES.SETTINGS_WORKSPACES,
[SCREENS.WORKSPACE.OVERVIEW]: ROUTES.WORKSPACE_OVERVIEW.route,
[SCREENS.WORKSPACE.PROFILE]: ROUTES.WORKSPACE_PROFILE.route,
[SCREENS.WORKSPACE.CARD]: {
path: ROUTES.WORKSPACE_CARD.route,
},
Expand Down Expand Up @@ -224,7 +224,7 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
path: ROUTES.SETTINGS_STATUS_CLEAR_AFTER_TIME,
},
[SCREENS.WORKSPACE.CURRENCY]: {
path: ROUTES.WORKSPACE_OVERVIEW_CURRENCY.route,
path: ROUTES.WORKSPACE_PROFILE_CURRENCY.route,
},
[SCREENS.WORKSPACE.RATE_AND_UNIT]: {
path: ROUTES.WORKSPACE_RATE_AND_UNIT.route,
Expand All @@ -245,7 +245,7 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
[SCREENS.KEYBOARD_SHORTCUTS]: {
path: ROUTES.KEYBOARD_SHORTCUTS,
},
[SCREENS.WORKSPACE.NAME]: ROUTES.WORKSPACE_OVERVIEW_NAME.route,
[SCREENS.WORKSPACE.NAME]: ROUTES.WORKSPACE_PROFILE_NAME.route,
},
},
[SCREENS.RIGHT_MODAL.PRIVATE_NOTES]: {
Expand Down
6 changes: 3 additions & 3 deletions src/libs/Navigation/switchPolicyID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ export default function switchPolicyID(navigation: NavigationContainerRef<RootSt
params.policyID = policyID;
}

// We need to redirect non admin users to overview screen, when switching workspace.
if (!isPolicyAdmin && isWorkspaceScreen && screen !== SCREENS.WORKSPACE.OVERVIEW) {
screen = SCREENS.WORKSPACE.OVERVIEW;
// We need to redirect non admin users to profile screen, when switching workspace.
if (!isPolicyAdmin && isWorkspaceScreen && screen !== SCREENS.WORKSPACE.PROFILE) {
screen = SCREENS.WORKSPACE.PROFILE;
}

// If the user is on the home page and changes the current workspace, then should be displayed a report from the selected workspace.
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type CentralPaneNavigatorParamList = {
};

[SCREENS.SETTINGS.WORKSPACES]: undefined;
[SCREENS.WORKSPACE.OVERVIEW]: {
[SCREENS.WORKSPACE.PROFILE]: {
policyID: string;
};
[SCREENS.WORKSPACE.CARD]: {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/workspace/WorkspaceInitialPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ function WorkspaceInitialPage(props) {

const menuItems = [
{
translationKey: 'workspace.common.overview',
translationKey: 'workspace.common.profile',
icon: Expensicons.Home,
action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_OVERVIEW.getRoute(policy.id)))),
action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_PROFILE.getRoute(policy.id)))),
brickRoadIndicator: hasGeneralSettingsError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '',
routeName: SCREENS.WORKSPACE.OVERVIEW,
routeName: SCREENS.WORKSPACE.PROFILE,
},
].concat(shouldShowProtectedItems ? protectedMenuItems : []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@ const defaultProps = {
...policyDefaultProps,
};

function WorkspaceOverviewPage({policy, currencyList, route}) {
function WorkspaceProfilePage({policy, currencyList, route}) {
const styles = useThemeStyles();
const {translate} = useLocalize();

const formattedCurrency = !_.isEmpty(policy) && !_.isEmpty(currencyList) ? `${policy.outputCurrency} - ${currencyList[policy.outputCurrency].symbol}` : '';

const onPressCurrency = useCallback(() => Navigation.navigate(ROUTES.WORKSPACE_OVERVIEW_CURRENCY.getRoute(policy.id)), [policy.id]);
const onPressName = useCallback(() => Navigation.navigate(ROUTES.WORKSPACE_OVERVIEW_NAME.getRoute(policy.id)), [policy.id]);
const onPressCurrency = useCallback(() => Navigation.navigate(ROUTES.WORKSPACE_PROFILE_CURRENCY.getRoute(policy.id)), [policy.id]);
const onPressName = useCallback(() => Navigation.navigate(ROUTES.WORKSPACE_PROFILE_NAME.getRoute(policy.id)), [policy.id]);

const policyName = lodashGet(policy, 'name', '');
const readOnly = !PolicyUtils.isPolicyAdmin(policy);

return (
<WorkspacePageWithSections
headerText={translate('workspace.common.overview')}
headerText={translate('workspace.common.profile')}
route={route}
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_OVERVIEW}
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_PROFILE}
shouldShowLoading={false}
shouldUseScrollView
shouldShowOfflineIndicatorInWideScreen
Expand Down Expand Up @@ -138,13 +138,13 @@ function WorkspaceOverviewPage({policy, currencyList, route}) {
);
}

WorkspaceOverviewPage.propTypes = propTypes;
WorkspaceOverviewPage.defaultProps = defaultProps;
WorkspaceOverviewPage.displayName = 'WorkspaceOverviewPage';
WorkspaceProfilePage.propTypes = propTypes;
WorkspaceProfilePage.defaultProps = defaultProps;
WorkspaceProfilePage.displayName = 'WorkspaceProfilePage';

export default compose(
withPolicy,
withOnyx({
currencyList: {key: ONYXKEYS.CURRENCY_LIST},
}),
)(WorkspaceOverviewPage);
)(WorkspaceProfilePage);

0 comments on commit 30f8e5d

Please sign in to comment.