From 59d4b99d89ea30127dfdf597c216abc137a5322f Mon Sep 17 00:00:00 2001 From: Anga205 Date: Sun, 8 Mar 2026 12:56:02 +0530 Subject: [PATCH 01/17] initialize astro --- web/.gitignore | 28 +++++++++++++++++++++++ web/.vscode/extensions.json | 4 ++++ web/.vscode/launch.json | 11 +++++++++ web/README.md | 43 ++++++++++++++++++++++++++++++++++++ web/astro.config.mjs | 5 +++++ web/package.json | 17 ++++++++++++++ web/public/favicon.ico | Bin 0 -> 655 bytes web/public/favicon.svg | 9 ++++++++ web/src/pages/index.astro | 17 ++++++++++++++ web/tsconfig.json | 5 +++++ 10 files changed, 139 insertions(+) create mode 100644 web/.gitignore create mode 100644 web/.vscode/extensions.json create mode 100644 web/.vscode/launch.json create mode 100644 web/README.md create mode 100644 web/astro.config.mjs create mode 100644 web/package.json create mode 100644 web/public/favicon.ico create mode 100644 web/public/favicon.svg create mode 100644 web/src/pages/index.astro create mode 100644 web/tsconfig.json diff --git a/web/.gitignore b/web/.gitignore new file mode 100644 index 0000000..aa07cc9 --- /dev/null +++ b/web/.gitignore @@ -0,0 +1,28 @@ +# build output +dist/ +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store + +# jetbrains setting folder +.idea/ + +bun.lockb + +package-lock.json \ No newline at end of file diff --git a/web/.vscode/extensions.json b/web/.vscode/extensions.json new file mode 100644 index 0000000..22a1505 --- /dev/null +++ b/web/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/web/.vscode/launch.json b/web/.vscode/launch.json new file mode 100644 index 0000000..d642209 --- /dev/null +++ b/web/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/web/README.md b/web/README.md new file mode 100644 index 0000000..4ced80a --- /dev/null +++ b/web/README.md @@ -0,0 +1,43 @@ +# Astro Starter Kit: Minimal + +```sh +bun create astro@latest -- --template minimal +``` + +> ๐Ÿง‘โ€๐Ÿš€ **Seasoned astronaut?** Delete this file. Have fun! + +## ๐Ÿš€ Project Structure + +Inside of your Astro project, you'll see the following folders and files: + +```text +/ +โ”œโ”€โ”€ public/ +โ”œโ”€โ”€ src/ +โ”‚ โ””โ”€โ”€ pages/ +โ”‚ โ””โ”€โ”€ index.astro +โ””โ”€โ”€ package.json +``` + +Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. + +There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. + +Any static assets, like images, can be placed in the `public/` directory. + +## ๐Ÿงž Commands + +All commands are run from the root of the project, from a terminal: + +| Command | Action | +| :------------------------ | :----------------------------------------------- | +| `bun install` | Installs dependencies | +| `bun dev` | Starts local dev server at `localhost:4321` | +| `bun build` | Build your production site to `./dist/` | +| `bun preview` | Preview your build locally, before deploying | +| `bun astro ...` | Run CLI commands like `astro add`, `astro check` | +| `bun astro -- --help` | Get help using the Astro CLI | + +## ๐Ÿ‘€ Want to learn more? + +Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). diff --git a/web/astro.config.mjs b/web/astro.config.mjs new file mode 100644 index 0000000..e762ba5 --- /dev/null +++ b/web/astro.config.mjs @@ -0,0 +1,5 @@ +// @ts-check +import { defineConfig } from 'astro/config'; + +// https://astro.build/config +export default defineConfig({}); diff --git a/web/package.json b/web/package.json new file mode 100644 index 0000000..41c39a6 --- /dev/null +++ b/web/package.json @@ -0,0 +1,17 @@ +{ + "name": "online-compiler", + "type": "module", + "version": "0.0.1", + "engines": { + "node": ">=22.12.0" + }, + "scripts": { + "dev": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro" + }, + "dependencies": { + "astro": "^6.1.2" + } +} \ No newline at end of file diff --git a/web/public/favicon.ico b/web/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..7f48a94d16071d6c8d06478c7458ab12e675019c GIT binary patch literal 655 zcmV;A0&x9_P)Rl-XF(A`bsas&GH{e7U1}Ri zJr5jR8B2*Jd6$=$AqgTM2o2FV$WZ9|#jJ3mmpEs{jB0ps@*Kxv}=RB|IJih8Z&fqwCG`%bN0000#bW%=J zQ=IH#a_&L{B{_6Lu_3m>0bMN%+@aOmN_3G~H^8EGi>+bXO=;-|Z`uFnf==AdP z{Oj-S=ltmI=<4`LcLE*&009F@L_t(|+I`d4ZUZ3@1<*Uo7H^LoCw6-8z4wsbd;b4l zA}zMFtOw2mLX6O5Mgl}(5P=uOM4%=tnuHiuAp%(G<c=npm$Fz%eL + + + diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro new file mode 100644 index 0000000..561196b --- /dev/null +++ b/web/src/pages/index.astro @@ -0,0 +1,17 @@ +--- + +--- + + + + + + + + + Astro + + +

