feat(webui): split overview into a processes page + mobile/ultrawide pass

The homepage was doing double duty — monitoring + injection control. Split it:

- New /processes page ("进程注入", sidebar #2) owns the QQ-process control
  surface (load / unload / refresh / probe-login + its dialogs). Overview is
  now a read-only dashboard: stats, host metrics, online accounts, plus a
  read-only injection-summary tile (online / loadable, links to /processes)
  and a first-run CTA that points at /processes while nothing is online.
  Route + AppPath + nav item wired; state/polling stay layout-owned.

Responsive + a11y pass:
- Mobile sidebar Sheet gets an sr-only title + description, fixing the Radix
  "DialogContent requires a DialogTitle" accessibility error.
- Log rows stack on phones (meta line + full-width message) instead of a
  ~40px column that broke every few chars; time parses defensively so a
  non-ISO value never renders "Invalid Date".
- Process cards stack on phones (info row + actions row) so name / PID / path
  stop collapsing to "Q.."; the status badge no longer wraps.
- Config tab strip scrolls horizontally on phones instead of wrapping to
  three rows; account strip defaults collapsed ≤lg; header buttons wrap.
- Dialogs keep a 1rem gutter on tiny screens via w-[calc(100vw-2rem)].
- Content widens to 1600px on ≥2xl; account/process grids gain a column at
  2xl so >1700px screens aren't mostly empty gutter.
This commit is contained in:
DrSmoothl committed 2026-05-30 16:56:34 +08:00
1 parent 3cfac51811
commit 71be3ae2e1
9 files changed
+369 -245

No files matched your search

@@ -21,6 +21,13 @@ const levelClass: Record<LogLevel, string> = {
const LEVELS: LogLevel[] = ['debug', 'info', 'success', 'warn', 'error'];
/** Show a locale time when the backend sends an ISO timestamp (it does);
* fall back to the raw string otherwise so we never render "Invalid Date". */
function formatTime(t: string): string {
const d = new Date(t);
return Number.isNaN(d.getTime()) ? t : d.toLocaleTimeString();
}
export function LogsPage() {
const api = useApi();
const [logs, setLogs] = useState<LogEntry[]>([]);
@@ -205,16 +212,19 @@ export function LogsPage() {
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.12 }}
className="flex gap-2 whitespace-pre-wrap px-3 py-0.5 leading-5 hover:bg-accent/30"
className="flex flex-col gap-0.5 px-3 py-1 leading-5 hover:bg-accent/30 sm:flex-row sm:gap-2 sm:py-0.5"
>
<span className="shrink-0 text-muted-foreground tabular-nums">
{new Date(log.time).toLocaleTimeString()}
</span>
<span className={cn('w-14 shrink-0 font-semibold', levelClass[log.level])}>
{log.level.toUpperCase()}
</span>
<span className="w-28 shrink-0 truncate text-muted-foreground">[{log.scope}]</span>
<span className="break-all">{log.message}</span>
{/* Meta drops to its own line on phones so the message gets
the full width instead of a ~40px column that breaks
every few characters. On sm+ it's the dense single row. */}
<div className="flex shrink-0 items-center gap-2">
<span className="shrink-0 text-muted-foreground tabular-nums">{formatTime(log.time)}</span>
<span className={cn('shrink-0 font-semibold sm:w-14', levelClass[log.level])}>
{log.level.toUpperCase()}
</span>
<span className="min-w-0 truncate text-muted-foreground sm:w-28">[{log.scope}]</span>
</div>
<span className="min-w-0 whitespace-pre-wrap break-all">{log.message}</span>
</motion.div>
))
)}