diff --git a/public/favicon.ico b/public/favicon.ico index 701556e..8029b16 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/src/App.jsx b/src/App.jsx index 9ff6dd7..928eed1 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,10 +1,10 @@ -import { useEffect, useRef, useState } from 'react'; -import Editor, { loader } from '@monaco-editor/react'; -import clearIcon from "./assets/images/clear.png"; -import outputIcon from "./assets/images/output.png"; -import pythonIcon from "./assets/images/python.png"; -import runIcon from "./assets/images/run.png"; -// import oneDarkProTheme from './assets/themes/OneDark-Pro.json'; +import { useEffect, useRef, useState } from "react"; +import Editor, { loader } from "@monaco-editor/react"; +// import clearIcon from "./assets/images/clear.png"; +// import outputIcon from "./assets/images/output.png"; +// import pythonIcon from "./assets/images/python.png"; +// import runIcon from "./assets/images/run.png"; +// import oneDarkProTheme from "./assets/themes/OneDark-Pro.json"; export default function App() { const editorRef = useRef(null); @@ -14,7 +14,7 @@ export default function App() { async function ping() { setReady(false); try { - await fetch(`${import.meta.env.VITE_API_URL}/ping`, {method: "GET"}); + await fetch(`${import.meta.env.VITE_API_URL}/ping`, { method: "GET" }); setReady(true); } catch (error) { console.error(error) @@ -29,8 +29,8 @@ export default function App() { // useEffect(() => { // loader.init().then((monaco) => { - // monaco.editor.defineTheme('one-dark-pro', { - // base: 'vs-dark', + // monaco.editor.defineTheme("one-dark-pro", { + // base: "vs-dark", // inherit: true, // rules: oneDarkProTheme.tokenColors, // colors: oneDarkProTheme.colors, @@ -40,8 +40,15 @@ export default function App() { function handleEditorDidMount(editor, monaco) { editorRef.current = editor; - editorRef.current.updateOptions({ theme: "vs" }); - // editorRef.current.updateOptions({ theme: "vs-dark" }); + + const isDarkTheme = window.matchMedia("(prefers-color-scheme: dark)").matches; + editorRef.current.updateOptions({ theme: isDarkTheme ? "vs-dark" : "vs" }); + + window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", event => { + const newTheme = event.matches ? "vs-dark" : "vs"; + editorRef.current.updateOptions({ theme: newTheme }); + }); + // editorRef.current.updateOptions({ theme: "one-dark-pro" }); } @@ -50,7 +57,7 @@ export default function App() { try { const response = await fetch( - `${import.meta.env.VITE_API_URL}/execute`, + `${import.meta.env.VITE_API_URL}/execute`, { method: "POST", headers: { @@ -77,27 +84,33 @@ export default function App() { } return ( -
+
-
-
- - Python +
+
+ + + + Python
- -
-
+
-
+
- - Output + + + + + Output
-
-
-
{output}
+
+
{output}