Skip to content

Commit adeeb36

Browse files
committed
Revert "Merge pull request Expensify#67412 from callstack-internal/duplicate-workspace"
This reverts commit 8f4897f, reversing changes made to 485a092.
1 parent 91f5892 commit adeeb36

35 files changed

Lines changed: 34 additions & 1366 deletions

src/ONYXKEYS.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,6 @@ const ONYXKEYS = {
466466

467467
NVP_PRIVATE_CANCELLATION_DETAILS: 'nvp_private_cancellationDetails',
468468

469-
/** Stores the information about duplicated workspace */
470-
DUPLICATE_WORKSPACE: 'duplicateWorkspace',
471-
472469
/** Stores the information about currently edited advanced approval workflow */
473470
APPROVAL_WORKFLOW: 'approvalWorkflow',
474471

@@ -686,8 +683,6 @@ const ONYXKEYS = {
686683
WORKSPACE_CATEGORY_FORM: 'workspaceCategoryForm',
687684
WORKSPACE_CONFIRMATION_FORM: 'workspaceConfirmationForm',
688685
WORKSPACE_CONFIRMATION_FORM_DRAFT: 'workspaceConfirmationFormDraft',
689-
WORKSPACE_DUPLICATE_FORM: 'workspaceDuplicateForm',
690-
WORKSPACE_DUPLICATE_FORM_DRAFT: 'workspaceDuplicateFormDraft',
691686
WORKSPACE_CATEGORY_FORM_DRAFT: 'workspaceCategoryFormDraft',
692687
WORKSPACE_CATEGORY_DESCRIPTION_HINT_FORM: 'workspaceCategoryDescriptionHintForm',
693688
WORKSPACE_CATEGORY_DESCRIPTION_HINT_FORM_DRAFT: 'workspaceCategoryDescriptionHintFormDraft',
@@ -894,7 +889,6 @@ type OnyxFormValuesMapping = {
894889
[ONYXKEYS.FORMS.WORKSPACE_SETTINGS_FORM]: FormTypes.WorkspaceSettingsForm;
895890
[ONYXKEYS.FORMS.WORKSPACE_CATEGORY_FORM]: FormTypes.WorkspaceCategoryForm;
896891
[ONYXKEYS.FORMS.WORKSPACE_CONFIRMATION_FORM]: FormTypes.WorkspaceConfirmationForm;
897-
[ONYXKEYS.FORMS.WORKSPACE_DUPLICATE_FORM]: FormTypes.WorkspaceDuplicateForm;
898892
[ONYXKEYS.FORMS.ONBOARDING_WORKSPACE_DETAILS_FORM]: FormTypes.WorkspaceConfirmationForm;
899893
[ONYXKEYS.FORMS.WORKSPACE_TAG_FORM]: FormTypes.WorkspaceTagForm;
900894
[ONYXKEYS.FORMS.WORKSPACE_TAX_CUSTOM_NAME]: FormTypes.WorkspaceTaxCustomName;
@@ -1196,7 +1190,6 @@ type OnyxValuesMapping = {
11961190
[ONYXKEYS.ADD_NEW_COMPANY_CARD]: OnyxTypes.AddNewCompanyCardFeed;
11971191
[ONYXKEYS.ASSIGN_CARD]: OnyxTypes.AssignCard;
11981192
[ONYXKEYS.MOBILE_SELECTION_MODE]: boolean;
1199-
[ONYXKEYS.DUPLICATE_WORKSPACE]: OnyxTypes.DuplicateWorkspace;
12001193
[ONYXKEYS.NVP_FIRST_DAY_FREE_TRIAL]: string;
12011194
[ONYXKEYS.NVP_LAST_DAY_FREE_TRIAL]: string;
12021195
[ONYXKEYS.NVP_BILLING_FUND_ID]: number;

src/ROUTES.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,14 +1876,6 @@ const ROUTES = {
18761876
return getUrlWithBackToParam(`workspaces/${policyID}/per-diem`, backTo);
18771877
},
18781878
},
1879-
WORKSPACE_DUPLICATE: {
1880-
route: 'workspace/:policyID/duplicate',
1881-
getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspace/${policyID}/duplicate`, backTo),
1882-
},
1883-
WORKSPACE_DUPLICATE_SELECT_FEATURES: {
1884-
route: 'workspace/:policyID/duplicate/select-features',
1885-
getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspace/${policyID}/duplicate/select-features`, backTo),
1886-
},
18871879
WORKSPACE_RECEIPT_PARTNERS: {
18881880
route: 'workspaces/:policyID/receipt-partners',
18891881
getRoute: (policyID: string | undefined, backTo?: string) => {

src/SCREENS.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ const SCREENS = {
192192
REPORT_DETAILS: 'Report_Details',
193193
REPORT_CHANGE_WORKSPACE: 'ReportChangeWorkspace',
194194
WORKSPACE_CONFIRMATION: 'Workspace_Confirmation',
195-
WORKSPACE_DUPLICATE: 'Workspace_Duplicate',
196195
REPORT_SETTINGS: 'Report_Settings',
197196
REPORT_DESCRIPTION: 'Report_Description',
198197
PARTICIPANTS: 'Participants',
@@ -389,7 +388,6 @@ const SCREENS = {
389388
},
390389

391390
WORKSPACE_CONFIRMATION: {ROOT: 'Workspace_Confirmation_Root'},
392-
WORKSPACE_DUPLICATE: {ROOT: 'Workspace_Duplicate_Root', SELECT_FEATURES: 'Workspace_Duplicate_Select_Features'},
393391

394392
WORKSPACES_LIST: 'Workspaces_List',
395393

src/components/WorkspaceConfirmationForm.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput';
44
import useLocalize from '@hooks/useLocalize';
55
import useOnyx from '@hooks/useOnyx';
66
import useThemeStyles from '@hooks/useThemeStyles';
7-
import useWorkspaceConfirmationAvatar from '@hooks/useWorkspaceConfirmationAvatar';
87
import {generateDefaultWorkspaceName, generatePolicyID} from '@libs/actions/Policy/Policy';
98
import type {CustomRNImageManipulatorResult} from '@libs/cropOrRotateImage/types';
109
import {addErrorMessage} from '@libs/ErrorUtils';
11-
import getFirstAlphaNumericCharacter from '@libs/getFirstAlphaNumericCharacter';
1210
import Navigation from '@libs/Navigation/Navigation';
1311
import {getDefaultWorkspaceAvatar} from '@libs/ReportUtils';
1412
import {isRequiredFulfilled} from '@libs/ValidationUtils';
1513
import CONST from '@src/CONST';
1614
import ONYXKEYS from '@src/ONYXKEYS';
1715
import INPUT_IDS from '@src/types/form/WorkspaceConfirmationForm';
1816
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
17+
import Avatar from './Avatar';
1918
import AvatarWithImagePicker from './AvatarWithImagePicker';
2019
import CurrencyPicker from './CurrencyPicker';
2120
import FormProvider from './Form/FormProvider';
@@ -27,6 +26,13 @@ import ScrollView from './ScrollView';
2726
import Text from './Text';
2827
import TextInput from './TextInput';
2928

29+
function getFirstAlphaNumericCharacter(str = '') {
30+
return str
31+
.normalize('NFD')
32+
.replace(/[^0-9a-z]/gi, '')
33+
.toUpperCase()[0];
34+
}
35+
3036
type WorkspaceConfirmationSubmitFunctionParams = {
3137
name: string;
3238
currency: string;
@@ -94,12 +100,22 @@ function WorkspaceConfirmationForm({onSubmit, policyOwnerEmail = '', onBackButto
94100

95101
const stashedLocalAvatarImage = workspaceAvatar?.avatarUri ?? undefined;
96102

97-
const DefaultAvatar = useWorkspaceConfirmationAvatar({
98-
policyID,
99-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- nullish coalescing cannot be used if left side can be empty string
100-
source: stashedLocalAvatarImage || getDefaultWorkspaceAvatar(workspaceNameFirstCharacter),
101-
name: workspaceNameFirstCharacter,
102-
});
103+
const DefaultAvatar = useCallback(
104+
() => (
105+
<Avatar
106+
containerStyles={styles.avatarXLarge}
107+
imageStyles={[styles.avatarXLarge, styles.alignSelfCenter]}
108+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- nullish coalescing cannot be used if left side can be empty string
109+
source={workspaceAvatar?.avatarUri || getDefaultWorkspaceAvatar(workspaceNameFirstCharacter)}
110+
fallbackIcon={Expensicons.FallbackWorkspaceAvatar}
111+
size={CONST.AVATAR_SIZE.X_LARGE}
112+
name={workspaceNameFirstCharacter}
113+
avatarID={policyID}
114+
type={CONST.ICON_TYPE_WORKSPACE}
115+
/>
116+
),
117+
[workspaceAvatar?.avatarUri, workspaceNameFirstCharacter, styles.alignSelfCenter, styles.avatarXLarge, policyID],
118+
);
103119

104120
return (
105121
<>

src/hooks/useWorkspaceConfirmationAvatar.tsx

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/languages/de.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ const translations = {
320320
count: 'Zählen',
321321
cancel: 'Abbrechen',
322322
dismiss: 'Verwerfen',
323-
proceed: 'Fortfahren',
324323
yes: 'Ja',
325324
no: 'No',
326325
ok: 'OK',
@@ -3461,14 +3460,12 @@ const translations = {
34613460
customField1: 'Benutzerdefiniertes Feld 1',
34623461
customField2: 'Benutzerdefiniertes Feld 2',
34633462
customFieldHint: 'Fügen Sie benutzerdefinierten Code hinzu, der für alle Ausgaben dieses Mitglieds gilt.',
3464-
reports: 'Berichte',
34653463
reportFields: 'Berichtsfelder',
34663464
reportTitle: 'Berichtstitel',
34673465
reportField: 'Berichtsfeld',
34683466
taxes: 'Steuern',
34693467
bills: 'Rechnungen',
34703468
invoices: 'Rechnungen',
3471-
perDiem: 'Per diem',
34723469
travel: 'Reisen',
34733470
members: 'Mitglieder',
34743471
accounting: 'Buchhaltung',
@@ -3481,7 +3478,6 @@ const translations = {
34813478
testTransactions: 'Transaktionen testen',
34823479
issueAndManageCards: 'Karten ausstellen und verwalten',
34833480
reconcileCards: 'Karten abstimmen',
3484-
selectAll: 'Alle auswählen',
34853481
selected: () => ({
34863482
one: '1 ausgewählt',
34873483
other: (count: number) => `${count} ausgewählt`,
@@ -3495,8 +3491,6 @@ const translations = {
34953491
memberNotFound: 'Mitglied nicht gefunden. Um ein neues Mitglied zum Arbeitsbereich einzuladen, verwenden Sie bitte die Einladungsschaltfläche oben.',
34963492
notAuthorized: `Sie haben keinen Zugriff auf diese Seite. Wenn Sie versuchen, diesem Arbeitsbereich beizutreten, bitten Sie einfach den Besitzer des Arbeitsbereichs, Sie als Mitglied hinzuzufügen. Etwas anderes? Kontaktieren Sie ${CONST.EMAIL.CONCIERGE}.`,
34973493
goToWorkspace: 'Zum Arbeitsbereich gehen',
3498-
duplicateWorkspace: 'Arbeitsbereich duplizieren',
3499-
duplicateWorkspacePrefix: 'Duplizieren',
35003494
goToWorkspaces: 'Zu Arbeitsbereichen gehen',
35013495
clearFilter: 'Filter löschen',
35023496
workspaceName: 'Arbeitsbereichsname',
@@ -4905,18 +4899,6 @@ const translations = {
49054899
taxCode: 'Steuercode',
49064900
updateTaxCodeFailureMessage: 'Beim Aktualisieren des Steuercodes ist ein Fehler aufgetreten, bitte versuchen Sie es erneut.',
49074901
},
4908-
duplicateWorkspace: {
4909-
title: 'Benennen Sie Ihren neuen Arbeitsbereich',
4910-
selectFeatures: 'Auswählen der zu kopierenden Features',
4911-
whichFeatures: 'Welche Funktionen möchten Sie in Ihren neuen Arbeitsbereich kopieren?',
4912-
confirmDuplicate: '\n\nMöchten Sie fortfahren?',
4913-
categories: 'Kategorien und Ihre Auto-Kategorisierungsregeln',
4914-
reimbursementAccount: 'Erstattungskonto',
4915-
delayedSubmission: 'verspätete Einreichung',
4916-
welcomeNote: 'Bitte beginnen Sie mit der Nutzung meines neuen Arbeitsbereichs',
4917-
confirmTitle: ({newWorkspaceName, totalMembers}: {newWorkspaceName?: string; totalMembers?: number}) =>
4918-
`Sie sind dabei, ${newWorkspaceName ?? ''} zu erstellen und mit ${totalMembers ?? 0} Mitgliedern aus dem ursprünglichen Arbeitsbereich zu teilen.`,
4919-
},
49204902
emptyWorkspace: {
49214903
title: 'Sie haben keine Arbeitsbereiche',
49224904
subtitle: 'Verfolgen Sie Belege, erstatten Sie Ausgaben, verwalten Sie Reisen, senden Sie Rechnungen und mehr.',

src/languages/en.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ const translations = {
312312
count: 'Count',
313313
cancel: 'Cancel',
314314
dismiss: 'Dismiss',
315-
proceed: 'Proceed',
316315
yes: 'Yes',
317316
no: 'No',
318317
ok: 'OK',
@@ -3458,14 +3457,12 @@ const translations = {
34583457
customField1: 'Custom field 1',
34593458
customField2: 'Custom field 2',
34603459
customFieldHint: 'Add custom coding that applies to all spend from this member.',
3461-
reports: 'Reports',
34623460
reportFields: 'Report fields',
34633461
reportTitle: 'Report title',
34643462
reportField: 'Report field',
34653463
taxes: 'Taxes',
34663464
bills: 'Bills',
34673465
invoices: 'Invoices',
3468-
perDiem: 'Per diem',
34693466
travel: 'Travel',
34703467
members: 'Members',
34713468
accounting: 'Accounting',
@@ -3478,7 +3475,6 @@ const translations = {
34783475
testTransactions: 'Test transactions',
34793476
issueAndManageCards: 'Issue and manage cards',
34803477
reconcileCards: 'Reconcile cards',
3481-
selectAll: 'Select all',
34823478
selected: () => ({
34833479
one: '1 selected',
34843480
other: (count: number) => `${count} selected`,
@@ -3492,8 +3488,6 @@ const translations = {
34923488
memberNotFound: 'Member not found. To invite a new member to the workspace, please use the invite button above.',
34933489
notAuthorized: `You don't have access to this page. If you're trying to join this workspace, just ask the workspace owner to add you as a member. Something else? Reach out to ${CONST.EMAIL.CONCIERGE}.`,
34943490
goToWorkspace: 'Go to workspace',
3495-
duplicateWorkspace: 'Duplicate Workspace',
3496-
duplicateWorkspacePrefix: 'Duplicate',
34973491
goToWorkspaces: 'Go to workspaces',
34983492
clearFilter: 'Clear filter',
34993493
workspaceName: 'Workspace name',
@@ -4888,18 +4882,6 @@ const translations = {
48884882
taxCode: 'Tax code',
48894883
updateTaxCodeFailureMessage: 'An error occurred while updating the tax code, please try again',
48904884
},
4891-
duplicateWorkspace: {
4892-
title: 'Name your new workspace',
4893-
selectFeatures: 'Select features to copy',
4894-
whichFeatures: 'Which features do you want to copy over to your new workspace?',
4895-
confirmDuplicate: '\n\nDo you want to continue?',
4896-
categories: 'categories and your auto-categorization rules',
4897-
reimbursementAccount: 'reimbursement account',
4898-
welcomeNote: 'Please start using my new workspace',
4899-
delayedSubmission: 'delayed submission',
4900-
confirmTitle: ({newWorkspaceName, totalMembers}: {newWorkspaceName?: string; totalMembers?: number}) =>
4901-
`You’re about to create and share ${newWorkspaceName ?? ''} with ${totalMembers ?? 0} members from the original workspace.`,
4902-
},
49034885
emptyWorkspace: {
49044886
title: 'You have no workspaces',
49054887
subtitle: 'Track receipts, reimburse expenses, manage travel, send invoices, and more.',

src/languages/es.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ const translations = {
302302
count: 'Contar',
303303
cancel: 'Cancelar',
304304
dismiss: 'Descartar',
305-
proceed: 'Proceed',
306305
yes: 'Sí',
307306
no: 'No',
308307
ok: 'OK',
@@ -3446,13 +3445,11 @@ const translations = {
34463445
customField1: 'Campo personalizado 1',
34473446
customField2: 'Campo personalizado 2',
34483447
customFieldHint: 'Añade una codificación personalizada que se aplique a todos los gastos de este miembro.',
3449-
reports: 'Informes',
34503448
reportFields: 'Campos de informe',
34513449
reportTitle: 'El título del informe.',
34523450
taxes: 'Impuestos',
34533451
bills: 'Pagar facturas',
34543452
invoices: 'Facturas',
3455-
perDiem: 'Per diem',
34563453
travel: 'Viajes',
34573454
members: 'Miembros',
34583455
accounting: 'Contabilidad',
@@ -3465,7 +3462,6 @@ const translations = {
34653462
testTransactions: 'Transacciones de prueba',
34663463
issueAndManageCards: 'Emitir y gestionar tarjetas',
34673464
reconcileCards: 'Reconciliar tarjetas',
3468-
selectAll: 'Seleccionar todo',
34693465
selected: () => ({
34703466
one: '1 seleccionado',
34713467
other: (count: number) => `${count} seleccionados`,
@@ -3479,8 +3475,6 @@ const translations = {
34793475
memberNotFound: 'Miembro no encontrado. Para invitar a un nuevo miembro al espacio de trabajo, por favor, utiliza el botón invitar que está arriba.',
34803476
notAuthorized: `No tienes acceso a esta página. Si estás intentando unirte a este espacio de trabajo, pide al dueño del espacio de trabajo que te añada como miembro. ¿Necesitas algo más? Comunícate con ${CONST.EMAIL.CONCIERGE}`,
34813477
goToWorkspace: 'Ir al espacio de trabajo',
3482-
duplicateWorkspace: 'Duplicar espacio de trabajo',
3483-
duplicateWorkspacePrefix: 'Duplicar',
34843478
goToWorkspaces: 'Ir a espacios de trabajo',
34853479
clearFilter: 'Borrar filtro',
34863480
workspaceName: 'Nombre del espacio de trabajo',
@@ -4898,18 +4892,6 @@ const translations = {
48984892
taxCode: 'Código de impuesto',
48994893
updateTaxCodeFailureMessage: 'Se produjo un error al actualizar el código tributario, inténtelo nuevamente',
49004894
},
4901-
duplicateWorkspace: {
4902-
title: 'Nombra tu nuevo espacio de trabajo',
4903-
selectFeatures: 'Selecciona las funciones a copiar',
4904-
whichFeatures: '¿Qué funciones deseas copiar a tu nuevo espacio de trabajo?',
4905-
confirmDuplicate: '\n\n¿Quieres continuar?',
4906-
categories: 'categorías y tus reglas de auto-categorización',
4907-
reimbursementAccount: 'cuenta de reembolso',
4908-
delayedSubmission: 'presentación retrasada',
4909-
welcomeNote: 'Por favor, comience a utilizar mi nuevo espacio de trabajo.',
4910-
confirmTitle: ({newWorkspaceName, totalMembers}: {newWorkspaceName?: string; totalMembers?: number}) =>
4911-
`Estás a punto de crear y compartir ${newWorkspaceName ?? ''} con ${totalMembers ?? 0} miembros del espacio de trabajo original.`,
4912-
},
49134895
emptyWorkspace: {
49144896
title: 'No tienes espacios de trabajo',
49154897
subtitle: 'Organiza recibos, reembolsa gastos, gestiona viajes, envía facturas y mucho más.',

0 commit comments

Comments
 (0)