Astro

+ + diff --git a/web/tsconfig.json b/web/tsconfig.json new file mode 100644 index 0000000..8bf91d3 --- /dev/null +++ b/web/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"] +} From 215720e7ebc116d1915f7cedfeffb933efaedc40 Mon Sep 17 00:00:00 2001 From: Anga205 Date: Tue, 10 Mar 2026 12:50:12 +0530 Subject: [PATCH 02/17] added meta tags for SEO --- web/package.json | 1 + web/public/favicon.ico | Bin 655 -> 0 bytes web/public/favicon.svg | 10 +--------- web/src/pages/index.astro | 15 ++++++++++++--- 4 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 web/public/favicon.ico diff --git a/web/package.json b/web/package.json index 41c39a6..a3fc014 100644 --- a/web/package.json +++ b/web/package.json @@ -12,6 +12,7 @@ "astro": "astro" }, "dependencies": { + "@monaco-editor/loader": "^1.7.0", "astro": "^6.1.2" } } \ No newline at end of file diff --git a/web/public/favicon.ico b/web/public/favicon.ico deleted file mode 100644 index 7f48a94d16071d6c8d06478c7458ab12e675019c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 655 zcmV;A0&x9_P)Rl-XF(A`bsas&GH{e7U1}Ri zJr5jR8B2*Jd6$=$AqgTM2o2FV$WZ9|#jJ3mmpEs{jB0ps@*Kxv}=RB|IJih8Z&fqwCG`%bN0000#bW%=J zQ=IH#a_&L{B{_6Lu_3m>0bMN%+@aOmN_3G~H^8EGi>+bXO=;-|Z`uFnf==AdP z{Oj-S=ltmI=<4`LcLE*&009F@L_t(|+I`d4ZUZ3@1<*Uo7H^LoCw6-8z4wsbd;b4l zA}zMFtOw2mLX6O5Mgl}(5P=uOM4%=tnuHiuAp%(G<c=npm$Fz%eL - - - + \ No newline at end of file diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index 561196b..b897524 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -6,12 +6,21 @@ - + - Astro + Anga's Online Compiler + + + + + + + + + -

Astro

+

Anga's Online Compiler

