mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
feat(dockview): export Dockview component and create ProblemDockview wrapper
- Export Dockview component from src/components/dockview.tsx to make it reusable - Create new ProblemDockview component in src/features/problems/components/dockview.tsx that: - Integrates with next-intl for locale handling - Connects to problem-dockview store - Wraps Dockview with problem-specific configuration - Adds locale-based key for proper re-rendering - Maintain existing Dockview functionality including: - Layout persistence - Panel management - API handling
This commit is contained in:
parent
148ae677d7
commit
aec8393d2d
@ -62,7 +62,7 @@ const useDockviewComponents = (
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Dockview = ({
|
export const Dockview = ({
|
||||||
storageKey,
|
storageKey,
|
||||||
onApiReady,
|
onApiReady,
|
||||||
components,
|
components,
|
||||||
@ -139,5 +139,3 @@ const Dockview = ({
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { Dockview };
|
|
||||||
|
32
src/features/problems/components/dockview.tsx
Normal file
32
src/features/problems/components/dockview.tsx
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useLocale } from "next-intl";
|
||||||
|
import type { AddPanelOptions } from "dockview";
|
||||||
|
import { Dockview, type PanelParams } from "@/components/dockview";
|
||||||
|
import { useProblemDockviewStore } from "@/stores/problem-dockview";
|
||||||
|
|
||||||
|
interface ProblemDockviewProps {
|
||||||
|
components: Record<string, React.ReactNode>;
|
||||||
|
tabComponents: Record<string, React.ReactNode>;
|
||||||
|
panelOptions: AddPanelOptions<PanelParams>[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ProblemDockview = ({
|
||||||
|
components,
|
||||||
|
tabComponents,
|
||||||
|
panelOptions,
|
||||||
|
}: ProblemDockviewProps) => {
|
||||||
|
const locale = useLocale();
|
||||||
|
const { setApi } = useProblemDockviewStore();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dockview
|
||||||
|
key={locale}
|
||||||
|
storageKey="dockview:problem"
|
||||||
|
onApiReady={setApi}
|
||||||
|
components={components}
|
||||||
|
tabComponents={tabComponents}
|
||||||
|
panelOptions={panelOptions}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user