import { isSameUrl } from '@/lib/utils'; import { edit } from '@/routes/profile'; import { Link } from '@inertiajs/react'; import { type InertiaLinkProps } from '@inertiajs/react'; import { Box, Button, Stack, Text, Title } from '@mantine/core'; import { IconUserCircle, type IconProps } from '@tabler/icons-react'; import { type FC, type PropsWithChildren } from 'react'; type SettingsNavItem = { title: string; href: NonNullable; icon: FC; }; const sidebarNavItems: SettingsNavItem[] = [ { title: 'Profile', href: edit(), icon: IconUserCircle, }, ]; export default function SettingsLayout({ children }: PropsWithChildren) { if (typeof window === 'undefined') { return null; } const currentPath = window.location.pathname; return ( Settings Manage your profile and account settings. ({ display: 'flex', alignItems: 'flex-start', gap: theme.spacing.xl, [theme.fn.smallerThan('sm')]: { flexDirection: 'column', }, })} > ({ width: 180, flexShrink: 0, [theme.fn.smallerThan('sm')]: { width: '100%', }, })} > {sidebarNavItems.map((item) => { const Icon = item.icon; const active = isSameUrl(currentPath, item.href); return ( ); })} ({ flex: 1, minWidth: 0, maxWidth: 640, [theme.fn.smallerThan('sm')]: { maxWidth: '100%', width: '100%', }, })} > {children} ); }