diff --git a/src/i18n/keys/en.keys.ts b/src/i18n/keys/en.keys.ts index c99a3f8..17cbed3 100644 --- a/src/i18n/keys/en.keys.ts +++ b/src/i18n/keys/en.keys.ts @@ -289,8 +289,11 @@ export const en_keys = { // 404 Page "404.title": "404 — Page not found", + "404.title_description": "OOPS! We had a memory leak", + "404.c_reference": "Just kidding, we aren't C", + "404.problem": "But we did have a problem finding this page", "404.image_alt": "404 - Page not found", - "404.back_home": "Home", + "404.back_home": "Back to home", // Login Page "login.title": "Sign in — RustLings", diff --git a/src/i18n/keys/es.keys.ts b/src/i18n/keys/es.keys.ts index 6c9b644..7070e6c 100644 --- a/src/i18n/keys/es.keys.ts +++ b/src/i18n/keys/es.keys.ts @@ -296,8 +296,11 @@ export const es_keys = { // 404 Page "404.title": "404 — Página no encontrada", + "404.title_description": "OOPS! Tuvimos un fallo de memoria", + "404.c_reference": "Es broma, no somos C", + "404.problem": "Pero sí tuvimos un problema en encontrar esta página", "404.image_alt": "404 - Página no encontrada", - "404.back_home": "Inicio", + "404.back_home": "Regresar a inicio", // Login Page "login.title": "Iniciar sesión — RustLings", diff --git a/src/pages/404.astro b/src/pages/404.astro deleted file mode 100644 index fa9f3be..0000000 --- a/src/pages/404.astro +++ /dev/null @@ -1,30 +0,0 @@ ---- -import { getLangFromUrl, useTranslations } from "~/i18n/utils" -import Layout from "~/layouts/Layout.astro" -import IconLeft from "~icons/tabler/arrow-big-left-lines-filled" - -export const prerender = true - -const lang = getLangFromUrl(Astro.url) -const t = useTranslations(lang) ---- - - - - - - - - {t("404.back_home")} - - - diff --git a/src/pages/[lang]/404.astro b/src/pages/[lang]/404.astro new file mode 100644 index 0000000..8669db0 --- /dev/null +++ b/src/pages/[lang]/404.astro @@ -0,0 +1,62 @@ +--- +import { getLangFromUrl, useTranslations } from "~/i18n/utils" +import Layout from "~/layouts/Layout.astro" +import IconLeft from "~icons/tabler/arrow-big-left-lines-filled" + +export { getStaticPaths } from "./index.astro" + +export const prerender = true + +const lang = getLangFromUrl(Astro.url) +const t = useTranslations(lang) +--- + + + + + + + + + + + + + + + + + + + 404 _ + + + + {t("404.title_description")} + + + + {t("404.c_reference")} + + // {t("404.problem")} + + + + + + + {t("404.back_home")} + + + + + + \ No newline at end of file diff --git a/src/pages/[lang]/[slug].astro b/src/pages/[lang]/[slug].astro index ae2cb8d..7df4651 100644 --- a/src/pages/[lang]/[slug].astro +++ b/src/pages/[lang]/[slug].astro @@ -15,11 +15,6 @@ import IconGripVertical from "~icons/tabler/grip-vertical" import IconTerminal from "~icons/tabler/terminal-2" const { lang, slug } = Astro.params - -if (!Astro.locals.user) { - return Astro.redirect(`/${lang}/login`) -} - const lessons = getLessonsByLang(lang ?? "es") const lessonIndex = lessons.findIndex((l) => l.meta.slug === slug) @@ -27,6 +22,10 @@ if (lessonIndex === -1) { return Astro.redirect(`/${lang}/404`) } +if (!Astro.locals.user) { + return Astro.redirect(`/${lang}/login`) +} + const lesson = lessons[lessonIndex] const previousLesson = lessons[lessonIndex - 1] const nextLesson = lessons[lessonIndex + 1] diff --git a/src/pages/[lang]/login.astro b/src/pages/[lang]/login.astro index 570f2e1..96499bc 100644 --- a/src/pages/[lang]/login.astro +++ b/src/pages/[lang]/login.astro @@ -2,6 +2,7 @@ import { getLangFromUrl, useTranslations } from "~/i18n/utils" import Layout from "~/layouts/Layout.astro" import JamGithub from "~icons/jam/github" +import IconLeft from "~icons/tabler/arrow-big-left-lines-filled" if (Astro.locals.user) { return Astro.redirect(`/${getLangFromUrl(Astro.url)}/aprender`) @@ -19,8 +20,13 @@ const errorMessages: Record = { --- - - + + + {t("404.back_home")} + + @@ -30,7 +36,7 @@ const errorMessages: Record = { - + {error && ( @@ -143,6 +149,7 @@ const errorMessages: Record = { --> + = { {t("login.github_button")} +
{t("404.c_reference")}
+ // {t("404.problem")} +