diff --git a/apps/web/public/dictionaries/de-DE.json b/apps/web/public/dictionaries/de-DE.json index b42827ec..ccdae440 100644 --- a/apps/web/public/dictionaries/de-DE.json +++ b/apps/web/public/dictionaries/de-DE.json @@ -917,5 +917,11 @@ "go_to_profile": "Zum Profil", "continue": "Weiter", "syncing": "Profil wird gespeichert..." + }, + "error_page": { + "title": "Etwas ist schiefgelaufen", + "description": "Ein unerwarteter Fehler ist aufgetreten. Keine Sorge, es liegt nicht an dir.", + "try_again": "Erneut versuchen", + "go_home": "Zur Startseite" } } diff --git a/apps/web/public/dictionaries/en-US.json b/apps/web/public/dictionaries/en-US.json index 88afd901..e1059ad3 100644 --- a/apps/web/public/dictionaries/en-US.json +++ b/apps/web/public/dictionaries/en-US.json @@ -919,5 +919,11 @@ "go_to_profile": "Go to Profile", "continue": "Continue", "syncing": "Saving profile..." + }, + "error_page": { + "title": "Something went wrong", + "description": "An unexpected error occurred. Don't worry, it's not your fault.", + "try_again": "Try again", + "go_home": "Go to home" } } diff --git a/apps/web/public/dictionaries/es-ES.json b/apps/web/public/dictionaries/es-ES.json index 93d25c20..27d9985e 100644 --- a/apps/web/public/dictionaries/es-ES.json +++ b/apps/web/public/dictionaries/es-ES.json @@ -921,5 +921,11 @@ "go_to_profile": "Ir a Perfil", "continue": "Continuar", "syncing": "Guardando perfil..." + }, + "error_page": { + "title": "Algo salió mal", + "description": "Ocurrió un error inesperado. No te preocupes, no es tu culpa.", + "try_again": "Intentar de nuevo", + "go_home": "Ir al inicio" } } diff --git a/apps/web/public/dictionaries/fr-FR.json b/apps/web/public/dictionaries/fr-FR.json index 557bef8e..a3485e7f 100644 --- a/apps/web/public/dictionaries/fr-FR.json +++ b/apps/web/public/dictionaries/fr-FR.json @@ -923,5 +923,11 @@ "go_to_profile": "Aller au profil", "continue": "Continuer", "syncing": "Enregistrement du profil..." + }, + "error_page": { + "title": "Quelque chose s'est mal passé", + "description": "Une erreur inattendue s'est produite. Ne vous inquiétez pas, ce n'est pas de votre faute.", + "try_again": "Réessayer", + "go_home": "Retour à l'accueil" } } diff --git a/apps/web/public/dictionaries/it-IT.json b/apps/web/public/dictionaries/it-IT.json index 5f7945c9..cc936ac8 100644 --- a/apps/web/public/dictionaries/it-IT.json +++ b/apps/web/public/dictionaries/it-IT.json @@ -920,5 +920,11 @@ "go_to_profile": "Vai al Profilo", "continue": "Continua", "syncing": "Salvataggio profilo..." + }, + "error_page": { + "title": "Qualcosa è andato storto", + "description": "Si è verificato un errore imprevisto. Non preoccuparti, non è colpa tua.", + "try_again": "Riprova", + "go_home": "Vai alla home" } } diff --git a/apps/web/public/dictionaries/ja-JP.json b/apps/web/public/dictionaries/ja-JP.json index b0a174ed..ef1d7548 100644 --- a/apps/web/public/dictionaries/ja-JP.json +++ b/apps/web/public/dictionaries/ja-JP.json @@ -923,5 +923,11 @@ "go_to_profile": "プロフィールへ", "continue": "続ける", "syncing": "プロフィールを保存中..." + }, + "error_page": { + "title": "問題が発生しました", + "description": "予期しないエラーが発生しました。ご心配なく、あなたのせいではありません。", + "try_again": "もう一度試す", + "go_home": "ホームへ戻る" } } diff --git a/apps/web/public/dictionaries/pt-BR.json b/apps/web/public/dictionaries/pt-BR.json index c680f46e..7c5055e0 100644 --- a/apps/web/public/dictionaries/pt-BR.json +++ b/apps/web/public/dictionaries/pt-BR.json @@ -922,5 +922,11 @@ "go_to_profile": "Ir para o Perfil", "continue": "Continuar", "syncing": "Salvando perfil..." + }, + "error_page": { + "title": "Algo deu errado", + "description": "Um erro inesperado aconteceu. Não se preocupe, não é sua culpa.", + "try_again": "Tentar novamente", + "go_home": "Ir para o início" } } diff --git a/apps/web/src/app/[lang]/error.tsx b/apps/web/src/app/[lang]/error.tsx new file mode 100644 index 00000000..a598a207 --- /dev/null +++ b/apps/web/src/app/[lang]/error.tsx @@ -0,0 +1,53 @@ +'use client' + +import { useEffect } from 'react' +import { useParams, useRouter } from 'next/navigation' +import { AlertCircle } from 'lucide-react' +import { Button } from '@plotwist/ui/components/ui/button' +import { useLanguage } from '@/context/language' + +export default function ErrorPage({ + error, + reset, +}: { + error: Error & { digest?: string } + reset: () => void +}) { + const { dictionary } = useLanguage() + const { lang } = useParams() + const router = useRouter() + + useEffect(() => { + console.error(error) + }, [error]) + + const { error_page } = dictionary + + return ( +
+
+
+ +
+ +
+

+ {error_page.title} +

+ +

+ {error_page.description} +

+
+
+ +
+ + + +
+
+ ) +} diff --git a/apps/web/src/app/global-error.tsx b/apps/web/src/app/global-error.tsx new file mode 100644 index 00000000..b44ba5af --- /dev/null +++ b/apps/web/src/app/global-error.tsx @@ -0,0 +1,60 @@ +'use client' + +import '@plotwist/ui/globals.css' + +import { useEffect } from 'react' +import { AlertCircle } from 'lucide-react' + +export default function GlobalError({ + error, + reset, +}: { + error: Error & { digest?: string } + reset: () => void +}) { + useEffect(() => { + console.error(error) + }, [error]) + + return ( + + +
+
+
+ +
+ +
+

+ Something went wrong +

+ +

+ An unexpected error occurred. Don't worry, it's not + your fault. +

+
+
+ +
+ + Go to home + + + +
+
+ + + ) +}