diff --git a/app/(admin)/_components/admin-layout-shell.tsx b/app/(admin)/_components/admin-layout-shell.tsx index 8dc2a86b3..d1a2fccb9 100644 --- a/app/(admin)/_components/admin-layout-shell.tsx +++ b/app/(admin)/_components/admin-layout-shell.tsx @@ -9,7 +9,7 @@ type AdminLayoutShellProps = ComponentProps & { }; function shouldHideSidebarChrome(pathname: string) { - return pathname === "/settings"; + return pathname === "/settings" || pathname.startsWith("/settings/"); } export function AdminLayoutShell({ diff --git a/app/(admin)/settings/_components/admin-settings-navigation.tsx b/app/(admin)/settings/_components/admin-settings-navigation.tsx index 4a08e25a6..bcb82ae70 100644 --- a/app/(admin)/settings/_components/admin-settings-navigation.tsx +++ b/app/(admin)/settings/_components/admin-settings-navigation.tsx @@ -1,16 +1,8 @@ "use client"; import Link from "next/link"; -import { ArrowLeft, ChevronDown } from "lucide-react"; +import { ArrowLeft } from "lucide-react"; import { Button } from "@/components/ui/button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu"; import { Select, SelectContent, @@ -25,7 +17,6 @@ import { Separator } from "@/components/ui/separator"; import { ADMIN_SETTINGS_NAV_GROUPS } from "../_lib/settings-navigation"; import type { AdminSettingsNavGroup, AdminSettingsNavItem } from "../_lib/types"; import { cn } from "@/lib/utils"; -import { SettingStatusBadge } from "./setting-status-badge"; function getActiveGroup(activeTab: string) { return ADMIN_SETTINGS_NAV_GROUPS.find((group) => @@ -33,78 +24,48 @@ function getActiveGroup(activeTab: string) { ); } -function SettingsGroupDropdown({ - activeTab, +function SettingsGroupTab({ group, + isActive, onTabChange, }: { - activeTab: string; group: AdminSettingsNavGroup; + isActive: boolean; onTabChange: (value: string) => void; }) { - const hasActiveTab = group.items.some((item) => item.value === activeTab); + const defaultItem = group.items[0]; + const hasHref = Boolean(defaultItem?.href); + const className = cn( + "h-10 w-full justify-center rounded-2xl border px-4 text-sm font-medium shadow-none transition-colors", + isActive + ? "border-foreground/10 bg-foreground text-background hover:bg-foreground/90 hover:text-background dark:border-white/20 dark:bg-white dark:text-black dark:hover:bg-white/90" + : "border-border/70 bg-zinc-50/80 text-muted-foreground hover:bg-background hover:text-foreground" + ); + + if (!defaultItem) return null; + + if (hasHref) { + return ( + + ); + } return ( - - - - - - -
{group.title}
-
- {group.description} -
-
- - {group.items.map((item) => { - const Icon = item.icon; - const itemContent = ( - <> - -
-
{item.label}
-
- {item.description} -
-
- {item.value === activeTab ? ( - 当前 - ) : null} - - ); - - if (item.href) { - return ( - - {itemContent} - - ); - } - - return ( - onTabChange(item.value)} - > - {itemContent} - - ); - })} -
-
+ ); } @@ -112,28 +73,33 @@ function SettingsQuickAction({ activeTab, item, onTabChange, + stretched = false, }: { activeTab: string; item: AdminSettingsNavItem; onTabChange: (value: string) => void; + stretched?: boolean; }) { const Icon = item.icon; const className = item.value === activeTab ? "border-foreground/10 bg-foreground text-background shadow-sm hover:bg-foreground/90 dark:border-white/20 dark:bg-white dark:text-black dark:hover:bg-white/90" : "border-transparent bg-transparent text-muted-foreground hover:border-border/80 hover:bg-background hover:text-foreground"; + const layoutClassName = stretched + ? "h-10 w-full min-w-0 justify-center gap-2 rounded-2xl border px-4" + : "h-9 shrink-0 gap-2 rounded-full border px-3.5"; if (item.href) { return ( ); @@ -141,13 +107,13 @@ function SettingsQuickAction({ return ( ); } @@ -160,6 +126,10 @@ export function AdminSettingsNavigation({ onTabChange: (value: string) => void; }) { const activeGroup = getActiveGroup(activeTab); + const groupButtons = ADMIN_SETTINGS_NAV_GROUPS.map((group) => ({ + group, + isActive: group.items.some((item) => item.value === activeTab), + })); return (
@@ -229,26 +199,39 @@ export function AdminSettingsNavigation({ -
- {ADMIN_SETTINGS_NAV_GROUPS.map((group) => ( - - ))} +
+
+ {groupButtons.map(({ group, isActive }) => ( + + ))} +
- + - {(activeGroup?.items ?? []).map((item) => ( - - ))} +
+ {(activeGroup?.items ?? []).map((item) => ( + + ))} +