🎨 refine sidebar navigation
Browse files at this commitb81a1f0b68ed802d4cc8d3dbffb5ed68048910c5Parent: 7700173- style
- 🎨 refine sidebar navigation
3 changed files +80 -64
- src/components/layout/app-shell.tsx +11 -11
- src/components/layout/side-nav.tsx +24 -25
- src/components/layout/sidebar-account.tsx +45 -28
src/components/layout/app-shell.tsxmodified+11 -11
| @@ -15,7 +15,7 @@ import { useAuth } from "@/stores/auth-context"; | |||
| 15 | import { usePreferences, useT } from "@/stores/preferences-context"; | 15 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| 16 | import { cn } from "@/lib/cn"; | 16 | import { cn } from "@/lib/cn"; |
| 17 | 17 | ||
| 18 | -const SIDEBAR_EXPANDED = "w-56 2xl:w-64"; | 18 | +const SIDEBAR_EXPANDED = "w-52 2xl:w-56"; |
| 19 | const SIDEBAR_COLLAPSED = "w-16"; | 19 | const SIDEBAR_COLLAPSED = "w-16"; |
| 20 | 20 | ||
| 21 | export function AppShell(props: ParentProps) { | 21 | export function AppShell(props: ParentProps) { |
| @@ -74,13 +74,13 @@ export function AppShell(props: ParentProps) { | |||
| 74 | <Show when={auth.user() && !fullScreen()}> | 74 | <Show when={auth.user() && !fullScreen()}> |
| 75 | <aside | 75 | <aside |
| 76 | class={cn( | 76 | class={cn( |
| 77 | - "sticky top-0 z-30 hidden h-screen shrink-0 border-r border-black/[0.06] dark:border-white/[0.08] bg-sidebar/95 backdrop-blur-md transition-[width] duration-200 ease-out lg:flex lg:flex-col", | 77 | + "sticky top-0 z-30 hidden h-screen shrink-0 border-r border-black/[0.06] bg-sidebar/95 text-sidebar-foreground backdrop-blur-md transition-[width] duration-200 ease-out dark:border-white/[0.08] dark:bg-[#070707] dark:text-white lg:flex lg:flex-col", |
| 78 | collapsed() ? SIDEBAR_COLLAPSED : SIDEBAR_EXPANDED, | 78 | collapsed() ? SIDEBAR_COLLAPSED : SIDEBAR_EXPANDED, |
| 79 | )} | 79 | )} |
| 80 | > | 80 | > |
| 81 | <div | 81 | <div |
| 82 | class={cn( | 82 | class={cn( |
| 83 | - "flex shrink-0 items-center gap-2 border-b border-black/[0.05] dark:border-white/[0.06]", | 83 | + "flex shrink-0 items-center gap-2 border-b border-black/[0.05] dark:border-white/[0.08]", |
| 84 | collapsed() ? "h-auto flex-col justify-center gap-1.5 px-2 py-2" : "h-14 px-3", | 84 | collapsed() ? "h-auto flex-col justify-center gap-1.5 px-2 py-2" : "h-14 px-3", |
| 85 | )} | 85 | )} |
| 86 | > | 86 | > |
| @@ -93,14 +93,14 @@ export function AppShell(props: ParentProps) { | |||
| 93 | H | 93 | H |
| 94 | </span> | 94 | </span> |
| 95 | <Show when={!collapsed()}> | 95 | <Show when={!collapsed()}> |
| 96 | - <span class="truncate font-display text-base font-semibold tracking-tight text-foreground 2xl:text-lg">{t("app.name")}</span> | 96 | + <span class="truncate font-display text-base font-semibold tracking-tight text-foreground dark:text-white 2xl:text-lg">{t("app.name")}</span> |
| 97 | </Show> | 97 | </Show> |
| 98 | </Link> | 98 | </Link> |
| 99 | <Button | 99 | <Button |
| 100 | type="button" | 100 | type="button" |
| 101 | variant="ghost" | 101 | variant="ghost" |
| 102 | size="sm" | 102 | size="sm" |
| 103 | - class="h-8 w-8 shrink-0 justify-center rounded-lg px-0 text-muted-foreground hover:bg-secondary hover:text-foreground" | 103 | + class="h-8 w-8 shrink-0 justify-center rounded-md px-0 text-muted-foreground hover:bg-secondary hover:text-foreground dark:text-white/70 dark:hover:bg-white/[0.08] dark:hover:text-white" |
| 104 | aria-label={collapsed() ? t("nav.expand") : t("nav.collapse")} | 104 | aria-label={collapsed() ? t("nav.expand") : t("nav.collapse")} |
| 105 | title={collapsed() ? t("nav.expand") : t("nav.collapse")} | 105 | title={collapsed() ? t("nav.expand") : t("nav.collapse")} |
| 106 | onClick={() => prefs.toggleSidebar()} | 106 | onClick={() => prefs.toggleSidebar()} |
| @@ -109,7 +109,7 @@ export function AppShell(props: ParentProps) { | |||
| 109 | </Button> | 109 | </Button> |
| 110 | </div> | 110 | </div> |
| 111 | 111 | ||
| 112 | - <div class="min-h-0 flex-1 overflow-y-auto overflow-x-hidden pt-4 pb-1"> | 112 | + <div class="min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-1.5 py-2.5"> |
| 113 | <SideNav collapsed={collapsed()} /> | 113 | <SideNav collapsed={collapsed()} /> |
| 114 | </div> | 114 | </div> |
| 115 | 115 | ||
| @@ -125,24 +125,24 @@ export function AppShell(props: ParentProps) { | |||
| 125 | aria-label={t("nav.close")} | 125 | aria-label={t("nav.close")} |
| 126 | onClick={() => setMobileOpen(false)} | 126 | onClick={() => setMobileOpen(false)} |
| 127 | /> | 127 | /> |
| 128 | - <aside class="absolute inset-y-0 left-0 flex w-72 max-w-[85vw] flex-col border-r border-black/[0.08] dark:border-white/[0.1] bg-sidebar/95 backdrop-blur-xl shadow-apple"> | 128 | + <aside class="absolute inset-y-0 left-0 flex w-60 max-w-[85vw] flex-col border-r border-black/[0.08] bg-sidebar/95 text-sidebar-foreground shadow-apple backdrop-blur-xl dark:border-white/[0.08] dark:bg-[#070707] dark:text-white"> |
| 129 | - <div class="flex h-14 shrink-0 items-center justify-between gap-2 border-b border-black/[0.05] dark:border-white/[0.06] px-4"> | 129 | + <div class="flex h-14 shrink-0 items-center justify-between gap-2 border-b border-black/[0.05] px-3 dark:border-white/[0.08]"> |
| 130 | <Link to="/" class="flex min-w-0 items-center gap-2.5" onClick={() => setMobileOpen(false)}> | 130 | <Link to="/" class="flex min-w-0 items-center gap-2.5" onClick={() => setMobileOpen(false)}> |
| 131 | <span class="flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-primary text-xs font-bold text-primary-foreground shadow-apple">H</span> | 131 | <span class="flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-primary text-xs font-bold text-primary-foreground shadow-apple">H</span> |
| 132 | - <span class="truncate font-display text-base font-semibold">{t("app.name")}</span> | 132 | + <span class="truncate font-display text-base font-semibold text-foreground dark:text-white">{t("app.name")}</span> |
| 133 | </Link> | 133 | </Link> |
| 134 | <Button | 134 | <Button |
| 135 | type="button" | 135 | type="button" |
| 136 | variant="ghost" | 136 | variant="ghost" |
| 137 | size="sm" | 137 | size="sm" |
| 138 | - class="h-8 w-8 shrink-0 rounded-lg px-0" | 138 | + class="h-8 w-8 shrink-0 rounded-md px-0 text-muted-foreground hover:bg-secondary hover:text-foreground dark:text-white/70 dark:hover:bg-white/[0.08] dark:hover:text-white" |
| 139 | aria-label={t("nav.close")} | 139 | aria-label={t("nav.close")} |
| 140 | onClick={() => setMobileOpen(false)} | 140 | onClick={() => setMobileOpen(false)} |
| 141 | > | 141 | > |
| 142 | <IconX class="h-4 w-4" /> | 142 | <IconX class="h-4 w-4" /> |
| 143 | </Button> | 143 | </Button> |
| 144 | </div> | 144 | </div> |
| 145 | - <div class="min-h-0 flex-1 overflow-y-auto py-3"> | 145 | + <div class="min-h-0 flex-1 overflow-y-auto px-1.5 py-2.5"> |
| 146 | <SideNav onNavigate={() => setMobileOpen(false)} /> | 146 | <SideNav onNavigate={() => setMobileOpen(false)} /> |
| 147 | </div> | 147 | </div> |
| 148 | <SidebarAccount onLogout={logout} /> | 148 | <SidebarAccount onLogout={logout} /> |
src/components/layout/side-nav.tsxmodified+24 -25
| @@ -29,18 +29,17 @@ function NavLink(props: { | |||
| 29 | title={t(props.item.labelKey)} | 29 | title={t(props.item.labelKey)} |
| 30 | aria-current={active() ? "page" : undefined} | 30 | aria-current={active() ? "page" : undefined} |
| 31 | class={cn( | 31 | class={cn( |
| 32 | - "relative flex h-9 w-full items-center rounded-xl outline-none transition-all duration-200 ease-out active:scale-[0.97] 2xl:h-10", | 32 | + "relative flex h-9 w-full items-center rounded-md outline-none transition-colors duration-150 active:scale-[0.98] 2xl:h-9", |
| 33 | - props.standalone ? "text-xs font-semibold 2xl:text-[13px]" : "text-[13px] font-medium 2xl:text-sm", | 33 | + props.standalone ? "text-sm font-semibold" : "text-[13px] font-medium", |
| 34 | - props.collapsed ? "justify-center px-0 h-10 w-10 mx-auto" : props.standalone ? "gap-2.5 px-3" : "gap-2.5 pl-8 pr-3", | 34 | + props.collapsed ? "mx-auto h-9 w-9 justify-center px-0" : props.standalone ? "gap-2.5 px-2.5" : "gap-2 px-2.5", |
| 35 | active() | 35 | active() |
| 36 | - ? "bg-primary/12 text-primary font-semibold shadow-[inset_0_0_0_1px_hsl(var(--primary)/0.14),0_1px_6px_hsl(var(--primary)/0.08)]" | 36 | + ? props.standalone |
| 37 | - : "text-sidebar-foreground/80 hover:bg-secondary hover:text-foreground", | 37 | + ? "bg-primary/12 font-semibold text-primary dark:bg-white/[0.09] dark:text-white" |
| 38 | + : "font-semibold text-primary dark:text-white" | ||
| 39 | + : "text-sidebar-foreground/80 hover:bg-secondary hover:text-foreground dark:text-white/86 dark:hover:bg-white/[0.07] dark:hover:text-white", | ||
| 38 | )} | 40 | )} |
| 39 | > | 41 | > |
| 40 | - <Show when={active() && !props.collapsed}> | 42 | + <props.item.Icon class={cn(props.standalone || props.collapsed ? "h-4 w-4" : "h-3.5 w-3.5", "shrink-0 transition-colors", active() ? "text-primary dark:text-white" : "text-muted-foreground dark:text-white/55")} /> |
| 41 | - <span class="absolute left-1 top-1/2 h-5 w-1 -translate-y-1/2 rounded-full bg-primary shadow-[0_0_10px_hsl(var(--primary)/0.35)]" /> | ||
| 42 | - </Show> | ||
| 43 | - <props.item.Icon class={cn("h-4 w-4 shrink-0 transition-colors 2xl:h-[18px] 2xl:w-[18px]", active() ? "text-primary" : "text-muted-foreground")} /> | ||
| 44 | <span class={cn("truncate", props.collapsed ? "sr-only" : "block min-w-0 flex-1 text-left")}>{t(props.item.labelKey)}</span> | 43 | <span class={cn("truncate", props.collapsed ? "sr-only" : "block min-w-0 flex-1 text-left")}>{t(props.item.labelKey)}</span> |
| 45 | </Link> | 44 | </Link> |
| 46 | ); | 45 | ); |
| @@ -74,7 +73,7 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | |||
| 74 | 73 | ||
| 75 | return ( | 74 | return ( |
| 76 | <nav class="flex h-full flex-col" aria-label={t("nav.menu")}> | 75 | <nav class="flex h-full flex-col" aria-label={t("nav.menu")}> |
| 77 | - <div class="flex flex-col gap-1 px-2"> | 76 | + <div class="flex flex-col gap-0.5"> |
| 78 | <NavLink item={HOME_ITEM} collapsed={props.collapsed} onNavigate={props.onNavigate} standalone /> | 77 | <NavLink item={HOME_ITEM} collapsed={props.collapsed} onNavigate={props.onNavigate} standalone /> |
| 79 | <For each={visibleGroups()}> | 78 | <For each={visibleGroups()}> |
| 80 | {(group, index) => { | 79 | {(group, index) => { |
| @@ -89,16 +88,16 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | |||
| 89 | when={!props.collapsed} | 88 | when={!props.collapsed} |
| 90 | fallback={ | 89 | fallback={ |
| 91 | <div class="px-2 py-2"> | 90 | <div class="px-2 py-2"> |
| 92 | - <span class="block h-px bg-border" /> | 91 | + <span class="block h-px bg-border dark:bg-white/[0.08]" /> |
| 93 | </div> | 92 | </div> |
| 94 | } | 93 | } |
| 95 | > | 94 | > |
| 96 | <div class="flex items-center gap-2 px-2 pb-1 pt-3"> | 95 | <div class="flex items-center gap-2 px-2 pb-1 pt-3"> |
| 97 | - <span class="h-px flex-1 bg-border" /> | 96 | + <span class="h-px flex-1 bg-border dark:bg-white/[0.08]" /> |
| 98 | - <span class="text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground 2xl:text-[11px]"> | 97 | + <span class="text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground dark:text-white/45 2xl:text-[11px]"> |
| 99 | {t("nav.admin")} | 98 | {t("nav.admin")} |
| 100 | </span> | 99 | </span> |
| 101 | - <span class="h-px flex-1 bg-border" /> | 100 | + <span class="h-px flex-1 bg-border dark:bg-white/[0.08]" /> |
| 102 | </div> | 101 | </div> |
| 103 | </Show> | 102 | </Show> |
| 104 | </Show> | 103 | </Show> |
| @@ -110,19 +109,19 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | |||
| 110 | <button | 109 | <button |
| 111 | type="button" | 110 | type="button" |
| 112 | class={cn( | 111 | class={cn( |
| 113 | - "flex h-8 w-full items-center gap-2 rounded-lg px-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground 2xl:h-9 2xl:text-xs", | 112 | + "flex h-9 w-full items-center gap-2.5 rounded-md px-2.5 text-sm font-semibold text-sidebar-foreground/80 transition-colors duration-150 hover:bg-secondary hover:text-foreground dark:text-white/86 dark:hover:bg-white/[0.07] dark:hover:text-white", |
| 114 | - groupActive() ? "bg-primary/[0.06] text-foreground" : open() && "text-foreground", | 113 | + groupActive() ? "bg-primary/12 text-primary dark:bg-white/[0.09] dark:text-white" : open() && "text-foreground dark:text-white", |
| 115 | )} | 114 | )} |
| 116 | title={t(group.labelKey)} | 115 | title={t(group.labelKey)} |
| 117 | aria-expanded={open()} | 116 | aria-expanded={open()} |
| 118 | onClick={() => toggleGroup(group.id)} | 117 | onClick={() => toggleGroup(group.id)} |
| 119 | > | 118 | > |
| 120 | - <group.Icon class="h-3.5 w-3.5 2xl:h-4 2xl:w-4" /> | 119 | + <group.Icon class="h-4 w-4 text-muted-foreground dark:text-white/55" /> |
| 121 | <span class="min-w-0 flex-1 truncate text-left">{t(group.labelKey)}</span> | 120 | <span class="min-w-0 flex-1 truncate text-left">{t(group.labelKey)}</span> |
| 122 | - <IconChevronRight class={cn("h-3.5 w-3.5 transition-transform duration-150 2xl:h-4 2xl:w-4", open() && "rotate-90")} /> | 121 | + <IconChevronRight class={cn("h-3.5 w-3.5 text-muted-foreground dark:text-white/45 transition-transform duration-150", open() && "rotate-90")} /> |
| 123 | </button> | 122 | </button> |
| 124 | <Show when={open()}> | 123 | <Show when={open()}> |
| 125 | - <div class="mt-1 grid gap-0.5 overflow-hidden transition-all duration-150"> | 124 | + <div class="ml-6 mt-0.5 grid gap-0.5 overflow-hidden border-l border-border pl-2 transition-all duration-150 dark:border-white/[0.12]"> |
| 126 | <For each={group.items}> | 125 | <For each={group.items}> |
| 127 | {(item) => <NavLink item={item} onNavigate={props.onNavigate} />} | 126 | {(item) => <NavLink item={item} onNavigate={props.onNavigate} />} |
| 128 | </For> | 127 | </For> |
| @@ -134,8 +133,8 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | |||
| 134 | <DropdownMenu placement="right-start" gutter={8}> | 133 | <DropdownMenu placement="right-start" gutter={8}> |
| 135 | <DropdownMenuTrigger | 134 | <DropdownMenuTrigger |
| 136 | class={cn( | 135 | class={cn( |
| 137 | - "relative flex h-8 w-full items-center justify-center rounded-md px-0 text-muted-foreground outline-none transition-colors duration-150 hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-[expanded]:bg-muted data-[expanded]:text-foreground", | 136 | + "relative flex h-9 w-full items-center justify-center rounded-md px-0 text-muted-foreground outline-none transition-colors duration-150 hover:bg-secondary hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-[expanded]:bg-secondary data-[expanded]:text-foreground dark:text-white/65 dark:hover:bg-white/[0.08] dark:hover:text-white dark:focus-visible:ring-white/30 dark:data-[expanded]:bg-white/[0.08] dark:data-[expanded]:text-white", |
| 138 | - groupActive() && "bg-primary/10 text-foreground", | 137 | + groupActive() && "bg-primary/12 text-primary dark:bg-white/[0.09] dark:text-white", |
| 139 | )} | 138 | )} |
| 140 | title={t(group.labelKey)} | 139 | title={t(group.labelKey)} |
| 141 | aria-label={t(group.labelKey)} | 140 | aria-label={t(group.labelKey)} |
| @@ -143,8 +142,8 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | |||
| 143 | <group.Icon class="h-3.5 w-3.5" /> | 142 | <group.Icon class="h-3.5 w-3.5" /> |
| 144 | <IconChevronRight class="absolute right-1 h-3 w-3 opacity-55" /> | 143 | <IconChevronRight class="absolute right-1 h-3 w-3 opacity-55" /> |
| 145 | </DropdownMenuTrigger> | 144 | </DropdownMenuTrigger> |
| 146 | - <DropdownMenuContent class="w-56 rounded-lg border-border/80 bg-popover p-1 shadow-soft"> | 145 | + <DropdownMenuContent class="w-52 rounded-lg p-1 shadow-soft dark:border-white/[0.1] dark:bg-[#101010] dark:text-white"> |
| 147 | - <p class="px-2 py-1.5 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground"> | 146 | + <p class="px-2 py-1.5 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground dark:text-white/45"> |
| 148 | {t(group.labelKey)} | 147 | {t(group.labelKey)} |
| 149 | </p> | 148 | </p> |
| 150 | <For each={group.items}> | 149 | <For each={group.items}> |
| @@ -152,14 +151,14 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | |||
| 152 | const itemActive = () => pathActive(pathname(), item.to, item.exact); | 151 | const itemActive = () => pathActive(pathname(), item.to, item.exact); |
| 153 | return ( | 152 | return ( |
| 154 | <DropdownMenuItem | 153 | <DropdownMenuItem |
| 155 | - class={cn("rounded-md p-0", itemActive() && "bg-primary/10 text-foreground")} | 154 | + class={cn("rounded-md p-0 dark:text-white/80 dark:focus:bg-white/[0.08] dark:focus:text-white", itemActive() && "bg-primary/12 text-primary dark:bg-white/[0.09] dark:text-white")} |
| 156 | > | 155 | > |
| 157 | <Link | 156 | <Link |
| 158 | to={item.to} | 157 | to={item.to} |
| 159 | onClick={() => props.onNavigate?.()} | 158 | onClick={() => props.onNavigate?.()} |
| 160 | class="flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 outline-none" | 159 | class="flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 outline-none" |
| 161 | > | 160 | > |
| 162 | - <item.Icon class={cn("h-4 w-4 shrink-0", itemActive() ? "text-primary" : "text-muted-foreground")} /> | 161 | + <item.Icon class={cn("h-4 w-4 shrink-0", itemActive() ? "text-primary dark:text-white" : "text-muted-foreground dark:text-white/55")} /> |
| 163 | <span class="min-w-0 flex-1 truncate">{t(item.labelKey)}</span> | 162 | <span class="min-w-0 flex-1 truncate">{t(item.labelKey)}</span> |
| 164 | </Link> | 163 | </Link> |
| 165 | </DropdownMenuItem> | 164 | </DropdownMenuItem> |
src/components/layout/sidebar-account.tsxmodified+45 -28
| @@ -10,7 +10,7 @@ import { | |||
| 10 | DropdownMenuSeparator, | 10 | DropdownMenuSeparator, |
| 11 | DropdownMenuTrigger, | 11 | DropdownMenuTrigger, |
| 12 | } from "@/components/ui/dropdown-menu"; | 12 | } from "@/components/ui/dropdown-menu"; |
| 13 | -import { IconChevronRight, IconEdit, IconGlobe, IconGuide, IconLogout, IconMoon, IconSun } from "@/components/ui/icons"; | 13 | +import { IconChevronRight, IconGlobe, IconGuide, IconLogout, IconMoon, IconSettings, IconSun } from "@/components/ui/icons"; |
| 14 | import { useAuth } from "@/stores/auth-context"; | 14 | import { useAuth } from "@/stores/auth-context"; |
| 15 | import { usePreferences, useT } from "@/stores/preferences-context"; | 15 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| 16 | import { cn } from "@/lib/cn"; | 16 | import { cn } from "@/lib/cn"; |
| @@ -39,21 +39,21 @@ export function SidebarAccount(props: { collapsed?: boolean; onLogout: () => voi | |||
| 39 | {(u) => { | 39 | {(u) => { |
| 40 | const name = () => displayName(u()); | 40 | const name = () => displayName(u()); |
| 41 | return ( | 41 | return ( |
| 42 | - <div class={cn("shrink-0 border-t border-border/80 p-2", props.collapsed && "px-2 py-2") }> | 42 | + <div class={cn("shrink-0 border-t border-border/80 p-2 dark:border-white/[0.08]", props.collapsed && "px-2 py-2") }> |
| 43 | <DropdownMenu placement="right-end" gutter={8}> | 43 | <DropdownMenu placement="right-end" gutter={8}> |
| 44 | <DropdownMenuTrigger | 44 | <DropdownMenuTrigger |
| 45 | class={cn( | 45 | class={cn( |
| 46 | "flex w-full items-center text-left outline-none transition-colors", | 46 | "flex w-full items-center text-left outline-none transition-colors", |
| 47 | - "focus-visible:ring-2 focus-visible:ring-ring", | 47 | + "focus-visible:ring-2 focus-visible:ring-ring dark:focus-visible:ring-white/30", |
| 48 | props.collapsed | 48 | props.collapsed |
| 49 | - ? "h-11 justify-center rounded-xl px-0 hover:bg-muted/70 data-[expanded]:bg-muted/70" | 49 | + ? "h-11 justify-center rounded-md px-0 text-foreground hover:bg-muted/70 data-[expanded]:bg-muted/70 dark:text-white dark:hover:bg-white/[0.08] dark:data-[expanded]:bg-white/[0.08]" |
| 50 | - : "h-12 gap-2 rounded-xl border border-border/80 bg-card/70 px-2 shadow-sm hover:bg-muted/50 data-[expanded]:bg-muted/50", | 50 | + : "h-12 gap-2 rounded-md px-2 text-foreground hover:bg-muted/70 data-[expanded]:bg-muted/70 dark:text-white dark:hover:bg-white/[0.08] dark:data-[expanded]:bg-white/[0.08]", |
| 51 | )} | 51 | )} |
| 52 | aria-label={t("nav.account")} | 52 | aria-label={t("nav.account")} |
| 53 | > | 53 | > |
| 54 | <span | 54 | <span |
| 55 | class={cn( | 55 | class={cn( |
| 56 | - "flex shrink-0 items-center justify-center rounded-full bg-primary text-[11px] font-bold text-primary-foreground shadow-sm ring-1 ring-border/70", | 56 | + "flex shrink-0 items-center justify-center rounded-full bg-primary/15 text-[11px] font-bold text-primary shadow-sm ring-1 ring-border/70 dark:bg-emerald-100 dark:text-emerald-950 dark:ring-white/20", |
| 57 | props.collapsed ? "h-9 w-9" : "h-8 w-8", | 57 | props.collapsed ? "h-9 w-9" : "h-8 w-8", |
| 58 | )} | 58 | )} |
| 59 | > | 59 | > |
| @@ -62,41 +62,58 @@ export function SidebarAccount(props: { collapsed?: boolean; onLogout: () => voi | |||
| 62 | <Show when={!props.collapsed}> | 62 | <Show when={!props.collapsed}> |
| 63 | <span class="min-w-0 flex-1"> | 63 | <span class="min-w-0 flex-1"> |
| 64 | <span class="block truncate text-[13px] font-semibold leading-4 2xl:text-sm">{name()}</span> | 64 | <span class="block truncate text-[13px] font-semibold leading-4 2xl:text-sm">{name()}</span> |
| 65 | - <span class="block truncate text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground 2xl:text-[11px]"> | 65 | + <span class="block truncate text-[10px] font-medium text-muted-foreground dark:text-white/55 2xl:text-[11px]"> |
| 66 | {t(`role.${u().role}` as MessageKey)} | 66 | {t(`role.${u().role}` as MessageKey)} |
| 67 | </span> | 67 | </span> |
| 68 | </span> | 68 | </span> |
| 69 | - <IconChevronRight class="h-3.5 w-3.5 shrink-0 text-muted-foreground" /> | 69 | + <IconChevronRight class="h-3.5 w-3.5 shrink-0 text-muted-foreground dark:text-white/50" /> |
| 70 | </Show> | 70 | </Show> |
| 71 | </DropdownMenuTrigger> | 71 | </DropdownMenuTrigger> |
| 72 | 72 | ||
| 73 | - <DropdownMenuContent class="w-52 rounded-2xl border-black/[0.08] bg-popover/95 p-1.5 shadow-apple backdrop-blur-xl dark:border-white/[0.12]"> | 73 | + <DropdownMenuContent class="w-72 rounded-xl p-0 shadow-apple dark:border-white/[0.1] dark:bg-[#151515] dark:text-white"> |
| 74 | - <DropdownMenuItem class="rounded-xl gap-2" onSelect={() => setProfileOpen(true)}> | 74 | + <DropdownMenuItem class="m-1.5 gap-2.5 rounded-xl bg-muted/70 p-2.5 focus:bg-muted data-[highlighted]:bg-muted dark:bg-white/[0.08] dark:focus:bg-white/[0.1] dark:data-[highlighted]:bg-white/[0.1]" onSelect={() => setProfileOpen(true)}> |
| 75 | - <IconEdit class="h-4 w-4 shrink-0 text-muted-foreground" /> | 75 | + <span class="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/15 text-sm font-bold text-primary dark:bg-emerald-100 dark:text-emerald-950"> |
| 76 | - <span>{t("profile.edit")}</span> | 76 | + {initials(name())} |
| 77 | + </span> | ||
| 78 | + <span class="min-w-0 flex-1"> | ||
| 79 | + <span class="block truncate text-sm font-semibold">{name()}</span> | ||
| 80 | + <span class="block truncate text-xs text-muted-foreground dark:text-white/60">{u().email || u().username}</span> | ||
| 81 | + </span> | ||
| 77 | </DropdownMenuItem> | 82 | </DropdownMenuItem> |
| 78 | - <DropdownMenuSeparator /> | 83 | + <div class="px-1.5 pb-1.5"> |
| 79 | - <DropdownMenuItem class="rounded-xl gap-2" onSelect={() => prefs.toggleTheme()}> | 84 | + <DropdownMenuItem class="rounded-lg gap-3" onSelect={() => setProfileOpen(true)}> |
| 80 | - <Show when={prefs.theme() === "dark"} fallback={<IconSun class="h-4 w-4 shrink-0 text-muted-foreground" />}> | 85 | + <IconSettings class="h-4 w-4 shrink-0 text-muted-foreground dark:text-white/60" /> |
| 81 | - <IconMoon class="h-4 w-4 shrink-0 text-muted-foreground" /> | 86 | + <span>{t("nav.settings")}</span> |
| 82 | - </Show> | ||
| 83 | - <span class="min-w-0 flex-1">{t("theme.toggle")}</span> | ||
| 84 | - <span class="text-xs text-muted-foreground">{prefs.theme() === "dark" ? t("theme.dark") : t("theme.light")}</span> | ||
| 85 | </DropdownMenuItem> | 87 | </DropdownMenuItem> |
| 86 | - <DropdownMenuItem class="rounded-xl gap-2" onSelect={() => prefs.setLocale(prefs.locale() === "tr" ? "en" : "tr")}> | 88 | + <DropdownMenuItem class="rounded-lg gap-3" onSelect={() => void navigate({ to: "/guide" })}> |
| 87 | - <IconGlobe class="h-4 w-4 shrink-0 text-muted-foreground" /> | 89 | + <IconGuide class="h-4 w-4 shrink-0 text-muted-foreground dark:text-white/60" /> |
| 88 | - <span class="min-w-0 flex-1">{t("lang.label")}</span> | ||
| 89 | - <span class="text-xs text-muted-foreground">{prefs.locale() === "tr" ? "TR" : "EN"}</span> | ||
| 90 | - </DropdownMenuItem> | ||
| 91 | - <DropdownMenuItem class="rounded-xl gap-2" onSelect={() => void navigate({ to: "/guide" })}> | ||
| 92 | - <IconGuide class="h-4 w-4 shrink-0 text-muted-foreground" /> | ||
| 93 | <span>{t("nav.guide")}</span> | 90 | <span>{t("nav.guide")}</span> |
| 94 | </DropdownMenuItem> | 91 | </DropdownMenuItem> |
| 95 | - <DropdownMenuSeparator /> | 92 | + <DropdownMenuItem class="rounded-lg gap-3" onSelect={() => prefs.setLocale(prefs.locale() === "tr" ? "en" : "tr")}> |
| 96 | - <DropdownMenuItem destructive class="rounded-xl gap-2" onSelect={() => void props.onLogout()}> | 93 | + <IconGlobe class="h-4 w-4 shrink-0 text-muted-foreground dark:text-white/60" /> |
| 94 | + <span class="min-w-0 flex-1">{t("lang.label")}</span> | ||
| 95 | + <span class="text-xs text-muted-foreground dark:text-white/55">{prefs.locale() === "tr" ? "TR" : "EN"}</span> | ||
| 96 | + </DropdownMenuItem> | ||
| 97 | + </div> | ||
| 98 | + <DropdownMenuSeparator class="my-0 dark:bg-white/[0.08]" /> | ||
| 99 | + <div class="p-1.5"> | ||
| 100 | + <DropdownMenuItem destructive class="rounded-lg gap-3" onSelect={() => void props.onLogout()}> | ||
| 97 | <IconLogout class="h-4 w-4 shrink-0" /> | 101 | <IconLogout class="h-4 w-4 shrink-0" /> |
| 98 | <span>{t("nav.logout")}</span> | 102 | <span>{t("nav.logout")}</span> |
| 99 | </DropdownMenuItem> | 103 | </DropdownMenuItem> |
| 104 | + </div> | ||
| 105 | + <DropdownMenuSeparator class="my-0 dark:bg-white/[0.08]" /> | ||
| 106 | + <div class="flex items-center justify-between gap-3 p-3"> | ||
| 107 | + <span class="font-semibold">{t("app.name")}</span> | ||
| 108 | + <div class="flex rounded-lg bg-muted p-0.5 dark:bg-white/[0.08]"> | ||
| 109 | + <button type="button" class={cn("rounded-md p-1.5 text-muted-foreground transition-colors hover:text-foreground dark:text-white/60 dark:hover:text-white", prefs.theme() === "light" && "bg-background text-foreground shadow-sm dark:bg-white/[0.12] dark:text-white")} onClick={() => prefs.setTheme("light")} title={t("theme.light")}> | ||
| 110 | + <IconSun class="h-4 w-4" /> | ||
| 111 | + </button> | ||
| 112 | + <button type="button" class={cn("rounded-md p-1.5 text-muted-foreground transition-colors hover:text-foreground dark:text-white/60 dark:hover:text-white", prefs.theme() === "dark" && "bg-background text-foreground shadow-sm dark:bg-white/[0.12] dark:text-white")} onClick={() => prefs.setTheme("dark")} title={t("theme.dark")}> | ||
| 113 | + <IconMoon class="h-4 w-4" /> | ||
| 114 | + </button> | ||
| 115 | + </div> | ||
| 116 | + </div> | ||
| 100 | </DropdownMenuContent> | 117 | </DropdownMenuContent> |
| 101 | </DropdownMenu> | 118 | </DropdownMenu> |
| 102 | </div> | 119 | </div> |