refactor: replace AdminPageHeader with PageShell

Migrate pages to PageShell, add global autofill styles, and update SDK/simulator page logic for server URL and state consistency.
This commit is contained in:
Team Dark Devil committed 2026-11-17 00:24:33 +06:00
1 parent fa4516b078
commit 81c5e4e2fd
24 files changed
+1238 -595

No files matched your search

+45 -9
View File
@@ -1,3 +1,4 @@
import { cn } from '@/lib/utils';
import React from 'react';
export interface SettingsTabItem {
@@ -16,7 +17,7 @@ export function SettingsTabs({
}) {
return (
<div
className="flex overflow-x-auto overflow-y-hidden border-b border-[var(--border)] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
className="flex w-full overflow-x-auto overflow-y-hidden border border-b-0 border-[var(--border)] bg-[var(--surface-2)] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
role="tablist"
aria-label="Settings categories"
>
@@ -28,10 +29,10 @@ export function SettingsTabs({
role="tab"
aria-selected={value === item.id}
aria-controls={`settings-panel-${item.id}`}
className={`shrink-0 border-b-2 px-3 py-1.5 text-[11.5px] transition-colors cursor-pointer whitespace-nowrap ${
className={`shrink-0 border-b-2 border-r border-r-[var(--border)] px-3.5 py-2 text-[11.5px] transition-colors cursor-pointer whitespace-nowrap ${
value === item.id
? 'border-[var(--accent)] text-[var(--text)] font-medium'
: 'border-transparent text-[var(--text-muted)] hover:text-[var(--text)]'
? 'border-b-[var(--accent)] bg-[var(--surface)] text-[var(--text)] font-medium'
: 'border-b-transparent text-[var(--text-muted)] hover:bg-[var(--surface)] hover:text-[var(--text)]'
}`}
onClick={() => onChange(item.id)}
>
@@ -42,6 +43,24 @@ export function SettingsTabs({
);
}
export function SettingsPanel({
children,
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) {
return (
<div
className={cn(
'w-full border border-[var(--border)] bg-[var(--surface)]',
className
)}
{...props}
>
{children}
</div>
);
}
export function SettingsGroup({
title,
children,
@@ -50,11 +69,11 @@ export function SettingsGroup({
children: React.ReactNode;
}) {
return (
<section className="border-b border-[var(--border)] p-3 last:border-b-0">
<h2 className="mb-2 flex items-center gap-1.5 text-[9.5px] uppercase tracking-wider text-[var(--text-faint)]">
<section className="border-b border-[var(--border)] p-3.5 last:border-b-0">
<h2 className="mb-2.5 flex items-center gap-1.5 text-[9.5px] font-medium uppercase tracking-wider text-[var(--text-faint)]">
{title}
</h2>
<div className="flex flex-col gap-1">{children}</div>
<div className="flex flex-col gap-1.5">{children}</div>
</section>
);
}
@@ -67,11 +86,28 @@ export function SettingsField({
children: React.ReactNode;
}) {
return (
<div className="grid grid-cols-1 items-center gap-1.5 py-1.5 sm:grid-cols-[180px_minmax(0,380px)] sm:justify-between sm:gap-4">
<div className="grid grid-cols-1 items-center gap-1.5 py-1 sm:grid-cols-[220px_minmax(0,520px)] sm:justify-start sm:gap-6">
<div className="min-w-0">
<div className="text-[11.5px] leading-snug text-[var(--text)]">{label}</div>
</div>
<div className="min-w-0">{children}</div>
<div className="min-w-0 w-full">{children}</div>
</div>
);
}
export function SettingsFooter({
status,
children,
}: {
status?: React.ReactNode;
children: React.ReactNode;
}) {
return (
<footer className="flex w-full flex-wrap items-center justify-between gap-2 border-t border-[var(--border)] bg-[var(--surface-2)] px-3.5 py-2">
<div className="flex items-center gap-1.5 text-[11px] text-[var(--text-muted)]" role="status">
{status}
</div>
<div className="flex items-center gap-1.5">{children}</div>
</footer>
);
}
+13 -7
View File
@@ -1,3 +1,4 @@
import { cn } from '@/lib/utils';
import type { ReactNode } from 'react';
type Dot = 'ok' | 'off' | 'pending';
@@ -9,17 +10,22 @@ const DOT_CLASS: Record<Dot, string> = {
pending: 'bg-[var(--warning)]',
};
export function StatStrip({ items }: { items: Item[] }) {
export function StatStrip({ items, className }: { items: Item[]; className?: string }) {
return (
<div className="mb-3 grid grid-cols-2 gap-px border border-[var(--border)] bg-[var(--border)] md:grid-cols-4">
<div
className={cn(
'stat-strip mb-3 grid w-full grid-cols-2 gap-px border border-[var(--border)] bg-[var(--border)] md:grid-cols-4',
className
)}
>
{items.map((item) => (
<div key={item.label} className="bg-[var(--surface)] px-3 py-2">
<div className="mb-0.5 text-[9.5px] uppercase tracking-wider text-[var(--text-faint)]">
<div key={item.label} className="min-w-0 bg-[var(--surface)] px-3 py-2">
<div className="mb-0.5 truncate text-[9.5px] uppercase tracking-wider text-[var(--text-faint)]">
{item.label}
</div>
<div className="flex items-center gap-1.5 font-mono text-[15px] font-medium leading-tight tracking-tight tabular-nums text-[var(--text)]">
{item.dot && <span aria-hidden="true" className={`h-1.5 w-1.5 ${DOT_CLASS[item.dot]}`} />}
{item.value}
<div className="flex min-w-0 items-center gap-1.5 font-mono text-[15px] font-medium leading-tight tracking-tight tabular-nums text-[var(--text)]">
{item.dot && <span aria-hidden="true" className={`h-1.5 w-1.5 shrink-0 ${DOT_CLASS[item.dot]}`} />}
<span className="truncate">{item.value}</span>
</div>
</div>
))}
+4 -4
View File
@@ -8,7 +8,7 @@ export const TableWrap: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({
}) => (
<div
className={cn(
'w-full overflow-x-auto border border-[var(--border)] bg-[var(--bg-elevated)]',
'w-full overflow-x-auto border border-[var(--border)] bg-[var(--surface)]',
className
)}
{...props}
@@ -40,7 +40,7 @@ export const TableHeader: React.FC<React.HTMLAttributes<HTMLTableSectionElement>
}) => (
<thead
className={cn(
'bg-[var(--bg-sidebar)] border-b border-[var(--border)] text-[10px] font-medium tracking-wider text-[var(--text-muted)] uppercase',
'border-b border-[var(--border)] bg-[var(--surface-2)] text-[10px] font-medium uppercase tracking-wider text-[var(--text-muted)]',
className
)}
{...props}
@@ -62,7 +62,7 @@ export const TableRow: React.FC<React.HTMLAttributes<HTMLTableRowElement>> = ({
}) => (
<tr
className={cn(
'transition-colors hover:bg-[var(--bg-hover)] text-[var(--text)]',
'text-[var(--text)] transition-colors hover:bg-[var(--bg-hover)]',
className
)}
{...props}
@@ -86,7 +86,7 @@ export const TableCell: React.FC<React.TdHTMLAttributes<HTMLTableCellElement>> =
children,
...props
}) => (
<td className={cn('px-3 py-1.5 text-[var(--text-muted)] align-middle', className)} {...props}>
<td className={cn('px-3 py-1.5 align-middle text-[var(--text-muted)]', className)} {...props}>
{children}
</td>
);