From 747d1914123e8e64ead014c4b0d50623cb04925f Mon Sep 17 00:00:00 2001 From: Takeshi Kimata <117462761+kimatata@users.noreply.github.com> Date: Sat, 4 May 2024 12:19:53 +0900 Subject: [PATCH] Include locale on all links and routers --- frontend/src/app/[locale]/LangSwitch.tsx | 2 +- frontend/src/app/[locale]/layout.tsx | 11 --------- .../app/[locale]/projects/ProjectsPage.tsx | 4 +++- .../app/[locale]/projects/ProjectsTable.tsx | 8 ++++--- .../[projectId]/{sidebar.tsx => Sidebar.tsx} | 23 +++++++++---------- .../[projectId]/folders/FoldersPane.tsx | 15 ++++++++---- .../folders/[folderId]/cases/CasesPane.tsx | 4 +++- .../[folderId]/cases/TestCaseTable.tsx | 8 ++++--- .../[folderId]/cases/[caseId]/CaseEditor.tsx | 12 +++++++--- .../[folderId]/cases/[caseId]/page.tsx | 8 ++++++- .../folders/[folderId]/cases/page.tsx | 8 +++++-- .../projects/[projectId]/folders/layout.tsx | 4 ++-- .../[locale]/projects/[projectId]/layout.tsx | 6 +++-- .../projects/[projectId]/runs/RunsPage.tsx | 4 +++- .../projects/[projectId]/runs/RunsTable.tsx | 14 +++++++---- .../[projectId]/runs/[runId]/RunEditor.tsx | 9 +++++--- .../[projectId]/runs/[runId]/page.tsx | 10 ++++++-- .../projects/[projectId]/runs/page.tsx | 8 +++++-- frontend/src/app/[locale]/projects/page.tsx | 4 ++-- frontend/src/navigation.ts | 3 +++ 20 files changed, 104 insertions(+), 61 deletions(-) rename frontend/src/app/[locale]/projects/[projectId]/{sidebar.tsx => Sidebar.tsx} (79%) diff --git a/frontend/src/app/[locale]/LangSwitch.tsx b/frontend/src/app/[locale]/LangSwitch.tsx index 68932c1..48a093c 100644 --- a/frontend/src/app/[locale]/LangSwitch.tsx +++ b/frontend/src/app/[locale]/LangSwitch.tsx @@ -21,7 +21,7 @@ export default function LangSwitch(params: { locale: string }) { async function changeLocale(nextLocale: string) { let newPathname; - if (params.locale.length < 4) { + if (pathname.length < 4) { // when root path router.push("/", { locale: nextLocale }); } else { diff --git a/frontend/src/app/[locale]/layout.tsx b/frontend/src/app/[locale]/layout.tsx index 97a35ff..18990c0 100644 --- a/frontend/src/app/[locale]/layout.tsx +++ b/frontend/src/app/[locale]/layout.tsx @@ -43,17 +43,6 @@ export default function RootLayout({