From 60aef705d59e0aea5b5bb58d8c1f321056bd5978 Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Thu, 13 Mar 2025 11:44:14 +0800 Subject: [PATCH] refactor(editor): replace loading skeleton with custom Loading component --- src/components/code-editor.tsx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/components/code-editor.tsx b/src/components/code-editor.tsx index 7ee4b17..9d82bfe 100644 --- a/src/components/code-editor.tsx +++ b/src/components/code-editor.tsx @@ -1,9 +1,9 @@ "use client"; import dynamic from "next/dynamic"; -import { Skeleton } from "./ui/skeleton"; import { highlighter } from "@/lib/shiki"; import type { editor } from "monaco-editor"; +import { Loading } from "@/components/loading"; import { EditorLanguage } from "@prisma/client"; import { shikiToMonaco } from "@shikijs/monaco"; import type { Monaco } from "@monaco-editor/react"; @@ -14,13 +14,6 @@ import { connectToLanguageServer } from "@/lib/language-server"; import { useCodeEditorStore } from "@/store/useCodeEditorStore"; import type { MonacoLanguageClient } from "monaco-languageclient"; -// Skeleton component for loading state -const CodeEditorLoadingSkeleton = () => ( -
- -
-); - // Dynamically import Monaco Editor with SSR disabled const Editor = dynamic( async () => { @@ -32,7 +25,7 @@ const Editor = dynamic( }, { ssr: false, - loading: () => , + loading: () => , } ); @@ -132,7 +125,7 @@ export default function CodeEditor({ }, []); if (!hydrated) { - return ; + return ; } const handleEditorWillMount = (monaco: Monaco) => { @@ -149,7 +142,7 @@ export default function CodeEditor({ onMount={handleEditorDidMount} onChange={handleEditorChange} options={editorConfig} - loading={} + loading={} className="h-full w-full py-2" /> );