From 28e1c83a972928c49180a653391ab160bdb13044 Mon Sep 17 00:00:00 2001 From: Anga205 Date: Wed, 11 Mar 2026 17:30:12 +0530 Subject: [PATCH 03/17] added tailwind and explained project goals in README --- web/.gitignore | 3 ++- web/.vscode/extensions.json | 4 --- web/.vscode/launch.json | 11 -------- web/README.md | 51 ++++++++++--------------------------- web/astro.config.mjs | 7 ++++- web/package.json | 6 +++-- web/src/pages/index.astro | 2 +- web/src/styles/global.css | 1 + 8 files changed, 27 insertions(+), 58 deletions(-) delete mode 100644 web/.vscode/extensions.json delete mode 100644 web/.vscode/launch.json create mode 100644 web/src/styles/global.css diff --git a/web/.gitignore b/web/.gitignore index aa07cc9..f49dfd1 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -25,4 +25,5 @@ pnpm-debug.log* bun.lockb -package-lock.json \ No newline at end of file +package-lock.json +.vscode/ \ No newline at end of file diff --git a/web/.vscode/extensions.json b/web/.vscode/extensions.json deleted file mode 100644 index 22a1505..0000000 --- a/web/.vscode/extensions.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "recommendations": ["astro-build.astro-vscode"], - "unwantedRecommendations": [] -} diff --git a/web/.vscode/launch.json b/web/.vscode/launch.json deleted file mode 100644 index d642209..0000000 --- a/web/.vscode/launch.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "command": "./node_modules/.bin/astro dev", - "name": "Development server", - "request": "launch", - "type": "node-terminal" - } - ] -} diff --git a/web/README.md b/web/README.md index 4ced80a..6e14b94 100644 --- a/web/README.md +++ b/web/README.md @@ -1,43 +1,18 @@ -# Astro Starter Kit: Minimal +# Anga's Online Compiler -```sh -bun create astro@latest -- --template minimal -``` +A browser-based compiler for **C, C++, Python, and Java**. -> ๐Ÿง‘โ€๐Ÿš€ **Seasoned astronaut?** Delete this file. Have fun! +## How to use -## ๐Ÿš€ Project Structure +1. Go to the [website](https://compiler.anga.codes/) +2. Select a language. +3. Write or paste code in the editor. +4. Add stdin input (optional). +5. Run the program. +6. View stdout/stderr output from the compiler runtime. -Inside of your Astro project, you'll see the following folders and files: +## Execution Constraints -```text -/ -โ”œโ”€โ”€ public/ -โ”œโ”€โ”€ src/ -โ”‚ โ””โ”€โ”€ pages/ -โ”‚ โ””โ”€โ”€ index.astro -โ””โ”€โ”€ package.json -``` - -Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. - -There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. - -Any static assets, like images, can be placed in the `public/` directory. - -## ๐Ÿงž Commands - -All commands are run from the root of the project, from a terminal: - -| Command | Action | -| :------------------------ | :----------------------------------------------- | -| `bun install` | Installs dependencies | -| `bun dev` | Starts local dev server at `localhost:4321` | -| `bun build` | Build your production site to `./dist/` | -| `bun preview` | Preview your build locally, before deploying | -| `bun astro ...` | Run CLI commands like `astro add`, `astro check` | -| `bun astro -- --help` | Get help using the Astro CLI | - -## ๐Ÿ‘€ Want to learn more? - -Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). +Code is executed in a controlled environment with fixed resource limits that can be changed via the UI. +- Limited CPU time (terminates after 60 seconds) +- Limited memory usage (you can use upto 128MB) \ No newline at end of file diff --git a/web/astro.config.mjs b/web/astro.config.mjs index e762ba5..7c229b9 100644 --- a/web/astro.config.mjs +++ b/web/astro.config.mjs @@ -1,5 +1,10 @@ // @ts-check import { defineConfig } from 'astro/config'; +import tailwindcss from "@tailwindcss/vite"; // https://astro.build/config -export default defineConfig({}); +export default defineConfig({ + vite: { + plugins: [tailwindcss()] + } +}); diff --git a/web/package.json b/web/package.json index a3fc014..ce09761 100644 --- a/web/package.json +++ b/web/package.json @@ -13,6 +13,8 @@ }, "dependencies": { "@monaco-editor/loader": "^1.7.0", - "astro": "^6.1.2" + "@tailwindcss/vite": "^4.2.2", + "astro": "^6.1.2", + "tailwindcss": "^4.2.2" } -} \ No newline at end of file +} diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index b897524..ffe77f8 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -1,5 +1,5 @@ --- - +import "../styles/global.css"; --- diff --git a/web/src/styles/global.css b/web/src/styles/global.css new file mode 100644 index 0000000..a461c50 --- /dev/null +++ b/web/src/styles/global.css @@ -0,0 +1 @@ +@import "tailwindcss"; \ No newline at end of file From bd82bc46bfc0ac68cd0b69fa73528b3ada4241cc Mon Sep 17 00:00:00 2001 From: Anga205 Date: Wed, 11 Mar 2026 18:30:12 +0530 Subject: [PATCH 04/17] created initial topbar --- web/package.json | 1 + web/public/{favicon.svg => anga.svg} | 0 web/src/assets/c.svg | 1 + web/src/assets/cplusplus.svg | 1 + web/src/assets/java.svg | 3 ++ web/src/assets/python.svg | 1 + web/src/components/topbar.astro | 72 ++++++++++++++++++++++++++++ web/src/pages/index.astro | 9 ++-- web/src/styles/global.css | 20 +++++++- 9 files changed, 103 insertions(+), 5 deletions(-) rename web/public/{favicon.svg => anga.svg} (100%) create mode 100644 web/src/assets/c.svg create mode 100644 web/src/assets/cplusplus.svg create mode 100644 web/src/assets/java.svg create mode 100644 web/src/assets/python.svg create mode 100644 web/src/components/topbar.astro diff --git a/web/package.json b/web/package.json index ce09761..84fa126 100644 --- a/web/package.json +++ b/web/package.json @@ -12,6 +12,7 @@ "astro": "astro" }, "dependencies": { + "@lucide/astro": "^1.7.0", "@monaco-editor/loader": "^1.7.0", "@tailwindcss/vite": "^4.2.2", "astro": "^6.1.2", diff --git a/web/public/favicon.svg b/web/public/anga.svg similarity index 100% rename from web/public/favicon.svg rename to web/public/anga.svg diff --git a/web/src/assets/c.svg b/web/src/assets/c.svg new file mode 100644 index 0000000..fc75a62 --- /dev/null +++ b/web/src/assets/c.svg @@ -0,0 +1 @@ +C \ No newline at end of file diff --git a/web/src/assets/cplusplus.svg b/web/src/assets/cplusplus.svg new file mode 100644 index 0000000..fe2f58d --- /dev/null +++ b/web/src/assets/cplusplus.svg @@ -0,0 +1 @@ +C++ \ No newline at end of file diff --git a/web/src/assets/java.svg b/web/src/assets/java.svg new file mode 100644 index 0000000..080950d --- /dev/null +++ b/web/src/assets/java.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/web/src/assets/python.svg b/web/src/assets/python.svg new file mode 100644 index 0000000..30587d8 --- /dev/null +++ b/web/src/assets/python.svg @@ -0,0 +1 @@ +Python \ No newline at end of file diff --git a/web/src/components/topbar.astro b/web/src/components/topbar.astro new file mode 100644 index 0000000..c3c85b7 --- /dev/null +++ b/web/src/components/topbar.astro @@ -0,0 +1,72 @@ +--- +import { Sun } from "@lucide/astro" +--- +
+
+ +
+
+

