
-
+
唯知导航
-
+
{onMenuClick && (
}
+ size='large'
onClick={onMenuClick}
aria-label="打开分类菜单"
title="分类菜单"
className="flex items-center justify-center lg:hidden"
- style={{
- fontSize: '18px',
- width: '40px',
- height: '40px',
- }}
/>
)}
@@ -129,38 +117,30 @@ const Header = memo(function Header({ onMenuClick }: HeaderProps) {
}
+ icon={}
+ size='large'
onClick={handleManageClick}
aria-label="打开数据管理页面"
title="数据管理"
className="flex items-center justify-center"
- style={{
- fontSize: '18px',
- width: '40px',
- height: '40px',
- }}
/>
}
+ size='large'
onClick={() => window.open('https://github.com/weizwz/weiz-nav', '_blank', 'noopener,noreferrer')}
aria-label="访问 GitHub 项目地址"
title="GitHub"
className="flex items-center justify-center"
- style={{
- fontSize: '18px',
- width: '40px',
- height: '40px',
- }}
/>
{/* 搜索栏 - 全宽 */}
-
diff --git a/components/layout/SearchBar.tsx b/components/layout/SearchBar.tsx
index ab4df92..8e453a9 100644
--- a/components/layout/SearchBar.tsx
+++ b/components/layout/SearchBar.tsx
@@ -157,8 +157,8 @@ export default function SearchBar() {
return (
}
- className="search-bar-modern"
- style={{
- borderRadius: '24px',
- paddingLeft: '12px',
- }}
+ className="search-bar-modern bg-(--background)! pl-3! shadow-none!"
aria-label="搜索输入框"
role="searchbox"
aria-describedby="search-description"
diff --git a/components/layout/ThemeToggle.tsx b/components/layout/ThemeToggle.tsx
index d3988e9..fb29e0b 100644
--- a/components/layout/ThemeToggle.tsx
+++ b/components/layout/ThemeToggle.tsx
@@ -76,16 +76,12 @@ export default function ThemeToggle() {
:
}
+ size='large'
onClick={toggleTheme}
className="transition-theme flex items-center justify-center"
aria-label={getTooltipTitle()}
role="switch"
aria-checked={isDark}
- style={{
- fontSize: '18px',
- width: '40px',
- height: '40px',
- }}
/>
);
diff --git a/components/management/DataTable.tsx b/components/management/DataTable.tsx
index cc92a15..af93b33 100644
--- a/components/management/DataTable.tsx
+++ b/components/management/DataTable.tsx
@@ -59,18 +59,19 @@ export const DataTable: React.FC
= ({
const categories = useAppSelector((state) => state.categories.items);
// 使用外部传入的 selectedRowKeys 或内部状态
- const selectedRowKeys = externalSelectedRowKeys !== undefined ? externalSelectedRowKeys : internalSelectedRowKeys;
+ const selectedRowKeys =
+ externalSelectedRowKeys !== undefined ? externalSelectedRowKeys : internalSelectedRowKeys;
// 构建树形数据结构
const treeData = useMemo(() => {
const tree: TreeNode[] = [];
// 按分类组织链接
- categories.forEach(category => {
+ categories.forEach((category) => {
const categoryLinks = links
- .filter(link => link.category === category.name)
+ .filter((link) => link.category === category.name)
.sort((a, b) => a.order - b.order)
- .map(link => ({
+ .map((link) => ({
key: link.id,
id: link.id,
name: link.name,
@@ -101,9 +102,9 @@ export const DataTable: React.FC = ({
// 添加未分类节点(如果有未分类的链接)
const uncategorizedLinks = links
- .filter(link => !link.category || link.category === '')
+ .filter((link) => !link.category || link.category === '')
.sort((a, b) => a.order - b.order)
- .map(link => ({
+ .map((link) => ({
key: link.id,
id: link.id,
name: link.name,
@@ -136,16 +137,13 @@ export const DataTable: React.FC = ({
return tree.sort((a, b) => a.order - b.order);
}, [links, categories]);
- // 默认展开所有分类(包括未分类)
+ // 默认展开第一个分类
useEffect(() => {
- const allCategoryKeys = categories.map(cat => `category-${cat.id}`);
- // 如果有未分类链接,也展开未分类节点
- const hasUncategorized = links.some(link => !link.category || link.category === '');
- if (hasUncategorized) {
- allCategoryKeys.push('category-uncategorized');
+ if (categories.length > 0) {
+ const firstCategoryKey = `category-${categories[0].id}`;
+ setExpandedRowKeys([firstCategoryKey]);
}
- setExpandedRowKeys(allCategoryKeys);
- }, [categories, links]);
+ }, [categories]);
// 表格列定义
const columns: ColumnsType = [
@@ -153,25 +151,48 @@ export const DataTable: React.FC = ({
title: '名称',
dataIndex: 'name',
key: 'name',
- width: 160,
+ width: 120,
ellipsis: true,
- render: (name: string, record: TreeNode) => (
-
- {name}
-
- ),
+ render: (name: string, record: TreeNode) =>
+ record.isCategory ? (
+ {name}
+ ) : record.icon ? (
+
+
+

{
+ e.currentTarget.style.display = 'none';
+ }}
+ />
+
+
{name}
+
+ ) : (
+ {name}
+ ),
},
{
title: '地址',
dataIndex: 'url',
key: 'url',
- width: 200,
+ width: 180,
ellipsis: true,
- render: (url: string, record: TreeNode) =>
+ render: (url: string, record: TreeNode) =>
record.isCategory ? (
-
) : url ? (
-
+
{url}
) : null,
@@ -180,9 +201,9 @@ export const DataTable: React.FC = ({
title: '描述',
dataIndex: 'description',
key: 'description',
- width: 300,
+ width: 240,
ellipsis: true,
- render: (description: string, record: TreeNode) =>
+ render: (description: string, record: TreeNode) =>
record.isCategory ? (
共 {record.children?.length || 0} 条链接
) : (
@@ -190,11 +211,11 @@ export const DataTable: React.FC = ({
),
},
{
- title: '背景颜色',
+ title: '背景',
dataIndex: 'backgroundColor',
key: 'backgroundColor',
width: 100,
- render: (color: string, record: TreeNode) =>
+ render: (color: string, record: TreeNode) =>
record.isCategory ? (
-
) : (
@@ -203,14 +224,14 @@ export const DataTable: React.FC = ({
className="w-6 h-6 rounded border border-gray-300"
style={{ backgroundColor: color || '#d9d9d9' }}
/>
- {color || '#d9d9d9'}
+ {color || '#d9d9d9'}
),
},
{
title: '操作',
key: 'action',
- width: 150,
+ width: 120,
fixed: 'right',
render: (_, record: TreeNode) => {
if (record.isCategory) {
@@ -218,7 +239,7 @@ export const DataTable: React.FC
= ({
if (record.id === 'uncategorized') {
return -;
}
-
+
// 分类节点的操作
const category: Category = {
id: record.id,
@@ -228,7 +249,7 @@ export const DataTable: React.FC = ({
createdAt: record.createdAt,
updatedAt: record.updatedAt,
};
-
+
return (
);
}
-
+
// 链接节点的操作
return (
@@ -280,12 +296,7 @@ export const DataTable: React.FC = ({
okText="确定"
cancelText="取消"
>
- }
- size="small"
- >
+ } size="small">
删除
@@ -300,7 +311,7 @@ export const DataTable: React.FC = ({
selectedRowKeys,
onChange: (newSelectedRowKeys: React.Key[]) => {
// 过滤掉分类节点
- const linkKeys = newSelectedRowKeys.filter(key => !String(key).startsWith('category-'));
+ const linkKeys = newSelectedRowKeys.filter((key) => !String(key).startsWith('category-'));
if (onSelectionChange) {
onSelectionChange(linkKeys);
} else {
@@ -321,15 +332,12 @@ export const DataTable: React.FC = ({
rowKey="key"
size="middle"
rowSelection={rowSelection}
- rowClassName={(record) =>
- record.isCategory
- ? 'category-row'
- : ''
- }
+ rowClassName={(record) => (record.isCategory ? 'category-row' : '')}
expandable={{
expandedRowKeys,
+ indentSize: 0,
onExpandedRowsChange: (keys) => setExpandedRowKeys([...keys]),
- defaultExpandAllRows: true,
+ // defaultExpandAllRows: true,
}}
pagination={{
current: currentPage,
@@ -347,7 +355,6 @@ export const DataTable: React.FC = ({
pageSizeOptions: ['10', '20', '50', '100'],
}}
scroll={{ x: 1200 }}
- className="[&_.ant-empty]:z-0 [&_.category-row>td]:bg-blue-50! [&_.category-row>td]:dark:bg-blue-900/30! [&_.category-row:hover>td]:bg-blue-100! [&_.category-row:hover>td]:dark:bg-blue-800/40!"
/>
);
diff --git a/components/modals/EditLinkModal.tsx b/components/modals/EditLinkModal.tsx
index 1825319..3066bf1 100644
--- a/components/modals/EditLinkModal.tsx
+++ b/components/modals/EditLinkModal.tsx
@@ -367,7 +367,34 @@ export const EditLinkModal: React.FC
= ({
-
+
+
+
+
+
+
+ {supportsEyeDropper && (
+ }
+ onClick={handleEyeDropper}
+ title="使用吸管工具选择颜色"
+ />
+ )}
+
+
+
+
+
{/* 预览卡片 */}
@@ -426,33 +453,6 @@ export const EditLinkModal: React.FC = ({
-
-
-
-
-
-
-
- {supportsEyeDropper && (
- }
- onClick={handleEyeDropper}
- title="使用吸管工具选择颜色"
- />
- )}
-
-
-
diff --git a/components/navigation/LinkGrid.tsx b/components/navigation/LinkGrid.tsx
index 39a69e7..c461297 100644
--- a/components/navigation/LinkGrid.tsx
+++ b/components/navigation/LinkGrid.tsx
@@ -160,7 +160,7 @@ const LinkGridBase: React.FC = ({
disabled={!isDraggingEnabled}
>