chore(store): update result type and remove unused imports

This commit is contained in:
cfngc4594 2025-03-16 19:31:05 +08:00
parent 2d4abc5141
commit 0cb5484fbd

View File

@ -1,10 +1,9 @@
import { create } from "zustand"; import { create } from "zustand";
import type { editor } from "monaco-editor"; import type { editor } from "monaco-editor";
import { JudgeResultMetadata } from "@/types/judge";
import { createJSONStorage, persist } from "zustand/middleware"; import { createJSONStorage, persist } from "zustand/middleware";
import { DefaultEditorOptionConfig } from "@/config/editor-option";
import { DEFAULT_EDITOR_LANGUAGE } from "@/config/editor-language"; import { DEFAULT_EDITOR_LANGUAGE } from "@/config/editor-language";
import { EditorLanguage, LanguageServerConfig } from "@prisma/client"; import { DefaultEditorOptionConfig } from "@/config/editor-option";
import { EditorLanguage, JudgeResult, LanguageServerConfig } from "@prisma/client";
interface CodeEditorState { interface CodeEditorState {
hydrated: boolean; hydrated: boolean;
@ -15,7 +14,7 @@ interface CodeEditorState {
isLspEnabled: boolean; isLspEnabled: boolean;
editorConfig: editor.IEditorConstructionOptions; editorConfig: editor.IEditorConstructionOptions;
editor: editor.IStandaloneCodeEditor | null; editor: editor.IStandaloneCodeEditor | null;
result: JudgeResultMetadata | null; result: JudgeResult | null;
setHydrated: (value: boolean) => void; setHydrated: (value: boolean) => void;
setLanguage: (language: EditorLanguage) => void; setLanguage: (language: EditorLanguage) => void;
setPath: (path: string) => void; setPath: (path: string) => void;
@ -24,7 +23,7 @@ interface CodeEditorState {
setIsLspEnabled: (enabled: boolean) => void; setIsLspEnabled: (enabled: boolean) => void;
setEditorConfig: (editorConfig: editor.IEditorConstructionOptions) => void; setEditorConfig: (editorConfig: editor.IEditorConstructionOptions) => void;
setEditor: (editor: editor.IStandaloneCodeEditor) => void; setEditor: (editor: editor.IStandaloneCodeEditor) => void;
setResult: (result: JudgeResultMetadata) => void; setResult: (result: JudgeResult) => void;
} }
export const useCodeEditorStore = create<CodeEditorState>()( export const useCodeEditorStore = create<CodeEditorState>()(
@ -46,7 +45,7 @@ export const useCodeEditorStore = create<CodeEditorState>()(
setLspConfig: (lspConfig) => set({ lspConfig }), setLspConfig: (lspConfig) => set({ lspConfig }),
setIsLspEnabled: (enabled) => set({ isLspEnabled: enabled }), setIsLspEnabled: (enabled) => set({ isLspEnabled: enabled }),
setEditorConfig: (editorConfig) => set({ editorConfig }), setEditorConfig: (editorConfig) => set({ editorConfig }),
setEditor: (editor) => set({ editor: editor }), setEditor: (editor) => set({ editor }),
setResult: (result) => set({ result }), setResult: (result) => set({ result }),
}), }),
{ {