Anga's

+

Online Compiler

+
+ +
+ +
+ + + +
+ +
+ +
+
\ No newline at end of file diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index ffe77f8..0be44d1 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -1,12 +1,13 @@ --- import "../styles/global.css"; +import Topbar from "../components/topbar.astro"; --- - - + + Anga's Online Compiler @@ -20,7 +21,7 @@ import "../styles/global.css"; - -

Anga's Online Compiler

+ + diff --git a/web/src/styles/global.css b/web/src/styles/global.css index a461c50..9953ef2 100644 --- a/web/src/styles/global.css +++ b/web/src/styles/global.css @@ -1 +1,19 @@ -@import "tailwindcss"; \ No newline at end of file +@import "tailwindcss"; + +.spin-scale-hover { + display: inline-block; + transition: transform 0.6s ease-out; +} + +.spin-scale-hover:hover { + animation: spinOnce 0.5s forwards; +} + +@keyframes spinOnce { + 0% { + transform: rotate(0deg) scale(1); + } + 100% { + transform: rotate(360deg) scale(1.2); + } +} \ No newline at end of file From 261e1692ec3fcb93f05c41b4e730d90dd5f96f74 Mon Sep 17 00:00:00 2001 From: Anga205 Date: Sat, 14 Mar 2026 01:53:23 +0530 Subject: [PATCH 05/17] improved the slider theme, add a body background --- web/src/components/topbar.astro | 40 +++++++++++++++++++++++++-------- web/src/pages/index.astro | 1 + 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/web/src/components/topbar.astro b/web/src/components/topbar.astro index c3c85b7..3db7777 100644 --- a/web/src/components/topbar.astro +++ b/web/src/components/topbar.astro @@ -1,18 +1,18 @@ --- import { Sun } from "@lucide/astro" --- -
-
+
+
-
+

