Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
fix: align with hasura branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Bouquillon committed Jul 29, 2023
1 parent 7efc07f commit 037796f
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 90 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build

on: [pull_request, push]

concurrency:
cancel-in-progress: true
group: build-${{ github.ref }}

jobs:
build:
name: Build and export
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
yarn install --prefer-offline --frozen-lockfile
- name: Build and export
run: |
yarn build
7 changes: 6 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cypress run
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v5
with:
build: yarn build
start: yarn start
component: false
env:
NEXTAUTH_URL: "http://keycloak:3000"
NEXTAUTH_SECRET: "A+EQqudlGhqTLDnBbCvohHBfbhUjTXAbZYy1NKsSsys="
NEXT_PUBLIC_HASURA_GRAPHQL_ENDPOINT_URL: "http://hasura:8082/v1/graphql"
4 changes: 4 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
fileignoreconfig:
- filename: .env.development
checksum: 44d017f8bd7ac1f3f4fb8b8175b3dddb6f160cf05b2738ec16b5b848aeb62d3f
- filename: .github/workflows/build.yml
checksum: 76b8b3bba21c8029b1fd0dd2759cf96448ee257439ea4118fddfb4254199a59b
- filename: .github/workflows/e2e.yml
checksum: eaf3ce6b34b2ceee77a0c89066d8c05b5938c60c71458e4341b636eb6b9d51da
- filename: .github/workflows/kontinuous-webhook-delete.yml
checksum: 6debf4f640d4ed9cb39bb19445214ab52dcb23fb7da12feeb85070816d7ee52a
- filename: .github/workflows/kontinuous-webhook-deploy.yml
Expand Down
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const { version } = require("./package.json");

const ContentSecurityPolicy = require("./csp.config");

/** @type {import('next').NextConfig} */
const moduleExports = {
reactStrictMode: true,
swcMinify: true,
Expand Down
2 changes: 1 addition & 1 deletion scripts/prebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const run = () => {
process.env.PRODUCTION ? true : false,
process.env.NEXT_PUBLIC_SITE_URL ?? "localhost"
);
console.log("Robots.txt generated.");
console.log("Robots.txt generated");
};

run();
183 changes: 95 additions & 88 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
import { useEffect } from "react";
import { useRouter } from "next/router";
import { ReactNode, useEffect } from "react";
import type { AppProps } from "next/app";
import Head from "next/head";
import Link from "next/link";
import { useRouter } from "next/router";

import { fr } from "@codegouvfr/react-dsfr";
import { createNextDsfrIntegrationApi } from "@codegouvfr/react-dsfr/next-pagesdir";
import { MuiDsfrThemeProvider } from "@codegouvfr/react-dsfr/mui";
import { createEmotionSsrAdvancedApproach } from "tss-react/next";
import { useStyles } from "tss-react/dsfr";
import {
Display,
headerFooterDisplayItem,
} from "@codegouvfr/react-dsfr/Display";
import { Header } from "@codegouvfr/react-dsfr/Header";
import { createNextDsfrIntegrationApi } from "@codegouvfr/react-dsfr/next-pagesdir";
import { Footer } from "@codegouvfr/react-dsfr/Footer";
import { fr } from "@codegouvfr/react-dsfr";
import { Header } from "@codegouvfr/react-dsfr/Header";
import { headerFooterDisplayItem } from "@codegouvfr/react-dsfr/Display";
import { init } from "@socialgouv/matomo-next";
import Head from "next/head";
import { MuiDsfrThemeProvider } from "@codegouvfr/react-dsfr/mui";
import { useStyles } from "tss-react/dsfr";

declare module "@codegouvfr/react-dsfr/next-pagesdir" {
interface RegisterLink {
Link: typeof Link;
}
}

