-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade next to 14 and app router and TS (#166)
* chore: upgrade next to 14 and app router * new og images * clean * fix yarnrc.yml * fix yarnrc.yml again * .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs * fix: compiling * fix: upgrade node --------- Co-authored-by: Matéo Mévollon <[email protected]>
- Loading branch information
1 parent
8a8e46f
commit a25375e
Showing
69 changed files
with
6,834 additions
and
5,975 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": [ | ||
"eslint:recommended", | ||
"next" | ||
], | ||
"rules": { | ||
"react/no-unescaped-entities": "off", | ||
"@next/next/no-img-element": "off" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,9 +1,8 @@ | ||
nodeLinker: node-modules | ||
|
||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-fetch.cjs | ||
- checksum: 240d225dd5bf1e25068497140ced7a3b7658a4c3754c08ea57162c9fe3335d757af0eae55555f96150a3015cdd0337852401f3fae69c1edd05221cb32f038d8c | ||
path: .yarn/plugins/@yarnpkg/plugin-fetch.cjs | ||
spec: "https://codeberg.org/devthefuture/yarn-plugin-fetch/raw/branch/master/bundles/@yarnpkg/plugin-fetch.js" | ||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs | ||
spec: "@yarnpkg/plugin-workspace-tools" | ||
|
||
yarnPath: .yarn/releases/yarn-3.7.0.cjs | ||
yarnPath: .yarn/releases/yarn-4.0.2.cjs |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# ozensemble-site | ||
|
||
https://ozensemble.fr | ||
https://ozensemble.fabrique.social.gouv.fr | ||
|
||
## Env vars | ||
|
||
|
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,5 @@ | ||
import { NextResponse } from "next/server" | ||
|
||
export async function GET() { | ||
return NextResponse.json({ message: "Hello, world!" }) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,57 @@ | ||
import React from "react" | ||
import Navigation, { DownloadPopupStandalone } from "~/components/Navigation" | ||
import Footer from "~/components/Footer" | ||
import fs from "fs" | ||
import path from "path" | ||
import matter from "gray-matter" | ||
import { parse } from "date-fns" | ||
import { fr } from "date-fns/locale" | ||
import type { Metadata } from "next" | ||
|
||
export async function generateMetadata({ | ||
params, | ||
}: { | ||
params: { blog: string } | ||
}): Promise<Metadata> { | ||
// read route params | ||
const filePath = path.join(process.cwd(), "content", `${params.blog}.mdx`) | ||
const fileContents = fs.readFileSync(filePath, "utf-8") | ||
const { data } = matter(fileContents) | ||
|
||
const articleDate = parse(data.date, "MMMM d, yyyy", new Date(), { | ||
locale: fr, | ||
}) | ||
|
||
const currentDate = new Date() | ||
|
||
if (articleDate >= currentDate) { | ||
return null | ||
} | ||
return { | ||
title: data.title, | ||
description: data.description, | ||
openGraph: { | ||
title: data.title, | ||
description: data.description, | ||
images: [data.image], | ||
}, | ||
} | ||
} | ||
|
||
export default function BlogLayout({ children }) { | ||
return ( | ||
<> | ||
<DownloadPopupStandalone /> | ||
<Navigation /> | ||
{children} | ||
<Footer /> | ||
</> | ||
) | ||
} | ||
|
||
export async function generateStaticParams() { | ||
const directoryPath = path.join(process.cwd(), "content") | ||
const filenames = fs.readdirSync(directoryPath) | ||
|
||
return filenames.map((filename) => ({ blog: filename.replace(".mdx", "") })) | ||
} |
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,6 @@ | ||
import DownloadPage from "~/app/download/page" | ||
import { metadata as metadataDownload } from "~/app/download/page" | ||
|
||
export const metadata = metadataDownload | ||
|
||
export default DownloadPage |
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,41 @@ | ||
import { ANDROID_URL, IOS_URL, ROOT_URL } from "~/constants" | ||
import { metadata as metadataMain } from "~/app/layout" | ||
|
||
export const metadata = { | ||
...metadataMain, | ||
title: "Télécharger Oz Ensemble", | ||
description: | ||
"Télécharger Oz Ensemble, une application mobile pour maitriser sa consommation d'alcool.", | ||
} | ||
|
||
export default function Download() { | ||
return ( | ||
<script | ||
dangerouslySetInnerHTML={{ | ||
__html: ` | ||
function redirect() { | ||
var userAgent = navigator.userAgent || navigator.vendor || window.opera; | ||
var ios = /iPad|iPhone|iPod/.test(userAgent) && !window.MSStream; | ||
if (ios) { | ||
// window.location = myapp://element/{ELEMENT_ID}; | ||
window.setTimeout(() => { | ||
window.location.replace('${IOS_URL}'); | ||
}, 25) | ||
return | ||
} | ||
var android = /android/i.test(userAgent); | ||
if (android) { | ||
// window.location = myapp://element/{ELEMENT_ID}; | ||
window.setTimeout(() => { | ||
window.location.replace('${ANDROID_URL}'); | ||
}, 25) | ||
return | ||
} | ||
window.location.replace('${ROOT_URL}') | ||
} | ||
redirect() | ||
`, | ||
}} | ||
/> | ||
) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.