Anga's

Online Compiler

-
+
+
+ + + \ No newline at end of file diff --git a/web/src/components/language-sidebar.astro b/web/src/components/language-sidebar.astro new file mode 100644 index 0000000..bbd694e --- /dev/null +++ b/web/src/components/language-sidebar.astro @@ -0,0 +1,74 @@ +--- +import pythonLogo from "../assets/python.svg"; +import javaLogo from "../assets/java.svg"; +import cLogo from "../assets/c.svg"; +import cppLogo from "../assets/cplusplus.svg"; + +const languages = [ + { key: "python", label: "Python", logo: pythonLogo }, + { key: "java", label: "Java", logo: javaLogo }, + { key: "c", label: "C", logo: cLogo }, + { key: "cpp", label: "C++", logo: cppLogo } +]; +--- + + + + + + diff --git a/web/src/components/output-pane.astro b/web/src/components/output-pane.astro new file mode 100644 index 0000000..e4f99bd --- /dev/null +++ b/web/src/components/output-pane.astro @@ -0,0 +1,13 @@ +
+
+

stdout

+ +
+ +
Program output will appear here.
+
diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index c041b4e..b3d75ed 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -1,6 +1,7 @@ --- import "../styles/global.css"; import Topbar from "../components/topbar.astro"; +import CompilerBody from "../components/compiler-body.astro"; --- @@ -23,6 +24,6 @@ import Topbar from "../components/topbar.astro"; -
+ From 1d486c210789117d2626cff72e214bcfb44b2a19 Mon Sep 17 00:00:00 2001 From: Anga205 Date: Sun, 15 Mar 2026 12:31:18 +0530 Subject: [PATCH 07/17] fix up the icons --- web/package.json | 1 + web/src/assets/c.svg | 1 - web/src/assets/cplusplus.svg | 1 - web/src/assets/java.svg | 3 --- web/src/assets/python.svg | 1 - web/src/components/compiler-body.astro | 2 +- web/src/components/editor-pane.astro | 2 +- web/src/components/language-sidebar.astro | 23 ++++++----------------- web/src/components/output-pane.astro | 2 +- 9 files changed, 10 insertions(+), 26 deletions(-) delete mode 100644 web/src/assets/c.svg delete mode 100644 web/src/assets/cplusplus.svg delete mode 100644 web/src/assets/java.svg delete mode 100644 web/src/assets/python.svg diff --git a/web/package.json b/web/package.json index 84fa126..0d749dc 100644 --- a/web/package.json +++ b/web/package.json @@ -16,6 +16,7 @@ "@monaco-editor/loader": "^1.7.0", "@tailwindcss/vite": "^4.2.2", "astro": "^6.1.2", + "devicon": "^2.17.0", "tailwindcss": "^4.2.2" } } diff --git a/web/src/assets/c.svg b/web/src/assets/c.svg deleted file mode 100644 index fc75a62..0000000 --- a/web/src/assets/c.svg +++ /dev/null @@ -1 +0,0 @@ -C \ No newline at end of file diff --git a/web/src/assets/cplusplus.svg b/web/src/assets/cplusplus.svg deleted file mode 100644 index fe2f58d..0000000 --- a/web/src/assets/cplusplus.svg +++ /dev/null @@ -1 +0,0 @@ -C++ \ No newline at end of file diff --git a/web/src/assets/java.svg b/web/src/assets/java.svg deleted file mode 100644 index 080950d..0000000 --- a/web/src/assets/java.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/web/src/assets/python.svg b/web/src/assets/python.svg deleted file mode 100644 index 30587d8..0000000 --- a/web/src/assets/python.svg +++ /dev/null @@ -1 +0,0 @@ -Python \ No newline at end of file diff --git a/web/src/components/compiler-body.astro b/web/src/components/compiler-body.astro index c27d374..e20e17e 100644 --- a/web/src/components/compiler-body.astro +++ b/web/src/components/compiler-body.astro @@ -19,7 +19,7 @@ import OutputPane from "./output-pane.astro"; aria-hidden="true" >
-
+
diff --git a/web/src/components/editor-pane.astro b/web/src/components/editor-pane.astro index cf7b13c..865c822 100644 --- a/web/src/components/editor-pane.astro +++ b/web/src/components/editor-pane.astro @@ -1,4 +1,4 @@ -
+
)) @@ -64,11 +61,3 @@ const languages = [ }) ); - - diff --git a/web/src/components/output-pane.astro b/web/src/components/output-pane.astro index e4f99bd..c824053 100644 --- a/web/src/components/output-pane.astro +++ b/web/src/components/output-pane.astro @@ -1,4 +1,4 @@ -
+

