From 7dbf57861fde5db35400d6623a00b2e6e3ab89fa Mon Sep 17 00:00:00 2001 From: dominictb Date: Wed, 11 Sep 2024 23:30:49 +0700 Subject: [PATCH 1/4] fix: wrong navigation when create category with the name 'new' --- src/ROUTES.ts | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index ea829d0cc722..155e4dfc9fcb 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -440,7 +440,7 @@ const ROUTES = { SETTINGS_CATEGORY_EDIT: { route: 'settings/:policyID/categories/:categoryName/edit', getRoute: (policyID: string, categoryName: string, backTo = '') => - getUrlWithBackToParam(`settings/workspaces/${policyID}/categories/${encodeURIComponent(categoryName)}/edit`, backTo), + getUrlWithBackToParam(`settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/edit`, backTo), }, MONEY_REQUEST_STEP_CURRENCY: { route: ':action/:iouType/currency/:transactionID/:reportID/:pageIndex?', @@ -767,8 +767,8 @@ const ROUTES = { getRoute: (policyID: string) => `settings/workspaces/${policyID}/categories` as const, }, WORKSPACE_CATEGORY_SETTINGS: { - route: 'settings/workspaces/:policyID/categories/:categoryName', - getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/categories/${encodeURIComponent(categoryName)}` as const, + route: 'settings/workspaces/:policyID/category/:categoryName', + getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}` as const, }, WORKSPACE_UPGRADE: { route: 'settings/workspaces/:policyID/upgrade/:featureName', @@ -792,36 +792,36 @@ const ROUTES = { getRoute: (policyID: string) => `settings/workspaces/${policyID}/categories/new` as const, }, WORKSPACE_CATEGORY_EDIT: { - route: 'settings/workspaces/:policyID/categories/:categoryName/edit', - getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/categories/${encodeURIComponent(categoryName)}/edit` as const, + route: 'settings/workspaces/:policyID/category/:categoryName/edit', + getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/edit` as const, }, WORKSPACE_CATEGORY_PAYROLL_CODE: { - route: 'settings/workspaces/:policyID/categories/:categoryName/payroll-code', - getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/categories/${encodeURIComponent(categoryName)}/payroll-code` as const, + route: 'settings/workspaces/:policyID/category/:categoryName/payroll-code', + getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/payroll-code` as const, }, WORKSPACE_CATEGORY_GL_CODE: { - route: 'settings/workspaces/:policyID/categories/:categoryName/gl-code', - getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/categories/${encodeURIComponent(categoryName)}/gl-code` as const, + route: 'settings/workspaces/:policyID/category/:categoryName/gl-code', + getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/gl-code` as const, }, WORSKPACE_CATEGORY_DEFAULT_TAX_RATE: { - route: 'settings/workspaces/:policyID/categories/:categoryName/tax-rate', - getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/categories/${encodeURIComponent(categoryName)}/tax-rate` as const, + route: 'settings/workspaces/:policyID/category/:categoryName/tax-rate', + getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/tax-rate` as const, }, WORSKPACE_CATEGORY_FLAG_AMOUNTS_OVER: { - route: 'settings/workspaces/:policyID/categories/:categoryName/flag-amounts', - getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/categories/${encodeURIComponent(categoryName)}/flag-amounts` as const, + route: 'settings/workspaces/:policyID/category/:categoryName/flag-amounts', + getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/flag-amounts` as const, }, WORSKPACE_CATEGORY_DESCRIPTION_HINT: { - route: 'settings/workspaces/:policyID/categories/:categoryName/description-hint', - getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/categories/${encodeURIComponent(categoryName)}/description-hint` as const, + route: 'settings/workspaces/:policyID/category/:categoryName/description-hint', + getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/description-hint` as const, }, WORSKPACE_CATEGORY_REQUIRE_RECEIPTS_OVER: { - route: 'settings/workspaces/:policyID/categories/:categoryName/require-receipts-over', - getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/categories/${encodeURIComponent(categoryName)}/require-receipts-over` as const, + route: 'settings/workspaces/:policyID/category/:categoryName/require-receipts-over', + getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/require-receipts-over` as const, }, WORSKPACE_CATEGORY_APPROVER: { - route: 'settings/workspaces/:policyID/categories/:categoryName/approver', - getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/categories/${encodeURIComponent(categoryName)}/approver` as const, + route: 'settings/workspaces/:policyID/category/:categoryName/approver', + getRoute: (policyID: string, categoryName: string) => `settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/approver` as const, }, WORKSPACE_MORE_FEATURES: { route: 'settings/workspaces/:policyID/more-features', From d29e77ee65ea268fffcc8d425f550dea706ed47b Mon Sep 17 00:00:00 2001 From: dominictb Date: Wed, 11 Sep 2024 23:50:16 +0700 Subject: [PATCH 2/4] run prettier --- src/ROUTES.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 155e4dfc9fcb..b17837ed4fb1 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -439,8 +439,7 @@ const ROUTES = { }, SETTINGS_CATEGORY_EDIT: { route: 'settings/:policyID/categories/:categoryName/edit', - getRoute: (policyID: string, categoryName: string, backTo = '') => - getUrlWithBackToParam(`settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/edit`, backTo), + getRoute: (policyID: string, categoryName: string, backTo = '') => getUrlWithBackToParam(`settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/edit`, backTo), }, MONEY_REQUEST_STEP_CURRENCY: { route: ':action/:iouType/currency/:transactionID/:reportID/:pageIndex?', From b75084d259ab55af6a38ecd052cd561b9312a60b Mon Sep 17 00:00:00 2001 From: dominictb Date: Tue, 17 Sep 2024 15:12:21 +0700 Subject: [PATCH 3/4] update category settings paths --- src/ROUTES.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index b17837ed4fb1..7686644b7ae8 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -422,23 +422,23 @@ const ROUTES = { getUrlWithBackToParam(`${action as string}/${iouType as string}/category/${transactionID}/${reportID}${reportActionID ? `/${reportActionID}` : ''}`, backTo), }, SETTINGS_CATEGORIES_ROOT: { - route: 'settings/:policyID/categories', - getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories`, backTo), + route: 'settings/:policyID/category', + getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/category`, backTo), }, SETTINGS_CATEGORY_SETTINGS: { - route: 'settings/:policyID/categories/:categoryName', - getRoute: (policyID: string, categoryName: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories/${encodeURIComponent(categoryName)}`, backTo), + route: 'settings/:policyID/category/:categoryName', + getRoute: (policyID: string, categoryName: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/category/${encodeURIComponent(categoryName)}`, backTo), }, SETTINGS_CATEGORIES_SETTINGS: { - route: 'settings/:policyID/categories/settings', - getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories/settings`, backTo), + route: 'settings/:policyID/category/settings', + getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/category/settings`, backTo), }, SETTINGS_CATEGORY_CREATE: { - route: 'settings/:policyID/categories/new', - getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories/new`, backTo), + route: 'settings/:policyID/category/new', + getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/category/new`, backTo), }, SETTINGS_CATEGORY_EDIT: { - route: 'settings/:policyID/categories/:categoryName/edit', + route: 'settings/:policyID/category/:categoryName/edit', getRoute: (policyID: string, categoryName: string, backTo = '') => getUrlWithBackToParam(`settings/workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/edit`, backTo), }, MONEY_REQUEST_STEP_CURRENCY: { From 72f5b91761b88d162f6f6f157aa2e757303eb308 Mon Sep 17 00:00:00 2001 From: dominictb Date: Tue, 17 Sep 2024 15:58:37 +0700 Subject: [PATCH 4/4] revert mistaken changes --- src/ROUTES.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 7686644b7ae8..266ce1f3d2fd 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -422,20 +422,20 @@ const ROUTES = { getUrlWithBackToParam(`${action as string}/${iouType as string}/category/${transactionID}/${reportID}${reportActionID ? `/${reportActionID}` : ''}`, backTo), }, SETTINGS_CATEGORIES_ROOT: { - route: 'settings/:policyID/category', - getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/category`, backTo), + route: 'settings/:policyID/categories', + getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories`, backTo), }, SETTINGS_CATEGORY_SETTINGS: { route: 'settings/:policyID/category/:categoryName', getRoute: (policyID: string, categoryName: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/category/${encodeURIComponent(categoryName)}`, backTo), }, SETTINGS_CATEGORIES_SETTINGS: { - route: 'settings/:policyID/category/settings', - getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/category/settings`, backTo), + route: 'settings/:policyID/categories/settings', + getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories/settings`, backTo), }, SETTINGS_CATEGORY_CREATE: { - route: 'settings/:policyID/category/new', - getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/category/new`, backTo), + route: 'settings/:policyID/categories/new', + getRoute: (policyID: string, backTo = '') => getUrlWithBackToParam(`settings/${policyID}/categories/new`, backTo), }, SETTINGS_CATEGORY_EDIT: { route: 'settings/:policyID/category/:categoryName/edit',