From 4b78aa847a076cd2c9e3595a2370102cf99cbd07 Mon Sep 17 00:00:00 2001 From: adevopg Date: Mon, 13 Jul 2026 11:22:06 +0000 Subject: [PATCH] =?UTF-8?q?web-next:=20p=C3=A1gina=20404=20tem=C3=A1tica?= =?UTF-8?q?=20(not-found)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Añade una 404 con el markup del tema (main-page > middle-content > body-content > title-content + body-box-content justified), dentro del layout de [locale] (cabecera/vídeo/pie). Como el layout raíz es un segmento dinámico ([locale]), se usa el patrón de next-intl: `[locale]/not-found.tsx` + catch-all `[locale]/[...rest]/page.tsx` que dispara notFound(). Bilingüe (claves NotFound.title/message en es/en). Devuelve HTTP 404; las rutas conocidas siguen 200. Co-Authored-By: Claude Opus 4.8 (1M context) --- web-next/app/[locale]/[...rest]/page.tsx | 9 ++++++++ web-next/app/[locale]/not-found.tsx | 26 ++++++++++++++++++++++++ web-next/messages/en.json | 4 ++++ web-next/messages/es.json | 4 ++++ 4 files changed, 43 insertions(+) create mode 100644 web-next/app/[locale]/[...rest]/page.tsx create mode 100644 web-next/app/[locale]/not-found.tsx diff --git a/web-next/app/[locale]/[...rest]/page.tsx b/web-next/app/[locale]/[...rest]/page.tsx new file mode 100644 index 0000000..b8aff18 --- /dev/null +++ b/web-next/app/[locale]/[...rest]/page.tsx @@ -0,0 +1,9 @@ +import { notFound } from 'next/navigation' + +/** + * Catch-all de rutas inexistentes bajo un idioma: dispara notFound() para que + * se renderice la 404 temática (`[locale]/not-found.tsx`) dentro del layout. + */ +export default function CatchAllNotFound() { + notFound() +} diff --git a/web-next/app/[locale]/not-found.tsx b/web-next/app/[locale]/not-found.tsx new file mode 100644 index 0000000..8916a1a --- /dev/null +++ b/web-next/app/[locale]/not-found.tsx @@ -0,0 +1,26 @@ +import { getTranslations } from 'next-intl/server' + +/** + * 404 temática (dentro del layout de [locale] → cabecera/vídeo/pie + tema). + * Se muestra cuando se llama a notFound() dentro de un segmento de idioma, + * incluido el catch-all `[...rest]` para rutas inexistentes. + */ +export default async function NotFound() { + const t = await getTranslations('NotFound') + return ( +
+
+
+
+

{t('title')}

+
+
+
+

{t('message')}

+
+
+
+
+
+ ) +} diff --git a/web-next/messages/en.json b/web-next/messages/en.json index 2deb289..bc3f9f7 100644 --- a/web-next/messages/en.json +++ b/web-next/messages/en.json @@ -510,5 +510,9 @@ "backToStore": "Back to the store", "orderNotFound": "Order not found or already processed.", "genericError": "An error occurred. Please try again." + }, + "NotFound": { + "title": "Page not found", + "message": "It looks like the page you are looking for doesn't exist or isn't available." } } diff --git a/web-next/messages/es.json b/web-next/messages/es.json index e302201..a4d5330 100644 --- a/web-next/messages/es.json +++ b/web-next/messages/es.json @@ -510,5 +510,9 @@ "backToStore": "Volver a la tienda", "orderNotFound": "Orden no encontrada o ya procesada.", "genericError": "Ha ocurrido un error. Inténtalo de nuevo." + }, + "NotFound": { + "title": "Página no encontrada", + "message": "Parece que la página que estás buscando no existe o no se encuentra disponible." } }