diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 7b1d350..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: CI - -on: - # Trigger the workflow every time you push to the `main` branch - # Using a different branch name? Replace `main` with your branch’s name - push: - branches: [main] - # Allows you to run this workflow manually from the Actions tab on GitHub. - workflow_dispatch: - -jobs: - lighthouse: - name: Lighthouse - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Use Node.js 18.x - uses: actions/setup-node@v3 - with: - node-version: 18.x - - name: npm install, build - run: | - npm install - npm run build - - name: run Lighthouse CI - run: | - npm install -g @lhci/cli@0.12.x - lhci autorun \ No newline at end of file diff --git a/astro.config.mjs b/astro.config.mjs index c5bf878..3d2ff94 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -35,15 +35,15 @@ export default defineConfig({ defaultLocale: "en", locales: { en: { - label: "English" + label: "English", }, es: { - label: "Español" + label: "Español", }, ca: { - label: "Català" - } - } + label: "Català", + }, + }, }), svelte(), ], diff --git a/lighthouserc.js b/lighthouserc.js deleted file mode 100644 index 0191025..0000000 --- a/lighthouserc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - ci: { - upload: { - target: 'temporary-public-storage', - }, - }, - }; \ No newline at end of file diff --git a/src/components/CodeBlock.svelte b/src/components/CodeBlock.svelte index 2f6f0c2..3fe9bc5 100644 --- a/src/components/CodeBlock.svelte +++ b/src/components/CodeBlock.svelte @@ -10,7 +10,7 @@ import { writable } from "svelte/store"; import { onThemeChange } from "src/utils/onThemeChange"; import { onDestroy } from "svelte"; - + /** Code that will be sent to the playground, replaces __VALUE__ with the code in the editor */ export let setup = "__VALUE__"; /** Code visible in the editor */ @@ -23,27 +23,30 @@ export let showLineNumbers = true; /** Language used by the editor */ export let lang: keyof typeof langs = "en"; - + const langs = { - "en": { + en: { placeholder: "Enter your code here...", compiling: "Compiling...", - error: "Woops, something went wrong and the code does not compile!\nIf you\'ve mistakenly messed up the code, click the \"Reset\" button to return it back to its original state.\n\nRemember to replace ? with your answer.", + error: + 'Woops, something went wrong and the code does not compile!\nIf you\'ve mistakenly messed up the code, click the "Reset" button to return it back to its original state.\n\nRemember to replace ? with your answer.', }, - "ca": { + ca: { placeholder: "Escriu el teu codi aqui...", compiling: "Compilant...", - error: "Ups, alguna cosa ha fallat i el codi no compila!\nSi t'has equivocat modificant el codi, fes clic al botó de \"Reset\" per tornar-lo al seu estat original.\n\nRecorda substituïr ? amb la teva resposta." + error: + 'Ups, alguna cosa ha fallat i el codi no compila!\nSi t\'has equivocat modificant el codi, fes clic al botó de "Reset" per tornar-lo al seu estat original.\n\nRecorda substituïr ? amb la teva resposta.', }, - "es": { + es: { placeholder: "Escribe tu código aquí...", compiling: "Compilando...", - error: "Vaya, ¡algo ha ido mal y el código no compila!\nSi has estropeado el código por error, haz clic en el botón \"Reset\" para devolverlo a su estado original.\n\nRecuerda sustituir ? con tu respuesta.", - } + error: + 'Vaya, ¡algo ha ido mal y el código no compila!\nSi has estropeado el código por error, haz clic en el botón "Reset" para devolverlo a su estado original.\n\nRecuerda sustituir ? con tu respuesta.', + }, }; const theme = writable(document.documentElement.dataset.theme); - const observer = onThemeChange(t => theme.set(t)); + const observer = onThemeChange((t) => theme.set(t)); onDestroy(() => observer.disconnect()); let value = code; @@ -55,14 +58,14 @@ if (!f && !focused) { return; } - + running = true; - + playground_response = langs[lang].compiling; // Wait for the editor to update `value` await new Promise((resolve) => setTimeout(resolve, 100)); - + const params = { version: "stable", optimize: "0", @@ -78,21 +81,24 @@ mode: "cors", body: JSON.stringify(params), }) - .then((response) => response.json()) - .then((response) => { - console.log({ params, response }); - return response; - }) - .then((response) => { - if (response.error === null) { - playground_response = response.result; - } else { - playground_response = errorMsg || langs[lang].error || response.error; - } - }) - .catch((error) => (playground_response = errorMsg || langs[lang].error || error.message)) - .finally(() => (running = false)); - + .then((response) => response.json()) + .then((response) => { + console.log({ params, response }); + return response; + }) + .then((response) => { + if (response.error === null) { + playground_response = response.result; + } else { + playground_response = errorMsg || langs[lang].error || response.error; + } + }) + .catch( + (error) => + (playground_response = + errorMsg || langs[lang].error || error.message), + ) + .finally(() => (running = false)); }; @@ -119,7 +125,7 @@ editable={!running} placeholder={placeholder || langs[lang].placeholder} /> - +