// Only in TypeScript projects
declare module "@codegouvfr/react-dsfr" {
interface RegisterLink {
Link: typeof Link;
Expand Down Expand Up @@ -108,95 +104,106 @@ const bottomLinks = [
},
];

function App({ Component, pageProps }: AppProps) {
const Layout = ({ children }: { children: ReactNode }) => {
const { css } = useStyles();

const router = useRouter();

const contentSecurityPolicy = process.env.CONTENT_SECURITY_POLICY;

useEffect(() => {
init({
url: process.env.NEXT_PUBLIC_MATOMO_URL ?? "",
siteId: process.env.NEXT_PUBLIC_MATOMO_SITE_ID ?? "",
});
}, []);

return (
<>
<MuiDsfrThemeProvider>
<Head>
<title>Template SocialGouv</title>
{contentSecurityPolicy && (
<meta
httpEquiv="Content-Security-Policy"
content={contentSecurityPolicy}
></meta>
)}
<link rel="icon" href="/favicon.ico" />
<MuiDsfrThemeProvider>
<Head>
<title>Template SocialGouv</title>
{contentSecurityPolicy && (
<meta
name="description"
content="Template de la fabrique des ministères sociaux."
/>
</Head>
<Header
brandTop={brandTop}
serviceTitle="La fabrique numérique des ministères sociaux"
serviceTagline="L'incubateur des services numériques du pôle ministériel"
homeLinkProps={homeLinkPops}
navigation={[
{
text: "Accueil",
linkProps: {
href: "/",
},
isActive: router.asPath === "/",
httpEquiv="Content-Security-Policy"
content={contentSecurityPolicy}
></meta>
)}
<link rel="icon" href="/favicon.ico" />
<meta
name="description"
content="Template de la fabrique des ministères sociaux."
/>
</Head>
<Header
brandTop={brandTop}
serviceTitle="La fabrique numérique des ministères sociaux"
serviceTagline="L'incubateur des services numériques du pôle ministériel"
homeLinkProps={homeLinkPops}
navigation={[
{
text: "Accueil",
linkProps: {
href: "/",
},
{
text: "DSFR playground",
linkProps: {
href: "/dsfr",
},
isActive: router.asPath === "/dsfr",
isActive: router.asPath === "/",
},
{
text: "DSFR playground",
linkProps: {
href: "/dsfr",
},
{
text: "Mui playground",
linkProps: {
href: "/mui",
},
isActive: router.asPath === "/mui",
isActive: router.asPath === "/dsfr",
},
{
text: "Mui playground",
linkProps: {
href: "/mui",
},
]}
quickAccessItems={[headerFooterDisplayItem]}
/>
<div
className={css({
margin: "auto",
maxWidth: 1000,
...fr.spacing("padding", {
topBottom: "10v",
}),
})}
>
<Component {...pageProps} />
</div>
<Footer
brandTop={brandTop}
accessibility="non compliant"
contentDescription={`
isActive: router.asPath === "/mui",
},
]}
quickAccessItems={[headerFooterDisplayItem]}
/>
<div
className={css({
margin: "auto",
maxWidth: 1000,
...fr.spacing("padding", {
topBottom: "10v",
}),
})}
>
{children}
</div>
<Footer
brandTop={brandTop}
accessibility="non compliant"
contentDescription={`
Ce message est à remplacer par les informations de votre site.
Comme exemple de contenu, vous pouvez indiquer les informations
suivantes : Le site officiel d’information administrative pour les entreprises.
`}
homeLinkProps={homeLinkPops}
accessibilityLinkProps={{ href: "/accessibilite" }}
termsLinkProps={{ href: "/mentions-legales" }}
bottomItems={[...bottomLinks, headerFooterDisplayItem]}
/>
<Display />
</MuiDsfrThemeProvider>
</>
homeLinkProps={homeLinkPops}
accessibilityLinkProps={{ href: "/accessibilite" }}
termsLinkProps={{ href: "/mentions-legales" }}
bottomItems={[...bottomLinks, headerFooterDisplayItem]}
/>
</MuiDsfrThemeProvider>
);
};

function App({ Component, pageProps }: AppProps) {
useEffect(() => {
init({
url: process.env.NEXT_PUBLIC_MATOMO_URL ?? "",
siteId: process.env.NEXT_PUBLIC_MATOMO_SITE_ID ?? "",
});
}, []);

return (
<div
style={{
minHeight: "100vh",
display: "flex",
flexDirection: "column",
}}
>
<Layout>
<Component {...pageProps} />
</Layout>
</div>
);
}

Expand Down

0 comments on commit 037796f

Please sign in to comment.