From ae505e6165bfe0f2f3859ddd117b31110e889644 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Tue, 26 Aug 2025 10:46:54 +0800 Subject: [PATCH] Fix: Optimize table style #3221 (#9703) ### What problem does this PR solve? Fix: Optimize table style -Modify the style of the table scrollbar and remove unnecessary scrollbars -Adjust the header style of the table, add background color and hierarchy -Optimize the style of datasets and file tables -Add a new background color variable ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/components/ui/table.tsx | 8 +- web/src/locales/en.ts | 2 +- .../dataset/dataset/dataset-action-cell.tsx | 22 ++++- .../pages/dataset/dataset/dataset-table.tsx | 3 +- web/src/pages/files/action-cell.tsx | 41 ++++++-- web/src/pages/files/files-table.tsx | 96 ++++++++++--------- web/tailwind.config.js | 2 +- web/tailwind.css | 4 + 8 files changed, 113 insertions(+), 65 deletions(-) diff --git a/web/src/components/ui/table.tsx b/web/src/components/ui/table.tsx index 5dd87688a..04ad0a4c8 100644 --- a/web/src/components/ui/table.tsx +++ b/web/src/components/ui/table.tsx @@ -8,7 +8,7 @@ const Table = React.forwardRef< >(({ className, rootClassName, ...props }, ref) => (
@@ -27,7 +27,7 @@ const TableHeader = React.forwardRef< >(({ className, ...props }, ref) => ( )); @@ -67,7 +67,7 @@ const TableRow = React.forwardRef< +
@@ -88,7 +94,8 @@ export function DatasetActionCell({ {isVirtualDocument || ( diff --git a/web/src/pages/dataset/dataset/dataset-table.tsx b/web/src/pages/dataset/dataset/dataset-table.tsx index 1ed05d39a..2182ec2d6 100644 --- a/web/src/pages/dataset/dataset/dataset-table.tsx +++ b/web/src/pages/dataset/dataset/dataset-table.tsx @@ -119,7 +119,7 @@ export function DatasetTable({ return (
- +
{table.getHeaderGroups().map((headerGroup) => ( @@ -144,6 +144,7 @@ export function DatasetTable({ {row.getVisibleCells().map((cell) => ( +
- - {isFolder || ( - )} @@ -89,7 +105,11 @@ export function ActionCell({ documentName={record.name} className="text-text-sub-title-invert" > - @@ -97,7 +117,8 @@ export function ActionCell({ {/* - @@ -118,7 +139,11 @@ export function ActionCell({ */} - diff --git a/web/src/pages/files/files-table.tsx b/web/src/pages/files/files-table.tsx index fee8e687f..5ea00dab9 100644 --- a/web/src/pages/files/files-table.tsx +++ b/web/src/pages/files/files-table.tsx @@ -213,6 +213,7 @@ export function FilesTable({ id: 'actions', header: t('action'), enableHiding: false, + enablePinning: true, cell: ({ row }) => { return ( -
- - {table.getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header) => { - return ( - - {header.isPlaceholder - ? null - : flexRender( - header.column.columnDef.header, - header.getContext(), - )} - - ); - })} - - ))} - - - {loading ? ( - - ) : table.getRowModel().rows?.length ? ( - table.getRowModel().rows.map((row) => ( - - {row.getVisibleCells().map((cell) => ( - - {flexRender(cell.column.columnDef.cell, cell.getContext())} - - ))} + <> +
+
+ + {table.getHeaderGroups().map((headerGroup) => ( + + {headerGroup.headers.map((header) => { + return ( + + {header.isPlaceholder + ? null + : flexRender( + header.column.columnDef.header, + header.getContext(), + )} + + ); + })} - )) - ) : ( - - )} - -
- + ))} + + + {loading ? ( + + ) : table.getRowModel().rows?.length ? ( + table.getRowModel().rows.map((row) => ( + + {row.getVisibleCells().map((cell) => ( + + {flexRender( + cell.column.columnDef.cell, + cell.getContext(), + )} + + ))} + + )) + ) : ( + + )} + + +
)} -
+ ); } diff --git a/web/tailwind.config.js b/web/tailwind.config.js index 631ea2eab..27de063ae 100644 --- a/web/tailwind.config.js +++ b/web/tailwind.config.js @@ -55,7 +55,7 @@ module.exports = { 'input-border': 'var(--input-border)', /* design colors */ - + 'bg-title': 'var(--bg-title)', 'bg-base': 'var(--bg-base)', 'bg-card': 'var(--bg-card)', 'bg-component': 'var(--bg-component)', diff --git a/web/tailwind.css b/web/tailwind.css index c7c9982f8..9df292555 100644 --- a/web/tailwind.css +++ b/web/tailwind.css @@ -91,6 +91,8 @@ --input-border: rgba(22, 22, 24, 0.2); --metallic: #46464a; + + --bg-title: #f6f6f7; /* design colors */ --bg-base: #ffffff; @@ -235,6 +237,8 @@ --input-border: rgba(255, 255, 255, 0.2); --metallic: #fafafa; + + --bg-title: #38383a; /* design colors */ --bg-base: #161618;