From 64182bccc6022892d282bdf3a09f2cc1c59281ef Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Sat, 19 Apr 2025 12:53:39 +0800 Subject: [PATCH] fix(dockview): move panel titles from options to params to prevent i18n title persistence in layout --- src/app/(app)/problems/[id]/page.tsx | 14 +++++++------- src/components/dockview.tsx | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/app/(app)/problems/[id]/page.tsx b/src/app/(app)/problems/[id]/page.tsx index 64ed3d5..488e101 100644 --- a/src/app/(app)/problems/[id]/page.tsx +++ b/src/app/(app)/problems/[id]/page.tsx @@ -53,20 +53,20 @@ export default function ProblemPage({ id: "Description", component: "Description", tabComponent: "Description", - title: t("Description"), params: { icon: FileTextIcon, content: Description, + title: t("Description"), }, }, { id: "Solutions", component: "Solutions", tabComponent: "Solutions", - title: t("Solutions"), params: { icon: FlaskConicalIcon, content: Solutions, + title: t("Solutions"), }, position: { referencePanel: "Description", @@ -78,10 +78,10 @@ export default function ProblemPage({ id: "Submissions", component: "Submissions", tabComponent: "Submissions", - title: t("Submissions"), params: { icon: CircleCheckBigIcon, content: Submissions, + title: t("Submissions"), }, position: { referencePanel: "Solutions", @@ -93,10 +93,10 @@ export default function ProblemPage({ id: "Details", component: "Details", tabComponent: "Details", - title: t("Details"), params: { icon: CircleCheckBigIcon, content: Details, + title: t("Details"), autoAdd: false, }, }, @@ -104,10 +104,10 @@ export default function ProblemPage({ id: "Code", component: "Code", tabComponent: "Code", - title: t("Code"), params: { icon: SquarePenIcon, content: Code, + title: t("Code"), }, position: { referencePanel: "Submissions", @@ -118,10 +118,10 @@ export default function ProblemPage({ id: "Testcase", component: "Testcase", tabComponent: "Testcase", - title: t("Testcase"), params: { icon: SquareCheckIcon, content: Testcase, + title: t("Testcase"), }, position: { referencePanel: "Code", @@ -132,10 +132,10 @@ export default function ProblemPage({ id: "Bot", component: "Bot", tabComponent: "Bot", - title: t("Bot"), params: { icon: BotIcon, content: Bot, + title: t("Bot"), autoAdd: false, }, position: { diff --git a/src/components/dockview.tsx b/src/components/dockview.tsx index 83508da..40bd24b 100644 --- a/src/components/dockview.tsx +++ b/src/components/dockview.tsx @@ -15,6 +15,7 @@ import { DockviewReact, themeAbyssSpaced } from "dockview"; interface PanelContent { icon?: LucideIcon; content?: React.ReactNode; + title?: string; autoAdd?: boolean; } @@ -45,7 +46,7 @@ export default function DockView({ storageKey, onApiReady, options }: DockviewPr return <>{content}; }; - tabComponents[id] = (props) => { + tabComponents[id] = () => { const Icon = params?.icon; return (
@@ -56,7 +57,7 @@ export default function DockView({ storageKey, onApiReady, options }: DockviewPr aria-hidden="true" /> )} - {props.api.title} + {params?.title}
); };