diff --git a/app/error.tsx b/app/error.tsx
new file mode 100644
index 0000000..5dcf921
--- /dev/null
+++ b/app/error.tsx
@@ -0,0 +1,21 @@
+'use client'
+
+import { useEffect } from 'react'
+
+import { ErrorPage } from '@/components/ErrorPage'
+
+export interface ErrorHandlingProps {
+ error: Error
+}
+
+const ErrorHandling = (props: ErrorHandlingProps): JSX.Element => {
+ const { error } = props
+
+ useEffect(() => {
+ console.error(error)
+ }, [error])
+
+ return
- {message}{' '} - - {t('errors:return-to-home-page')} - -
-+ {message}{' '} + + {i18n.translate('errors.return-to-home-page')} + +
++ + Théo LUDWIG + {' '} + | {i18n.translate('common.all-rights-reserved')} +
+ ) +} diff --git a/components/Footer/FooterVersion.tsx b/components/Footer/FooterVersion.tsx new file mode 100644 index 0000000..d679c65 --- /dev/null +++ b/components/Footer/FooterVersion.tsx @@ -0,0 +1,28 @@ +import { useMemo } from 'react' + +interface FooterVersionProps { + version: string +} + +export const FooterVersion = (props: FooterVersionProps): JSX.Element => { + const { version } = props + + const versionLink = useMemo(() => { + return `https://github.com/theoludwig/theoludwig/releases/tag/v${version}` + }, [version]) + + return ( ++ Version{' '} + + {version} + +
+ ) +} diff --git a/components/Footer/index.tsx b/components/Footer/index.tsx new file mode 100644 index 0000000..22102c0 --- /dev/null +++ b/components/Footer/index.tsx @@ -0,0 +1,14 @@ +import { FooterText } from './FooterText' +import { FooterVersion } from './FooterVersion' + +export const Footer = async (): Promise- {language.toUpperCase()} -
- > - ) -} diff --git a/components/Header/Language/Arrow.tsx b/components/Header/Locales/Arrow.tsx similarity index 100% rename from components/Header/Language/Arrow.tsx rename to components/Header/Locales/Arrow.tsx diff --git a/components/Header/Locales/LocaleFlag.tsx b/components/Header/Locales/LocaleFlag.tsx new file mode 100644 index 0000000..0cba0a3 --- /dev/null +++ b/components/Header/Locales/LocaleFlag.tsx @@ -0,0 +1,30 @@ +import Image from 'next/image' + +import type { CookiesStore } from '@/i18n/i18n.client' +import { useI18n } from '@/i18n/i18n.client' + +export interface LocaleFlagProps { + locale: string + cookiesStore: CookiesStore +} + +export const LocaleFlag: React.FC+ {i18n.translate(`common.${locale}`)} +
+ > + ) +} diff --git a/components/Header/Language/index.tsx b/components/Header/Locales/index.tsx similarity index 58% rename from components/Header/Language/index.tsx rename to components/Header/Locales/index.tsx index 8641e97..e0da89c 100644 --- a/components/Header/Language/index.tsx +++ b/components/Header/Locales/index.tsx @@ -1,17 +1,22 @@ 'use client' import { useCallback, useEffect, useState, useRef } from 'react' -import useTranslation from 'next-translate/useTranslation' -import setLanguage from 'next-translate/setLanguage' import classNames from 'clsx' -import i18n from 'i18n.json' +import { AVAILABLE_LOCALES } from '@/utils/constants' +import type { CookiesStore } from '@/i18n/i18n.client' import { Arrow } from './Arrow' -import { LanguageFlag } from './LanguageFlag' +import { LocaleFlag } from './LocaleFlag' + +export interface LocalesProps { + currentLocale: string + cookiesStore: CookiesStore +} + +export const Locales = (props: LocalesProps): JSX.Element => { + const { currentLocale, cookiesStore } = props -export const Language: React.FC = () => { - const { lang: currentLanguage } = useTranslation() const [hiddenMenu, setHiddenMenu] = useState(true) const languageClickRef = useRef{t('home:open-source.description')}
++ {i18n.translate('home.open-source.description')} +
- {t('home:about.description-bottom')}
- {lang === 'fr' ? (
+ {i18n.translate('home.about.description-bottom')}
+ {i18n.locale === 'fr-FR' ? (
<>
diff --git a/components/Profile/ProfileInfo.tsx b/components/Profile/ProfileInfo.tsx
index 566d76e..9fb5219 100644
--- a/components/Profile/ProfileInfo.tsx
+++ b/components/Profile/ProfileInfo.tsx
@@ -1,14 +1,16 @@
-import useTranslation from 'next-translate/useTranslation'
+import { getI18n } from '@/i18n/i18n.server'
export const ProfileInformation: React.FC = () => {
- const { t } = useTranslation()
+ const i18n = getI18n()
return (