Skip to content

Commit

Permalink
Merge pull request #53800 from Krishna2323/krishna2323/issue/53399
Browse files Browse the repository at this point in the history
improvement: Add "Workspace" to Profile and Name at the workspace level for clarity.
  • Loading branch information
carlosmiceli authored Dec 23, 2024
2 parents 9fa6243 659f159 commit 5c8a21f
Show file tree
Hide file tree
Showing 15 changed files with 141 additions and 18 deletions.
12 changes: 12 additions & 0 deletions assets/images/buildings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 32,7 @@ import Box from '@assets/images/box.svg';
import Briefcase from '@assets/images/briefcase.svg';
import Bug from '@assets/images/bug.svg';
import Building from '@assets/images/building.svg';
import Buildings from '@assets/images/buildings.svg';
import CalendarSolid from '@assets/images/calendar-solid.svg';
import Calendar from '@assets/images/calendar.svg';
import Camera from '@assets/images/camera.svg';
Expand Down Expand Up @@ -235,6 236,7 @@ export {
Briefcase,
Bug,
Building,
Buildings,
Calendar,
Camera,
Car,
Expand Down
4 changes: 4 additions & 0 deletions src/components/Icon/Illustrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 74,8 @@ import BankArrow from '@assets/images/simple-illustrations/simple-illustration__
import BigRocket from '@assets/images/simple-illustrations/simple-illustration__bigrocket.svg';
import PinkBill from '@assets/images/simple-illustrations/simple-illustration__bill.svg';
import Binoculars from '@assets/images/simple-illustrations/simple-illustration__binoculars.svg';
import Building from '@assets/images/simple-illustrations/simple-illustration__building.svg';
import Buildings from '@assets/images/simple-illustrations/simple-illustration__buildings.svg';
import CarIce from '@assets/images/simple-illustrations/simple-illustration__car-ice.svg';
import Car from '@assets/images/simple-illustrations/simple-illustration__car.svg';
import ChatBubbles from '@assets/images/simple-illustrations/simple-illustration__chatbubbles.svg';
Expand Down Expand Up @@ -228,6 230,8 @@ export {
PendingBank,
ThreeLeggedLaptopWoman,
House,
Building,
Buildings,
Alert,
TeachersUnite,
Abacus,
Expand Down
2 changes: 1 addition & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2536,7 2536,7 @@ const translations = {
rules: 'Rules',
displayedAs: 'Displayed as',
plan: 'Plan',
profile: 'Profile',
profile: 'Workspace profile',
perDiem: 'Per diem',
bankAccount: 'Bank account',
connectBankAccount: 'Connect bank account',
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2558,7 2558,7 @@ const translations = {
accounting: 'Contabilidad',
rules: 'Reglas',
plan: 'Plan',
profile: 'Perfil',
profile: 'Perfil del espacio de trabajo',
perDiem: 'Per diem',
bankAccount: 'Cuenta bancaria',
displayedAs: 'Mostrado como',
Expand Down
2 changes: 1 addition & 1 deletion src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 1093,7 @@ function getCurrentTaxID(policy: OnyxEntry<Policy>, taxID: string): string | und
return Object.keys(policy?.taxRates?.taxes ?? {}).find((taxIDKey) => policy?.taxRates?.taxes?.[taxIDKey].previousTaxCode === taxID || taxIDKey === taxID);
}

function getWorkspaceAccountID(policyID: string) {
function getWorkspaceAccountID(policyID?: string) {
const policy = getPolicy(policyID);

if (!policy) {
Expand Down
5 changes: 4 additions & 1 deletion src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 725,10 @@ function clearWorkspaceReimbursementErrors(policyID: string) {
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {errorFields: {reimbursementChoice: null}});
}

function leaveWorkspace(policyID: string) {
function leaveWorkspace(policyID?: string) {
if (!policyID) {
return;
}
const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`];
const workspaceChats = ReportUtils.getAllWorkspaceReports(policyID);

Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 181,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
const items: MenuData[] = [
{
translationKey: 'common.workspaces',
icon: Expensicons.Building,
icon: Expensicons.Buildings,
routeName: ROUTES.SETTINGS_WORKSPACES,
brickRoadIndicator: hasGlobalWorkspaceSettingsRBR(policies, allConnectionSyncProgresses) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/AccessOrNotFoundWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 123,7 @@ function AccessOrNotFoundWrapper({
...props
}: AccessOrNotFoundWrapperProps) {
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID ?? CONST.DEFAULT_NUMBER_ID}`);
const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA, {initialValue: true});
const {login = ''} = useCurrentUserPersonalDetails();
const isPolicyIDInRoute = !!policyID?.length;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceInitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 325,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac
const menuItems: WorkspaceMenuItem[] = [
{
translationKey: 'workspace.common.profile',
icon: Expensicons.Home,
icon: Expensicons.Building,
action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_PROFILE.getRoute(policyID)))),
brickRoadIndicator: hasGeneralSettingsError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
routeName: SCREENS.WORKSPACE.PROFILE,
Expand Down
8 changes: 4 additions & 4 deletions src/pages/workspace/WorkspaceNamePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 58,7 @@ function WorkspaceNamePage({policy}: Props) {

return (
<AccessOrNotFoundWrapper
policyID={policy?.id ?? '-1'}
policyID={policy?.id}
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]}
>
<ScreenWrapper
Expand All @@ -67,7 67,7 @@ function WorkspaceNamePage({policy}: Props) {
testID={WorkspaceNamePage.displayName}
>
<HeaderWithBackButton
title={translate('workspace.editor.nameInputLabel')}
title={translate('workspace.common.workspaceName')}
onBackButtonPress={() => Navigation.goBack()}
/>

Expand All @@ -85,8 85,8 @@ function WorkspaceNamePage({policy}: Props) {
InputComponent={TextInput}
role={CONST.ROLE.PRESENTATION}
inputID={INPUT_IDS.NAME}
label={translate('workspace.editor.nameInputLabel')}
accessibilityLabel={translate('workspace.editor.nameInputLabel')}
label={translate('workspace.common.workspaceName')}
accessibilityLabel={translate('workspace.common.workspaceName')}
defaultValue={policy?.name}
spellCheck={false}
autoFocus
Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/WorkspaceProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 184,7 @@ function WorkspaceProfilePage({policyDraft, policy: policyProp, route}: Workspac
shouldUseScrollView
shouldShowOfflineIndicatorInWideScreen
shouldShowNonAdmin
icon={Illustrations.House}
icon={Illustrations.Building}
shouldShowNotFoundPage={policy === undefined}
>
{(hasVBA?: boolean) => (
Expand Down Expand Up @@ -253,7 253,7 @@ function WorkspaceProfilePage({policyDraft, policy: policyProp, route}: Workspac
<MenuItemWithTopDescription
title={policyName}
titleStyle={styles.workspaceTitleStyle}
description={translate('workspace.editor.nameInputLabel')}
description={translate('workspace.common.workspaceName')}
shouldShowRightIcon={!readOnly}
disabled={readOnly}
wrapperStyle={[styles.sectionMenuItemTopDescription, shouldUseNarrowLayout ? styles.mt3 : {}]}
Expand Down
10 changes: 5 additions & 5 deletions src/pages/workspace/WorkspacesListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 122,7 @@ function WorkspacesListPage() {
const isLessThanMediumScreen = isMediumScreenWidth || shouldUseNarrowLayout;

// We need this to update translation for deleting a workspace when it has third party card feeds or expensify card assigned.
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyIDToDelete ?? '-1');
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyIDToDelete);
const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`);
const [cardsList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${CONST.EXPENSIFY_CARD.BANK}`);
const policyToDelete = PolicyUtils.getPolicy(policyIDToDelete);
Expand Down Expand Up @@ -180,7 180,7 @@ function WorkspacesListPage() {
setIsSupportalActionRestrictedModalOpen(true);
return;
}
setPolicyIDToDelete(item.policyID ?? '-1');
setPolicyIDToDelete(item.policyID);
setPolicyNameToDelete(item.title);
setIsDeleteModalOpen(true);
},
Expand All @@ -192,7 192,7 @@ function WorkspacesListPage() {
threeDotsMenuItems.push({
icon: Expensicons.Exit,
text: translate('common.leave'),
onSelected: Session.checkIfActionIsAllowed(() => Policy.leaveWorkspace(item.policyID ?? '-1')),
onSelected: Session.checkIfActionIsAllowed(() => Policy.leaveWorkspace(item.policyID)),
});
}

Expand Down Expand Up @@ -416,7 416,7 @@ function WorkspacesListPage() {
shouldShowBackButton={shouldUseNarrowLayout}
shouldDisplaySearchRouter
onBackButtonPress={() => Navigation.goBack()}
icon={Illustrations.BigRocket}
icon={Illustrations.Buildings}
shouldUseHeadlineHeader
/>
<ScrollView contentContainerStyle={styles.pt3}>
Expand Down Expand Up @@ -451,7 451,7 @@ function WorkspacesListPage() {
shouldShowBackButton={shouldUseNarrowLayout}
shouldDisplaySearchRouter
onBackButtonPress={() => Navigation.goBack()}
icon={Illustrations.BigRocket}
icon={Illustrations.Buildings}
shouldUseHeadlineHeader
>
{!shouldUseNarrowLayout && getHeaderButton()}
Expand Down

0 comments on commit 5c8a21f

Please sign in to comment.