diff --git a/messages/en.json b/messages/en.json index 316e4ba..7c9b26f 100644 --- a/messages/en.json +++ b/messages/en.json @@ -11,6 +11,14 @@ "morePages": "More pages", "page": "page" }, + "error": { + "notFound": "404 - Page not found", + "notFoundDescription": "Oops! Looks like this page got lost in cyberspace.", + "error": "Oops! Something went wrong", + "errorDescription": "Don't worry, our best hackers are on it!", + "goToHomepage": "Return to homepage", + "tryAgain": "Try again" + }, "layout": { "hackerspaceHome": "Hackerspace homepage", "navigationMenu": "Navigation menu", diff --git a/messages/no.json b/messages/no.json index 79286cb..a832c42 100644 --- a/messages/no.json +++ b/messages/no.json @@ -11,6 +11,14 @@ "morePages": "Flere sider", "page": "side" }, + "error": { + "notFound": "404 - Siden ble ikke funnet", + "notFoundDescription": "Oops! Ser ut som denne siden gikk seg vill i cyberspace.", + "error": "Oops! Noe gikk galt", + "errorDescription": "Ikke bekymre deg, våre beste hackere jobber med saken!", + "goToHomepage": "Gå tilbake til hjemmesiden", + "tryAgain": "Prøv igjen" + }, "layout": { "hackerspaceHome": "Hackerspace hjemmeside", "navigationMenu": "Navigasjonsmeny", diff --git a/package.json b/package.json index 4b7093b..1277f30 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "prepare": "if [ \"$NODE_ENV\" != \"production\" ]; then lefthook install; fi", - "dev": "next dev --turbo", + "dev": "next dev", "lint": "biome check --write", "prebuild": "next telemetry disable", "build": "next build", diff --git a/src/app/[locale]/error.tsx b/src/app/[locale]/error.tsx new file mode 100644 index 0000000..a839b0a --- /dev/null +++ b/src/app/[locale]/error.tsx @@ -0,0 +1,44 @@ +'use client'; + +import { Button } from '@/components/ui/Button'; +import { Link } from '@/lib/locale/navigation'; +import { AlertTriangleIcon } from 'lucide-react'; +import { useTranslations } from 'next-intl'; +import { useEffect } from 'react'; + +export default function ErrorPage({ + error, + reset, +}: { + error: Error; + reset: () => void; +}) { + const t = useTranslations('error'); + useEffect(() => { + console.error(error); + }, [error]); + return ( +
+ {t('errorDescription')} +
+ {error.message && ( ++ Error: {error.message} +
+ )} ++ {t('notFoundDescription')} +
+ +