Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinebigard committed Jan 6, 2025
1 parent a462c4c commit 0ef2997
Show file tree
Hide file tree
Showing 11 changed files with 383 additions and 183 deletions.
8 changes: 8 additions & 0 deletions .infra/local/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM mongo:7
COPY ./mongo_keyfile /tmp/mongo_keyfile
COPY ./mongod.conf /etc/mongod.conf
RUN chown mongodb:mongodb /etc/mongod.conf
RUN chown mongodb:mongodb /tmp/mongo_keyfile
RUN chmod 400 /tmp/mongo_keyfile

CMD ["mongod", "--config", "/etc/mongod.conf"]
5 changes: 1 addition & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
services:
mongodb:
image: mongo:7
build: ./.infra/local/
restart: unless-stopped
hostname: mongodb
ports:
- "127.0.0.1:27017:27017"
command: ["-f", "/etc/mongod.conf"]
volumes:
- tpml_mongodb_data:/data
- ./.infra/local/mongo_keyfile:/tmp/mongo_keyfile
- ./.infra/local/mongod.conf:/etc/mongod.conf:ro
healthcheck:
test: ["CMD", "mongosh", "--eval", '''db.runCommand("ping").ok''', "--quiet"]
interval: 10s
Expand Down
4 changes: 3 additions & 1 deletion ui/app/StartDsfr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import { startReactDsfr } from "@codegouvfr/react-dsfr/next-appdir";
import Link from "next/link";

import { defaultColorScheme } from "@/theme/defaultColorScheme";

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

startReactDsfr({ defaultColorScheme: "light", Link });
startReactDsfr({ defaultColorScheme, Link });

export function StartDsfr() {
//Yes, leave null here.
Expand Down
5 changes: 3 additions & 2 deletions ui/app/admin/utilisateurs/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { apiGet } from "@/utils/api.utils";
import UserView from "./components/UserView";

interface Props {
params: { id: string };
params: Promise<{ id: string }>;
}

const AdminUserViewPage = async ({ params }: Props) => {
const AdminUserViewPage = async (props: Props) => {
const params = await props.params;
//@ts-expect-error: TODO fix this
const user = await apiGet(`/admin/users/:id`, { params });

Expand Down
6 changes: 3 additions & 3 deletions ui/app/doc/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import NotFoundPage from "@/app/not-found";
export const revalidate = 3_600;

type DocPageProps = {
params: {
params: Promise<{
slug: string[];
};
}>;
};

export default async function DocPage(props: DocPageProps) {
const path = `/doc/${props.params.slug.join("/")}`;
const path = `/doc/${(await props.params).slug.join("/")}`;
const page = Object.values(NOTION_PAGES).find((p) => {
return p.path === path;
});
Expand Down
6 changes: 5 additions & 1 deletion ui/app/notion/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import NotionPage from "@/app/components/notion/NotionPage";

export const revalidate = 300;

export default async function Page({ params: { id } }: { params: { id: string } }) {
export default async function Page(props: { params: Promise<{ id: string }> }) {
const params = await props.params;

const { id } = params;

return <NotionPage pageId={id} />;
}
2 changes: 1 addition & 1 deletion ui/app/template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const RootTemplate: FC<Props> = ({ children }) => {
<Container maxWidth="xl">
<Box minHeight="60vh">{children}</Box>
</Container>
<Footer />
{/* <Footer /> */}
</MuiDsfrThemeProvider>
</QueryClientProvider>
</PlausibleProvider>
Expand Down
17 changes: 10 additions & 7 deletions ui/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/** @type {import('next').NextConfig} */
/**
* @type {import('next').NextConfig}
*/

import { withSentryConfig } from "@sentry/nextjs";
import { withPlausibleProxy } from "next-plausible";
Expand Down Expand Up @@ -31,14 +32,16 @@ const contentSecurityPolicy = `
`;

const nextConfig = {
transpilePackages: ["shared"],
transpilePackages: [
"shared",
"@codegouvfr/react-dsfr",
"tss-react", // This is for MUI or if you use htts://tss-react.dev
],
poweredByHeader: false,
productionBrowserSourceMaps: true,
swcMinify: true,
outputFileTracingRoot: path.join(path.dirname(fileURLToPath(import.meta.url)), "../"),
experimental: {
outputFileTracingRoot: path.join(path.dirname(fileURLToPath(import.meta.url)), "../"),
typedRoutes: true,
instrumentationHook: true,
// typedRoutes: true,
},

output: "standalone",
Expand Down
26 changes: 15 additions & 11 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@
"dev": "yarn predev && next dev",
"build": "yarn prebuild && next build --no-lint",
"typecheck": "tsc --noEmit",
"predev": "only-include-used-icons",
"prebuild": "only-include-used-icons"
"predev": "react-dsfr update-icons",
"prebuild": "react-dsfr update-icons"
},
"type": "module",
"dependencies": {
"@babel/runtime": "^7.25.7",
"@codegouvfr/react-dsfr": "^1.13.8",
"@codegouvfr/react-dsfr": "^1.16.5",
"@emotion/cache": "^11.13.1",
"@emotion/react": "^11.13.3",
"@emotion/react": "^11.14.0",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.13.0",
"@emotion/styled": "^11.14.0",
"@hookform/resolvers": "^3.9.0",
"@mui/icons-material": "^6.1.3",
"@mui/material": "^6.1.3",
"@mui/material": "^6.3.1",
"@mui/material-nextjs": "^6.1.3",
"@mui/system": "^6.1.3",
"@mui/x-data-grid": "^7.20.0",
"@mui/x-date-pickers": "^7.20.0",
"@sentry/nextjs": "^8.34.0",
"@tanstack/react-query": "^5.59.13",
"@types/node": "^22.5.5",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"@types/react": "19.0.3",
"@types/react-dom": "19.0.2",
"accept-language": "^3.0.20",
"autosuggest-highlight": "^3.3.4",
"core-js": "^3.38.1",
Expand All @@ -44,11 +44,11 @@
"jwt-decode": "^4.0.0",
"match-sorter": "^6.3.4",
"mobx": "^6.13.3",
"next": "^14.2.20",
"next": "15.1.3",
"next-plausible": "^3.12.2",
"notion-client": "^6.16.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-hook-form": "^7.53.0",
"react-i18next": "^15.0.3",
"react-markdown": "^9.0.1",
Expand All @@ -72,5 +72,9 @@
"notion-types": "^6.16.0",
"type-fest": "^4.26.1",
"vitest": "^2.1.3"
},
"resolutions": {
"@types/react": "19.0.3",
"@types/react-dom": "19.0.2"
}
}
3 changes: 2 additions & 1 deletion ui/utils/api.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ async function getHeaders(options: IRequestOptions) {
// By default server-side we don't use headers
// But we need them for the api, as all routes are authenticated
const { headers: nextHeaders } = await import("next/headers");
const cookie = nextHeaders().get("cookie");
const headersList = await nextHeaders();
const cookie = headersList.get("cookie");
if (cookie) {
headers.append("cookie", cookie);
}
Expand Down
Loading

0 comments on commit 0ef2997

Please sign in to comment.