diff --git a/Dockerfile b/Dockerfile
index 00ab186..64edbbe 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,3 @@
-FROM node:20-alpine AS deps
-WORKDIR /app
-COPY package.json package-lock.json ./
-RUN npm ci --only=production
-
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
diff --git a/package.json b/package.json
index f3458a3..3f25ff6 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"dev": "node node_modules/next/dist/bin/next dev",
"build": "node node_modules/next/dist/bin/next build",
"start": "node node_modules/next/dist/bin/next start",
- "lint": "node node_modules/eslint/bin/eslint.js"
+ "lint": "node node_modules/eslint/bin/eslint.js ."
},
"dependencies": {
"lucide-react": "^1.26.0",
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 7d0b71d..26b5d8f 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,5 +1,6 @@
import type { Metadata } from "next"
import { Inter } from "next/font/google"
+import { getConfig } from "@/lib/config"
import "./globals.css"
const inter = Inter({
@@ -8,17 +9,19 @@ const inter = Inter({
variable: "--font-inter",
})
-export const metadata: Metadata = {
- title: "Soch Family",
- description: "Les applications de la famille",
-}
-
-function getInitialTheme(): string {
+export async function generateMetadata(): Promise {
try {
- const { loadConfig } = require("@/lib/config")
- return loadConfig().theme.mode
+ const config = getConfig()
+ return {
+ title: config.site.name,
+ description: config.site.title,
+ icons: config.site.favicon ? { icon: config.site.favicon } : undefined,
+ }
} catch {
- return "dark"
+ return {
+ title: "Sochboard",
+ description: "Dashboard",
+ }
}
}
@@ -27,7 +30,10 @@ export default function RootLayout({
}: Readonly<{
children: React.ReactNode
}>) {
- const theme = getInitialTheme()
+ let theme = "dark"
+ try {
+ theme = getConfig().theme.mode
+ } catch {}
return (
diff --git a/src/components/dashboard/DashboardHeader.tsx b/src/components/dashboard/DashboardHeader.tsx
index 19f45f3..9337cc2 100644
--- a/src/components/dashboard/DashboardHeader.tsx
+++ b/src/components/dashboard/DashboardHeader.tsx
@@ -15,13 +15,6 @@ export function DashboardHeader({ site, initialTheme }: DashboardHeaderProps) {
document.documentElement.classList.toggle("theme-light", isLight)
}, [isLight])
- useEffect(() => {
- document.documentElement.classList.toggle(
- "theme-light",
- initialTheme === "light"
- )
- }, [initialTheme])
-
function toggleTheme() {
setIsLight((prev) => !prev)
}
diff --git a/src/components/dashboard/ServiceCard.tsx b/src/components/dashboard/ServiceCard.tsx
index 9598068..d03e1d7 100644
--- a/src/components/dashboard/ServiceCard.tsx
+++ b/src/components/dashboard/ServiceCard.tsx
@@ -47,23 +47,26 @@ export function ServiceCard({ link, index = 0, layout = "horizontal" }: ServiceC
)}
{link.openInNewTab && (
-
+ <>
+
+ Nouvel onglet
+ >
)}
>
) : (
@@ -83,23 +86,26 @@ export function ServiceCard({ link, index = 0, layout = "horizontal" }: ServiceC
)}
{link.openInNewTab && (
-
+ <>
+
+ Nouvel onglet
+ >
)}
diff --git a/src/lib/config.ts b/src/lib/config.ts
index a9bdfd8..e98c2c6 100644
--- a/src/lib/config.ts
+++ b/src/lib/config.ts
@@ -1,3 +1,4 @@
+import { cache } from "react"
import { readYamlFile } from "./yaml"
import { dashboardConfigSchema } from "./validation"
import type { DashboardConfig } from "@/types/config"
@@ -21,3 +22,5 @@ export function loadConfig(configPath?: string): DashboardConfig {
return result.data
}
+
+export const getConfig = cache((configPath?: string) => loadConfig(configPath))