From 5645645c5fbac7f00195a29267a5f1f1b4865418 Mon Sep 17 00:00:00 2001 From: lonelyhentxi Date: Thu, 1 May 2025 20:49:42 +0800 Subject: [PATCH] fix: fix table horizontal scroll and collapsed sidebar --- apps/webui/graphql-codegen.ts | 3 + .../src/components/detail-card-skeleton.tsx | 32 ++ apps/webui/src/components/layout/nav-main.tsx | 134 +++++--- .../src/components/ui/detail-empty-view.tsx | 18 ++ apps/webui/src/components/ui/sidebar.tsx | 8 +- .../domains/recorder/schema/credential3rd.ts | 25 ++ apps/webui/src/infra/graphql/gql/gql.ts | 6 + apps/webui/src/infra/graphql/gql/graphql.ts | 72 +++-- apps/webui/src/infra/routes/nav.ts | 4 +- apps/webui/src/infra/styles/context.ts | 7 +- apps/webui/src/infra/styles/theme.service.ts | 39 ++- .../src/presentation/hooks/use-mobile.ts | 30 +- apps/webui/src/presentation/routeTree.gen.ts | 29 +- .../routes/_app/credential3rd/create.tsx | 19 +- .../routes/_app/credential3rd/detail.$id.tsx | 215 ++++++++++++- .../routes/_app/credential3rd/edit.$id.tsx | 292 ++++++++++++++++++ .../routes/_app/credential3rd/manage.tsx | 37 ++- .../routes/auth/oidc/callback.tsx | 6 +- biome.json | 7 + 19 files changed, 849 insertions(+), 134 deletions(-) create mode 100644 apps/webui/src/components/detail-card-skeleton.tsx create mode 100644 apps/webui/src/components/ui/detail-empty-view.tsx create mode 100644 apps/webui/src/presentation/routes/_app/credential3rd/edit.$id.tsx diff --git a/apps/webui/graphql-codegen.ts b/apps/webui/graphql-codegen.ts index f0112eb..4c60969 100644 --- a/apps/webui/graphql-codegen.ts +++ b/apps/webui/graphql-codegen.ts @@ -10,6 +10,9 @@ const config: CodegenConfig = { presetConfig: { gqlTagName: 'gql', }, + config: { + enumsAsConst: true, + }, }, }, }; diff --git a/apps/webui/src/components/detail-card-skeleton.tsx b/apps/webui/src/components/detail-card-skeleton.tsx new file mode 100644 index 0000000..0f44d96 --- /dev/null +++ b/apps/webui/src/components/detail-card-skeleton.tsx @@ -0,0 +1,32 @@ +import { Card, CardContent, CardHeader } from './ui/card'; +import { Skeleton } from './ui/skeleton'; + +export function DetailCardSkeleton() { + return ( +
+
+
+ +
+ + +
+
+ + + + + + + {Array.from({ length: 6 }).map((_, i) => ( +
+ + +
+ ))} +
+
+
+
+ ); +} diff --git a/apps/webui/src/components/layout/nav-main.tsx b/apps/webui/src/components/layout/nav-main.tsx index 45209b0..1afa4a5 100644 --- a/apps/webui/src/components/layout/nav-main.tsx +++ b/apps/webui/src/components/layout/nav-main.tsx @@ -7,6 +7,14 @@ import { CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible'; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from '@/components/ui/dropdown-menu'; +import { ProLink, type ProLinkProps } from '@/components/ui/pro-link'; import { SidebarGroup, SidebarGroupLabel, @@ -16,9 +24,9 @@ import { SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, + useSidebar, } from '@/components/ui/sidebar'; import { useMatches } from '@tanstack/react-router'; -import { ProLink, type ProLinkProps } from '../ui/pro-link'; export interface NavMainItem { link?: ProLinkProps; @@ -38,6 +46,7 @@ export function NavMain({ groups: NavMainGroup[]; }) { const matches = useMatches(); + const { state } = useSidebar(); const isMenuMatch = (link: ProLinkProps | undefined) => { const linkTo = link?.to; @@ -50,13 +59,84 @@ export function NavMain({ const renderSidebarMenuItemButton = (item: NavMainItem) => { return ( <> - {item.icon && } - {item.title} + {item.icon &&