mirror of
https://github.com/cfngc4594/monaco-editor-lsp-next.git
synced 2026-05-31 10:18:52 +00:00
fix(detail): remove stale detail tab without submission
This commit is contained in:
parent
12c2963447
commit
0c1ccb556f
@ -12,7 +12,11 @@ interface DetailPanelProps {
|
||||
|
||||
export const DetailPanel = ({ submissionId }: DetailPanelProps) => {
|
||||
if (!submissionId) {
|
||||
return <DetailContentSkeleton />;
|
||||
return (
|
||||
<PanelLayout isScroll={false}>
|
||||
<DetailContentSkeleton />
|
||||
</PanelLayout>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
25
src/features/problems/detail/components/tab-sync.tsx
Normal file
25
src/features/problems/detail/components/tab-sync.tsx
Normal file
@ -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;
|
||||
};
|
||||
@ -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 (
|
||||
<div className="relative flex h-full w-full">
|
||||
<DetailTabSync submissionId={submissionId} />
|
||||
<SubmissionRealtimeListener problemId={problemId} />
|
||||
<ProblemFlexLayout components={components} />
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user