Samuel Shuert | 4f932df | 2024-09-08 14:04:51 -0400 | [diff] [blame] | 1 | import type { Metadata } from "next"; |
| 2 | import { GeistSans } from "geist/font/sans"; |
| 3 | import { GeistMono } from "geist/font/mono"; |
| 4 | import localFont from "next/font/local"; |
| 5 | import "./globals.css"; |
| 6 | import { Button } from "@/components/ui/button"; |
| 7 | import Link from "next/link"; |
| 8 | import { MonitorIcon, WifiIcon, BluetoothIcon, Volume2Icon } from "lucide-react"; |
| 9 | import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; |
| 10 | import { Separator } from "@/components/ui/separator"; |
| 11 | |
| 12 | |
| 13 | const nf = localFont({ |
| 14 | src: "/fonts/SymbolsNerdFontMono-Regular.ttf", |
| 15 | variable: "--font-nf" |
| 16 | }); |
| 17 | |
| 18 | |
| 19 | export const metadata: Metadata = { |
| 20 | title: "System Settings", |
| 21 | description: "Main system settings page", |
| 22 | }; |
| 23 | |
| 24 | const props = { color: "#FFFFFF" }; |
| 25 | const pages: {link: string, icon: JSX.Element, name: string, tooltip: string, colour: string}[] = [ |
| 26 | { |
| 27 | name: "Wifi", |
| 28 | link: "/wifi", |
| 29 | icon: <WifiIcon {...props} />, |
| 30 | tooltip: "Configure WiFi Networks", |
| 31 | colour: "blue"// Tailwind's blue-500 |
| 32 | }, |
| 33 | { |
| 34 | name: "Bluetooth", |
| 35 | link: "/bluetooth", |
| 36 | icon: <BluetoothIcon {...props} />, |
| 37 | tooltip: "Configure and pair bluetooth devices", |
| 38 | colour: "blue" |
| 39 | }, |
| 40 | { |
| 41 | name: "Sound", |
| 42 | link: "/sound", |
| 43 | icon: <Volume2Icon {...props} />, |
| 44 | tooltip: "Manage inputs and outputs", |
| 45 | colour: "red" |
| 46 | }, |
| 47 | // { |
| 48 | // name: "VPN", |
| 49 | // link: "/bluetooth", |
| 50 | // icon: ... |
| 51 | // tooltip: "Configure and pair bluetooth devices" |
| 52 | // }, |
| 53 | { |
| 54 | name: "Display", |
| 55 | link: "/display", |
| 56 | icon: <MonitorIcon {...props} />, |
| 57 | tooltip: "Modify the layout of your monitors", |
| 58 | colour: "green" |
| 59 | } |
| 60 | ]; |
| 61 | |
| 62 | export default function RootLayout({ |
| 63 | children, |
| 64 | }: Readonly<{ |
| 65 | children: React.ReactNode; |
| 66 | }>) { |
| 67 | return ( |
| 68 | <html lang="en"> |
| 69 | <body |
| 70 | className={`${GeistSans.variable} ${GeistMono.variable} ${nf.variable} antialiased`} |
| 71 | > |
| 72 | <div className={"grid grid-cols-2 h-screen w-screen font-sans"}> |
| 73 | <nav className={"md:w-80 w-fit h-full bg-gray-100 flex flex-col gap-2 p-4 transition ease-in-out duration-75"}> |
| 74 | <div className={"flex flex-row"}> |
| 75 | {/* |
| 76 | For some reason, in dev mode (haven't tried prod), tailwind does not |
| 77 | seem to be able to generate the classes for the colours. |
| 78 | This is a shitty hack that should be removed later. |
| 79 | */} |
| 80 | <p className="bg-red-500">R</p> |
| 81 | <p className="bg-green-500">G</p> |
| 82 | <p className="bg-blue-500">B</p> |
| 83 | </div> |
| 84 | <div className={"w-full bg-white flex flex-col p-1 rounded-md"}> |
| 85 | { pages.map((page, index) => ( |
| 86 | <TooltipProvider key={index}> |
| 87 | <Tooltip> |
| 88 | <TooltipTrigger> |
| 89 | <Link href={page.link}> |
| 90 | <div className="w-full flex flex-row items-center justify-start space-x-4 h-12 px-4"> |
| 91 | <div className={`w-8 h-8 rounded-sm bg-${page.colour}-500 flex items-center justify-center`}> |
| 92 | {page.icon} |
| 93 | </div> |
| 94 | <span className="text-lg text-left text-black">{page.name}</span> |
| 95 | </div> |
| 96 | </Link> |
| 97 | { (index + 1 < pages.length) && <Separator /> } |
| 98 | </TooltipTrigger> |
| 99 | <TooltipContent>{page.tooltip}</TooltipContent> |
| 100 | </Tooltip></TooltipProvider> |
| 101 | ))} |
| 102 | </div> |
| 103 | </nav> |
| 104 | <main>{children}</main> |
| 105 | </div> |
| 106 | </body> |
| 107 | </html> |
| 108 | ); |
| 109 | } |