From 3ef18bb084d948475e373da65e8a398cc12857cd Mon Sep 17 00:00:00 2001 From: MarioYellowy Date: Wed, 11 Mar 2026 01:37:38 -0600 Subject: [PATCH 1/4] feat(i18n): add keys for 404 error page --- src/i18n/keys/en.keys.ts | 5 ++++- src/i18n/keys/es.keys.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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", From c800fab0228643fc7b07a0052a9d03e5fa7c85e7 Mon Sep 17 00:00:00 2001 From: MarioYellowy Date: Wed, 11 Mar 2026 01:39:56 -0600 Subject: [PATCH 2/4] fix(validation): change validations orders for 404 error page --- src/pages/[lang]/[slug].astro | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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] From 9bc90fdfc3682aa89d9cce165079a7745d4257a3 Mon Sep 17 00:00:00 2001 From: MarioYellowy Date: Wed, 11 Mar 2026 01:41:48 -0600 Subject: [PATCH 3/4] feat(404): add 404 error page with i18n --- src/pages/404.astro | 30 ------------------ src/pages/[lang]/404.astro | 62 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 30 deletions(-) delete mode 100644 src/pages/404.astro create mode 100644 src/pages/[lang]/404.astro 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) +--- + + +
+ +
+
+ +
+ +
+
+ + {t("404.image_alt")} + +
+ +
+

+ 404 _ +

+ +

+ {t("404.title_description")} +

+ +
+

{t("404.c_reference")}

+

+ // {t("404.problem")} +

+
+
+ + + + {t("404.back_home")} + +
+ +
+
+
\ No newline at end of file From e200e5795aa175ef943595d18df6cdef6003da28 Mon Sep 17 00:00:00 2001 From: MarioYellowy Date: Wed, 11 Mar 2026 01:43:51 -0600 Subject: [PATCH 4/4] feat(login): implement back to home btn on login --- src/pages/[lang]/login.astro | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 = { --- -
-