feat(webui): redesign settings About panel in the Apple style
Split the single centered card into a clean three-section stack consistent with the rest of settings: - Brand hero card: logo glow + name + version pill + tagline/description. - "软件更新" grouped list (reuses Group/SettingRow): current-version row + check-update row (status dot/spinner + 重新检查); when an update exists, a tinted detail block with version, notes, platform asset hint and 前往下载. - Support card: refined Star CTA + repo/releases/issues links. UpdateStatus → UpdateGroup; all update states (checking/disabled/error/ latest) preserved.
This commit is contained in:
1 file changed
+95
-98
@@ -758,44 +758,43 @@ function assetHint(latest: string, platform?: string, arch?: string): string | n
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Advisory update status. Read-only: links to the GitHub release; SnowLuma
|
// Advisory software update, shown as a grouped list. Read-only: links to the
|
||||||
// never downloads or applies anything itself.
|
// GitHub release; SnowLuma never downloads or applies anything itself.
|
||||||
function UpdateStatus() {
|
function UpdateGroup() {
|
||||||
const { updateInfo, refreshUpdate, systemInfo } = useAppState();
|
const { updateInfo, refreshUpdate, systemInfo } = useAppState();
|
||||||
const [checking, setChecking] = useState(false);
|
const [checking, setChecking] = useState(false);
|
||||||
|
|
||||||
const onCheck = async () => {
|
const onCheck = async () => {
|
||||||
setChecking(true);
|
setChecking(true);
|
||||||
try {
|
try { await refreshUpdate(true); } finally { setChecking(false); }
|
||||||
await refreshUpdate(true);
|
|
||||||
} finally {
|
|
||||||
setChecking(false);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkButton = (
|
const disabledCheck = updateInfo?.error === 'disabled';
|
||||||
<Button variant="outline" size="sm" onClick={onCheck} disabled={checking}>
|
|
||||||
{checking ? <Loader2 className="size-4 animate-spin" /> : <RefreshCw className="size-4" />}
|
|
||||||
重新检查
|
|
||||||
</Button>
|
|
||||||
);
|
|
||||||
|
|
||||||
|
let status: ReactNode;
|
||||||
|
if (!updateInfo) status = <span className="text-muted-foreground">正在检查…</span>;
|
||||||
|
else if (disabledCheck) status = <span className="text-muted-foreground">检查已关闭</span>;
|
||||||
|
else if (updateInfo.error) status = <span className="text-muted-foreground">无法检查</span>;
|
||||||
|
else if (updateInfo.hasUpdate && updateInfo.latest) status = <span className="font-medium text-primary">发现新版本</span>;
|
||||||
|
else status = <span className="inline-flex items-center gap-1.5 text-success"><Check className="size-3.5" /> 已是最新</span>;
|
||||||
|
|
||||||
|
// Rich detail block, only when an update is available (narrows `latest`).
|
||||||
|
let detail: ReactNode = null;
|
||||||
if (updateInfo?.hasUpdate && updateInfo.latest) {
|
if (updateInfo?.hasUpdate && updateInfo.latest) {
|
||||||
const hint = assetHint(updateInfo.latest, systemInfo?.platform, systemInfo?.arch);
|
const latest = updateInfo.latest;
|
||||||
return (
|
const hint = assetHint(latest, systemInfo?.platform, systemInfo?.arch);
|
||||||
<div className="w-full max-w-md rounded-xl border border-primary/30 bg-primary/[0.06] p-4 text-left">
|
detail = (
|
||||||
|
<div className="bg-primary/[0.05] px-5 py-4 text-left">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Sparkles className="size-4 text-primary" />
|
<Sparkles className="size-4 text-primary" />
|
||||||
<span className="text-sm font-medium">发现新版本 v{updateInfo.latest}</span>
|
<span className="text-sm font-medium">v{latest}</span>
|
||||||
{updateInfo.publishedAt && (
|
{updateInfo.publishedAt && (
|
||||||
<span className="ml-auto text-[11px] tabular-nums text-muted-foreground">
|
<span className="ml-auto text-[11px] tabular-nums text-muted-foreground">
|
||||||
{new Date(updateInfo.publishedAt).toLocaleDateString()}
|
{new Date(updateInfo.publishedAt).toLocaleDateString()}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1 text-[11px] text-muted-foreground">
|
<p className="mt-1 text-[11px] text-muted-foreground">当前 v{updateInfo.current} → 最新 v{latest}</p>
|
||||||
当前 v{updateInfo.current} → 最新 v{updateInfo.latest}
|
|
||||||
</p>
|
|
||||||
{updateInfo.notes && (
|
{updateInfo.notes && (
|
||||||
<pre className="mt-3 max-h-40 overflow-auto whitespace-pre-wrap rounded-lg bg-muted/50 p-3 text-[11px] leading-relaxed text-muted-foreground">
|
<pre className="mt-3 max-h-40 overflow-auto whitespace-pre-wrap rounded-lg bg-muted/50 p-3 text-[11px] leading-relaxed text-muted-foreground">
|
||||||
{updateInfo.notes}
|
{updateInfo.notes}
|
||||||
@@ -803,99 +802,97 @@ function UpdateStatus() {
|
|||||||
)}
|
)}
|
||||||
{hint && (
|
{hint && (
|
||||||
<p className="mt-3 text-[11px] text-muted-foreground">
|
<p className="mt-3 text-[11px] text-muted-foreground">
|
||||||
适合你的平台:
|
适合你的平台:<code className="rounded bg-muted px-1 py-0.5 font-mono">{hint}</code>(在下载页选择)
|
||||||
<code className="rounded bg-muted px-1 py-0.5 font-mono">{hint}</code>
|
|
||||||
(在下载页选择)
|
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<div className="mt-3 flex items-center gap-2">
|
{updateInfo.htmlUrl && (
|
||||||
{updateInfo.htmlUrl && (
|
<Button asChild size="sm" className="mt-3">
|
||||||
<Button asChild size="sm">
|
<a href={updateInfo.htmlUrl} target="_blank" rel="noreferrer noopener">
|
||||||
<a href={updateInfo.htmlUrl} target="_blank" rel="noreferrer noopener">
|
<Download className="size-4" /> 前往下载
|
||||||
<Download className="size-4" />
|
</a>
|
||||||
前往下载
|
</Button>
|
||||||
</a>
|
)}
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
{checkButton}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let text: string;
|
|
||||||
if (!updateInfo) text = '正在检查更新…';
|
|
||||||
else if (updateInfo.error === 'disabled') text = '更新检查已关闭';
|
|
||||||
else if (updateInfo.error) text = '无法检查更新';
|
|
||||||
else text = `已是最新版本(v${updateInfo.current})`;
|
|
||||||
|
|
||||||
const ok = !!updateInfo && !updateInfo.error;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex w-full max-w-md flex-wrap items-center justify-center gap-3 text-[12px] text-muted-foreground">
|
<Group title="软件更新" icon={Sparkles} description="仅提示新版本,从不自动下载或安装。">
|
||||||
<span className="inline-flex items-center gap-1.5">
|
<SettingRow label="当前版本" layout="inline">
|
||||||
{ok ? <Check className="size-3.5 text-success" /> : <Info className="size-3.5" />}
|
<code className="rounded-md border bg-muted/40 px-2 py-0.5 font-mono text-xs tabular-nums">v{__APP_VERSION__}</code>
|
||||||
{text}
|
</SettingRow>
|
||||||
</span>
|
<SettingRow label="检查更新">
|
||||||
{updateInfo?.error !== 'disabled' && checkButton}
|
<div className="flex items-center gap-2.5 text-[12px]">
|
||||||
</div>
|
{status}
|
||||||
|
{!disabledCheck && (
|
||||||
|
<Button variant="outline" size="sm" onClick={onCheck} disabled={checking}>
|
||||||
|
{checking ? <Loader2 className="size-4 animate-spin" /> : <RefreshCw className="size-4" />}
|
||||||
|
重新检查
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</SettingRow>
|
||||||
|
{detail}
|
||||||
|
</Group>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function AboutPanel() {
|
function AboutPanel() {
|
||||||
return (
|
return (
|
||||||
<Card className="overflow-hidden">
|
<div className="flex flex-col gap-5">
|
||||||
<CardContent className="flex flex-col items-center gap-6 px-6 py-8 text-center sm:px-8">
|
{/* brand hero */}
|
||||||
{/* brand hero */}
|
<Card className="overflow-hidden">
|
||||||
<motion.div
|
<CardContent className="flex flex-col items-center gap-3 px-6 py-9 text-center">
|
||||||
initial={{ opacity: 0, y: 10, scale: 0.96 }}
|
<motion.div
|
||||||
animate={{ opacity: 1, y: 0, scale: 1 }}
|
initial={{ opacity: 0, y: 10, scale: 0.96 }}
|
||||||
transition={{ type: 'spring', stiffness: 260, damping: 22 }}
|
animate={{ opacity: 1, y: 0, scale: 1 }}
|
||||||
className="flex flex-col items-center gap-3"
|
transition={{ type: 'spring', stiffness: 260, damping: 22 }}
|
||||||
>
|
className="flex flex-col items-center gap-3"
|
||||||
<div className="relative">
|
>
|
||||||
<div aria-hidden className="absolute inset-0 -z-10 scale-125 rounded-full bg-primary/20 blur-2xl" />
|
<div className="relative">
|
||||||
<img src="/logo.png" alt="SnowLuma" className="size-20 object-contain drop-shadow-sm" />
|
<div aria-hidden className="absolute inset-0 -z-10 scale-125 rounded-full bg-primary/20 blur-2xl" />
|
||||||
</div>
|
<img src="/logo.png" alt="SnowLuma" className="size-20 object-contain drop-shadow-sm" />
|
||||||
<div className="flex items-center gap-2">
|
</div>
|
||||||
<span className="text-2xl font-semibold tracking-tight">SnowLuma</span>
|
<div className="flex items-center gap-2">
|
||||||
<span className="rounded-full border border-primary/30 bg-primary/10 px-2 py-0.5 font-mono text-[11px] text-primary tabular-nums">
|
<span className="text-2xl font-semibold tracking-tight">SnowLuma</span>
|
||||||
v{__APP_VERSION__}
|
<span className="rounded-full border border-primary/30 bg-primary/10 px-2 py-0.5 font-mono text-[11px] text-primary tabular-nums">
|
||||||
</span>
|
v{__APP_VERSION__}
|
||||||
</div>
|
</span>
|
||||||
<p className="text-sm text-muted-foreground">Next Remote Protocol Framework · 下一代远程协议框架</p>
|
</div>
|
||||||
</motion.div>
|
<p className="text-sm text-muted-foreground">Next Remote Protocol Framework · 下一代远程协议框架</p>
|
||||||
|
</motion.div>
|
||||||
<p className="max-w-md text-[13px] leading-relaxed text-muted-foreground">
|
<p className="max-w-md text-[13px] leading-relaxed text-muted-foreground">
|
||||||
以轻量注入驱动 QQ NT,对外提供标准 OneBot v11 接口,让机器人一次部署、长期稳定运行。
|
以轻量注入驱动 QQ NT,对外提供标准 OneBot v11 接口,让机器人一次部署、长期稳定运行。
|
||||||
</p>
|
|
||||||
|
|
||||||
{/* Update status */}
|
|
||||||
<UpdateStatus />
|
|
||||||
|
|
||||||
{/* Star CTA */}
|
|
||||||
<div className="flex w-full max-w-sm flex-col items-center gap-2 rounded-xl border bg-gradient-to-b from-primary/[0.07] to-transparent p-5">
|
|
||||||
<Star className="size-6 fill-primary/20 text-primary" />
|
|
||||||
<p className="text-sm font-medium">喜欢 SnowLuma?点个 Star 支持一下</p>
|
|
||||||
<p className="text-[11px] leading-relaxed text-muted-foreground">
|
|
||||||
开源不易,你的 ⭐ 是我们持续维护的最大动力。
|
|
||||||
</p>
|
</p>
|
||||||
<Button asChild className="mt-1 w-full">
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
{/* software update */}
|
||||||
|
<UpdateGroup />
|
||||||
|
|
||||||
|
{/* support + links */}
|
||||||
|
<Card className="overflow-hidden">
|
||||||
|
<CardContent className="flex flex-col items-center gap-4 px-6 py-7 text-center">
|
||||||
|
<Star className="size-7 fill-primary/15 text-primary" />
|
||||||
|
<div className="flex flex-col items-center gap-1">
|
||||||
|
<p className="text-sm font-medium">喜欢 SnowLuma?给个 Star 支持一下</p>
|
||||||
|
<p className="max-w-xs text-[11px] leading-relaxed text-muted-foreground">
|
||||||
|
开源不易,你的 ⭐ 是我们持续维护的最大动力。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<Button asChild className="w-full max-w-xs">
|
||||||
<a href={REPO_URL} target="_blank" rel="noreferrer noopener">
|
<a href={REPO_URL} target="_blank" rel="noreferrer noopener">
|
||||||
<Github className="size-4" />
|
<Github className="size-4" /> 去 GitHub 点 Star
|
||||||
去 GitHub 点 Star
|
|
||||||
</a>
|
</a>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
<div className="flex flex-wrap items-center justify-center gap-x-5 gap-y-2 pt-1 text-[12px]">
|
||||||
|
<AboutLink href={REPO_URL} icon={Github}>仓库</AboutLink>
|
||||||
{/* secondary links */}
|
<AboutLink href={`${REPO_URL}/releases`} icon={Tag}>发行版</AboutLink>
|
||||||
<div className="flex flex-wrap items-center justify-center gap-x-5 gap-y-2 text-[12px]">
|
<AboutLink href={`${REPO_URL}/issues`} icon={Bug}>反馈问题</AboutLink>
|
||||||
<AboutLink href={REPO_URL} icon={Github}>仓库</AboutLink>
|
</div>
|
||||||
<AboutLink href={`${REPO_URL}/releases`} icon={Tag}>发行版</AboutLink>
|
</CardContent>
|
||||||
<AboutLink href={`${REPO_URL}/issues`} icon={Bug}>反馈问题</AboutLink>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user