diff --git a/app/globals.css b/app/globals.css index db426f6..97b64d6 100644 --- a/app/globals.css +++ b/app/globals.css @@ -4,10 +4,10 @@ @layer base { body { - @apply bg-background; + @apply bg-background dark:bg-background-dark; font-size: 16px; min-height: 100vh; - color: #1f2937; + @apply text-foreground dark:text-foreground-dark; } } diff --git a/app/layout.tsx b/app/layout.tsx index 7d2582c..e6d38f0 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -2,6 +2,7 @@ import type { Metadata } from "next"; import { Inter } from "next/font/google"; import "./globals.css"; import PWARegister from "@/components/PWARegister"; +import { ThemeProvider } from "@/components/ThemeProvider"; const inter = Inter({ subsets: ["latin"] }); @@ -29,14 +30,21 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - + - {children} - + + {children} + + ); diff --git a/components/ThemeProvider.tsx b/components/ThemeProvider.tsx new file mode 100644 index 0000000..1946dab --- /dev/null +++ b/components/ThemeProvider.tsx @@ -0,0 +1,9 @@ +"use client"; + +import { ThemeProvider as NextThemesProvider } from "next-themes"; +import { type ThemeProviderProps } from "next-themes/dist/types"; + +export function ThemeProvider({ children, ...props }: ThemeProviderProps) { + return {children}; +} + diff --git a/components/ThemeToggle.tsx b/components/ThemeToggle.tsx new file mode 100644 index 0000000..3e60af0 --- /dev/null +++ b/components/ThemeToggle.tsx @@ -0,0 +1,45 @@ +"use client"; + +import { useTheme } from "next-themes"; +import { Moon, Sun } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { useEffect, useState } from "react"; + +export function ThemeToggle() { + const { theme, setTheme } = useTheme(); + const [mounted, setMounted] = useState(false); + + useEffect(() => { + setMounted(true); + }, []); + + if (!mounted) { + return ( + + ); + } + + return ( + + ); +} + diff --git a/components/accueil/WifiCard.tsx b/components/accueil/WifiCard.tsx index 1277386..72c67ef 100644 --- a/components/accueil/WifiCard.tsx +++ b/components/accueil/WifiCard.tsx @@ -71,7 +71,7 @@ export default function WifiCard() { const showPasswordFallback = error && error.includes("sélectionner manuellement"); return ( - + @@ -80,22 +80,22 @@ export default function WifiCard() {
-

Nom du réseau

+

Nom du réseau

{wifiName || "Chargement..."}

{showPasswordFallback && wifiPassword && ( -
-

+

+

{wifiPassword}

)} {error && !showPasswordFallback && ( -
- -

{error}

+
+ +

{error}

)} diff --git a/components/admin/AdminLayout.tsx b/components/admin/AdminLayout.tsx index 521a783..d7c9a9e 100644 --- a/components/admin/AdminLayout.tsx +++ b/components/admin/AdminLayout.tsx @@ -3,6 +3,7 @@ import { LogOut } from "lucide-react"; import { Button } from "@/components/ui/button"; import { useRouter } from "next/navigation"; +import { ThemeToggle } from "@/components/ThemeToggle"; export default function AdminLayout({ children }: { children: React.ReactNode }) { const router = useRouter(); @@ -13,14 +14,17 @@ export default function AdminLayout({ children }: { children: React.ReactNode }) }; return ( -
-
+
+
-

Administration

- +

Administration

+
+ + +
{children}
diff --git a/components/layout/Layout.tsx b/components/layout/Layout.tsx index 47ea130..3a430f7 100644 --- a/components/layout/Layout.tsx +++ b/components/layout/Layout.tsx @@ -2,7 +2,7 @@ import TabNavigation from "./TabNavigation"; export default function Layout({ children }: { children: React.ReactNode }) { return ( -
+
{children}
diff --git a/components/layout/TabNavigation.tsx b/components/layout/TabNavigation.tsx index 4cbb11c..42f629d 100644 --- a/components/layout/TabNavigation.tsx +++ b/components/layout/TabNavigation.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; import { Home, MapPin, Info, Waves } from "lucide-react"; import { cn } from "@/lib/utils"; +import { ThemeToggle } from "@/components/ThemeToggle"; const tabs = [ { @@ -32,7 +33,7 @@ export default function TabNavigation() { const pathname = usePathname(); return ( -