diff --git a/.gitignore b/.gitignore index f434856..1211bfe 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,7 @@ bun.lock pnpm-lock.yaml # wrangler -.wrangler/ \ No newline at end of file +.wrangler/ + +# pnpm workspace +pnpm-workspace.yaml \ No newline at end of file diff --git a/public/404.png b/public/404.png new file mode 100644 index 0000000..9b626fe Binary files /dev/null and b/public/404.png differ diff --git a/src/components/editor/CodeEditor.astro b/src/components/editor/CodeEditor.astro index 9dd1f99..3e7ea38 100644 --- a/src/components/editor/CodeEditor.astro +++ b/src/components/editor/CodeEditor.astro @@ -24,11 +24,10 @@ const { slug, initialCode = 'fn main() {\n println!("Hola, mundo!");\n}\n' } import { basicSetup } from "codemirror"; import { indentWithTab } from "@codemirror/commands"; import { gruvbox } from "~/components/editor/theme"; - import { db, editorCode } from "~/lib/stores/editor-store"; + import { editorCode } from "~/lib/stores/editor-store"; import { rust } from "~/components/editor/config"; let editorView: EditorView | null = null; - let saveTimeout: number | undefined; async function initEditor() { const editorElement = document.getElementById("editor"); @@ -44,7 +43,7 @@ const { slug, initialCode = 'fn main() {\n println!("Hola, mundo!");\n}\n' } initialCode: string; }; - const initialDoc = (await db.getCode(slug)) ?? initialCode; + const initialDoc = initialCode; editorView = new EditorView({ state: EditorState.create({ @@ -58,11 +57,6 @@ const { slug, initialCode = 'fn main() {\n println!("Hola, mundo!");\n}\n' } if (update.docChanged) { const value = update.state.doc.toString(); editorCode.set(value); - clearTimeout(saveTimeout); - saveTimeout = window.setTimeout( - () => db.saveCode(slug, value), - 500, - ); } }), ], @@ -89,7 +83,6 @@ const { slug, initialCode = 'fn main() {\n println!("Hola, mundo!");\n}\n' } document.addEventListener("astro:page-load", initEditor); document.addEventListener("astro:before-swap", () => { - clearTimeout(saveTimeout); window.removeEventListener("editor:reset", handleReset); if (editorView) { diff --git a/src/components/editor/output/Terminal.astro b/src/components/editor/output/Terminal.astro index 00cb371..24687dd 100644 --- a/src/components/editor/output/Terminal.astro +++ b/src/components/editor/output/Terminal.astro @@ -1,4 +1,5 @@ --- +import { getLangFromUrl, useTranslations } from "~/i18n/utils" import IconLoader2 from "~icons/tabler/loader-2" import IconPlayerPlay from "~icons/tabler/player-play" import IconRestore from "~icons/tabler/restore" @@ -11,6 +12,8 @@ interface Props { const { expectedOutput, testCode } = Astro.props const isTestMode = !!testCode +const lang = getLangFromUrl(Astro.url) +const t = useTranslations(lang) --- - Reiniciar + {t("editor.reset")} @@ -78,22 +81,22 @@ const isTestMode = !!testCode