diff --git a/src/app/(root)/allocationStatus/page.tsx b/src/app/(root)/allocationStatus/page.tsx index 8610f1e..be72405 100644 --- a/src/app/(root)/allocationStatus/page.tsx +++ b/src/app/(root)/allocationStatus/page.tsx @@ -12,6 +12,7 @@ import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { Button } from '@/components/ui/button' import { ArrowUpDown, ArrowUp, ArrowDown } from 'lucide-react' +import { Page } from '@/components/page' const filterSchema = z.object({ timeFilter: z.string(), @@ -139,9 +140,8 @@ export default function AllocationStatus({ detailed = false }: { detailed?: bool if (error) return return ( -
-

节点分配状态

- + +

节点分配状态

@@ -173,69 +173,48 @@ export default function AllocationStatus({ detailed = false }: { detailed?: bool
-
-
- - - - handleSort('city')} - > -
- 城市 - {renderSortIcon('city')} -
-
- handleSort('count')} - > -
- 可用IP量 - {renderSortIcon('count')} -
-
- handleSort('assigned')} - > -
- 分配IP量 - {renderSortIcon('assigned')} -
-
- handleSort('overage')} - > -
- 超额量 - {renderSortIcon('overage')} -
-
+
+ + + 城市 + handleSort('count')}> +
+ 可用IP量 + {renderSortIcon('count')} +
+
+ handleSort('assigned')}> +
+ 分配IP量 + {renderSortIcon('assigned')} +
+
+ handleSort('overage')}> +
+ 超额量 + {renderSortIcon('overage')} +
+
+
+
+ + {sortedData.map((item, index) => { + const overage = calculateOverage(Number(item.assigned), Number(item.count)) + return ( + + {item.city} + {item.count} + {item.assigned} + + 0 ? 'text-red-600 font-medium' : ''}> + {overage} + + - - - {sortedData.map((item, index) => { - const overage = calculateOverage(Number(item.assigned), Number(item.count)) - return ( - - {item.city} - {item.count} - {item.assigned} - - 0 ? 'text-red-600 font-medium' : ''}> - {overage} - - - - ) - })} - -
-
-
-
+ ) + })} + + + ) } diff --git a/src/app/(root)/cityNodeStats/page.tsx b/src/app/(root)/cityNodeStats/page.tsx index a804b36..baed55d 100644 --- a/src/app/(root)/cityNodeStats/page.tsx +++ b/src/app/(root)/cityNodeStats/page.tsx @@ -3,6 +3,7 @@ import { useEffect, useState } from 'react' import { Table, TableHeader, TableBody, TableHead, TableRow, TableCell } from '@/components/ui/table' import { getCityNodeCount, type CityNode } from '@/actions/stats' +import { Page } from '@/components/page' export default function CityNodeStats() { const [data, setData] = useState([]) @@ -38,7 +39,7 @@ export default function CityNodeStats() { } return ( -
+

城市节点数量分布

@@ -46,39 +47,28 @@ export default function CityNodeStats() {
-
-
- - - - 城市 - 节点数量 - Hash - 标签 - 轮换顺位 - - - - {data.map((item, index) => ( - - {item.city} - {item.count} - {item.hash} - - - {item.label || '无标签'} - - - {item.offset} - - ))} - -
-
-
-
+ + + + 城市 + 节点数量 + Hash + 标签 + 轮换顺位 + + + + {data.map((item, index) => ( + + {item.city} + {item.count} + {item.hash} + {item.label} + {item.offset} + + ))} + +
+ ) } diff --git a/src/app/(root)/layout.tsx b/src/app/(root)/layout.tsx index 60f50d6..b53da0a 100644 --- a/src/app/(root)/layout.tsx +++ b/src/app/(root)/layout.tsx @@ -3,7 +3,7 @@ import { ReactNode, useState } from 'react' import { useRouter, usePathname } from 'next/navigation' import { logout } from '@/actions/auth' -import { LogOut } from 'lucide-react' +import { LogOutIcon } from 'lucide-react' import Link from 'next/link' export default function DashboardLayout({ @@ -37,47 +37,45 @@ export default function DashboardLayout({ } return ( -
+
+ {/* 顶部导航栏 */} - + {/* 主要内容区域 */} -
+
{/* 侧边栏 */} -
- -
+ {/* 内容区域 */} -
+
{children} -
+
) diff --git a/src/components/page.tsx b/src/components/page.tsx new file mode 100644 index 0000000..a90d01a --- /dev/null +++ b/src/components/page.tsx @@ -0,0 +1,11 @@ +import { ComponentProps, ReactNode } from 'react' + +export function Page(props: { + children: ReactNode +} & ComponentProps<'div'>) { + return ( +
+ {props.children} +
+ ) +} diff --git a/src/components/ui/table.tsx b/src/components/ui/table.tsx index 7ea8f6f..f3fd9d7 100644 --- a/src/components/ui/table.tsx +++ b/src/components/ui/table.tsx @@ -8,11 +8,11 @@ function Table({ className, ...props }: React.ComponentProps<'table'>) { return (
@@ -23,7 +23,7 @@ function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) { return ( ) @@ -57,7 +57,7 @@ function TableRow({ className, ...props }: React.ComponentProps<'tr'>) { ) { data-slot="table-head" className={cn( 'text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]', + 'text-sm text-gray-500', className, )} {...props}