From 010b8a182e96256a2ac69e8d89bbf54ca824b46f Mon Sep 17 00:00:00 2001 From: lajbel Date: Mon, 14 Oct 2024 22:37:28 -0300 Subject: [PATCH] chore: fix file handling --- src/components/Editor/MonacoEditor.tsx | 5 ++--- src/components/FileTree/FileEntry.tsx | 8 +++++++- src/components/FileTree/FileFold.tsx | 14 +++++++++++--- src/components/Playground/Playground.tsx | 11 ++++++++++- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/components/Editor/MonacoEditor.tsx b/src/components/Editor/MonacoEditor.tsx index e195c24..3a9291b 100644 --- a/src/components/Editor/MonacoEditor.tsx +++ b/src/components/Editor/MonacoEditor.tsx @@ -8,10 +8,9 @@ import { configMonaco } from "./monacoConfig"; type Props = { onMount?: () => void; + defaultTheme?: string; }; -const defaultTheme = localStorage.getItem("theme") as string; - export const MonacoEditor: FC = (props) => { const { updateFile, getFile } = useProject(); const { @@ -101,7 +100,7 @@ export const MonacoEditor: FC = (props) => { defaultValue={getFile(getRuntime().currentFile)?.value} beforeMount={handleEditorBeforeMount} onMount={handleEditorMount} - theme={defaultTheme} + theme={props.defaultTheme} language="javascript" options={{ fontSize: 20, diff --git a/src/components/FileTree/FileEntry.tsx b/src/components/FileTree/FileEntry.tsx index f89cb0e..4655eaa 100644 --- a/src/components/FileTree/FileEntry.tsx +++ b/src/components/FileTree/FileEntry.tsx @@ -6,7 +6,6 @@ import { cn } from "../../util/cn"; import { removeExtension } from "../../util/removeExtensions"; import "./FileEntry.css"; import { useEditor } from "../../hooks/useEditor"; -import { debug } from "../../util/logs"; type Props = { file: File; @@ -23,11 +22,13 @@ const FileButton: FC<{ onClick: MouseEventHandler; icon: keyof typeof assets; rotate?: 0 | 90 | 180 | 270; + hidden?: boolean; }> = (props) => { return (