From bb3422d03b1d85177839fe95879c4755fa0e93b7 Mon Sep 17 00:00:00 2001 From: nakrovati <59262179+nakrovati@users.noreply.github.com> Date: Sun, 10 May 2026 05:32:13 +0400 Subject: [PATCH] Migrate shadcn/ui from Radix to Base UI (#115) --- .editorconfig | 13 + README.md | 2 +- .../_components/performance-server-list.tsx | 2 +- app/(dashboard)/site-replication/page.tsx | 14 +- app/(dashboard)/sse/page.tsx | 24 +- app/globals.css | 21 +- components.json | 2 +- components/access-keys/edit-item.tsx | 8 +- components/access-keys/new-item.tsx | 8 +- components/app-sidebar.tsx | 158 +- components/buckets/info.tsx | 4 +- components/buckets/new-form.tsx | 9 +- .../data-table/data-table-pagination.tsx | 2 +- components/datetime-picker.tsx | 42 +- components/dialog-host.tsx | 70 +- components/events/new-form.tsx | 25 +- components/language-switcher.tsx | 12 +- components/lifecycle/new-form.tsx | 26 +- components/links/github.tsx | 2 +- components/links/x.tsx | 2 +- components/object/list.tsx | 24 +- components/object/new-form.tsx | 4 +- components/object/preview-modal.tsx | 3 +- components/object/upload-picker.tsx | 7 +- components/page-header.tsx | 2 +- components/policies/form.tsx | 8 +- components/providers/i18n-provider.tsx | 2 +- components/replication/new-form.tsx | 23 +- components/site-replication/edit-form.tsx | 19 +- components/site-replication/new-form.tsx | 15 +- components/tasks/stats-button.tsx | 2 +- components/theme-switcher.tsx | 12 +- components/top-nav-breadcrumb.tsx | 24 +- components/ui/accordion.tsx | 23 +- components/ui/alert-dialog.tsx | 54 +- components/ui/alert.tsx | 10 +- components/ui/aspect-ratio.tsx | 19 +- components/ui/avatar.tsx | 20 +- components/ui/badge.tsx | 31 +- components/ui/breadcrumb.tsx | 39 +- components/ui/button-group.tsx | 46 +- components/ui/button.tsx | 37 +- components/ui/calendar.tsx | 49 +- components/ui/card.tsx | 10 +- components/ui/carousel.tsx | 16 +- components/ui/chart.tsx | 72 +- components/ui/checkbox.tsx | 9 +- components/ui/collapsible.tsx | 12 +- components/ui/combobox.tsx | 28 +- components/ui/command.tsx | 21 +- components/ui/context-menu.tsx | 164 +- components/ui/dialog.tsx | 57 +- components/ui/direction.tsx | 17 +- components/ui/drawer.tsx | 14 +- components/ui/dropdown-menu.tsx | 238 +-- components/ui/empty.tsx | 12 +- components/ui/field.tsx | 30 +- components/ui/hover-card.tsx | 44 +- components/ui/input-group.tsx | 29 +- components/ui/input-otp.tsx | 8 +- components/ui/input.tsx | 5 +- components/ui/item.tsx | 54 +- components/ui/kbd.tsx | 4 +- components/ui/label.tsx | 7 +- components/ui/menubar.tsx | 167 +- components/ui/native-select.tsx | 18 +- components/ui/navigation-menu.tsx | 88 +- components/ui/pagination.tsx | 27 +- components/ui/popover.tsx | 57 +- components/ui/progress.tsx | 53 +- components/ui/radio-group.tsx | 26 +- components/ui/resizable.tsx | 15 +- components/ui/scroll-area.tsx | 23 +- components/ui/select.tsx | 116 +- components/ui/separator.tsx | 15 +- components/ui/sheet.tsx | 47 +- components/ui/sidebar.tsx | 265 +-- components/ui/skeleton.tsx | 2 +- components/ui/slider.tsx | 59 +- components/ui/switch.tsx | 10 +- components/ui/table.tsx | 11 +- components/ui/tabs.tsx | 27 +- components/ui/textarea.tsx | 2 +- components/ui/toggle-group.tsx | 19 +- components/ui/toggle.tsx | 19 +- components/ui/tooltip.tsx | 54 +- components/user-group/edit-form.tsx | 4 +- components/user-group/new-form.tsx | 4 +- components/user-group/policies.tsx | 28 +- .../user-group/set-policies-multiple.tsx | 7 +- components/user/add-to-group-form.tsx | 4 +- components/user/dropdown.tsx | 56 +- components/user/edit-form.tsx | 8 +- components/user/edit/access-keys.tsx | 16 +- components/user/edit/groups.tsx | 26 +- components/user/edit/policies.tsx | 26 +- components/user/new-form.tsx | 60 +- components/user/notice.tsx | 8 +- components/user/selector.tsx | 26 +- lib/utils.ts | 4 - package.json | 11 +- pnpm-lock.yaml | 1506 +++-------------- 102 files changed, 1862 insertions(+), 2822 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..dbba1c6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + diff --git a/README.md b/README.md index 2abe19d..bdc7f4f 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ A modern, responsive web management console for RustFS distributed file system, ### UI & Styling - **[Tailwind CSS v4](https://tailwindcss.com/)** - Utility-first CSS framework -- **[shadcn/ui](https://ui.shadcn.com/)** - High-quality component library based on Radix UI +- **[shadcn/ui](https://ui.shadcn.com/)** - High-quality component library based on Base UI - **[Remix Icon](https://remixicon.com/)** - Icon library - **[next-themes](https://github.com/pacocoursey/next-themes)** - Theme switching support diff --git a/app/(dashboard)/_components/performance-server-list.tsx b/app/(dashboard)/_components/performance-server-list.tsx index 526094c..a201046 100644 --- a/app/(dashboard)/_components/performance-server-list.tsx +++ b/app/(dashboard)/_components/performance-server-list.tsx @@ -35,7 +35,7 @@ export function PerformanceServerList({ servers, t }: { servers: ServerInfo[]; t - + {servers.map((server, index) => ( diff --git a/app/(dashboard)/site-replication/page.tsx b/app/(dashboard)/site-replication/page.tsx index 1e73862..632a31b 100644 --- a/app/(dashboard)/site-replication/page.tsx +++ b/app/(dashboard)/site-replication/page.tsx @@ -354,12 +354,14 @@ export default function SiteReplicationPage() { return ( - - - + + + {t("Actions")} + + } + /> {peer.name || t("Peer site")} {canManageSites ? ( diff --git a/app/(dashboard)/sse/page.tsx b/app/(dashboard)/sse/page.tsx index 25d0549..5d070e6 100644 --- a/app/(dashboard)/sse/page.tsx +++ b/app/(dashboard)/sse/page.tsx @@ -700,11 +700,13 @@ export default function SSEPage() { {hasConfiguration && ( - - - + + {t("Advanced Actions")} + + } + /> {clearingCache ? t("Clearing cache...") : t("Clear Cache")} @@ -1069,11 +1071,13 @@ export default function SSEPage() {
- - - + + {t("Actions")} + + } + /> setSelectedKeyId(key.key_id)}> {t("View Details")} diff --git a/app/globals.css b/app/globals.css index 6d47136..d0b2354 100644 --- a/app/globals.css +++ b/app/globals.css @@ -7,8 +7,6 @@ @theme inline { --color-background: var(--background); --color-foreground: var(--foreground); - --font-sans: var(--font-sans); - --font-mono: var(--font-geist-mono); --color-sidebar-ring: var(--sidebar-ring); --color-sidebar-border: var(--sidebar-border); --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); @@ -45,11 +43,11 @@ --radius-2xl: calc(var(--radius) + 8px); --radius-3xl: calc(var(--radius) + 12px); --radius-4xl: calc(var(--radius) + 16px); + --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; + --font-heading: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace; } :root { - --background: oklch(1 0 0); - --foreground: oklch(0.145 0 0); --card: oklch(1 0 0); --card-foreground: oklch(0.145 0 0); --popover: oklch(1 0 0); @@ -62,7 +60,7 @@ --muted-foreground: oklch(0.556 0 0); --accent: oklch(0.97 0 0); --accent-foreground: oklch(0.205 0 0); - --destructive: oklch(0.58 0.22 27); + --destructive: oklch(0.577 0.245 27.325); --border: oklch(0.922 0 0); --input: oklch(0.922 0 0); --ring: oklch(0.708 0 0); @@ -71,7 +69,7 @@ --chart-3: oklch(0.546 0.245 262.881); --chart-4: oklch(0.488 0.243 264.376); --chart-5: oklch(0.424 0.199 265.638); - --radius: 0; + --radius: 0.625rem; --sidebar: oklch(0.985 0 0); --sidebar-foreground: oklch(0.145 0 0); --sidebar-primary: oklch(0.205 0 0); @@ -80,8 +78,8 @@ --sidebar-accent-foreground: oklch(0.205 0 0); --sidebar-border: oklch(0.922 0 0); --sidebar-ring: oklch(0.708 0 0); - --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; - --font-geist-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace; + --background: oklch(1 0 0); + --foreground: oklch(0.145 0 0); } .dark { @@ -91,13 +89,13 @@ --card-foreground: oklch(0.985 0 0); --popover: oklch(0.205 0 0); --popover-foreground: oklch(0.985 0 0); - --primary: oklch(0.87 0 0); + --primary: oklch(0.922 0 0); --primary-foreground: oklch(0.205 0 0); --secondary: oklch(0.269 0 0); --secondary-foreground: oklch(0.985 0 0); --muted: oklch(0.269 0 0); --muted-foreground: oklch(0.708 0 0); - --accent: oklch(0.371 0 0); + --accent: oklch(0.269 0 0); --accent-foreground: oklch(0.985 0 0); --destructive: oklch(0.704 0.191 22.216); --border: oklch(1 0 0 / 10%); @@ -125,6 +123,9 @@ body { @apply bg-background text-foreground; } + html { + @apply font-sans; + } } @keyframes fadeInWord { diff --git a/components.json b/components.json index a786b87..00d6fa6 100644 --- a/components.json +++ b/components.json @@ -1,6 +1,6 @@ { "$schema": "https://ui.shadcn.com/schema.json", - "style": "radix-lyra", + "style": "base-lyra", "rsc": true, "tsx": true, "tailwind": { diff --git a/components/access-keys/edit-item.tsx b/components/access-keys/edit-item.tsx index a9ba3fc..0bbd8c4 100644 --- a/components/access-keys/edit-item.tsx +++ b/components/access-keys/edit-item.tsx @@ -100,12 +100,8 @@ export function AccessKeysEditItem({ open, onOpenChange, row, onSuccess }: Acces } return ( - - e.preventDefault()} - onInteractOutside={(e) => e.preventDefault()} - > + + {t("Edit Key")} diff --git a/components/access-keys/new-item.tsx b/components/access-keys/new-item.tsx index 22a1942..6981590 100644 --- a/components/access-keys/new-item.tsx +++ b/components/access-keys/new-item.tsx @@ -147,12 +147,8 @@ export function AccessKeysNewItem({ visible, onVisibleChange, onSuccess, onNotic } return ( - - e.preventDefault()} - onInteractOutside={(e) => e.preventDefault()} - > + + {t("Create Key")} diff --git a/components/app-sidebar.tsx b/components/app-sidebar.tsx index 519a359..e3d3f74 100644 --- a/components/app-sidebar.tsx +++ b/components/app-sidebar.tsx @@ -170,79 +170,95 @@ export function AppSidebar() { {group.map((item) => ( - {hasChildren(item) ? ( - - - - - {getLabel(item)} - - - - - - {item.children!.map((child) => ( - - {isExternal(child) ? ( - - - - {getLabel(child)} - - - - ) : ( - - - - {getLabel(child)} - - - )} - - ))} - - - - ) : ( - - {isExternal(item) ? ( - - - - {getLabel(item)} - - - - ) : ( - - - - {getLabel(item)} - - - )} - - )} - + render={ + hasChildren(item) ? ( + + + + {getLabel(item)} + + + } + /> + + + {item.children!.map((child) => ( + + {isExternal(child) ? ( + + + {getLabel(child)} + + + } + /> + ) : ( + + + {getLabel(child)} + + } + /> + )} + + ))} + + + + ) : ( + + {isExternal(item) ? ( + + + {getLabel(item)} + + + } + /> + ) : ( + + + {getLabel(item)} + + } + /> + )} + + ) + } + /> ))} diff --git a/components/buckets/info.tsx b/components/buckets/info.tsx index b2ca1ce..300aa40 100644 --- a/components/buckets/info.tsx +++ b/components/buckets/info.tsx @@ -802,7 +802,7 @@ export function BucketInfo({ bucketName }: BucketInfoProps) { {t("Encryption Type")} - setEncryptFormType(value ?? "")}> @@ -818,7 +818,7 @@ export function BucketInfo({ bucketName }: BucketInfoProps) { KMS Key ID - setEncryptFormKmsKeyId(value ?? "")}> diff --git a/components/buckets/new-form.tsx b/components/buckets/new-form.tsx index f5bb6a7..2563276 100644 --- a/components/buckets/new-form.tsx +++ b/components/buckets/new-form.tsx @@ -146,13 +146,8 @@ export function BucketNewForm({ show, onShowChange }: BucketNewFormProps) { } return ( - !open && closeModal()}> - e.preventDefault()} - onInteractOutside={(e) => e.preventDefault()} - > + !open && closeModal()} disablePointerDismissal> + {t("Create Bucket")} diff --git a/components/data-table/data-table-pagination.tsx b/components/data-table/data-table-pagination.tsx index 51a4806..58b5a15 100644 --- a/components/data-table/data-table-pagination.tsx +++ b/components/data-table/data-table-pagination.tsx @@ -36,7 +36,7 @@ export function DataTablePagination({
{t("Rows per page")} - handlePageSizeChange(value ?? "")}> diff --git a/components/datetime-picker.tsx b/components/datetime-picker.tsx index baff409..983d445 100644 --- a/components/datetime-picker.tsx +++ b/components/datetime-picker.tsx @@ -110,26 +110,28 @@ export function DateTimePicker({ return (
- - - + + + + {displayValue || placeholder || t("Please select expiry date")} + + + } + /> {displayValue && !disabled ? ( + } + /> + )} + { e.preventDefault() void runDialogAction({ dialogId: dialog.id, pendingIds: pendingDialogIdsRef.current, setPendingIds: setPendingDialogIds, - action: dialog.onNegativeClick, + action: dialog.onPositiveClick, close: () => controller.close(dialog.id), onError: (error) => { console.error(error) @@ -65,37 +95,11 @@ export function DialogHost() { }) }} > - {dialog.negativeText} + {isPending ?