diff --git a/src/features/problems/detail/components/panel.tsx b/src/features/problems/detail/components/panel.tsx index 8bfe231..573e9dc 100644 --- a/src/features/problems/detail/components/panel.tsx +++ b/src/features/problems/detail/components/panel.tsx @@ -12,7 +12,11 @@ interface DetailPanelProps { export const DetailPanel = ({ submissionId }: DetailPanelProps) => { if (!submissionId) { - return ; + return ( + + + + ); } return ( diff --git a/src/features/problems/detail/components/tab-sync.tsx b/src/features/problems/detail/components/tab-sync.tsx new file mode 100644 index 0000000..9f63ecd --- /dev/null +++ b/src/features/problems/detail/components/tab-sync.tsx @@ -0,0 +1,25 @@ +"use client"; + +import { useEffect } from "react"; +import { Actions } from "flexlayout-react"; +import { useProblemFlexLayoutStore } from "@/stores/flexlayout"; + +interface DetailTabSyncProps { + submissionId: string | undefined; +} + +export const DetailTabSync = ({ submissionId }: DetailTabSyncProps) => { + const { model } = useProblemFlexLayoutStore(); + + useEffect(() => { + if (!model || submissionId) return; + + const detailTab = model.getNodeById("detail"); + if (!detailTab) return; + + model.doAction(Actions.selectTab("submission")); + model.doAction(Actions.deleteTab("detail")); + }, [model, submissionId]); + + return null; +}; diff --git a/src/features/problems/ui/views/problem-view.tsx b/src/features/problems/ui/views/problem-view.tsx index 945398c..701e027 100644 --- a/src/features/problems/ui/views/problem-view.tsx +++ b/src/features/problems/ui/views/problem-view.tsx @@ -2,6 +2,7 @@ import { TestcasePanel } from "@/features/problems/testcase/panel"; import { BotPanel } from "@/features/problems/bot/components/panel"; import { CodePanel } from "@/features/problems/code/components/panel"; import { DetailPanel } from "@/features/problems/detail/components/panel"; +import { DetailTabSync } from "@/features/problems/detail/components/tab-sync"; import { SolutionPanel } from "@/features/problems/solution/components/panel"; import { SubmissionPanel } from "@/features/problems/submission/components/panel"; import { DescriptionPanel } from "@/features/problems/description/components/panel"; @@ -26,6 +27,7 @@ export const ProblemView = ({ problemId, submissionId }: ProblemViewProps) => { return (
+