-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(client): 🚧 migrate "publier" to app router with react-i18next
- Loading branch information
1 parent
091d9af
commit 0c5d7e5
Showing
81 changed files
with
394 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
/// <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. | ||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use client"; | ||
|
||
import { startReactDsfr } from "@codegouvfr/react-dsfr/next-appdir"; | ||
import Link from "next/link"; | ||
|
||
declare module "@codegouvfr/react-dsfr/next-appdir" { | ||
interface RegisterLink { | ||
Link: typeof Link; | ||
} | ||
} | ||
|
||
startReactDsfr({ | ||
defaultColorScheme: "light", | ||
Link, | ||
}); | ||
|
||
export default function StartDsfr() { | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { DsfrHead } from "@codegouvfr/react-dsfr/next-appdir/DsfrHead"; | ||
import { DsfrProvider } from "@codegouvfr/react-dsfr/next-appdir/DsfrProvider"; | ||
import { getHtmlAttributes } from "@codegouvfr/react-dsfr/next-appdir/getHtmlAttributes"; | ||
import Link from "next/link"; | ||
import React from "react"; | ||
import StartDsfr from "~/app/StartDsfr"; | ||
import StoreProvider from "~/app/storeProvider"; | ||
import Footer from "~/components/Layout/Footer"; | ||
import styles from "~/components/Layout/Layout.module.scss"; | ||
import Navbar from "~/components/Navigation/Navbar"; | ||
import { locales } from "~/lib/i18nConfig"; | ||
|
||
import "scss/index.css"; | ||
import "scss/index.scss"; | ||
|
||
export async function generateStaticParams() { | ||
return locales.map((locale) => ({ locale })); | ||
} | ||
|
||
export default function RootLayout({ | ||
children, | ||
params: { locale }, | ||
}: Readonly<{ children: React.ReactNode; params: { locale: string } }>) { | ||
return ( | ||
<html {...getHtmlAttributes({ defaultColorScheme: "light", lang: locale })}> | ||
<head> | ||
<StartDsfr /> | ||
<DsfrHead Link={Link} /> | ||
<link rel="shortcut icon" href="/favicon.ico" /> | ||
<link rel="manifest" href="/manifest.json" /> | ||
<meta name="theme-color" content="#000000" /> | ||
{process.env.NEXT_PUBLIC_REACT_APP_ENV !== "production" && <meta name="robots" content="noindex, nofollow" />} | ||
<script defer data-domain="refugies.info" src="https://plausible.io/js/script.tagged-events.js"></script> | ||
</head> | ||
|
||
<body dir={/* isRTL */ false ? "rtl" : "ltr"}> | ||
<StoreProvider> | ||
<DsfrProvider lang={locale}> | ||
<Navbar /> | ||
<div id="contenu" className={styles.main}> | ||
<main className={styles.content}>{children}</main> | ||
</div> | ||
<Footer /> | ||
</DsfrProvider> | ||
</StoreProvider> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import PublierPage from "~/app/[locale]/publier/page-publier"; | ||
import API from "~/utils/API"; | ||
|
||
async function getData() { | ||
const dispStatistics = await API.getDispositifsStatistics({ | ||
facets: ["nbVues", "nbVuesMobile", "nbDispositifs", "nbDemarches"], | ||
}); | ||
const structStatistics = await API.getStructuresStatistics({ facets: ["nbStructures"] }); | ||
|
||
return { | ||
nbVues: (dispStatistics.nbVues || 0) + (dispStatistics.nbVuesMobile || 0), | ||
nbFiches: (dispStatistics.nbDispositifs || 0) + (dispStatistics.nbDemarches || 0), | ||
nbStructures: structStatistics.nbStructures || 0, | ||
}; | ||
} | ||
|
||
export default async function Publier({ params }: { params: { locale: string } }) { | ||
const data = await getData(); | ||
return ( | ||
<PublierPage | ||
nbVues={data.nbVues} | ||
nbFiches={data.nbFiches} | ||
nbStructures={data.nbStructures} | ||
locale={params.locale} | ||
/> | ||
); | ||
} |
Oops, something went wrong.