feat(webui): apply Apple-style polish to processes + config pages
Carry the logs/settings visual language across the remaining pages: - Processes: sort control becomes a segmented radiogroup; action banner gains a spinner; cards round to xl with a hover tint; calmer empty state. - Config: save status collapses from bordered pills into one inline dot/spinner indicator; node summary rows round to xl with hover and fold the three flag badges into a single muted "数组 · 不上报自身 · 已设 Token" line; empty states round to xl; account rail rounds to xl. Presentational only — all state wiring and handlers unchanged.
This commit is contained in:
@@ -35,7 +35,7 @@ export function AccountSidebar({
|
||||
<motion.aside
|
||||
animate={{ width: collapsed ? 56 : 248 }}
|
||||
transition={{ type: 'spring', stiffness: 300, damping: 32 }}
|
||||
className="shrink-0 rounded-lg border bg-card/40"
|
||||
className="shrink-0 rounded-xl border bg-card/40"
|
||||
>
|
||||
<div className={cn('flex items-center', collapsed ? 'justify-center px-1.5 py-2' : 'justify-between px-3 py-2')}>
|
||||
{!collapsed && <span className="text-xs font-medium text-muted-foreground">在线连接</span>}
|
||||
|
||||
@@ -54,7 +54,7 @@ export function NodeSummaryCard<T extends AdapterCommon>({
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.18 }}
|
||||
className={cn(
|
||||
'flex flex-col gap-2 rounded-lg border bg-card/40 p-3 transition-opacity sm:flex-row sm:items-center sm:gap-3',
|
||||
'flex flex-col gap-2 rounded-xl border bg-card/40 p-3.5 transition-all hover:bg-accent/20 sm:flex-row sm:items-center sm:gap-3',
|
||||
!enabled && 'opacity-60',
|
||||
)}
|
||||
>
|
||||
@@ -79,22 +79,12 @@ export function NodeSummaryCard<T extends AdapterCommon>({
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-0.5 truncate font-mono text-xs text-muted-foreground tabular-nums">{summary}</div>
|
||||
<div className="mt-1.5 flex flex-wrap items-center gap-1.5">
|
||||
<Badge variant="outline" className="font-normal">
|
||||
{item.messageFormat === 'string' ? 'CQ 码' : '数组'}
|
||||
</Badge>
|
||||
<Badge variant="outline" className="font-normal">
|
||||
{item.reportSelfMessage ? '上报自身' : '不上报自身'}
|
||||
</Badge>
|
||||
{item.accessToken ? (
|
||||
<Badge variant="outline" className="font-normal">
|
||||
已设 Token
|
||||
</Badge>
|
||||
) : (
|
||||
<Badge variant="outline" className="font-normal text-muted-foreground">
|
||||
无 Token
|
||||
</Badge>
|
||||
)}
|
||||
<div className="mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-muted-foreground">
|
||||
<span>{item.messageFormat === 'string' ? 'CQ 码' : '数组'}</span>
|
||||
<span aria-hidden className="text-border">·</span>
|
||||
<span>{item.reportSelfMessage ? '上报自身' : '不上报自身'}</span>
|
||||
<span aria-hidden className="text-border">·</span>
|
||||
<span className={cn(!item.accessToken && 'text-muted-foreground/60')}>{item.accessToken ? '已设 Token' : '无 Token'}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { motion } from 'motion/react';
|
||||
import { MousePointerClick, Plus, Save } from 'lucide-react';
|
||||
import { Check, Loader2, MousePointerClick, Plus, Save } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -276,24 +276,18 @@ function HeaderBar({ selectedUin, dirty, saveStatus, onSave, activeTab, onCreate
|
||||
UIN {selectedUin}
|
||||
</code>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{saveStatus && (
|
||||
<span
|
||||
className={cn(
|
||||
'rounded-full border px-2.5 py-1 text-[11px] font-medium',
|
||||
saveStatus === '保存成功' && 'border-success/30 bg-success/10 text-success',
|
||||
saveStatus === '保存中...' && 'border-border bg-muted text-muted-foreground',
|
||||
saveStatus !== '保存成功' &&
|
||||
saveStatus !== '保存中...' &&
|
||||
'border-destructive/30 bg-destructive/10 text-destructive',
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
{(saveStatus || dirty) && (
|
||||
<span className="inline-flex items-center gap-1.5 text-[11px] font-medium">
|
||||
{saveStatus === '保存中...' ? (
|
||||
<><Loader2 className="size-3.5 animate-spin text-muted-foreground" /><span className="text-muted-foreground">保存中</span></>
|
||||
) : saveStatus === '保存成功' ? (
|
||||
<><Check className="size-3.5 text-success" /><span className="text-success">已保存</span></>
|
||||
) : saveStatus ? (
|
||||
<><span className="size-1.5 rounded-full bg-destructive" /><span className="text-destructive">{saveStatus}</span></>
|
||||
) : (
|
||||
<><span className="size-1.5 rounded-full bg-warning" /><span className="text-warning">未保存</span></>
|
||||
)}
|
||||
>
|
||||
{saveStatus}
|
||||
</span>
|
||||
)}
|
||||
{dirty && !saveStatus && (
|
||||
<span className="rounded-full border border-warning/30 bg-warning/10 px-2.5 py-1 text-[11px] font-medium text-warning">
|
||||
未保存
|
||||
</span>
|
||||
)}
|
||||
{onCreate && (
|
||||
@@ -410,7 +404,7 @@ function NetworkTabView({
|
||||
|
||||
if (list.length === 0) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed py-16 text-muted-foreground">
|
||||
<div className="flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed py-16 text-muted-foreground">
|
||||
<p className="text-sm">暂无 {tab.title} 节点</p>
|
||||
<Button variant="outline" size="sm" onClick={onCreateClick}>
|
||||
<Plus className="size-3.5" /> 创建第一个
|
||||
@@ -447,8 +441,8 @@ function NetworkTabView({
|
||||
|
||||
function EmptyState() {
|
||||
return (
|
||||
<div className="flex h-64 flex-col items-center justify-center gap-2 rounded-lg border border-dashed text-muted-foreground">
|
||||
<MousePointerClick className="size-7" strokeWidth={1.5} />
|
||||
<div className="flex h-64 flex-col items-center justify-center gap-2 rounded-xl border border-dashed text-muted-foreground">
|
||||
<MousePointerClick className="size-8 opacity-40" strokeWidth={1.5} />
|
||||
<p className="text-sm">请在左栏选择会话以配置通信节点</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -65,28 +65,32 @@ export function ProcessesPage() {
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between gap-3 space-y-0">
|
||||
<div>
|
||||
<CardHeader className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:space-y-0">
|
||||
<div className="min-w-0">
|
||||
<CardTitle>进程注入</CardTitle>
|
||||
<CardDescription>加载 SnowLuma 后会监听登录状态,登录后自动接入 OneBot 流程</CardDescription>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{processList.length > 1 && (
|
||||
<div className="hidden items-center gap-1 sm:flex">
|
||||
<span className="text-[11px] text-muted-foreground">排序</span>
|
||||
{SORT_OPTIONS.map((o) => (
|
||||
<button
|
||||
key={o.id}
|
||||
type="button"
|
||||
onClick={() => setPages({ processesSort: o.id })}
|
||||
className={cn(
|
||||
'rounded-md border px-2 py-1 text-[11px] transition-colors cursor-pointer',
|
||||
sortKey === o.id ? 'border-primary bg-primary/10 text-primary' : 'border-border text-muted-foreground hover:bg-accent/40',
|
||||
)}
|
||||
>
|
||||
{o.label}
|
||||
</button>
|
||||
))}
|
||||
<div className="hidden items-center gap-1 rounded-lg bg-muted/60 p-1 sm:flex" role="radiogroup" aria-label="排序方式">
|
||||
{SORT_OPTIONS.map((o) => {
|
||||
const active = sortKey === o.id;
|
||||
return (
|
||||
<button
|
||||
key={o.id}
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={active}
|
||||
onClick={() => setPages({ processesSort: o.id })}
|
||||
className={cn(
|
||||
'rounded-md px-2.5 py-1 text-[11px] font-medium transition-all cursor-pointer outline-none focus-visible:ring-[3px] focus-visible:ring-ring/40',
|
||||
active ? 'bg-card font-semibold text-foreground shadow-sm ring-1 ring-border' : 'text-muted-foreground hover:text-foreground',
|
||||
)}
|
||||
>
|
||||
{o.label}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
<Button variant="outline" size="sm" onClick={refreshProcesses}>
|
||||
@@ -99,14 +103,15 @@ export function ProcessesPage() {
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: -4 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="mb-3 rounded-md border border-primary/20 bg-primary/5 px-3 py-2 text-xs text-primary"
|
||||
className="mb-3 flex items-center gap-2 rounded-lg border border-primary/20 bg-primary/[0.06] px-3 py-2 text-xs text-primary"
|
||||
>
|
||||
<Loader2 className="size-3.5 shrink-0 animate-spin" />
|
||||
{processActionStatus}
|
||||
</motion.div>
|
||||
)}
|
||||
{processList.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed py-16 text-muted-foreground">
|
||||
<Cpu className="size-7" strokeWidth={1.5} />
|
||||
<div className="flex flex-col items-center justify-center gap-2 rounded-xl border border-dashed py-16 text-muted-foreground">
|
||||
<Cpu className="size-8 opacity-40" strokeWidth={1.5} />
|
||||
<p className="text-sm">未检测到可加载 QQ 主进程</p>
|
||||
<p className="text-[11px] text-muted-foreground/80">请确认 QQ 已启动后点击右上角刷新</p>
|
||||
</div>
|
||||
@@ -129,7 +134,7 @@ export function ProcessesPage() {
|
||||
initial={{ opacity: 0, y: 6 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ delay: 0.03 + idx * 0.025, duration: 0.22 }}
|
||||
className="flex flex-col gap-3 rounded-lg border bg-card/50 p-3 sm:flex-row sm:items-center"
|
||||
className="flex flex-col gap-3 rounded-xl border bg-card/50 p-3.5 transition-colors hover:bg-accent/20 sm:flex-row sm:items-center"
|
||||
>
|
||||
{/* icon + info stay horizontal; on phones the actions drop to
|
||||
a second row so name / PID / path get the full width
|
||||
@@ -137,7 +142,7 @@ export function ProcessesPage() {
|
||||
<div className="flex min-w-0 flex-1 items-center gap-3">
|
||||
<div
|
||||
className={cn(
|
||||
'flex size-10 shrink-0 items-center justify-center rounded-lg',
|
||||
'flex size-10 shrink-0 items-center justify-center rounded-xl',
|
||||
isOnline
|
||||
? 'bg-success/15 text-success'
|
||||
: proc.status === 'error'
|
||||
|
||||
Reference in New Issue
Block a user