- rebuild the public site on the Next.js App Router with static export, per-section SEO pages, metadata, sitemap, robots and a generated OG image - add full-screen scroll-snap regions, staged scroll reveals, a hash-free tab navigation with a sliding indicator and region-by-region menu scrolling - replace the theme text toggle with animated sun/moon icons - restructure the CRM API into config, middleware, models, routes, services and utils layers - redesign the CRM shell with a single surface, tab rail, full-width blurred DataTable, record dialogs and mask-based icons - update Docker/Nginx publishing, Makefile targets, shared UI polish and docs
66 lines
2.7 KiB
TypeScript
66 lines
2.7 KiB
TypeScript
"use client";
|
|
|
|
import { useLanguage } from "../contexts/LanguageContext";
|
|
import { useTheme } from "../contexts/ThemeContext";
|
|
|
|
/**
|
|
* Soleil et lune au trait fin, avec une étoile : la bascule de thème prend le
|
|
* vocabulaire « spatial » du reste du site plutôt qu'un libellé texte.
|
|
*
|
|
* Le CSS de `globals.css` décide laquelle est visible selon `.dark` (posé avant
|
|
* le premier rendu par le script anti-FOUC), donc aucun flash d'icône.
|
|
*/
|
|
const SunIcon = () => (
|
|
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true" className="size-[18px]">
|
|
<circle cx="12" cy="12" r="3.6" stroke="currentColor" strokeWidth="1.5" />
|
|
<circle cx="12" cy="12" r="1" fill="currentColor" />
|
|
<g stroke="currentColor" strokeWidth="1.5" strokeLinecap="round">
|
|
<path d="M12 2.75v1.9M12 19.35v1.9M2.75 12h1.9M19.35 12h1.9M5.45 5.45l1.35 1.35M17.2 17.2l1.35 1.35M18.55 5.45l-1.35 1.35M6.8 17.2l-1.35 1.35" />
|
|
</g>
|
|
<path
|
|
d="M19.4 2.6l.45 1.05 1.05.45-1.05.45-.45 1.05-.45-1.05-1.05-.45 1.05-.45Z"
|
|
fill="currentColor"
|
|
opacity=".8"
|
|
/>
|
|
</svg>
|
|
);
|
|
|
|
const MoonIcon = () => (
|
|
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true" className="size-[18px]">
|
|
<path
|
|
d="M20.2 14.6A8.6 8.6 0 0 1 9.4 3.8 8.6 8.6 0 1 0 20.2 14.6Z"
|
|
stroke="currentColor"
|
|
strokeWidth="1.5"
|
|
strokeLinejoin="round"
|
|
/>
|
|
<path
|
|
d="M17.6 4.1l.4.95.95.4-.95.4-.4.95-.4-.95-.95-.4.95-.4Z"
|
|
fill="currentColor"
|
|
/>
|
|
<circle cx="21" cy="8.6" r=".7" fill="currentColor" />
|
|
</svg>
|
|
);
|
|
|
|
export const ThemeToggle = () => {
|
|
const { t } = useLanguage();
|
|
const { theme, toggleTheme } = useTheme();
|
|
const label = t(theme === "dark" ? "theme.light" : "theme.dark");
|
|
|
|
return (
|
|
<button
|
|
type="button"
|
|
onClick={toggleTheme}
|
|
aria-label={label}
|
|
title={label}
|
|
className="group relative inline-flex h-8 w-8 items-center justify-center rounded-full border border-border/70 bg-surface/40 text-muted-foreground transition-[color,background-color,border-color,box-shadow] duration-fast ease-out-soft hover:border-accent/50 hover:bg-accent/10 hover:text-accent hover:shadow-[0_0_20px_-6px_var(--color-accent)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-none"
|
|
>
|
|
<span className="theme-icon theme-icon-sun absolute inset-0 flex items-center justify-center transition-[opacity,transform] duration-500 ease-out-soft">
|
|
<SunIcon />
|
|
</span>
|
|
<span className="theme-icon theme-icon-moon absolute inset-0 flex items-center justify-center transition-[opacity,transform] duration-500 ease-out-soft">
|
|
<MoonIcon />
|
|
</span>
|
|
</button>
|
|
);
|
|
};
|