stdout

@@ -41,8 +41,25 @@ cpp: "cpp" }; - let monacoRef: { editor: { setModelLanguage: (arg0: any, arg1: any) => void; }; } | null = null; - let editorRef: { getModel: () => any; layout: () => any; } | null = null; + type MonacoModel = unknown; + + type MonacoEditorInstance = { + getModel: () => MonacoModel; + layout: () => void; + }; + + type MonacoEditorApi = { + setModelLanguage: (model: MonacoModel, language: string) => void; + setTheme: (theme: string) => void; + create: (container: HTMLElement, options: Record) => MonacoEditorInstance; + }; + + type MonacoModule = { + editor: MonacoEditorApi; + }; + + let monacoRef: MonacoModule | null = null; + let editorRef: MonacoEditorInstance | null = null; const tabTriggers = document.querySelectorAll(".tab-trigger"); const tabPanels = document.querySelectorAll(".tab-panel"); @@ -52,8 +69,8 @@ const targetId = trigger.getAttribute("data-target"); tabTriggers.forEach((item) => { - item.classList.remove("is-active", "border-neutral-100", "text-neutral-100"); - item.classList.add("border-transparent", "text-neutral-400"); + item.classList.remove("is-active", "border-[var(--text-primary)]", "text-[var(--text-primary)]"); + item.classList.add("border-transparent", "text-[var(--text-muted)]"); item.setAttribute("aria-selected", "false"); }); @@ -61,8 +78,8 @@ panel.classList.add("hidden"); }); - trigger.classList.add("is-active", "border-neutral-100", "text-neutral-100"); - trigger.classList.remove("border-transparent", "text-neutral-400"); + trigger.classList.add("is-active", "border-[var(--text-primary)]", "text-[var(--text-primary)]"); + trigger.classList.remove("border-transparent", "text-[var(--text-muted)]"); trigger.setAttribute("aria-selected", "true"); const targetPanel = document.getElementById(targetId ?? ""); @@ -93,9 +110,18 @@ setEditorLanguage(selectedLanguage); }); + window.addEventListener("compiler-theme-change", (event) => { + if (!(event instanceof CustomEvent)) return; + + const selectedTheme = event.detail?.theme; + if (selectedTheme !== "dark" && selectedTheme !== "light") return; + + monacoRef?.editor.setTheme(selectedTheme === "light" ? "vs" : "vs-dark"); + }); + if (monacoContainer) { loader.init().then((monaco) => { - monacoRef = monaco; + monacoRef = monaco as MonacoModule; editorRef = monaco.editor.create(monacoContainer, { value: [ "def solve():", @@ -105,7 +131,7 @@ "solve()" ].join("\n"), language: "python", - theme: "vs-dark", + theme: document.documentElement.dataset.theme === "light" ? "vs" : "vs-dark", minimap: { enabled: false }, fontSize: 14, automaticLayout: true, diff --git a/web/src/components/language-sidebar.astro b/web/src/components/language-sidebar.astro index 0f37a92..27a993e 100644 --- a/web/src/components/language-sidebar.astro +++ b/web/src/components/language-sidebar.astro @@ -9,7 +9,7 @@ const languages = [ ]; --- -
-
Program output will appear here.
+
Program output will appear here.
diff --git a/web/src/components/topbar.astro b/web/src/components/topbar.astro index 3db7777..b995412 100644 --- a/web/src/components/topbar.astro +++ b/web/src/components/topbar.astro @@ -1,23 +1,23 @@ --- -import { Sun } from "@lucide/astro" +import { Moon, Sun } from "@lucide/astro"; --- -
+
-
+

Anga's

-

Online Compiler

+

Online Compiler

-
+
-
+