diff --git a/src/App.tsx b/src/App.tsx index 06d6606..87ba06b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,10 +1,12 @@ import { useMemo } from 'react' import { SidebarProvider, SidebarInset } from '@/components/ui/sidebar' import { TooltipProvider } from '@/components/ui/tooltip' +import { Toaster } from '@/components/ui/toast' import { AppSidebar } from '@/components/layout/app-sidebar' import { AppHeader } from '@/components/layout/app-header' import { OverviewPage } from '@/pages/overview' import { ConnectionsPage } from '@/pages/connections' +import { SettingsPage } from '@/pages/settings' import { useKlalbSSE } from '@/hooks/use-klalb-sse' import { useHashRoute } from '@/hooks/use-hash-route' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' @@ -68,22 +70,27 @@ export function App() { /> )} - {currentTab !== 'overview' && currentTab !== 'connections' && ( -
- - - {currentTab} 模块 - - -

- 该模块即将实现。当前可查看「总览」与「连接」进行实时监控与管理。 -

-
-
-
- )} + {currentTab === 'settings' && } + + {currentTab !== 'overview' && + currentTab !== 'connections' && + currentTab !== 'settings' && ( +
+ + + {currentTab} 模块 + + +

+ 该模块即将实现。当前可查看「总览」、「连接」与「系统配置」进行实时监控与管理。 +

+
+
+
+ )} + ) diff --git a/src/components/ui/field.tsx b/src/components/ui/field.tsx new file mode 100644 index 0000000..887fa2f --- /dev/null +++ b/src/components/ui/field.tsx @@ -0,0 +1,238 @@ +"use client" + +import { useMemo } from "react" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" +import { Label } from "@/components/ui/label" +import { Separator } from "@/components/ui/separator" + +function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) { + return ( +
[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", + className + )} + {...props} + /> + ) +} + +function FieldLegend({ + className, + variant = "legend", + ...props +}: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) { + return ( + + ) +} + +function FieldGroup({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ) +} + +const fieldVariants = cva( + "group/field flex w-full gap-2 data-[invalid=true]:text-destructive", + { + variants: { + orientation: { + vertical: "flex-col *:w-full [&>.sr-only]:w-auto", + horizontal: + "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px", + responsive: + "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px", + }, + }, + defaultVariants: { + orientation: "vertical", + }, + } +) + +function Field({ + className, + orientation = "vertical", + ...props +}: React.ComponentProps<"div"> & VariantProps) { + return ( +
+ ) +} + +function FieldContent({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ) +} + +function FieldLabel({ + className, + ...props +}: React.ComponentProps) { + return ( +