feat: initial Sochboard dashboard
- Next.js 16 App Router with TypeScript + Tailwind CSS v4 - YAML config read at runtime via server components (force-dynamic) - Zod validation for config schema (site, theme, sections, links) - Dark/light theme with CSS variables and client-side toggle - Dashboard layout: header (logo + title), sections, responsive card grid - Horizontal card layout (icon left, text right) with optional vertical mode - Lucide React icons with fallback, custom iconUrl support for SVG icons - Glassmorphism cards with hover/focus/keyboard accessibility - Mobile responsive: 2 columns on mobile, up to 5 on xl screens - Docker multi-stage build with docker-compose volume for config - Standalone Next.js output for production - CONFIGURATION.md and ROADMAP.md documentation
This commit is contained in:
parent
a7acba047d
commit
528e8bcbbb
7
.dockerignore
Normal file
7
.dockerignore
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
.git
|
||||
.gitignore
|
||||
.next
|
||||
node_modules
|
||||
README.md
|
||||
.env.example
|
||||
*.md
|
||||
150
CONFIGURATION.md
Normal file
150
CONFIGURATION.md
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
# Configuration de Sochboard
|
||||
|
||||
## Structure générale
|
||||
|
||||
```yaml
|
||||
site:
|
||||
# Informations du site
|
||||
theme:
|
||||
# Apparence
|
||||
sections:
|
||||
# Liste des sections et liens
|
||||
```
|
||||
|
||||
## `site`
|
||||
|
||||
| Champ | Requis | Type | Défaut | Description |
|
||||
|---|---|---|---|---|
|
||||
| `name` | Oui | chaîne | — | Nom du site (ex: "Soch Family") |
|
||||
| `title` | Oui | chaîne | — | Sous-titre affiché sous le nom |
|
||||
| `description` | Non | chaîne | — | Texte optionnel dans le header |
|
||||
| `favicon` | Non | chaîne | — | URL ou chemin du favicon |
|
||||
| `logoUrl` | Non | chaîne (URL) | — | URL d'une photo/image qui remplace le "S" |
|
||||
| `showFooter` | Non | booléen | `true` | `false` pour masquer le footer |
|
||||
|
||||
```yaml
|
||||
site:
|
||||
name: "Soch Family"
|
||||
title: "Les applications de la famille"
|
||||
description: "Accès rapide à nos services"
|
||||
logoUrl: "https://example.com/photo.jpg"
|
||||
showFooter: true
|
||||
```
|
||||
|
||||
## `theme`
|
||||
|
||||
| Champ | Requis | Type | Défaut | Description |
|
||||
|---|---|---|---|---|
|
||||
| `mode` | Non | `"dark"` ou `"light"` | `"dark"` | Mode de couleur |
|
||||
| `accent` | Non | chaîne (hex) | `"#8b5cf6"` | Couleur d'accent (ex: `"#ff0000"`) |
|
||||
| `background` | Non | `"gradient"` ou `"solid"` | `"gradient"` | Type d'arrière-plan |
|
||||
|
||||
```yaml
|
||||
theme:
|
||||
mode: "dark"
|
||||
accent: "#8b5cf6"
|
||||
background: "gradient"
|
||||
```
|
||||
|
||||
## `sections`
|
||||
|
||||
Tableau de sections. Chaque section contient :
|
||||
|
||||
| Champ | Requis | Type | Défaut | Description |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Oui | chaîne | — | Identifiant unique |
|
||||
| `title` | Oui | chaîne | — | Titre affiché |
|
||||
| `description` | Non | chaîne | — | Texte sous le titre |
|
||||
| `cardLayout` | Non | `"horizontal"` ou `"vertical"` | `"horizontal"` | Disposition des cartes dans la section |
|
||||
| `links` | Non | tableau | `[]` | Liste des liens |
|
||||
|
||||
```yaml
|
||||
sections:
|
||||
- id: "global"
|
||||
title: "Global"
|
||||
description: "Tous les services"
|
||||
cardLayout: "horizontal"
|
||||
links: []
|
||||
```
|
||||
|
||||
### `links`
|
||||
|
||||
Tableau de liens. Chaque lien contient :
|
||||
|
||||
| Champ | Requis | Type | Défaut | Description |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Oui | chaîne | — | Identifiant unique |
|
||||
| `name` | Oui | chaîne | — | Nom affiché |
|
||||
| `description` | Non | chaîne | — | Description sous le nom |
|
||||
| `url` | Oui | chaîne (URL) | — | Lien de l'application |
|
||||
| `icon` | Oui | chaîne | — | Nom de l'icône Lucide |
|
||||
| `iconUrl` | Non | chaîne (URL) | — | URL d'une image personnalisée (remplace `icon`) |
|
||||
| `color` | Non | chaîne (hex) | — | Couleur d'accent (ex: `"#2daae1"`) |
|
||||
| `openInNewTab` | Non | booléen | `true` | `false` pour ouvrir dans le même onglet |
|
||||
|
||||
```yaml
|
||||
links:
|
||||
- id: "nextcloud"
|
||||
name: "Nextcloud"
|
||||
description: "Fichiers et documents"
|
||||
url: "https://cloud.example.com"
|
||||
icon: "Cloud"
|
||||
iconUrl: "https://example.com/nextcloud-icon.svg"
|
||||
color: "#2daae1"
|
||||
openInNewTab: false
|
||||
```
|
||||
|
||||
## Icônes Lucide disponibles
|
||||
|
||||
```
|
||||
Cloud Film Music Gamepad2 Router
|
||||
Server House BookOpen Calendar Mail
|
||||
Shield Settings Globe ExternalLink
|
||||
```
|
||||
|
||||
Si le nom de l'icône est inconnu, `ExternalLink` est utilisé par défaut.
|
||||
|
||||
Si `iconUrl` est fourni, l'URL est prioritaire et `icon` sert uniquement de fallback.
|
||||
|
||||
Des icônes pour les applications self-hostées sont disponibles sur [dashboardicons.com](https://dashboardicons.com/).
|
||||
|
||||
Format CDN : `https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/<nom>.svg`
|
||||
|
||||
## Exemple complet
|
||||
|
||||
```yaml
|
||||
site:
|
||||
name: "Soch Family"
|
||||
title: "Mes applis"
|
||||
logoUrl: "https://example.com/logo.png"
|
||||
showFooter: false
|
||||
|
||||
theme:
|
||||
mode: "dark"
|
||||
accent: "#8b5cf6"
|
||||
background: "gradient"
|
||||
|
||||
sections:
|
||||
- id: "services"
|
||||
title: "Services"
|
||||
cardLayout: "horizontal"
|
||||
links:
|
||||
- id: "nextcloud"
|
||||
name: "Nextcloud"
|
||||
url: "https://cloud.example.com"
|
||||
icon: "Cloud"
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/nextcloud.svg"
|
||||
color: "#2daae1"
|
||||
openInNewTab: true
|
||||
|
||||
- id: "admin"
|
||||
title: "Administration"
|
||||
cardLayout: "vertical"
|
||||
links:
|
||||
- id: "mon-app"
|
||||
name: "Mon App"
|
||||
url: "https://app.example.com"
|
||||
icon: "Globe"
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/home-assistant.svg"
|
||||
openInNewTab: false
|
||||
```
|
||||
33
Dockerfile
Normal file
33
Dockerfile
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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 ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM node:20-alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 nextjs
|
||||
|
||||
COPY --from=build /app/public ./public
|
||||
COPY --from=build /app/.next/standalone ./
|
||||
COPY --from=build /app/.next/static ./.next/static
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
USER nextjs
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
77
README.md
77
README.md
|
|
@ -1,36 +1,71 @@
|
|||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||
# Sochboard
|
||||
|
||||
## Getting Started
|
||||
Dashboard familial pour les applications auto-hébergées.
|
||||
|
||||
First, run the development server:
|
||||
## Démarrage rapide
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
L'application est accessible sur http://localhost:3000.
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
## Configuration
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||
La configuration se fait via un fichier YAML monté dans le conteneur.
|
||||
|
||||
## Learn More
|
||||
Par défaut : `config/dashboard.yml`
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
### Structure du fichier
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
```yaml
|
||||
site:
|
||||
name: "Soch Family"
|
||||
title: "Les applications de la famille"
|
||||
description: "Accès rapide à nos services"
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
theme:
|
||||
mode: "dark"
|
||||
accent: "#8b5cf6"
|
||||
background: "gradient"
|
||||
|
||||
## Deploy on Vercel
|
||||
sections:
|
||||
- id: "global"
|
||||
title: "Global"
|
||||
description: "Services accessibles à toute la famille"
|
||||
links:
|
||||
- id: "nextcloud"
|
||||
name: "Nextcloud"
|
||||
description: "Fichiers et documents"
|
||||
url: "https://cloud.example.com"
|
||||
icon: "Cloud"
|
||||
color: "#2daae1"
|
||||
openInNewTab: true
|
||||
```
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
### Icônes disponibles
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
Cloud, Film, Music, Gamepad2, Router, Server, House, BookOpen, Calendar, Mail, Shield, Settings, Globe, ExternalLink
|
||||
|
||||
## Développement
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Modifiez `config/dashboard.yml` puis redémarrez le conteneur :
|
||||
|
||||
```bash
|
||||
docker compose restart
|
||||
```
|
||||
|
||||
## Licence
|
||||
|
||||
MIT
|
||||
|
|
|
|||
38
ROADMAP.md
Normal file
38
ROADMAP.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Roadmap
|
||||
|
||||
## iOS — Bouton thème non fonctionnel
|
||||
|
||||
Le bouton de bascule thème clair/sombre ne répond pas au toucher sur Firefox iOS.
|
||||
|
||||
**Pistes :**
|
||||
- Contourner le système d'événements React (addEventListener natif) — essayé, sans effet
|
||||
- Remplacer `<button>` par un `<a>` ou `<div role="button>` — à tester
|
||||
- Vérifier le comportement iOS WebKit avec `classList.toggle` vs `setAttribute`
|
||||
- Tester avec un bouton complètement isolé (hors du header, hors des composants dashboard)
|
||||
- Vérifier si le problème persiste dans une page vide sans CSS gradient
|
||||
|
||||
## Filtrage par en-têtes HTTP (ex: Authelia)
|
||||
|
||||
Masquer/afficher des sections ou des liens en fonction des en-têtes HTTP envoyés par un reverse proxy ou un provider d'authentification (Authelia, Authentik, etc.).
|
||||
|
||||
**Cas d'usage :** un lien d'administration n'apparaît que si l'utilisateur a le groupe `admin` dans `X-Forwarded-Groups`.
|
||||
|
||||
```yaml
|
||||
links:
|
||||
- id: "admin"
|
||||
name: "Admin"
|
||||
url: "https://admin.example.com"
|
||||
icon: "Shield"
|
||||
requiredHeaders:
|
||||
X-Forwarded-Groups: "admin"
|
||||
|
||||
sections:
|
||||
- id: "superviseurs"
|
||||
title: "Supervision"
|
||||
requiredHeaders:
|
||||
X-Forwarded-Groups: "superviseur"
|
||||
```
|
||||
|
||||
**Côté serveur :** utiliser `headers()` de `next/headers` pour lire les en-têtes au SSR et filtrer les sections/liens avant le rendu.
|
||||
|
||||
**Sécurité :** les en-têtes ne sont pas modifiables côté client (ils viennent du reverse proxy). Pas de risque de contournement par un utilisateur non auth.
|
||||
74
config/dashboard.yml
Normal file
74
config/dashboard.yml
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
site:
|
||||
name: "Soch Family"
|
||||
title: "Les applications de la famille"
|
||||
#logoUrl: ""
|
||||
#description: "Accès rapide à nos services"
|
||||
showFooter: false
|
||||
|
||||
theme:
|
||||
mode: "dark"
|
||||
accent: "#8b5cf6"
|
||||
background: "gradient"
|
||||
|
||||
sections:
|
||||
- id: "global"
|
||||
title: "Global"
|
||||
description: "Services accessibles à toute la famille"
|
||||
links:
|
||||
- id: "nextcloud"
|
||||
name: "Nextcloud"
|
||||
description: "Fichiers et documents"
|
||||
url: "https://cloud.example.com"
|
||||
icon: "Cloud"
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/nextcloud.svg"
|
||||
color: "#2daae1"
|
||||
openInNewTab: false
|
||||
|
||||
- id: "jellyfin"
|
||||
name: "Jellyfin"
|
||||
description: "Films et séries"
|
||||
url: "https://jellyfin.example.com"
|
||||
icon: "Film"
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/jellyfin.svg"
|
||||
color: "#aa5cc3"
|
||||
openInNewTab: false
|
||||
|
||||
- id: "navidrome"
|
||||
name: "Navidrome"
|
||||
description: "Musique"
|
||||
url: "https://music.example.com"
|
||||
icon: "Music"
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/navidrome.svg"
|
||||
color: "#22c55e"
|
||||
openInNewTab: false
|
||||
|
||||
- id: "minecraft"
|
||||
name: "Minecraft"
|
||||
description: "Serveur de jeu"
|
||||
url: "https://minecraft.example.com"
|
||||
icon: "Gamepad2"
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/minecraft.svg"
|
||||
color: "#f97316"
|
||||
openInNewTab: false
|
||||
|
||||
- id: "custom"
|
||||
title: "Liens personnalisés"
|
||||
description: "Autres liens utiles"
|
||||
cardLayout: "horizontal"
|
||||
links:
|
||||
- id: "homeassistant"
|
||||
name: "Home Assistant"
|
||||
description: "Domotique"
|
||||
url: "https://ha.example.com"
|
||||
icon: "House"
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/home-assistant.svg"
|
||||
color: "#22c55e"
|
||||
openInNewTab: false
|
||||
|
||||
- id: "router"
|
||||
name: "Routeur"
|
||||
description: "Administration réseau"
|
||||
url: "http://192.168.1.1"
|
||||
icon: "Router"
|
||||
color: "#f59e0b"
|
||||
openInNewTab: false
|
||||
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
services:
|
||||
sochboard:
|
||||
build: .
|
||||
container_name: sochboard
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./config:/app/config:ro
|
||||
environment:
|
||||
- CONFIG_PATH=/app/config/dashboard.yml
|
||||
restart: unless-stopped
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import type { NextConfig } from "next";
|
||||
import type { NextConfig } from "next"
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
};
|
||||
output: "standalone",
|
||||
}
|
||||
|
||||
export default nextConfig;
|
||||
export default nextConfig
|
||||
|
|
|
|||
30
package-lock.json
generated
30
package-lock.json
generated
|
|
@ -8,9 +8,12 @@
|
|||
"name": "sochboard-temp",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"lucide-react": "^1.26.0",
|
||||
"next": "16.2.11",
|
||||
"react": "19.2.4",
|
||||
"react-dom": "19.2.4"
|
||||
"react-dom": "19.2.4",
|
||||
"yaml": "^2.9.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4",
|
||||
|
|
@ -5084,6 +5087,15 @@
|
|||
"yallist": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/lucide-react": {
|
||||
"version": "1.26.0",
|
||||
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.26.0.tgz",
|
||||
"integrity": "sha512-raglYVR2+VkMfJL158krjVmE+rV5ST2lzA/KQm1FRSjMHT4MnWaegHxoVEpmc2So3nOEhp9oGejJwAPX8MoAjg==",
|
||||
"license": "ISC",
|
||||
"peerDependencies": {
|
||||
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "0.30.21",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
|
||||
|
|
@ -6779,6 +6791,21 @@
|
|||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/yaml": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
|
||||
"integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"yaml": "bin.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/eemeli"
|
||||
}
|
||||
},
|
||||
"node_modules/yocto-queue": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||
|
|
@ -6796,7 +6823,6 @@
|
|||
"version": "4.4.3",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
|
||||
"integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
|
|
|
|||
15
package.json
15
package.json
|
|
@ -1,17 +1,20 @@
|
|||
{
|
||||
"name": "sochboard-temp",
|
||||
"name": "sochboard",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint"
|
||||
"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"
|
||||
},
|
||||
"dependencies": {
|
||||
"lucide-react": "^1.26.0",
|
||||
"next": "16.2.11",
|
||||
"react": "19.2.4",
|
||||
"react-dom": "19.2.4"
|
||||
"react-dom": "19.2.4",
|
||||
"yaml": "^2.9.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4",
|
||||
|
|
|
|||
4
public/favicon.svg
Normal file
4
public/favicon.svg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
||||
<rect width="100" height="100" rx="20" fill="#8b5cf6"/>
|
||||
<text x="50" y="68" font-family="system-ui, sans-serif" font-size="52" font-weight="700" fill="white" text-anchor="middle">S</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 262 B |
|
|
@ -1 +0,0 @@
|
|||
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
||||
|
Before Width: | Height: | Size: 391 B |
|
|
@ -1 +0,0 @@
|
|||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
||||
|
Before Width: | Height: | Size: 1 KiB |
|
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
|
|
@ -1 +0,0 @@
|
|||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
||||
|
Before Width: | Height: | Size: 128 B |
|
|
@ -1 +0,0 @@
|
|||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
||||
|
Before Width: | Height: | Size: 385 B |
|
|
@ -1,26 +1,80 @@
|
|||
@import "tailwindcss";
|
||||
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
--foreground: #171717;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
--font-sans: var(--font-inter);
|
||||
--font-mono: var(--font-inter);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background: #0a0a0a;
|
||||
--foreground: #ededed;
|
||||
:root {
|
||||
--bg-primary: #0a0a0f;
|
||||
--bg-gradient: radial-gradient(ellipse at 50% 0%, #1a1a2e 0%, #0f0f1a 50%, #0a0a0f 100%);
|
||||
--bg-card: rgba(255, 255, 255, 0.03);
|
||||
--bg-card-hover: rgba(255, 255, 255, 0.06);
|
||||
--border-card: rgba(255, 255, 255, 0.06);
|
||||
--border-card-hover: rgba(255, 255, 255, 0.12);
|
||||
--text-primary: rgba(255, 255, 255, 0.9);
|
||||
--text-secondary: rgba(255, 255, 255, 0.5);
|
||||
--text-tertiary: rgba(255, 255, 255, 0.3);
|
||||
--focus-ring: #8b5cf6;
|
||||
--focus-ring-offset: #0a0a0f;
|
||||
}
|
||||
|
||||
html.theme-light {
|
||||
--bg-primary: #f8fafc;
|
||||
--bg-gradient: radial-gradient(ellipse at 50% 0%, #e2e8f0 0%, #f1f5f9 50%, #f8fafc 100%);
|
||||
--bg-card: rgba(0, 0, 0, 0.02);
|
||||
--bg-card-hover: rgba(0, 0, 0, 0.04);
|
||||
--border-card: rgba(0, 0, 0, 0.06);
|
||||
--border-card-hover: rgba(0, 0, 0, 0.12);
|
||||
--text-primary: rgba(0, 0, 0, 0.85);
|
||||
--text-secondary: rgba(0, 0, 0, 0.5);
|
||||
--text-tertiary: rgba(0, 0, 0, 0.3);
|
||||
--focus-ring: #8b5cf6;
|
||||
--focus-ring-offset: #f8fafc;
|
||||
}
|
||||
|
||||
.dashboard-root {
|
||||
min-height: 100vh;
|
||||
background: var(--bg-gradient);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
@keyframes fade-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
@keyframes fade-in-up {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(12px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-fade-in {
|
||||
animation: fade-in 0.4s ease-out both;
|
||||
}
|
||||
|
||||
.animate-fade-in-up {
|
||||
animation: fade-in-up 0.5s ease-out both;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
animation-duration: 0.01ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
transition-duration: 0.01ms !important;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,40 @@
|
|||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import type { Metadata } from "next"
|
||||
import { Inter } from "next/font/google"
|
||||
import "./globals.css"
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
const inter = Inter({
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
display: "swap",
|
||||
variable: "--font-inter",
|
||||
})
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
};
|
||||
title: "Soch Family",
|
||||
description: "Les applications de la famille",
|
||||
}
|
||||
|
||||
function getInitialTheme(): string {
|
||||
try {
|
||||
const { loadConfig } = require("@/lib/config")
|
||||
return loadConfig().theme.mode
|
||||
} catch {
|
||||
return "dark"
|
||||
}
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
children: React.ReactNode
|
||||
}>) {
|
||||
const theme = getInitialTheme()
|
||||
|
||||
return (
|
||||
<html
|
||||
lang="en"
|
||||
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
||||
lang="fr"
|
||||
className={`${inter.variable} ${theme === "light" ? "theme-light" : ""} antialiased`}
|
||||
>
|
||||
<body className="min-h-full flex flex-col">{children}</body>
|
||||
<body className="min-h-screen font-sans">{children}</body>
|
||||
</html>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,65 +1,29 @@
|
|||
import Image from "next/image";
|
||||
import { loadConfig } from "@/lib/config"
|
||||
import { Dashboard } from "@/components/dashboard/Dashboard"
|
||||
import { ErrorDisplay } from "@/components/ui/ErrorDisplay"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
function getConfig() {
|
||||
try {
|
||||
return { ok: true as const, config: loadConfig() }
|
||||
} catch (error) {
|
||||
return {
|
||||
ok: false as const,
|
||||
message:
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: "Une erreur inconnue est survenue",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className="flex flex-col flex-1 items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
||||
<main className="flex flex-1 w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={100}
|
||||
height={20}
|
||||
priority
|
||||
/>
|
||||
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
||||
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
||||
To get started, edit the page.tsx file.
|
||||
</h1>
|
||||
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
||||
Looking for a starting point or more instructions? Head over to{" "}
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Templates
|
||||
</a>{" "}
|
||||
or the{" "}
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Learning
|
||||
</a>{" "}
|
||||
center.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Deploy Now
|
||||
</a>
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
const result = getConfig()
|
||||
|
||||
if (!result.ok) {
|
||||
return <ErrorDisplay message={result.message} />
|
||||
}
|
||||
|
||||
return <Dashboard config={result.config} />
|
||||
}
|
||||
|
|
|
|||
25
src/components/dashboard/Dashboard.tsx
Normal file
25
src/components/dashboard/Dashboard.tsx
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { DashboardHeader } from "./DashboardHeader"
|
||||
import { DashboardSection } from "./DashboardSection"
|
||||
import type { DashboardConfig } from "@/types/config"
|
||||
|
||||
interface DashboardProps {
|
||||
config: DashboardConfig
|
||||
}
|
||||
|
||||
export function Dashboard({ config }: DashboardProps) {
|
||||
return (
|
||||
<div className="dashboard-root mx-auto flex w-full max-w-7xl flex-col px-4 py-8 sm:px-6 lg:px-8">
|
||||
<DashboardHeader site={config.site} initialTheme={config.theme.mode} />
|
||||
<main className="flex flex-col gap-12">
|
||||
{config.sections.map((section, index) => (
|
||||
<DashboardSection key={section.id} section={section} sectionIndex={index} />
|
||||
))}
|
||||
</main>
|
||||
{config.site.showFooter !== false && (
|
||||
<footer className="mt-16 border-t border-[var(--border-card)] pt-6 text-center text-xs text-[var(--text-tertiary)]">
|
||||
Sochboard
|
||||
</footer>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
122
src/components/dashboard/DashboardHeader.tsx
Normal file
122
src/components/dashboard/DashboardHeader.tsx
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
"use client"
|
||||
|
||||
import { useState, useEffect } from "react"
|
||||
import type { SiteConfig } from "@/types/config"
|
||||
|
||||
interface DashboardHeaderProps {
|
||||
site: SiteConfig
|
||||
initialTheme: "dark" | "light"
|
||||
}
|
||||
|
||||
export function DashboardHeader({ site, initialTheme }: DashboardHeaderProps) {
|
||||
const [isLight, setIsLight] = useState(initialTheme === "light")
|
||||
|
||||
useEffect(() => {
|
||||
document.documentElement.classList.toggle("theme-light", isLight)
|
||||
}, [isLight])
|
||||
|
||||
useEffect(() => {
|
||||
document.documentElement.classList.toggle(
|
||||
"theme-light",
|
||||
initialTheme === "light"
|
||||
)
|
||||
}, [initialTheme])
|
||||
|
||||
function toggleTheme() {
|
||||
setIsLight((prev) => !prev)
|
||||
}
|
||||
|
||||
return (
|
||||
<header className="mb-12 flex animate-fade-in flex-col gap-4">
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="flex items-center gap-4">
|
||||
{site.logoUrl ? (
|
||||
<img
|
||||
src={site.logoUrl}
|
||||
alt=""
|
||||
className="size-12 rounded-xl object-cover"
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
className="flex size-12 items-center justify-center rounded-xl bg-gradient-to-br from-[#8b5cf6] to-[#6d28d9] text-lg font-bold text-white shadow-lg shadow-[#8b5cf6]/20"
|
||||
aria-hidden="true"
|
||||
>
|
||||
S
|
||||
</div>
|
||||
)}
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-[var(--text-primary)]">
|
||||
{site.name}
|
||||
</h1>
|
||||
<p className="mt-0.5 text-sm text-[var(--text-secondary)]">
|
||||
{site.title}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
{site.description && (
|
||||
<p className="hidden text-sm text-[var(--text-tertiary)] lg:block">
|
||||
{site.description}
|
||||
</p>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={toggleTheme}
|
||||
className="flex size-10 items-center justify-center rounded-lg border transition-colors hover:opacity-80 active:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)] sm:size-9"
|
||||
style={{
|
||||
backgroundColor: "rgba(128,128,128,0.15)",
|
||||
borderColor: "rgba(128,128,128,0.25)",
|
||||
color: "var(--text-tertiary)",
|
||||
}}
|
||||
aria-label={isLight ? "Passer au thème sombre" : "Passer au thème clair"}
|
||||
>
|
||||
{isLight ? (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" />
|
||||
</svg>
|
||||
) : (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<circle cx="12" cy="12" r="4" />
|
||||
<path d="M12 2v2" />
|
||||
<path d="M12 20v2" />
|
||||
<path d="m4.93 4.93 1.41 1.41" />
|
||||
<path d="m17.66 17.66 1.41 1.41" />
|
||||
<path d="M2 12h2" />
|
||||
<path d="M20 12h2" />
|
||||
<path d="m6.34 17.66-1.41 1.41" />
|
||||
<path d="m19.07 4.93-1.41 1.41" />
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{site.description && (
|
||||
<p className="text-sm text-[var(--text-tertiary)] lg:hidden">
|
||||
{site.description}
|
||||
</p>
|
||||
)}
|
||||
</header>
|
||||
)
|
||||
}
|
||||
43
src/components/dashboard/DashboardSection.tsx
Normal file
43
src/components/dashboard/DashboardSection.tsx
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { ServiceCard } from "./ServiceCard"
|
||||
import type { SectionConfig } from "@/types/config"
|
||||
|
||||
interface DashboardSectionProps {
|
||||
section: SectionConfig
|
||||
sectionIndex?: number
|
||||
}
|
||||
|
||||
export function DashboardSection({ section, sectionIndex = 0 }: DashboardSectionProps) {
|
||||
if (section.links.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
aria-labelledby={`section-${section.id}-title`}
|
||||
className="animate-fade-in-up"
|
||||
style={{ animationDelay: `${sectionIndex * 100}ms` }}
|
||||
>
|
||||
<div className="mb-6">
|
||||
<h2
|
||||
id={`section-${section.id}-title`}
|
||||
className="text-lg font-semibold text-[var(--text-primary)]"
|
||||
>
|
||||
{section.title}
|
||||
</h2>
|
||||
{section.description && (
|
||||
<p className="mt-1 text-sm text-[var(--text-secondary)]">{section.description}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 sm:gap-4">
|
||||
{section.links.map((link, index) => (
|
||||
<ServiceCard
|
||||
key={link.id}
|
||||
link={link}
|
||||
index={index}
|
||||
layout={section.cardLayout}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
45
src/components/dashboard/IconRenderer.tsx
Normal file
45
src/components/dashboard/IconRenderer.tsx
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import {
|
||||
Cloud,
|
||||
Film,
|
||||
Music,
|
||||
Gamepad2,
|
||||
Router,
|
||||
Server,
|
||||
House,
|
||||
BookOpen,
|
||||
Calendar,
|
||||
Mail,
|
||||
Shield,
|
||||
Settings,
|
||||
Globe,
|
||||
ExternalLink,
|
||||
type LucideIcon,
|
||||
} from "lucide-react"
|
||||
|
||||
const iconMap: Record<string, LucideIcon> = {
|
||||
Cloud,
|
||||
Film,
|
||||
Music,
|
||||
Gamepad2,
|
||||
Router,
|
||||
Server,
|
||||
House,
|
||||
BookOpen,
|
||||
Calendar,
|
||||
Mail,
|
||||
Shield,
|
||||
Settings,
|
||||
Globe,
|
||||
ExternalLink,
|
||||
}
|
||||
|
||||
interface IconRendererProps {
|
||||
name: string
|
||||
className?: string
|
||||
size?: number
|
||||
}
|
||||
|
||||
export function IconRenderer({ name, className, size = 24 }: IconRendererProps) {
|
||||
const Icon = iconMap[name] || ExternalLink
|
||||
return <Icon className={className} size={size} aria-hidden="true" />
|
||||
}
|
||||
115
src/components/dashboard/ServiceCard.tsx
Normal file
115
src/components/dashboard/ServiceCard.tsx
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
import { IconRenderer } from "./IconRenderer"
|
||||
import type { LinkConfig } from "@/types/config"
|
||||
|
||||
interface ServiceCardProps {
|
||||
link: LinkConfig
|
||||
index?: number
|
||||
layout?: "horizontal" | "vertical"
|
||||
}
|
||||
|
||||
export function ServiceCard({ link, index = 0, layout = "horizontal" }: ServiceCardProps) {
|
||||
const linkProps = link.openInNewTab
|
||||
? { target: "_blank", rel: "noopener noreferrer" }
|
||||
: {}
|
||||
|
||||
const isHorizontal = layout === "horizontal"
|
||||
|
||||
return (
|
||||
<a
|
||||
href={link.url}
|
||||
{...linkProps}
|
||||
className={`group relative flex rounded-xl border border-[var(--border-card)] bg-[var(--bg-card)] backdrop-blur-sm transition-all duration-200 ease-out hover:scale-[1.02] hover:border-[var(--border-card-hover)] hover:bg-[var(--bg-card-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--focus-ring-offset)] ${isHorizontal ? "flex-row items-center gap-3 p-3" : "flex-col gap-3 p-5"}`}
|
||||
style={{ animationDelay: `${index * 50}ms` }}
|
||||
>
|
||||
{isHorizontal ? (
|
||||
<>
|
||||
<div
|
||||
className="flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg"
|
||||
style={{
|
||||
backgroundColor: `${link.color || "#8b5cf6"}20`,
|
||||
color: link.color || "#8b5cf6",
|
||||
}}
|
||||
>
|
||||
{link.iconUrl ? (
|
||||
<img src={link.iconUrl} alt="" className="size-5 object-contain" />
|
||||
) : (
|
||||
<IconRenderer name={link.icon} size={18} />
|
||||
)}
|
||||
</div>
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<span className="truncate text-sm font-semibold text-[var(--text-primary)]">
|
||||
{link.name}
|
||||
</span>
|
||||
{link.description && (
|
||||
<span className="truncate text-xs text-[var(--text-secondary)]">
|
||||
{link.description}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{link.openInNewTab && (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="14"
|
||||
height="14"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
className="shrink-0 text-[var(--text-tertiary)] transition-colors group-hover:text-[var(--text-secondary)]"
|
||||
aria-label="Ouvre dans un nouvel onglet"
|
||||
>
|
||||
<path d="M15 3h6v6" />
|
||||
<path d="M10 14 21 3" />
|
||||
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
|
||||
</svg>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="flex items-start justify-between">
|
||||
<div
|
||||
className="flex size-12 items-center justify-center overflow-hidden rounded-xl"
|
||||
style={{
|
||||
backgroundColor: `${link.color || "#8b5cf6"}20`,
|
||||
color: link.color || "#8b5cf6",
|
||||
}}
|
||||
>
|
||||
{link.iconUrl ? (
|
||||
<img src={link.iconUrl} alt="" className="size-6 object-contain" />
|
||||
) : (
|
||||
<IconRenderer name={link.icon} size={22} />
|
||||
)}
|
||||
</div>
|
||||
{link.openInNewTab && (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="14"
|
||||
height="14"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
className="mt-1 text-[var(--text-tertiary)] transition-colors group-hover:text-[var(--text-secondary)]"
|
||||
aria-label="Ouvre dans un nouvel onglet"
|
||||
>
|
||||
<path d="M15 3h6v6" />
|
||||
<path d="M10 14 21 3" />
|
||||
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
|
||||
</svg>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-col gap-1">
|
||||
<h3 className="text-sm font-semibold text-[var(--text-primary)]">{link.name}</h3>
|
||||
{link.description && (
|
||||
<p className="text-xs text-[var(--text-secondary)]">{link.description}</p>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
38
src/components/ui/ErrorDisplay.tsx
Normal file
38
src/components/ui/ErrorDisplay.tsx
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
interface ErrorDisplayProps {
|
||||
title?: string
|
||||
message: string
|
||||
}
|
||||
|
||||
export function ErrorDisplay({
|
||||
title = "Erreur de configuration",
|
||||
message,
|
||||
}: ErrorDisplayProps) {
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-[var(--bg-primary)] p-8">
|
||||
<div className="max-w-lg rounded-xl border border-red-500/20 bg-red-500/5 p-8 backdrop-blur-sm">
|
||||
<div className="mb-4 flex size-12 items-center justify-center rounded-xl bg-red-500/10 text-red-400">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<line x1="12" x2="12" y1="8" y2="12" />
|
||||
<line x1="12" x2="12.01" y1="16" y2="16" />
|
||||
</svg>
|
||||
</div>
|
||||
<h2 className="mb-2 text-lg font-semibold text-red-400">{title}</h2>
|
||||
<pre className="whitespace-pre-wrap text-sm text-red-300/80">
|
||||
{message}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
23
src/lib/config.ts
Normal file
23
src/lib/config.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { readYamlFile } from "./yaml"
|
||||
import { dashboardConfigSchema } from "./validation"
|
||||
import type { DashboardConfig } from "@/types/config"
|
||||
|
||||
function getDefaultConfigPath(): string {
|
||||
return process.env.CONFIG_PATH || "./config/dashboard.yml"
|
||||
}
|
||||
|
||||
export function loadConfig(configPath?: string): DashboardConfig {
|
||||
const path = configPath || getDefaultConfigPath()
|
||||
|
||||
const raw = readYamlFile(path)
|
||||
const result = dashboardConfigSchema.safeParse(raw)
|
||||
|
||||
if (!result.success) {
|
||||
const issues = result.error.issues
|
||||
.map((i) => ` - ${i.path.join(".")}: ${i.message}`)
|
||||
.join("\n")
|
||||
throw new Error(`Invalid configuration:\n${issues}`)
|
||||
}
|
||||
|
||||
return result.data
|
||||
}
|
||||
50
src/lib/validation.ts
Normal file
50
src/lib/validation.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { z } from "zod"
|
||||
|
||||
const hexColorRegex = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
|
||||
|
||||
export const linkSchema = z.object({
|
||||
id: z.string().min(1, "Link id is required"),
|
||||
name: z.string().min(1, "Link name is required"),
|
||||
description: z.string().optional(),
|
||||
url: z.string().url("Invalid URL").min(1, "URL is required"),
|
||||
icon: z.string().min(1, "Icon name is required"),
|
||||
iconUrl: z.string().url("Invalid icon URL").optional(),
|
||||
color: z.string().regex(hexColorRegex, "Invalid hex color").optional(),
|
||||
openInNewTab: z.boolean().optional().default(true),
|
||||
})
|
||||
|
||||
export const sectionSchema = z.object({
|
||||
id: z.string().min(1, "Section id is required"),
|
||||
title: z.string().min(1, "Section title is required"),
|
||||
description: z.string().optional(),
|
||||
cardLayout: z.enum(["horizontal", "vertical"]).optional().default("horizontal"),
|
||||
links: z.array(linkSchema).default([]),
|
||||
})
|
||||
|
||||
export const themeSchema = z.object({
|
||||
mode: z.enum(["dark", "light"]).default("dark"),
|
||||
accent: z
|
||||
.string()
|
||||
.regex(hexColorRegex, "Invalid accent color")
|
||||
.default("#8b5cf6"),
|
||||
background: z.enum(["gradient", "solid"]).default("gradient"),
|
||||
})
|
||||
|
||||
export const siteSchema = z.object({
|
||||
name: z.string().min(1, "Site name is required"),
|
||||
title: z.string().min(1, "Site title is required"),
|
||||
description: z.string().optional(),
|
||||
favicon: z.string().optional(),
|
||||
logoUrl: z.string().url("Invalid logo URL").optional(),
|
||||
showFooter: z.boolean().optional().default(true),
|
||||
})
|
||||
|
||||
export const dashboardConfigSchema = z.object({
|
||||
site: siteSchema,
|
||||
theme: themeSchema.optional().default({
|
||||
mode: "dark",
|
||||
accent: "#8b5cf6",
|
||||
background: "gradient",
|
||||
}),
|
||||
sections: z.array(sectionSchema).default([]),
|
||||
})
|
||||
14
src/lib/yaml.ts
Normal file
14
src/lib/yaml.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { readFileSync } from "node:fs"
|
||||
import yaml from "yaml"
|
||||
|
||||
export function readYamlFile(path: string): unknown {
|
||||
try {
|
||||
const content = readFileSync(path, "utf-8")
|
||||
return yaml.parse(content)
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw new Error(`Failed to read YAML file: ${error.message}`)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
39
src/types/config.ts
Normal file
39
src/types/config.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
export interface SiteConfig {
|
||||
name: string
|
||||
title: string
|
||||
description?: string
|
||||
favicon?: string
|
||||
logoUrl?: string
|
||||
showFooter?: boolean
|
||||
}
|
||||
|
||||
export interface ThemeConfig {
|
||||
mode: "dark" | "light"
|
||||
accent: string
|
||||
background: "gradient" | "solid"
|
||||
}
|
||||
|
||||
export interface LinkConfig {
|
||||
id: string
|
||||
name: string
|
||||
description?: string
|
||||
url: string
|
||||
icon: string
|
||||
iconUrl?: string
|
||||
color?: string
|
||||
openInNewTab?: boolean
|
||||
}
|
||||
|
||||
export interface SectionConfig {
|
||||
id: string
|
||||
title: string
|
||||
description?: string
|
||||
cardLayout?: "horizontal" | "vertical"
|
||||
links: LinkConfig[]
|
||||
}
|
||||
|
||||
export interface DashboardConfig {
|
||||
site: SiteConfig
|
||||
theme: ThemeConfig
|
||||
sections: SectionConfig[]
|
||||
}
|
||||
Loading…
Reference in a new issue