Unify the frontend on one component library
parent
629cfc5207
commit
22eb0fcddb
|
|
@ -21,6 +21,7 @@ Squid 的重要变更记录在这里。版本号使用语义化版本,日期
|
|||
- 概览页采用新的三列指标布局,所有页面一级标题下不再重复二级描述。
|
||||
- 主界面的更新提示现在直接打开“设置 → 更新”分区。
|
||||
- macOS 隐藏仅依赖 Windows 服务的“系统维护”,权限管理只保留开机启动项页签。
|
||||
- 前端统一为一套标准组件库:页签、卡片、行、状态标签、工具栏与搜索框不再由各模块自行定义;空间清理三个页签与设置页一致,权限管理的开机启动项信息与其他模块一致。
|
||||
|
||||
## [0.1.11] - 2026-11-22
|
||||
|
||||
|
|
|
|||
|
|
@ -17,10 +17,14 @@ import type { Finding, ProcessDetail, ProcessRow } from "../types";
|
|||
import type { SecurityWorkspace } from "../hooks/useSecurityWorkspace";
|
||||
import {
|
||||
Button,
|
||||
Chip,
|
||||
ConfirmDialog,
|
||||
EmptyState,
|
||||
InlineError,
|
||||
Modal,
|
||||
SearchField,
|
||||
Section,
|
||||
Toolbar,
|
||||
useToast,
|
||||
} from "./ui";
|
||||
|
||||
|
|
@ -224,55 +228,47 @@ export function ProcessTable({
|
|||
if (error && !rows) return <InlineError message={error} />;
|
||||
|
||||
return (
|
||||
<section className="panel">
|
||||
<div className="process-controls">
|
||||
<label className="search-field">
|
||||
<Search size={14} />
|
||||
<input
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder={t("Search name, path or PID", "搜索名称、路径或 PID")}
|
||||
/>
|
||||
</label>
|
||||
<Section
|
||||
title={t("Processes", "进程")}
|
||||
hint={
|
||||
rows
|
||||
? t(
|
||||
`${formatCount(rows.length)} running processes · signature checks are on demand`,
|
||||
`${formatCount(rows.length)} 个运行中的进程 · 签名按需检查`,
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<Toolbar>
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
label={t("Search processes", "搜索进程")}
|
||||
placeholder={t("Search name, path or PID", "搜索名称、路径或 PID")}
|
||||
/>
|
||||
<div className="chip-row">
|
||||
<button
|
||||
className={`filter-chip ${mineOnly ? "is-active" : ""}`}
|
||||
onClick={() => setMineOnly((current) => !current)}
|
||||
>
|
||||
<Chip active={mineOnly} onClick={() => setMineOnly((current) => !current)}>
|
||||
{t("My processes", "我的进程")}
|
||||
</button>
|
||||
<button
|
||||
className={`filter-chip ${unsignedOnly ? "is-active" : ""}`}
|
||||
onClick={() => setUnsignedOnly((current) => !current)}
|
||||
>
|
||||
</Chip>
|
||||
<Chip active={unsignedOnly} onClick={() => setUnsignedOnly((current) => !current)}>
|
||||
{t("Unsigned only", "仅未签名")}
|
||||
</button>
|
||||
<button
|
||||
className={`filter-chip ${startupOnly ? "is-active" : ""}`}
|
||||
onClick={() => setStartupOnly((current) => !current)}
|
||||
>
|
||||
</Chip>
|
||||
<Chip active={startupOnly} onClick={() => setStartupOnly((current) => !current)}>
|
||||
{t("Started at login", "由登录项启动")}
|
||||
</button>
|
||||
<button
|
||||
className={`filter-chip ${grouped ? "is-active" : ""}`}
|
||||
onClick={() => setGrouped((current) => !current)}
|
||||
>
|
||||
</Chip>
|
||||
<Chip active={grouped} onClick={() => setGrouped((current) => !current)}>
|
||||
{t("Group by app", "按应用聚合")}
|
||||
</button>
|
||||
<button
|
||||
className={`filter-chip ${trust ? "is-active" : ""}`}
|
||||
</Chip>
|
||||
<Chip
|
||||
active={trust}
|
||||
onClick={() => {
|
||||
const next = !trust;
|
||||
setTrust(next);
|
||||
void load(next);
|
||||
}}
|
||||
title={t(
|
||||
"Signature lookups make each refresh slower",
|
||||
"读取签名会让每次刷新变慢",
|
||||
)}
|
||||
>
|
||||
{t("Check signatures", "检查签名")}
|
||||
</button>
|
||||
</Chip>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
|
@ -283,7 +279,7 @@ export function ProcessTable({
|
|||
{t("Refresh", "刷新")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Toolbar>
|
||||
|
||||
{visible.length === 0 ? (
|
||||
<EmptyState
|
||||
|
|
@ -474,7 +470,7 @@ export function ProcessTable({
|
|||
onConfirm={() => victim && void stop(victim)}
|
||||
onClose={() => setVictim(null)}
|
||||
/>
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,17 @@ import { api } from "../lib/api";
|
|||
import { messageFrom, shortPath } from "../lib/format";
|
||||
import type { ScanSchedule, SecurityStatus } from "../types";
|
||||
import type { SecurityWorkspace } from "../hooks/useSecurityWorkspace";
|
||||
import { Button, ConfirmDialog, Select, Toggle, useToast } from "./ui";
|
||||
import {
|
||||
Button,
|
||||
ConfirmDialog,
|
||||
IconButton,
|
||||
Row,
|
||||
Section,
|
||||
Select,
|
||||
Subhead,
|
||||
Toggle,
|
||||
useToast,
|
||||
} from "./ui";
|
||||
|
||||
const SCHEDULES: [ScanSchedule, string, string][] = [
|
||||
["manual", "Only when I ask", "仅在我要求时"],
|
||||
|
|
@ -110,21 +120,12 @@ export function SecuritySettingsCard({
|
|||
};
|
||||
|
||||
return (
|
||||
<section className="settings-section">
|
||||
<div className="settings-section-head">
|
||||
<div>
|
||||
<h2>
|
||||
<ShieldCheck size={18} />
|
||||
{t("Security", "安全")}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="settings-row is-first">
|
||||
<div>
|
||||
<strong>{t("Scan schedule", "扫描计划")}</strong>
|
||||
<span>
|
||||
{settings.scanSchedule === "manual"
|
||||
<Section icon={<ShieldCheck size={16} />} title={t("Security", "安全")}>
|
||||
<div className="row-list">
|
||||
<Row
|
||||
title={t("Scan schedule", "扫描计划")}
|
||||
subtitle={
|
||||
settings.scanSchedule === "manual"
|
||||
? t(
|
||||
"Nothing is scanned unless you start it.",
|
||||
"不主动扫描,只在你点开始时才扫描。",
|
||||
|
|
@ -132,59 +133,57 @@ export function SecuritySettingsCard({
|
|||
: t(
|
||||
"No background service, so a scheduled scan runs only while Squid is in the tray.",
|
||||
"Squid 无后台服务,定时扫描只在驻留托盘时才会运行。",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<Select
|
||||
value={settings.scanSchedule}
|
||||
disabled={busy}
|
||||
label={t("Scan schedule", "扫描计划")}
|
||||
options={SCHEDULES.map(([value, en, zh]) => ({ value, label: t(en, zh) }))}
|
||||
onChange={(next) => void save({ scanSchedule: next })}
|
||||
)
|
||||
}
|
||||
trailing={
|
||||
<Select
|
||||
value={settings.scanSchedule}
|
||||
disabled={busy}
|
||||
label={t("Scan schedule", "扫描计划")}
|
||||
options={SCHEDULES.map(([value, en, zh]) => ({ value, label: t(en, zh) }))}
|
||||
onChange={(next) => void save({ scanSchedule: next })}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="settings-row">
|
||||
<div>
|
||||
<strong>{t("Notify on confirmed findings", "发现高危时通知")}</strong>
|
||||
<span>
|
||||
{t(
|
||||
"The banner and the tray report the same thing without it.",
|
||||
"关闭后,应用内提示与托盘仍会显示相同状态。",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<Toggle
|
||||
checked={settings.notifyOnFindings}
|
||||
disabled={busy}
|
||||
label={t("Notify on confirmed findings", "发现高危时通知")}
|
||||
onChange={(next) => void save({ notifyOnFindings: next })}
|
||||
<Row
|
||||
title={t("Notify on confirmed findings", "发现高危时通知")}
|
||||
subtitle={t(
|
||||
"The banner and the tray report the same thing without it.",
|
||||
"关闭后,应用内提示与托盘仍会显示相同状态。",
|
||||
)}
|
||||
trailing={
|
||||
<Toggle
|
||||
checked={settings.notifyOnFindings}
|
||||
disabled={busy}
|
||||
label={t("Notify on confirmed findings", "发现高危时通知")}
|
||||
onChange={(next) => void save({ notifyOnFindings: next })}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="settings-row">
|
||||
<div>
|
||||
<strong>{t("Auto-quarantine confirmed findings", "自动隔离已确认项")}</strong>
|
||||
<span>
|
||||
{t(
|
||||
"Confirmed findings only. A suspicious file is never moved on its own.",
|
||||
"仅针对已确认发现,可疑项不会被自动移动。",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<Toggle
|
||||
checked={settings.autoQuarantine}
|
||||
disabled={busy}
|
||||
label={t("Auto-quarantine confirmed findings", "自动隔离已确认项")}
|
||||
onChange={(next) => (next ? setConfirmAuto(true) : void save({ autoQuarantine: false }))}
|
||||
<Row
|
||||
title={t("Auto-quarantine confirmed findings", "自动隔离已确认项")}
|
||||
subtitle={t(
|
||||
"Confirmed findings only. A suspicious file is never moved on its own.",
|
||||
"仅针对已确认发现,可疑项不会被自动移动。",
|
||||
)}
|
||||
trailing={
|
||||
<Toggle
|
||||
checked={settings.autoQuarantine}
|
||||
disabled={busy}
|
||||
label={t("Auto-quarantine confirmed findings", "自动隔离已确认项")}
|
||||
onChange={(next) =>
|
||||
next ? setConfirmAuto(true) : void save({ autoQuarantine: false })
|
||||
}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="settings-row">
|
||||
<div>
|
||||
<strong>{t("Update rules automatically", "自动更新规则")}</strong>
|
||||
<span>
|
||||
{intel.source === "pack"
|
||||
<Row
|
||||
title={t("Update rules automatically", "自动更新规则")}
|
||||
subtitle={
|
||||
intel.source === "pack"
|
||||
? t(
|
||||
`Rule pack r${intel.revision} · ${intel.installedRules} rules · published ${intel.published} · ${
|
||||
intel.signed
|
||||
|
|
@ -198,62 +197,62 @@ export function SecuritySettingsCard({
|
|||
: t(
|
||||
`${intel.builtinRules} built-in rules in this build; nothing downloaded yet.`,
|
||||
`当前构建内置 ${intel.builtinRules} 条规则,尚未下载规则包。`,
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<Toggle
|
||||
checked={settings.updateRules}
|
||||
disabled={busy}
|
||||
label={t("Update rules automatically", "自动更新规则")}
|
||||
onChange={(next) => void save({ updateRules: next })}
|
||||
)
|
||||
}
|
||||
trailing={
|
||||
<Toggle
|
||||
checked={settings.updateRules}
|
||||
disabled={busy}
|
||||
label={t("Update rules automatically", "自动更新规则")}
|
||||
onChange={(next) => void save({ updateRules: next })}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
<Row
|
||||
title={t("Rule pack", "规则包")}
|
||||
subtitle={
|
||||
rulesNote ??
|
||||
t(
|
||||
"Rules are downloaded to this machine; nothing is ever sent out.",
|
||||
"规则只下载到本机,不上传任何内容。",
|
||||
)
|
||||
}
|
||||
trailing={
|
||||
<div className="row-actions">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon={<Download size={14} />}
|
||||
disabled={busy || !settings.updateRules}
|
||||
onClick={() => void runRules(security.updateRules)}
|
||||
>
|
||||
{t("Check for rules", "检查规则更新")}
|
||||
</Button>
|
||||
{intel.fallbackAvailable ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon={<RotateCcw size={14} />}
|
||||
disabled={busy}
|
||||
onClick={() => void runRules(security.rollbackRules)}
|
||||
>
|
||||
{t("Roll back one pack", "回滚上一版规则")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="settings-row is-actions">
|
||||
<div>
|
||||
<strong>{t("Rule pack", "规则包")}</strong>
|
||||
<span>
|
||||
{rulesNote ??
|
||||
t(
|
||||
"Rules are downloaded to this machine; nothing is ever sent out.",
|
||||
"规则只下载到本机,不上传任何内容。",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="settings-row-buttons">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon={<Download size={14} />}
|
||||
disabled={busy || !settings.updateRules}
|
||||
onClick={() => void runRules(security.updateRules)}
|
||||
>
|
||||
{t("Check for rules", "检查规则更新")}
|
||||
</Button>
|
||||
{intel.fallbackAvailable ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon={<RotateCcw size={14} />}
|
||||
disabled={busy}
|
||||
onClick={() => void runRules(security.rollbackRules)}
|
||||
>
|
||||
{t("Roll back one pack", "回滚上一版规则")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="settings-subsection">
|
||||
<div className="settings-subsection-head">
|
||||
<strong>{t("Scan exclusions", "安全扫描排除项")}</strong>
|
||||
<span>
|
||||
{t(
|
||||
"Separate from the cleanup whitelist. Nothing inside is reported.",
|
||||
"与清理白名单彼此独立。被排除目录内的威胁不会上报。",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<Subhead
|
||||
title={t("Scan exclusions", "安全扫描排除项")}
|
||||
hint={t(
|
||||
"Separate from the cleanup whitelist. Nothing inside is reported.",
|
||||
"与清理白名单彼此独立。被排除目录内的威胁不会上报。",
|
||||
)}
|
||||
/>
|
||||
<div className="whitelist-add">
|
||||
<input
|
||||
value={draft}
|
||||
|
|
@ -274,120 +273,133 @@ export function SecuritySettingsCard({
|
|||
{t("Add", "添加")}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="whitelist-list">
|
||||
<div className="row-list">
|
||||
{settings.scanExclusions.length === 0 ? (
|
||||
<p className="settings-empty">
|
||||
<p className="row-empty">
|
||||
{t("No folders are excluded from scanning.", "没有排除扫描的文件夹。")}
|
||||
</p>
|
||||
) : (
|
||||
settings.scanExclusions.map((pattern) => (
|
||||
<div className="whitelist-row" key={pattern}>
|
||||
<span className="whitelist-icon is-warning">
|
||||
<AlertTriangle size={15} />
|
||||
</span>
|
||||
<code title={pattern}>{shortPath(pattern, 88)}</code>
|
||||
<button
|
||||
className="row-reveal"
|
||||
aria-label={t("Stop excluding", "取消排除")}
|
||||
onClick={() => setPendingRemove(pattern)}
|
||||
disabled={busy}
|
||||
>
|
||||
<X size={14} />
|
||||
</button>
|
||||
</div>
|
||||
<Row
|
||||
key={pattern}
|
||||
leading={
|
||||
<span className="whitelist-icon is-warning">
|
||||
<AlertTriangle size={15} />
|
||||
</span>
|
||||
}
|
||||
title={<code title={pattern}>{shortPath(pattern, 88)}</code>}
|
||||
trailing={
|
||||
<IconButton
|
||||
label={t("Stop excluding", "取消排除")}
|
||||
onClick={() => setPendingRemove(pattern)}
|
||||
disabled={busy}
|
||||
>
|
||||
<X size={14} />
|
||||
</IconButton>
|
||||
}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{settings.allowlist.length ? (
|
||||
<div className="settings-subsection">
|
||||
<div className="settings-subsection-head">
|
||||
<strong>{t("Trusted software", "已信任的软件")}</strong>
|
||||
<span>
|
||||
{t(
|
||||
`${settings.allowlist.length} rules quiet ordinary advisories. Confirmed threats are never trusted.`,
|
||||
`${settings.allowlist.length} 条规则用于静默普通提示,已确认威胁永远不会被信任。`,
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="whitelist-list">
|
||||
<div>
|
||||
<Subhead
|
||||
title={t("Trusted software", "已信任的软件")}
|
||||
hint={t(
|
||||
`${settings.allowlist.length} rules quiet ordinary advisories. Confirmed threats are never trusted.`,
|
||||
`${settings.allowlist.length} 条规则用于静默普通提示,已确认威胁永远不会被信任。`,
|
||||
)}
|
||||
/>
|
||||
<div className="row-list">
|
||||
{settings.allowlist.map((entry) => (
|
||||
<div className="whitelist-row" key={`${entry.kind}:${entry.value}`}>
|
||||
<span className="whitelist-icon">
|
||||
<ShieldCheck size={15} />
|
||||
</span>
|
||||
<span className="allowlist-kind">
|
||||
{entry.kind === "publisher"
|
||||
? t("Publisher", "发布者")
|
||||
: entry.kind === "path"
|
||||
? t("Folder", "文件夹")
|
||||
: t("Note type", "提示类型")}
|
||||
</span>
|
||||
<code title={entry.value}>
|
||||
{entry.kind === "evidence"
|
||||
? t(
|
||||
EVIDENCE_LABELS[entry.value]?.[0] ?? entry.value,
|
||||
EVIDENCE_LABELS[entry.value]?.[1] ?? entry.value,
|
||||
)
|
||||
: entry.kind === "path"
|
||||
? shortPath(entry.value, 88)
|
||||
: entry.value}
|
||||
</code>
|
||||
<button
|
||||
className="row-reveal"
|
||||
aria-label={t("Stop trusting", "取消信任")}
|
||||
onClick={() => void untrust(entry.kind, entry.value)}
|
||||
disabled={busy}
|
||||
>
|
||||
<X size={14} />
|
||||
</button>
|
||||
</div>
|
||||
<Row
|
||||
key={`${entry.kind}:${entry.value}`}
|
||||
leading={
|
||||
<span className="whitelist-icon">
|
||||
<ShieldCheck size={15} />
|
||||
</span>
|
||||
}
|
||||
title={
|
||||
<code title={entry.value}>
|
||||
{entry.kind === "evidence"
|
||||
? t(
|
||||
EVIDENCE_LABELS[entry.value]?.[0] ?? entry.value,
|
||||
EVIDENCE_LABELS[entry.value]?.[1] ?? entry.value,
|
||||
)
|
||||
: entry.kind === "path"
|
||||
? shortPath(entry.value, 88)
|
||||
: entry.value}
|
||||
</code>
|
||||
}
|
||||
tags={
|
||||
<span className="allowlist-kind">
|
||||
{entry.kind === "publisher"
|
||||
? t("Publisher", "发布者")
|
||||
: entry.kind === "path"
|
||||
? t("Folder", "文件夹")
|
||||
: t("Note type", "提示类型")}
|
||||
</span>
|
||||
}
|
||||
trailing={
|
||||
<IconButton
|
||||
label={t("Stop trusting", "取消信任")}
|
||||
onClick={() => void untrust(entry.kind, entry.value)}
|
||||
disabled={busy}
|
||||
>
|
||||
<X size={14} />
|
||||
</IconButton>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{settings.ignoredFindings.length ? (
|
||||
<div className="settings-subsection">
|
||||
<div className="settings-subsection-head">
|
||||
<strong>{t("Ignored findings", "已忽略的发现")}</strong>
|
||||
<span>
|
||||
{t(
|
||||
`${settings.ignoredFindings.length} dismissed. Future scans hide them until you restore them here.`,
|
||||
`已忽略 ${settings.ignoredFindings.length} 项。在恢复之前,后续扫描不会再次报告。`,
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="whitelist-list">
|
||||
<div>
|
||||
<Subhead
|
||||
title={t("Ignored findings", "已忽略的发现")}
|
||||
hint={t(
|
||||
`${settings.ignoredFindings.length} dismissed. Future scans hide them until you restore them here.`,
|
||||
`已忽略 ${settings.ignoredFindings.length} 项。在恢复之前,后续扫描不会再次报告。`,
|
||||
)}
|
||||
/>
|
||||
<div className="row-list">
|
||||
{settings.ignoredFindings.map((fingerprint) => (
|
||||
<div className="whitelist-row" key={fingerprint}>
|
||||
<code title={fingerprint}>{shortPath(fingerprint, 88)}</code>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
disabled={busy}
|
||||
onClick={() => {
|
||||
const match = status.scan?.findings.find(
|
||||
(finding) =>
|
||||
`${finding.confidence}|${finding.path}` === fingerprint,
|
||||
);
|
||||
if (match) {
|
||||
void security.dismiss(match.id, false).then((message) => push(message, "success"));
|
||||
} else {
|
||||
push(
|
||||
t(
|
||||
"This finding is not in the last scan — run a scan to restore it.",
|
||||
"该发现不在上次扫描结果中,请先扫描再恢复。",
|
||||
),
|
||||
"danger",
|
||||
<Row
|
||||
key={fingerprint}
|
||||
title={<code title={fingerprint}>{shortPath(fingerprint, 88)}</code>}
|
||||
trailing={
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
disabled={busy}
|
||||
onClick={() => {
|
||||
const match = status.scan?.findings.find(
|
||||
(finding) =>
|
||||
`${finding.confidence}|${finding.path}` === fingerprint,
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{t("Report again", "重新报告")}
|
||||
</Button>
|
||||
</div>
|
||||
if (match) {
|
||||
void security
|
||||
.dismiss(match.id, false)
|
||||
.then((message) => push(message, "success"));
|
||||
} else {
|
||||
push(
|
||||
t(
|
||||
"This finding is not in the last scan — run a scan to restore it.",
|
||||
"该发现不在上次扫描结果中,请先扫描再恢复。",
|
||||
),
|
||||
"danger",
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{t("Report again", "重新报告")}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -437,6 +449,6 @@ export function SecuritySettingsCard({
|
|||
}}
|
||||
onClose={() => setPendingRemove(null)}
|
||||
/>
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { api } from "../lib/api";
|
|||
import { messageFrom } from "../lib/format";
|
||||
import type { PermissionStatus, SecurityStatus } from "../types";
|
||||
import type { SecurityWorkspace } from "../hooks/useSecurityWorkspace";
|
||||
import { Button } from "./ui";
|
||||
import { Badge, Button, Row } from "./ui";
|
||||
|
||||
type State = "checking" | "granted" | "denied" | "unknown" | "not-required" | "error";
|
||||
|
||||
|
|
@ -362,22 +362,30 @@ function SetupRow({
|
|||
}) {
|
||||
const { t } = useI18n();
|
||||
return (
|
||||
<div className={`setup-check is-${state.tone}`}>
|
||||
<span className="setup-check-icon">{icon}</span>
|
||||
<div className="setup-check-copy">
|
||||
<strong>
|
||||
{title}
|
||||
{optional ? <span className="setup-check-optional">{t("optional", "可选")}</span> : null}
|
||||
<span className="setup-check-state">
|
||||
{state.tone === "ok" ? <Check size={13} /> : null}
|
||||
{state.tone === "problem" ? <X size={13} /> : null}
|
||||
<Row
|
||||
leading={<span className="setup-check-icon">{icon}</span>}
|
||||
title={title}
|
||||
tags={
|
||||
<>
|
||||
{optional ? <Badge>{t("optional", "可选")}</Badge> : null}
|
||||
<Badge
|
||||
tone={
|
||||
state.tone === "ok"
|
||||
? "success"
|
||||
: state.tone === "problem"
|
||||
? "warning"
|
||||
: "neutral"
|
||||
}
|
||||
>
|
||||
{state.tone === "ok" ? <Check size={12} /> : null}
|
||||
{state.tone === "problem" ? <X size={12} /> : null}
|
||||
{state.label}
|
||||
</span>
|
||||
</strong>
|
||||
<small>{note}</small>
|
||||
{code ? <code>{code}</code> : null}
|
||||
</div>
|
||||
{action ? <div className="setup-check-action">{action}</div> : null}
|
||||
</div>
|
||||
</Badge>
|
||||
</>
|
||||
}
|
||||
subtitle={note}
|
||||
detail={code ? <code>{code}</code> : undefined}
|
||||
trailing={action}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { useI18n } from "../i18n";
|
|||
import { formatBytes } from "../lib/format";
|
||||
import type { UpdateFlow } from "../hooks/useUpdateFlow";
|
||||
import type { Bootstrap } from "../types";
|
||||
import { Button, Toggle } from "./ui";
|
||||
import { Badge, Button, Row, Section, Toggle } from "./ui";
|
||||
|
||||
function architectureLabel(arch: string): string {
|
||||
if (arch === "aarch64") return "ARM64";
|
||||
|
|
@ -44,14 +44,11 @@ export function UpdatePanel({
|
|||
: null;
|
||||
|
||||
return (
|
||||
<section className="settings-section update-section">
|
||||
<div className="settings-section-head">
|
||||
<div>
|
||||
<h2>
|
||||
<Sparkles size={18} />
|
||||
{t("Software updates", "软件更新")}
|
||||
</h2>
|
||||
</div>
|
||||
<Section
|
||||
className="update-section"
|
||||
icon={<Sparkles size={16} />}
|
||||
title={t("Software updates", "软件更新")}
|
||||
actions={
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
|
|
@ -61,22 +58,24 @@ export function UpdatePanel({
|
|||
>
|
||||
{flow.checking ? t("Checking…", "检查中…") : t("Check now", "立即检查")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="update-system-panel">
|
||||
<span className="update-system-icon">
|
||||
<Monitor size={16} />
|
||||
</span>
|
||||
<div className="update-system-copy">
|
||||
<small>{t("Current system", "当前系统")}</small>
|
||||
<strong>
|
||||
{bootstrap.osVersion || bootstrap.osName}
|
||||
</strong>
|
||||
</div>
|
||||
<div className="update-system-facts">
|
||||
<span>{architectureLabel(bootstrap.arch)}</span>
|
||||
<span className="is-app">Squid {bootstrap.version}</span>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="row-list">
|
||||
<Row
|
||||
leading={
|
||||
<span className="whitelist-icon">
|
||||
<Monitor size={16} />
|
||||
</span>
|
||||
}
|
||||
title={t("Current system", "当前系统")}
|
||||
subtitle={bootstrap.osVersion || bootstrap.osName}
|
||||
tags={
|
||||
<>
|
||||
<Badge>{architectureLabel(bootstrap.arch)}</Badge>
|
||||
<Badge tone="primary">Squid {bootstrap.version}</Badge>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{available && status ? (
|
||||
|
|
@ -188,17 +187,22 @@ export function UpdatePanel({
|
|||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="settings-row">
|
||||
<div>
|
||||
<strong>{t("Check for updates daily", "每天自动检查更新")}</strong>
|
||||
<span>{t("At most once a day, when Squid starts.", "每天最多一次,在启动时进行。")}</span>
|
||||
</div>
|
||||
<Toggle
|
||||
checked={autoCheck}
|
||||
onChange={onAutoCheckChange}
|
||||
label={t("Check for updates automatically", "自动检查更新")}
|
||||
<div className="row-list">
|
||||
<Row
|
||||
title={t("Check for updates daily", "每天自动检查更新")}
|
||||
subtitle={t(
|
||||
"At most once a day, when Squid starts.",
|
||||
"每天最多一次,在启动时进行。",
|
||||
)}
|
||||
trailing={
|
||||
<Toggle
|
||||
checked={autoCheck}
|
||||
onChange={onAutoCheckChange}
|
||||
label={t("Check for updates automatically", "自动检查更新")}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import {
|
|||
LoaderCircle,
|
||||
PackageOpen,
|
||||
Puzzle,
|
||||
Search,
|
||||
Trash2,
|
||||
X,
|
||||
} from "lucide-react";
|
||||
|
|
@ -795,6 +796,364 @@ export function SectionTitle({
|
|||
);
|
||||
}
|
||||
|
||||
/* ── Standard library ─────────────────────────────────────────────────
|
||||
Every page composes these instead of inventing its own tab bar, row,
|
||||
section card or status pill. The matching CSS lives in one place in
|
||||
styles.css under the same names. */
|
||||
|
||||
export interface TabItem<T extends string> {
|
||||
id: T;
|
||||
label: ReactNode;
|
||||
icon?: ReactNode;
|
||||
badge?: ReactNode;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export function Tabs<T extends string>({
|
||||
items,
|
||||
value,
|
||||
onChange,
|
||||
label,
|
||||
className = "",
|
||||
}: {
|
||||
items: TabItem<T>[];
|
||||
value: T;
|
||||
onChange: (next: T) => void;
|
||||
label: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className={`tabs ${className}`} role="tablist" aria-label={label}>
|
||||
{items.map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={value === item.id}
|
||||
disabled={item.disabled}
|
||||
className={`tab ${value === item.id ? "is-active" : ""}`}
|
||||
onClick={() => onChange(item.id)}
|
||||
>
|
||||
{item.icon}
|
||||
<span>{item.label}</span>
|
||||
{item.badge != null ? <b className="tab-badge">{item.badge}</b> : null}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Chip({
|
||||
active = false,
|
||||
count,
|
||||
tone,
|
||||
onClick,
|
||||
children,
|
||||
}: {
|
||||
active?: boolean;
|
||||
count?: ReactNode;
|
||||
tone?: "danger";
|
||||
onClick?: () => void;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={active}
|
||||
className={`chip ${active ? "is-active" : ""} ${tone ? `is-${tone}` : ""}`}
|
||||
onClick={onClick}
|
||||
>
|
||||
{children}
|
||||
{count != null ? <b className="chip-count">{count}</b> : null}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
export function Segmented<T extends string | number>({
|
||||
value,
|
||||
options,
|
||||
onChange,
|
||||
label,
|
||||
className = "",
|
||||
}: {
|
||||
value: T;
|
||||
options: { value: T; label: ReactNode }[];
|
||||
onChange: (next: T) => void;
|
||||
label: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className={`segmented ${className}`} role="group" aria-label={label}>
|
||||
{options.map((option) => (
|
||||
<button
|
||||
key={String(option.value)}
|
||||
type="button"
|
||||
aria-pressed={option.value === value}
|
||||
className={`segmented-item ${option.value === value ? "is-active" : ""}`}
|
||||
onClick={() => onChange(option.value)}
|
||||
>
|
||||
{option.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function ChoiceCard({
|
||||
selected,
|
||||
onClick,
|
||||
icon,
|
||||
title,
|
||||
description,
|
||||
disabled = false,
|
||||
}: {
|
||||
selected: boolean;
|
||||
onClick: () => void;
|
||||
icon?: ReactNode;
|
||||
title: ReactNode;
|
||||
description?: ReactNode;
|
||||
disabled?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={selected}
|
||||
disabled={disabled}
|
||||
className={`choice-card ${selected ? "is-active" : ""}`}
|
||||
onClick={onClick}
|
||||
>
|
||||
{icon ? <span className="choice-icon">{icon}</span> : null}
|
||||
<span className="choice-copy">
|
||||
<strong>{title}</strong>
|
||||
{description ? <small>{description}</small> : null}
|
||||
</span>
|
||||
<span className="choice-dot" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
export function Section({
|
||||
icon,
|
||||
title,
|
||||
hint,
|
||||
actions,
|
||||
children,
|
||||
className = "",
|
||||
}: {
|
||||
icon?: ReactNode;
|
||||
title: ReactNode;
|
||||
hint?: ReactNode;
|
||||
actions?: ReactNode;
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<section className={`section ${className}`}>
|
||||
<header className="section-head">
|
||||
<div className="section-head-main">
|
||||
{icon ? <span className="section-icon">{icon}</span> : null}
|
||||
<div className="section-copy">
|
||||
<h2>{title}</h2>
|
||||
{hint ? <p>{hint}</p> : null}
|
||||
</div>
|
||||
</div>
|
||||
{actions ? <div className="section-actions">{actions}</div> : null}
|
||||
</header>
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function Subhead({
|
||||
title,
|
||||
hint,
|
||||
action,
|
||||
}: {
|
||||
title: ReactNode;
|
||||
hint?: ReactNode;
|
||||
action?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="subhead">
|
||||
<div className="subhead-copy">
|
||||
<h3>{title}</h3>
|
||||
{hint ? <span>{hint}</span> : null}
|
||||
</div>
|
||||
{action ? <div className="subhead-action">{action}</div> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Row({
|
||||
leading,
|
||||
title,
|
||||
subtitle,
|
||||
detail,
|
||||
tags,
|
||||
trailing,
|
||||
children,
|
||||
onClick,
|
||||
selected = false,
|
||||
muted = false,
|
||||
busy = false,
|
||||
className = "",
|
||||
}: {
|
||||
leading?: ReactNode;
|
||||
title: ReactNode;
|
||||
subtitle?: ReactNode;
|
||||
detail?: ReactNode;
|
||||
tags?: ReactNode;
|
||||
trailing?: ReactNode;
|
||||
children?: ReactNode;
|
||||
onClick?: () => void;
|
||||
selected?: boolean;
|
||||
muted?: boolean;
|
||||
busy?: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
const body = (
|
||||
<>
|
||||
{leading ? <div className="row-leading">{leading}</div> : null}
|
||||
<div className="row-copy">
|
||||
<div className="row-title">
|
||||
<span className="row-title-text">{title}</span>
|
||||
{tags}
|
||||
</div>
|
||||
{subtitle ? <div className="row-sub">{subtitle}</div> : null}
|
||||
{detail ? <div className="row-detail">{detail}</div> : null}
|
||||
{children}
|
||||
</div>
|
||||
{trailing ? <div className="row-trailing">{trailing}</div> : null}
|
||||
</>
|
||||
);
|
||||
const classes = `row ${onClick ? "is-clickable" : ""} ${selected ? "is-selected" : ""} ${
|
||||
muted ? "is-muted" : ""
|
||||
} ${busy ? "is-busy" : ""} ${className}`;
|
||||
return (
|
||||
<div
|
||||
className={classes}
|
||||
role={onClick ? "button" : undefined}
|
||||
tabIndex={onClick ? 0 : undefined}
|
||||
onClick={onClick}
|
||||
onKeyDown={
|
||||
onClick
|
||||
? (event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
onClick();
|
||||
}
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{body}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Badge({
|
||||
tone = "neutral",
|
||||
children,
|
||||
className = "",
|
||||
title,
|
||||
}: {
|
||||
tone?: "neutral" | "success" | "warning" | "danger" | "info" | "primary";
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
title?: string;
|
||||
}) {
|
||||
return (
|
||||
<span className={`badge is-${tone} ${className}`} title={title}>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export function Toolbar({
|
||||
children,
|
||||
className = "",
|
||||
}: {
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
}) {
|
||||
return <div className={`toolbar ${className}`}>{children}</div>;
|
||||
}
|
||||
|
||||
export function SearchField({
|
||||
value,
|
||||
onChange,
|
||||
placeholder,
|
||||
label,
|
||||
className = "",
|
||||
}: {
|
||||
value: string;
|
||||
onChange: (next: string) => void;
|
||||
placeholder: string;
|
||||
label: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<label className={`search-field ${className}`}>
|
||||
<Search size={14} />
|
||||
<input
|
||||
value={value}
|
||||
aria-label={label}
|
||||
onChange={(event) => onChange(event.target.value)}
|
||||
placeholder={placeholder}
|
||||
/>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
export function Notice({
|
||||
tone = "info",
|
||||
icon,
|
||||
children,
|
||||
actions,
|
||||
}: {
|
||||
tone?: "info" | "warning" | "danger";
|
||||
icon?: ReactNode;
|
||||
children: ReactNode;
|
||||
actions?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className={`notice is-${tone}`}>
|
||||
{icon ? <span className="notice-icon">{icon}</span> : null}
|
||||
<div className="notice-copy">{children}</div>
|
||||
{actions ? <div className="notice-actions">{actions}</div> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Stat({
|
||||
icon,
|
||||
label,
|
||||
value,
|
||||
hint,
|
||||
tone,
|
||||
children,
|
||||
}: {
|
||||
icon?: ReactNode;
|
||||
label: ReactNode;
|
||||
value: ReactNode;
|
||||
hint?: ReactNode;
|
||||
tone?: string;
|
||||
children?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className={`stat ${tone ? `tone-${tone}` : ""}`}>
|
||||
<header className="stat-head">
|
||||
{icon ? <span className="stat-icon">{icon}</span> : null}
|
||||
<span className="stat-label">{label}</span>
|
||||
</header>
|
||||
<strong className="stat-value">{value}</strong>
|
||||
{hint ? <span className="stat-hint">{hint}</span> : null}
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function CategoryCard({
|
||||
category,
|
||||
total,
|
||||
|
|
|
|||
|
|
@ -17,14 +17,20 @@ import { formatBytes, formatCount, messageFrom, shortPath } from "../lib/format"
|
|||
import type { AppInfo, DeleteMode } from "../types";
|
||||
import type { AppsWorkspace } from "../hooks/useAppsWorkspace";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Checkbox,
|
||||
ConfirmDialog,
|
||||
EmptyState,
|
||||
InlineError,
|
||||
Notice,
|
||||
PageHeader,
|
||||
ProgressCard,
|
||||
ResultSummary,
|
||||
Row,
|
||||
SearchField,
|
||||
Section,
|
||||
Segmented,
|
||||
categoryLabel,
|
||||
lockLabel,
|
||||
useToast,
|
||||
|
|
@ -60,40 +66,49 @@ function AppRow({
|
|||
const letter = app.name.trim().slice(0, 1).toUpperCase() || "?";
|
||||
const badge = sourceBadge(app.source);
|
||||
return (
|
||||
<button className={`app-row ${selected ? "is-selected" : ""}`} onClick={onSelect}>
|
||||
<span className="app-glyph" aria-hidden="true">
|
||||
{app.icon ? <img src={app.icon} alt="" /> : letter}
|
||||
</span>
|
||||
<span className="app-row-copy">
|
||||
<span className="app-row-title">
|
||||
<strong>{app.name}</strong>
|
||||
<Row
|
||||
className="app-row"
|
||||
selected={selected}
|
||||
onClick={onSelect}
|
||||
leading={
|
||||
<span className="app-glyph" aria-hidden="true">
|
||||
{app.icon ? <img src={app.icon} alt="" /> : letter}
|
||||
</span>
|
||||
}
|
||||
title={app.name}
|
||||
tags={
|
||||
<>
|
||||
{app.running ? (
|
||||
<span className="status-chip is-live">
|
||||
<Badge tone="success">
|
||||
<Play size={10} fill="currentColor" />
|
||||
{t("Running", "运行中")}
|
||||
</span>
|
||||
</Badge>
|
||||
) : null}
|
||||
{app.dead ? (
|
||||
<span className="status-chip is-danger">
|
||||
<Badge tone="danger">
|
||||
<ShieldAlert size={10} />
|
||||
{t("Incomplete install", "安装不完整")}
|
||||
</span>
|
||||
</Badge>
|
||||
) : null}
|
||||
{badge ? (
|
||||
<span className="status-chip is-source" title={badge[1]}>
|
||||
<Badge tone="info" title={badge[1]}>
|
||||
<Hammer size={10} />
|
||||
{badge[0]}
|
||||
</span>
|
||||
</Badge>
|
||||
) : null}
|
||||
</span>
|
||||
<span>{app.bundle_id || shortPath(app.path, 45)}</span>
|
||||
</span>
|
||||
<span className="app-row-meta">
|
||||
<strong>{formatBytes(app.size)}</strong>
|
||||
<small>{app.version ? `v${app.version}` : app.publisher || app.source}</small>
|
||||
</span>
|
||||
<ChevronRight size={16} />
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
subtitle={app.bundle_id || shortPath(app.path, 45)}
|
||||
trailing={
|
||||
<>
|
||||
<span className="app-row-meta">
|
||||
<strong>{formatBytes(app.size)}</strong>
|
||||
<small>{app.version ? `v${app.version}` : app.publisher || app.source}</small>
|
||||
</span>
|
||||
<ChevronRight size={16} />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
export function ApplicationsPage({
|
||||
|
|
@ -203,30 +218,26 @@ export function ApplicationsPage({
|
|||
|
||||
{workspace.scanned && !workspace.scanning && !workspace.summary ? (
|
||||
<div className="apps-layout">
|
||||
<section className="apps-list-panel">
|
||||
<div className="apps-list-head">
|
||||
<div>
|
||||
<h2>{t("Installed applications", "已安装应用")}</h2>
|
||||
<p>
|
||||
{t(
|
||||
`${formatCount(workspace.apps.length)} apps · ${formatBytes(
|
||||
workspace.total,
|
||||
)}`,
|
||||
`${formatCount(workspace.apps.length)} 个应用 · ${formatBytes(
|
||||
workspace.total,
|
||||
)}`,
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<label className="search-field">
|
||||
<Search size={15} />
|
||||
<input
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder={t("Search apps", "搜索应用")}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<Section
|
||||
className="apps-list-panel"
|
||||
title={t("Installed applications", "已安装应用")}
|
||||
hint={t(
|
||||
`${formatCount(workspace.apps.length)} apps · ${formatBytes(
|
||||
workspace.total,
|
||||
)}`,
|
||||
`${formatCount(workspace.apps.length)} 个应用 · ${formatBytes(
|
||||
workspace.total,
|
||||
)}`,
|
||||
)}
|
||||
actions={
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
label={t("Search apps", "搜索应用")}
|
||||
placeholder={t("Search apps", "搜索应用")}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<div className="app-list">
|
||||
{apps.map((app) => (
|
||||
<AppRow
|
||||
|
|
@ -246,9 +257,9 @@ export function ApplicationsPage({
|
|||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<aside className="app-plan-panel">
|
||||
<aside className="section app-plan-panel">
|
||||
{workspace.planning ? (
|
||||
<ProgressCard
|
||||
progress={workspace.progress}
|
||||
|
|
@ -282,16 +293,10 @@ export function ApplicationsPage({
|
|||
</div>
|
||||
|
||||
{workspace.plan.app.dead ? (
|
||||
<div className="plan-dead-callout">
|
||||
<ShieldAlert size={16} />
|
||||
<div>
|
||||
<strong>{t("Incomplete install", "安装不完整")}</strong>
|
||||
<p>
|
||||
{t(
|
||||
"The program files are already gone; only its registry record and leftovers remain. Removing the record makes Windows stop listing it.",
|
||||
"程序本体已经不存在,只剩下注册表记录和残留文件。清除记录后,系统将不再列出这个应用。",
|
||||
)}
|
||||
</p>
|
||||
<Notice
|
||||
tone="warning"
|
||||
icon={<ShieldAlert size={16} />}
|
||||
actions={
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
|
|
@ -303,14 +308,23 @@ export function ApplicationsPage({
|
|||
? t("Cleaning…", "正在清理…")
|
||||
: t("Clean leftovers", "清理残留记录")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<strong>{t("Incomplete install", "安装不完整")}</strong>
|
||||
<br />
|
||||
{t(
|
||||
"The program files are already gone; only its registry record and leftovers remain. Removing the record makes Windows stop listing it.",
|
||||
"程序本体已经不存在,只剩下注册表记录和残留文件。清除记录后,系统将不再列出这个应用。",
|
||||
)}
|
||||
</Notice>
|
||||
) : null}
|
||||
|
||||
{workspace.plan.warnings.length > 0 ? (
|
||||
<div className="plan-warnings">
|
||||
{workspace.plan.warnings.map((warning) => (
|
||||
<p key={warning}>{warning}</p>
|
||||
<Notice key={warning} tone="warning" icon={<ShieldAlert size={13} />}>
|
||||
{warning}
|
||||
</Notice>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
|
|
@ -332,32 +346,30 @@ export function ApplicationsPage({
|
|||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="plan-items">
|
||||
<div className="row-list plan-items">
|
||||
{workspace.plan.items.map((item, index) => (
|
||||
<div
|
||||
<Row
|
||||
key={`${item.path}-${index}`}
|
||||
className={`plan-item ${item.lock ? "is-locked" : ""}`}
|
||||
leading={
|
||||
<Checkbox
|
||||
checked={workspace.planSelected.has(index)}
|
||||
disabled={Boolean(item.lock)}
|
||||
onChange={() => workspace.togglePlanItem(index)}
|
||||
label={item.label}
|
||||
/>
|
||||
}
|
||||
title={item.label}
|
||||
subtitle={shortPath(item.displayPath, 44)}
|
||||
detail={`${categoryLabel(item.category, lang, bin)}${
|
||||
item.note ? ` · ${item.note}` : ""
|
||||
}${item.lock ? ` · ${lockLabel(item.lock, t)}` : ""}`}
|
||||
trailing={<b>{formatBytes(item.onDisk)}</b>}
|
||||
muted={Boolean(item.lock)}
|
||||
onClick={() => {
|
||||
if (!item.lock) workspace.togglePlanItem(index);
|
||||
}}
|
||||
>
|
||||
<Checkbox
|
||||
checked={workspace.planSelected.has(index)}
|
||||
disabled={Boolean(item.lock)}
|
||||
onChange={() => workspace.togglePlanItem(index)}
|
||||
label={item.label}
|
||||
/>
|
||||
<span className="plan-item-copy">
|
||||
<strong>{item.label}</strong>
|
||||
<span title={item.displayPath}>{shortPath(item.displayPath, 44)}</span>
|
||||
<small>
|
||||
{categoryLabel(item.category, lang, bin)}
|
||||
{item.note ? ` · ${item.note}` : ""}
|
||||
{item.lock ? ` · ${lockLabel(item.lock, t)}` : ""}
|
||||
</small>
|
||||
</span>
|
||||
<b>{formatBytes(item.onDisk)}</b>
|
||||
</div>
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
|
|
@ -442,22 +454,31 @@ export function ApplicationsPage({
|
|||
busy={workspace.deleting}
|
||||
icon={<Trash2 size={23} />}
|
||||
>
|
||||
<div className="mode-picker">
|
||||
<button
|
||||
className={mode === "trash" ? "is-active" : ""}
|
||||
onClick={() => setMode("trash")}
|
||||
>
|
||||
<FolderOpen size={17} />
|
||||
<span>{bin}</span>
|
||||
</button>
|
||||
<button
|
||||
className={mode === "permanent" ? "is-active" : ""}
|
||||
onClick={() => setMode("permanent")}
|
||||
>
|
||||
<Trash2 size={17} />
|
||||
<span>{t("Permanent", "永久")}</span>
|
||||
</button>
|
||||
</div>
|
||||
<Segmented
|
||||
value={mode}
|
||||
label={t("Deletion mode", "删除方式")}
|
||||
onChange={setMode}
|
||||
options={[
|
||||
{
|
||||
value: "trash",
|
||||
label: (
|
||||
<>
|
||||
<FolderOpen size={17} />
|
||||
{bin}
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
value: "permanent",
|
||||
label: (
|
||||
<>
|
||||
<Trash2 size={17} />
|
||||
{t("Permanent", "永久")}
|
||||
</>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</ConfirmDialog>
|
||||
|
||||
{workspace.deleting ? (
|
||||
|
|
|
|||
|
|
@ -17,12 +17,18 @@ import { useI18n } from "../i18n";
|
|||
import { agoLabel, formatBytes, formatCount } from "../lib/format";
|
||||
import { keepIndexOf, useDuplicatesWorkspace } from "../hooks/useDuplicatesWorkspace";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Checkbox,
|
||||
EmptyState,
|
||||
IconButton,
|
||||
InlineError,
|
||||
Notice,
|
||||
PageHeader,
|
||||
ProgressCard,
|
||||
Row,
|
||||
Segmented,
|
||||
Toolbar,
|
||||
useToast,
|
||||
} from "../components/ui";
|
||||
import { CleanBar } from "../components/CleanBar";
|
||||
|
|
@ -75,97 +81,94 @@ function DupGroupCard({
|
|||
// the strategy stays visible, and adds a warning when it gets picked.
|
||||
const keepPicked = picked?.has(keep) ?? false;
|
||||
return (
|
||||
<section className={`dup-group ${group.personal ? "is-personal" : ""}`}>
|
||||
<header className="dup-group-head">
|
||||
<div className="dup-group-title">
|
||||
<span className="dup-group-count">
|
||||
{group.copies.length} {t("copies", "份相同")}
|
||||
</span>
|
||||
<b>{group.copies[keep]?.path.split(/[\\/]/).pop()}</b>
|
||||
<span className="dup-waste-chip">
|
||||
{t("wastes", "重复浪费")} {formatBytes(wasted)}
|
||||
</span>
|
||||
{keepPicked ? (
|
||||
<span className="dup-empty-chip">
|
||||
{t("group will be empty", "本组将一份不剩")}
|
||||
</span>
|
||||
) : null}
|
||||
{group.personal ? (
|
||||
<span className="dup-personal-chip">
|
||||
<Lock size={11} />
|
||||
{t("personal files", "个人文件")}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="dup-group-size">
|
||||
{formatBytes(group.size)} {t("each", "/ 份")}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="dup-group-dismiss"
|
||||
title={t("Ignore this group", "忽略本组")}
|
||||
onClick={() => onDismiss(index)}
|
||||
>
|
||||
<X size={13} />
|
||||
</button>
|
||||
</header>
|
||||
<ul className="dup-copies">
|
||||
<section className={`section dup-group ${group.personal ? "is-personal" : ""}`}>
|
||||
<Row
|
||||
className="dup-group-head"
|
||||
title={group.copies[keep]?.path.split(/[\\/]/).pop()}
|
||||
tags={
|
||||
<>
|
||||
<Badge tone="neutral">
|
||||
{group.copies.length} {t("copies", "份相同")}
|
||||
</Badge>
|
||||
<Badge tone="warning">
|
||||
{t("wastes", "重复浪费")} {formatBytes(wasted)}
|
||||
</Badge>
|
||||
{keepPicked ? (
|
||||
<Badge tone="danger">{t("group will be empty", "本组将一份不剩")}</Badge>
|
||||
) : null}
|
||||
{group.personal ? (
|
||||
<Badge tone="info">
|
||||
<Lock size={11} />
|
||||
{t("personal files", "个人文件")}
|
||||
</Badge>
|
||||
) : null}
|
||||
</>
|
||||
}
|
||||
subtitle={t(
|
||||
`${formatBytes(group.size)} each`,
|
||||
`每份 ${formatBytes(group.size)}`,
|
||||
)}
|
||||
trailing={
|
||||
<IconButton
|
||||
label={t("Ignore this group", "忽略本组")}
|
||||
onClick={() => onDismiss(index)}
|
||||
>
|
||||
<X size={13} />
|
||||
</IconButton>
|
||||
}
|
||||
/>
|
||||
<div className="row-list dup-copies">
|
||||
{group.copies.map((copy, copyIndex) => {
|
||||
const isKeep = copyIndex === keep;
|
||||
const checked = picked?.has(copyIndex) ?? false;
|
||||
return (
|
||||
<li
|
||||
<Row
|
||||
key={copy.path}
|
||||
className={`dup-copy ${checked ? "is-picked" : ""} ${isKeep ? "is-keep" : ""} ${
|
||||
isKeep && checked ? "is-keep-picked" : ""
|
||||
}`}
|
||||
>
|
||||
<Checkbox
|
||||
checked={checked}
|
||||
disabled={Boolean(copy.locked)}
|
||||
onChange={() => onToggle(index, copyIndex)}
|
||||
label={copy.path}
|
||||
/>
|
||||
{isKeep ? (
|
||||
<span
|
||||
className={`dup-keep-chip ${checked ? "is-danger" : ""}`}
|
||||
title={
|
||||
checked
|
||||
? t(
|
||||
"This is the kept copy — deleting it leaves the group with nothing.",
|
||||
"此文件为最后保留版本,勾选即完全删除本组。",
|
||||
)
|
||||
: undefined
|
||||
selected={checked}
|
||||
muted={isKeep}
|
||||
leading={
|
||||
<Checkbox
|
||||
checked={checked}
|
||||
disabled={Boolean(copy.locked)}
|
||||
onChange={() => onToggle(index, copyIndex)}
|
||||
label={copy.path}
|
||||
/>
|
||||
}
|
||||
title={copy.path}
|
||||
tags={
|
||||
<>
|
||||
{isKeep ? (
|
||||
<Badge tone={checked ? "danger" : "primary"}>
|
||||
{checked
|
||||
? t("keep · deleting", "保留 · 已勾选删除")
|
||||
: t("keep", "保留")}
|
||||
</Badge>
|
||||
) : null}
|
||||
{copy.locked ? (
|
||||
<Badge tone="neutral" title={copy.locked}>
|
||||
<Lock size={11} />
|
||||
</Badge>
|
||||
) : null}
|
||||
</>
|
||||
}
|
||||
subtitle={copy.mtimeMs ? agoLabel(copy.mtimeMs, lang) : undefined}
|
||||
trailing={
|
||||
<IconButton
|
||||
label={t("Reveal in Explorer", "在文件夹中显示")}
|
||||
onClick={() =>
|
||||
void apiClient.api.revealPath(copy.path).catch(() => undefined)
|
||||
}
|
||||
>
|
||||
{checked ? t("keep · deleting", "保留 · 已勾选删除") : t("keep", "保留")}
|
||||
</span>
|
||||
) : null}
|
||||
|
||||
{copy.locked ? (
|
||||
<span className="dup-lock-chip" title={copy.locked}>
|
||||
<Lock size={11} />
|
||||
</span>
|
||||
) : null}
|
||||
<span className="dup-copy-path" title={copy.path}>
|
||||
{copy.path}
|
||||
</span>
|
||||
<span className="dup-copy-age">
|
||||
{copy.mtimeMs ? agoLabel(copy.mtimeMs, lang) : ""}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
className="dup-copy-reveal"
|
||||
onClick={() => void apiClient.api.revealPath(copy.path).catch(() => undefined)}
|
||||
title={t("Reveal in Explorer", "在文件夹中显示")}
|
||||
>
|
||||
<MapPin size={12} />
|
||||
{t("Reveal", "定位")}
|
||||
</button>
|
||||
</li>
|
||||
<MapPin size={12} />
|
||||
</IconButton>
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
@ -280,18 +283,15 @@ export function DuplicateFilesPage({
|
|||
</button>
|
||||
<span className="dup-config-spacer" />
|
||||
<span className="dup-config-label">{t("Min size", "最小体积")}</span>
|
||||
<div className="dup-seg" role="group">
|
||||
{MIN_SIZE_OPTIONS.map((option) => (
|
||||
<button
|
||||
key={option.value}
|
||||
type="button"
|
||||
className={minSize === option.value ? "is-active" : ""}
|
||||
onClick={() => setMinSize(option.value)}
|
||||
>
|
||||
{option.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<Segmented
|
||||
value={minSize}
|
||||
label={t("Min size", "最小体积")}
|
||||
onChange={setMinSize}
|
||||
options={MIN_SIZE_OPTIONS.map((option) => ({
|
||||
value: option.value,
|
||||
label: option.label,
|
||||
}))}
|
||||
/>
|
||||
<Button
|
||||
size="lg"
|
||||
variant="primary"
|
||||
|
|
@ -401,44 +401,47 @@ export function DuplicateFilesPage({
|
|||
|
||||
{!workspace.scanning && groups.length > 0 ? (
|
||||
<>
|
||||
<section className="dup-toolbar">
|
||||
<button type="button" className="dup-smart" onClick={() => workspace.smartSelect()}>
|
||||
<Sparkles size={13} />{" "}
|
||||
<Toolbar>
|
||||
<div className="toolbar-copy">
|
||||
{formatCount(groups.length)} {t("groups · duplicate copies", "组 · 重复副本")}{" "}
|
||||
{formatCount(groups.reduce((sum, g) => sum + g.copies.length - 1, 0))} ·{" "}
|
||||
{formatBytes(visibleWasted)}
|
||||
{empties > 0 ? (
|
||||
<b>
|
||||
{t(
|
||||
`${formatCount(empties)} group(s) will be fully removed`,
|
||||
` · ${formatCount(empties)} 组将一份不剩`,
|
||||
)}
|
||||
</b>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="toolbar-group">
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
icon={<Sparkles size={13} />}
|
||||
onClick={() => workspace.smartSelect()}
|
||||
>
|
||||
{t("Smart pick (keep one per group)", "智能选择(每组保留一份)")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="dup-strategy"
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() =>
|
||||
workspace.setKeepStrategy(
|
||||
workspace.keepStrategy === "shortest" ? "oldest" : "shortest",
|
||||
)
|
||||
}
|
||||
title={t("Which copy survives when picking smartly", "智能选择保留哪一份")}
|
||||
>
|
||||
{workspace.keepStrategy === "shortest"
|
||||
? t("keep: shortest path", "保留:路径最短")
|
||||
: t("keep: oldest copy", "保留:最早的一份")}
|
||||
</button>
|
||||
<button type="button" className="dup-invert" onClick={workspace.invertSelection}>
|
||||
</Button>
|
||||
<Button variant="ghost" size="sm" onClick={workspace.invertSelection}>
|
||||
{t("Invert", "反选")}
|
||||
</button>
|
||||
<span className="dup-toolbar-sum">
|
||||
{formatCount(groups.length)} {t("groups · duplicate copies", "组 · 重复副本")}{" "}
|
||||
{formatCount(groups.reduce((sum, g) => sum + g.copies.length - 1, 0))} ·{" "}
|
||||
{formatBytes(visibleWasted)}
|
||||
{empties > 0 ? (
|
||||
<em className="dup-empties">
|
||||
{t(
|
||||
`${formatCount(empties)} group(s) will be fully removed`,
|
||||
` · ${formatCount(empties)} 组将一份不剩`,
|
||||
)}
|
||||
</em>
|
||||
) : null}
|
||||
</span>
|
||||
</Button>
|
||||
<Button
|
||||
variant="danger"
|
||||
className="dup-clean"
|
||||
disabled={workspace.selectedCount === 0 || workspace.deleting}
|
||||
onClick={() => setConfirming(true)}
|
||||
>
|
||||
|
|
@ -452,44 +455,44 @@ export function DuplicateFilesPage({
|
|||
)} · ${formatBytes(workspace.selectedBytes)}`}
|
||||
</span>
|
||||
</Button>
|
||||
</section>
|
||||
</div>
|
||||
</Toolbar>
|
||||
{confirming ? (
|
||||
<section className={`dup-confirm ${empties > 0 ? "is-strict" : ""}`}>
|
||||
<ShieldAlert size={15} />
|
||||
<div>
|
||||
<b>
|
||||
{lang === "zh"
|
||||
? `将 ${workspace.selectedCount} 个副本(${formatBytes(workspace.selectedBytes)})移入回收站?`
|
||||
: `Move ${workspace.selectedCount} copies (${formatBytes(workspace.selectedBytes)}) to the Recycle Bin?`}
|
||||
</b>
|
||||
{empties > 0 ? (
|
||||
<b className="dup-confirm-warn">
|
||||
{lang === "zh"
|
||||
? `${formatCount(empties)} 组勾选了最后保留版本——这 ${formatCount(empties)} 组将被完全删除!`
|
||||
: `${formatCount(empties)} group(s) include the kept copy — they will be deleted entirely!`}
|
||||
</b>
|
||||
) : (
|
||||
<small>
|
||||
{t(
|
||||
"Every group keeps at least one copy; a mis-click is one Undo away from History.",
|
||||
"每组至少保留一份;误删可从「历史记录 → 撤销」找回。",
|
||||
)}
|
||||
</small>
|
||||
)}
|
||||
<small>
|
||||
{t(
|
||||
"Deletions land in the Recycle Bin — undo from History.",
|
||||
"删除一律进回收站,可从「历史记录 → 撤销」找回。",
|
||||
<Notice
|
||||
tone={empties > 0 ? "danger" : "warning"}
|
||||
icon={<ShieldAlert size={15} />}
|
||||
actions={
|
||||
<>
|
||||
<Button onClick={() => setConfirming(false)}>{t("Cancel", "取消")}</Button>
|
||||
<Button variant="danger" onClick={() => void confirmClean()}>
|
||||
{empties > 0
|
||||
? t("Delete everything selected", "确认完全删除")
|
||||
: t("Confirm", "确认清理")}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<b>
|
||||
{lang === "zh"
|
||||
? `将 ${workspace.selectedCount} 个副本(${formatBytes(workspace.selectedBytes)})移入回收站?`
|
||||
: `Move ${workspace.selectedCount} copies (${formatBytes(workspace.selectedBytes)}) to the Recycle Bin?`}
|
||||
</b>
|
||||
<br />
|
||||
{empties > 0
|
||||
? t(
|
||||
`${formatCount(empties)} group(s) include the kept copy — they will be deleted entirely!`,
|
||||
`${formatCount(empties)} 组勾选了最后保留版本——这 ${formatCount(empties)} 组将被完全删除!`,
|
||||
)
|
||||
: t(
|
||||
"Every group keeps at least one copy; a mis-click is one Undo away from History.",
|
||||
"每组至少保留一份;误删可从「历史记录 → 撤销」找回。",
|
||||
)}
|
||||
</small>
|
||||
</div>
|
||||
<Button onClick={() => setConfirming(false)}>{t("Cancel", "取消")}</Button>
|
||||
<Button variant="danger" onClick={() => void confirmClean()}>
|
||||
{empties > 0
|
||||
? t("Delete everything selected", "确认完全删除")
|
||||
: t("Confirm", "确认清理")}
|
||||
</Button>
|
||||
</section>
|
||||
<br />
|
||||
{t(
|
||||
"Deletions land in the Recycle Bin — undo from History.",
|
||||
"删除一律进回收站,可从「历史记录 → 撤销」找回。",
|
||||
)}
|
||||
</Notice>
|
||||
) : null}
|
||||
<div className="dup-groups">
|
||||
{entries.map(({ group, index }) => (
|
||||
|
|
|
|||
|
|
@ -19,11 +19,16 @@ import {
|
|||
} from "../lib/format";
|
||||
import type { HistorySession } from "../types";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
ConfirmDialog,
|
||||
EmptyState,
|
||||
IconButton,
|
||||
InlineError,
|
||||
PageHeader,
|
||||
Row,
|
||||
Section,
|
||||
Stat,
|
||||
useToast,
|
||||
} from "../components/ui";
|
||||
|
||||
|
|
@ -105,25 +110,17 @@ export function HistoryPage() {
|
|||
{error ? <InlineError message={error} /> : null}
|
||||
|
||||
{sessions.length > 0 ? (
|
||||
<div className="history-summary">
|
||||
<div>
|
||||
<span>{t("Space kept clean", "当前已释放")}</span>
|
||||
<strong>{formatBytes(totalKept)}</strong>
|
||||
</div>
|
||||
<div>
|
||||
<span>{t("Cleanup sessions", "清理记录")}</span>
|
||||
<strong>{formatCount(sessions.length)}</strong>
|
||||
</div>
|
||||
<div>
|
||||
<span>{t("Restorable sessions", "可还原记录")}</span>
|
||||
<strong>
|
||||
{formatCount(
|
||||
sessions.filter(
|
||||
(session) => session.mode === "trash" && !session.restored,
|
||||
).length,
|
||||
)}
|
||||
</strong>
|
||||
</div>
|
||||
<div className="stat-row">
|
||||
<Stat label={t("Space kept clean", "当前已释放")} value={formatBytes(totalKept)} />
|
||||
<Stat label={t("Cleanup sessions", "清理记录")} value={formatCount(sessions.length)} />
|
||||
<Stat
|
||||
label={t("Restorable sessions", "可还原记录")}
|
||||
value={formatCount(
|
||||
sessions.filter(
|
||||
(session) => session.mode === "trash" && !session.restored,
|
||||
).length,
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
|
|
@ -151,50 +148,52 @@ export function HistoryPage() {
|
|||
session.entries.some((entry) => entry.trash_path);
|
||||
const isOpen = expanded === session.id;
|
||||
return (
|
||||
<article
|
||||
key={session.id}
|
||||
className={`history-card ${session.restored ? "is-restored" : ""}`}
|
||||
>
|
||||
<button
|
||||
className="history-card-head"
|
||||
onClick={() => setExpanded(isOpen ? null : session.id)}
|
||||
>
|
||||
<span className={`history-mode ${session.restored ? "is-restored" : ""}`}>
|
||||
{session.restored ? <RotateCcw size={18} /> : <Trash2 size={18} />}
|
||||
</span>
|
||||
<span className="history-main">
|
||||
<strong>
|
||||
{session.command.replace(/^Squid · /, "") ||
|
||||
t("Cleanup", "清理")}
|
||||
</strong>
|
||||
<small>
|
||||
{formatDate(session.started, lang)} ·{" "}
|
||||
{session.mode === "trash"
|
||||
? t(`Moved to ${bin}`, `已移入${bin}`)
|
||||
: t("Permanently removed", "已永久删除")}
|
||||
</small>
|
||||
</span>
|
||||
<span className="history-count">
|
||||
<strong>{formatBytes(bytes)}</strong>
|
||||
<small>
|
||||
{formatCount(session.removed)} {t("items", "项")}
|
||||
{session.failed > 0 ? ` · ${session.failed} ${t("failed", "失败")}` : ""}
|
||||
</small>
|
||||
</span>
|
||||
{session.restored ? (
|
||||
<span className="status-chip is-restored">
|
||||
<RotateCcw size={11} />
|
||||
{t("Restored", "已还原")}
|
||||
<article key={session.id} className="section history-card">
|
||||
<Row
|
||||
className="history-head"
|
||||
leading={
|
||||
<span className={`history-mode ${session.restored ? "is-restored" : ""}`}>
|
||||
{session.restored ? <RotateCcw size={18} /> : <Trash2 size={18} />}
|
||||
</span>
|
||||
) : null}
|
||||
<span className="history-time">
|
||||
{(session.duration_ms / 1000).toFixed(1)}s
|
||||
</span>
|
||||
<ChevronDown
|
||||
size={17}
|
||||
className={`history-chevron ${isOpen ? "is-open" : ""}`}
|
||||
/>
|
||||
</button>
|
||||
}
|
||||
title={
|
||||
session.command.replace(/^Squid · /, "") || t("Cleanup", "清理")
|
||||
}
|
||||
subtitle={`${formatDate(session.started, lang)} · ${
|
||||
session.mode === "trash"
|
||||
? t(`Moved to ${bin}`, `已移入${bin}`)
|
||||
: t("Permanently removed", "已永久删除")
|
||||
}`}
|
||||
tags={
|
||||
session.restored ? (
|
||||
<Badge tone="neutral">
|
||||
<RotateCcw size={11} />
|
||||
{t("Restored", "已还原")}
|
||||
</Badge>
|
||||
) : undefined
|
||||
}
|
||||
trailing={
|
||||
<>
|
||||
<span className="history-count">
|
||||
<strong>{formatBytes(bytes)}</strong>
|
||||
<small>
|
||||
{formatCount(session.removed)} {t("items", "项")}
|
||||
{session.failed > 0
|
||||
? ` · ${session.failed} ${t("failed", "失败")}`
|
||||
: ""}
|
||||
</small>
|
||||
</span>
|
||||
<span className="history-time">
|
||||
{(session.duration_ms / 1000).toFixed(1)}s
|
||||
</span>
|
||||
<ChevronDown
|
||||
size={17}
|
||||
className={`history-chevron ${isOpen ? "is-open" : ""}`}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
onClick={() => setExpanded(isOpen ? null : session.id)}
|
||||
/>
|
||||
|
||||
{isOpen ? (
|
||||
<div className="history-detail">
|
||||
|
|
@ -216,30 +215,29 @@ export function HistoryPage() {
|
|||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="history-entries">
|
||||
<div className="row-list history-entries">
|
||||
{session.entries.slice(0, 40).map((entry, index) => (
|
||||
<div className="history-entry" key={`${entry.path}-${index}`}>
|
||||
<span className="history-entry-dot" />
|
||||
<span className="history-entry-copy">
|
||||
<strong title={entry.path}>{shortPath(entry.path, 78)}</strong>
|
||||
<small>
|
||||
{entry.category || entry.kind}
|
||||
{entry.trash_path
|
||||
? ` · ${t(`in ${bin}`, `位于${bin}`)}`
|
||||
: ""}
|
||||
</small>
|
||||
</span>
|
||||
<span>{formatBytes(entry.allocated || entry.logical)}</span>
|
||||
<button
|
||||
className="row-reveal"
|
||||
title={t("Show in Finder", "在访达中显示")}
|
||||
onClick={() =>
|
||||
void api.revealPath(entry.path).catch(() => undefined)
|
||||
}
|
||||
>
|
||||
<ExternalLink size={13} />
|
||||
</button>
|
||||
</div>
|
||||
<Row
|
||||
key={`${entry.path}-${index}`}
|
||||
className="history-entry"
|
||||
title={shortPath(entry.path, 78)}
|
||||
subtitle={`${entry.category || entry.kind}${
|
||||
entry.trash_path ? ` · ${t(`in ${bin}`, `位于${bin}`)}` : ""
|
||||
}`}
|
||||
trailing={
|
||||
<>
|
||||
<span>{formatBytes(entry.allocated || entry.logical)}</span>
|
||||
<IconButton
|
||||
label={t("Show in Finder", "在访达中显示")}
|
||||
onClick={() =>
|
||||
void api.revealPath(entry.path).catch(() => undefined)
|
||||
}
|
||||
>
|
||||
<ExternalLink size={13} />
|
||||
</IconButton>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -18,12 +18,18 @@ import { subscribeJobProgress } from "../lib/api";
|
|||
import { useI18n } from "../i18n";
|
||||
import { agoLabel, formatBytes, formatCount, messageFrom } from "../lib/format";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Checkbox,
|
||||
EmptyState,
|
||||
IconButton,
|
||||
InlineError,
|
||||
Notice,
|
||||
PageHeader,
|
||||
ProgressCard,
|
||||
Row,
|
||||
Segmented,
|
||||
Toolbar,
|
||||
useToast,
|
||||
} from "../components/ui";
|
||||
import { CleanBar } from "../components/CleanBar";
|
||||
|
|
@ -191,54 +197,45 @@ export function LargeFilesPage({
|
|||
|
||||
<section className="bigfiles-config">
|
||||
<span className="dup-config-label">{t("Scope", "范围")}</span>
|
||||
<div className="dup-seg" role="group">
|
||||
<button
|
||||
type="button"
|
||||
className={scope.length === 0 ? "is-active" : ""}
|
||||
onClick={() => setScope([])}
|
||||
>
|
||||
{t("All local drives", "全部本地磁盘")}
|
||||
</button>
|
||||
{["C:", "D:", "E:"].map((drive) => (
|
||||
<button
|
||||
key={drive}
|
||||
type="button"
|
||||
className={scope.length === 1 && scope[0] === `${drive}\\` ? "is-active" : ""}
|
||||
onClick={() => setScope([`${drive}\\`])}
|
||||
>
|
||||
{drive}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<Segmented
|
||||
value={scope.length === 1 ? scope[0] : ""}
|
||||
label={t("Scope", "范围")}
|
||||
onChange={(next) => setScope(next ? [next] : [])}
|
||||
options={[
|
||||
{ value: "", label: t("All local drives", "全部本地磁盘") },
|
||||
...["C:", "D:", "E:"].map((drive) => ({
|
||||
value: `${drive}\\`,
|
||||
label: drive,
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
<span className="dup-config-label">{t("At least", "阈值")}</span>
|
||||
<div className="dup-seg" role="group">
|
||||
{THRESHOLDS.map((option) => (
|
||||
<button
|
||||
key={option.value}
|
||||
type="button"
|
||||
className={threshold === option.value ? "is-active" : ""}
|
||||
onClick={() => setThreshold(option.value)}
|
||||
>
|
||||
{option.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<Segmented
|
||||
value={threshold}
|
||||
label={t("At least", "阈值")}
|
||||
onChange={setThreshold}
|
||||
options={THRESHOLDS.map((option) => ({
|
||||
value: option.value,
|
||||
label: option.label,
|
||||
}))}
|
||||
/>
|
||||
<span className="dup-config-label">{t("Type", "类型")}</span>
|
||||
<div className="dup-seg is-classes" role="group">
|
||||
{CLASSES.map((option) => {
|
||||
<Segmented
|
||||
value={klass}
|
||||
label={t("Type", "类型")}
|
||||
onChange={setKlass}
|
||||
options={CLASSES.map((option) => {
|
||||
const Icon = option.icon;
|
||||
return (
|
||||
<button
|
||||
key={option.id}
|
||||
type="button"
|
||||
className={klass === option.id ? "is-active" : ""}
|
||||
onClick={() => setKlass(option.id)}
|
||||
>
|
||||
<Icon size={12} /> {lang === "zh" ? option.zh : option.en}
|
||||
</button>
|
||||
);
|
||||
return {
|
||||
value: option.id,
|
||||
label: (
|
||||
<>
|
||||
<Icon size={12} /> {lang === "zh" ? option.zh : option.en}
|
||||
</>
|
||||
),
|
||||
};
|
||||
})}
|
||||
</div>
|
||||
/>
|
||||
<Button
|
||||
size="lg"
|
||||
variant="primary"
|
||||
|
|
@ -312,8 +309,8 @@ export function LargeFilesPage({
|
|||
|
||||
{visible && visible.length > 0 ? (
|
||||
<>
|
||||
<section className="bigfiles-list-head">
|
||||
<div>
|
||||
<Toolbar className="bigfiles-list-head">
|
||||
<div className="toolbar-copy">
|
||||
<b>
|
||||
{formatCount(visible.length)} {t("large files", "个大文件")} ·{" "}
|
||||
<span className="is-accent">{formatBytes(totalBytes)}</span>
|
||||
|
|
@ -330,7 +327,8 @@ export function LargeFilesPage({
|
|||
)}
|
||||
</small>
|
||||
</div>
|
||||
<label className="bigfiles-hide-critical">
|
||||
<div className="toolbar-group">
|
||||
<label className="toggle-label">
|
||||
<Checkbox
|
||||
checked={hideCritical}
|
||||
onChange={() => setHideCritical((v) => !v)}
|
||||
|
|
@ -346,78 +344,106 @@ export function LargeFilesPage({
|
|||
<Trash2 size={14} />
|
||||
<span>{t("Clean selected", "清理已选")}</span>
|
||||
</Button>
|
||||
</section>
|
||||
</div>
|
||||
</Toolbar>
|
||||
{confirming ? (
|
||||
<section className="dup-confirm">
|
||||
<ShieldAlert size={15} />
|
||||
<div>
|
||||
<b>
|
||||
{lang === "zh"
|
||||
? `将 ${pickedCount} 个大文件(${formatBytes(pickedBytes)})移入回收站?`
|
||||
: `Move ${pickedCount} files (${formatBytes(pickedBytes)}) to the Recycle Bin?`}
|
||||
</b>
|
||||
<small>
|
||||
{t(
|
||||
"Undo from History while the Recycle Bin holds them.",
|
||||
"回收站清空前,可随时在「历史记录」撤销。",
|
||||
)}
|
||||
</small>
|
||||
</div>
|
||||
<Button onClick={() => setConfirming(false)}>{t("Cancel", "取消")}</Button>
|
||||
<Button variant="danger" disabled={deleting} onClick={() => void confirmDelete()}>
|
||||
{deleting ? t("Cleaning…", "清理中…") : t("Confirm", "确认清理")}
|
||||
</Button>
|
||||
</section>
|
||||
<Notice
|
||||
tone="danger"
|
||||
icon={<ShieldAlert size={15} />}
|
||||
actions={
|
||||
<>
|
||||
<Button onClick={() => setConfirming(false)}>{t("Cancel", "取消")}</Button>
|
||||
<Button
|
||||
variant="danger"
|
||||
disabled={deleting}
|
||||
onClick={() => void confirmDelete()}
|
||||
>
|
||||
{deleting ? t("Cleaning…", "清理中…") : t("Confirm", "确认清理")}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<b>
|
||||
{lang === "zh"
|
||||
? `将 ${pickedCount} 个大文件(${formatBytes(pickedBytes)})移入回收站?`
|
||||
: `Move ${pickedCount} files (${formatBytes(pickedBytes)}) to the Recycle Bin?`}
|
||||
</b>
|
||||
<br />
|
||||
{t(
|
||||
"Undo from History while the Recycle Bin holds them.",
|
||||
"回收站清空前,可随时在「历史记录」撤销。",
|
||||
)}
|
||||
</Notice>
|
||||
) : null}
|
||||
<ul className="bigfiles-list">
|
||||
<div className="row-list bigfiles-list">
|
||||
{visible.map((file, index) => {
|
||||
const Icon = CLASS_ICON[file.class] ?? HardDrive;
|
||||
const dormant =
|
||||
file.modifiedMs > 0 && (now - file.modifiedMs) / 1000 > DORMANT_SECS;
|
||||
return (
|
||||
<li key={file.path} className={`bigfile-row ${picked.has(file.path) ? "is-picked" : ""}`}>
|
||||
<Checkbox
|
||||
checked={picked.has(file.path)}
|
||||
onChange={() => toggle(file.path)}
|
||||
label={file.displayPath}
|
||||
/>
|
||||
<span className="bigfile-index">{String(index + 1).padStart(2, "0")}</span>
|
||||
<span className="bigfile-icon">
|
||||
<Icon size={15} />
|
||||
</span>
|
||||
<div className="bigfile-main">
|
||||
<b>{file.path.split(/[\\/]/).pop()}</b>
|
||||
<span className="bigfile-path">{file.displayPath}</span>
|
||||
</div>
|
||||
{dormant ? (
|
||||
<span className="space-rule-dormant">
|
||||
{agoLabel(file.modifiedMs, lang)} {t("untouched", "未修改")}
|
||||
<Row
|
||||
key={file.path}
|
||||
className="bigfile-row"
|
||||
selected={picked.has(file.path)}
|
||||
leading={
|
||||
<span className="space-cat-lead">
|
||||
<Checkbox
|
||||
checked={picked.has(file.path)}
|
||||
onChange={() => toggle(file.path)}
|
||||
label={file.displayPath}
|
||||
/>
|
||||
<span className="bigfile-index">
|
||||
{String(index + 1).padStart(2, "0")}
|
||||
</span>
|
||||
<span className="bigfile-icon">
|
||||
<Icon size={15} />
|
||||
</span>
|
||||
</span>
|
||||
) : null}
|
||||
{file.cloudHint ? (
|
||||
<span className="bigfile-cloud-chip">
|
||||
<Cloud size={11} /> {t("cloud copy?", "网盘可能有副本?")}
|
||||
</span>
|
||||
) : null}
|
||||
{file.maybeMounted ? (
|
||||
<span className="dup-lock-chip" title={t("May be in use by Hyper-V/WSL", "可能正被 Hyper-V/WSL 使用")}>
|
||||
<Lock size={11} /> {t("check in use", "占用检查")}
|
||||
</span>
|
||||
) : null}
|
||||
<span className="bigfile-size">{formatBytes(file.size)}</span>
|
||||
<button
|
||||
type="button"
|
||||
className="dup-copy-reveal"
|
||||
onClick={() => void apiClient.api.revealPath(file.path).catch(() => undefined)}
|
||||
title={t("Reveal in Explorer", "在文件夹中显示")}
|
||||
>
|
||||
<MapPin size={12} />
|
||||
{t("Reveal", "定位")}
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
title={file.path.split(/[\\/]/).pop()}
|
||||
tags={
|
||||
<>
|
||||
{dormant ? (
|
||||
<Badge tone="warning">
|
||||
{agoLabel(file.modifiedMs, lang)} {t("untouched", "未修改")}
|
||||
</Badge>
|
||||
) : null}
|
||||
{file.cloudHint ? (
|
||||
<Badge tone="info">
|
||||
<Cloud size={11} /> {t("cloud copy?", "网盘可能有副本?")}
|
||||
</Badge>
|
||||
) : null}
|
||||
{file.maybeMounted ? (
|
||||
<Badge
|
||||
tone="neutral"
|
||||
title={t(
|
||||
"May be in use by Hyper-V/WSL",
|
||||
"可能正被 Hyper-V/WSL 使用",
|
||||
)}
|
||||
>
|
||||
<Lock size={11} /> {t("check in use", "占用检查")}
|
||||
</Badge>
|
||||
) : null}
|
||||
</>
|
||||
}
|
||||
detail={file.displayPath}
|
||||
trailing={
|
||||
<>
|
||||
<span className="bigfile-size">{formatBytes(file.size)}</span>
|
||||
<IconButton
|
||||
label={t("Reveal in Explorer", "在文件夹中显示")}
|
||||
onClick={() =>
|
||||
void apiClient.api.revealPath(file.path).catch(() => undefined)
|
||||
}
|
||||
>
|
||||
<MapPin size={12} />
|
||||
</IconButton>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { EyeOff, SlidersHorizontal, Wrench } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useI18n } from "../i18n";
|
||||
import { EmptyState, PageHeader } from "../components/ui";
|
||||
import { EmptyState, PageHeader, Tabs } from "../components/ui";
|
||||
import { MaintenancePage } from "./MaintenancePage";
|
||||
import { PrivacyPage } from "./PrivacyPage";
|
||||
import { OptimizationPage } from "./OptimizationPage";
|
||||
|
|
@ -56,26 +56,20 @@ export function MaintenanceHubPage({
|
|||
<PageHeader
|
||||
title={t("System maintenance", "系统维护")}
|
||||
/>
|
||||
<div className="hub-tabs" role="tablist">
|
||||
{TABS.map((item) => {
|
||||
<Tabs
|
||||
label={t("System maintenance sections", "系统维护分区")}
|
||||
value={tab}
|
||||
onChange={setTab}
|
||||
items={TABS.map((item) => {
|
||||
const Icon = item.icon;
|
||||
const badge = badges[item.id];
|
||||
return (
|
||||
<button
|
||||
key={item.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tab === item.id}
|
||||
className={`hub-tab ${tab === item.id ? "is-active" : ""}`}
|
||||
onClick={() => setTab(item.id)}
|
||||
>
|
||||
<Icon size={15} />
|
||||
{t(item.en, item.zh)}
|
||||
{badge ? <b>{badge}</b> : null}
|
||||
</button>
|
||||
);
|
||||
return {
|
||||
id: item.id,
|
||||
label: t(item.en, item.zh),
|
||||
icon: <Icon size={15} />,
|
||||
badge: badges[item.id] ?? undefined,
|
||||
};
|
||||
})}
|
||||
</div>
|
||||
/>
|
||||
<div className="hub-pane" style={{ display: tab === "repair" ? undefined : "none" }}>
|
||||
<MaintenancePage embedded onBadge={report("repair")} />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -12,19 +12,25 @@ import { api, subscribeJobProgress } from "../lib/api";
|
|||
import { useI18n } from "../i18n";
|
||||
import { messageFrom } from "../lib/format";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
InlineError,
|
||||
Notice,
|
||||
PageHeader,
|
||||
ProgressCard,
|
||||
Row,
|
||||
Section,
|
||||
useToast,
|
||||
} from "../components/ui";
|
||||
import type { JobProgress, MaintenanceResult, MaintenanceTask } from "../types";
|
||||
|
||||
const RISK_CHIP: Record<MaintenanceTask["risk"], [string, string, string]> = {
|
||||
// [class, zh, en]
|
||||
safe: ["is-safe", "安全", "Safe"],
|
||||
admin: ["is-admin", "需要管理员", "Admin rights"],
|
||||
slow: ["is-slow", "较慢", "Slow"],
|
||||
const RISK_CHIP: Record<
|
||||
MaintenanceTask["risk"],
|
||||
[tone: "success" | "warning" | "neutral", zh: string, en: string]
|
||||
> = {
|
||||
safe: ["success", "安全", "Safe"],
|
||||
admin: ["warning", "需要管理员", "Admin rights"],
|
||||
slow: ["neutral", "较慢", "Slow"],
|
||||
};
|
||||
|
||||
export function MaintenancePage({
|
||||
|
|
@ -115,28 +121,56 @@ export function MaintenancePage({
|
|||
)}
|
||||
{error ? <InlineError message={error} onDismiss={() => setError(null)} /> : null}
|
||||
|
||||
<div className="maint-summary">
|
||||
<ShieldCheck size={15} />
|
||||
<span>
|
||||
{t(
|
||||
"All repairs below touch only system caches / services / indexes — never your documents.",
|
||||
"以下修复只影响系统缓存 / 服务 / 索引,不碰你的文档。",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<Notice icon={<ShieldCheck size={15} />}>
|
||||
{t(
|
||||
"All repairs below touch only system caches / services / indexes — never your documents.",
|
||||
"以下修复只影响系统缓存 / 服务 / 索引,不碰你的文档。",
|
||||
)}
|
||||
</Notice>
|
||||
|
||||
<ul className="maint-list">
|
||||
{tasks.map((task) => {
|
||||
const [chipClass, chipZh, chipEn] = RISK_CHIP[task.risk];
|
||||
const isRunning = running === task.id;
|
||||
return (
|
||||
<li key={task.id} className={`maint-row ${isRunning ? "is-running" : ""}`}>
|
||||
<span className="maint-icon">
|
||||
<Wrench size={16} />
|
||||
</span>
|
||||
<div className="maint-copy">
|
||||
<b>{lang === "zh" ? task.titleZh : task.titleEn}</b>
|
||||
<small>{lang === "zh" ? task.detailZh : task.detailEn}</small>
|
||||
<Section title={t("Repairs", "修复项目")}>
|
||||
<div className="row-list">
|
||||
{tasks.map((task) => {
|
||||
const [chipTone, chipZh, chipEn] = RISK_CHIP[task.risk];
|
||||
const isRunning = running === task.id;
|
||||
return (
|
||||
<Row
|
||||
key={task.id}
|
||||
className={isRunning ? "is-busy" : ""}
|
||||
leading={
|
||||
<span className="whitelist-icon">
|
||||
<Wrench size={16} />
|
||||
</span>
|
||||
}
|
||||
title={lang === "zh" ? task.titleZh : task.titleEn}
|
||||
subtitle={lang === "zh" ? task.detailZh : task.detailEn}
|
||||
tags={
|
||||
<>
|
||||
<Badge tone={chipTone}>{lang === "zh" ? chipZh : chipEn}</Badge>
|
||||
<Badge>{task.estimate}</Badge>
|
||||
</>
|
||||
}
|
||||
trailing={
|
||||
isRunning ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => job.current && void api.cancelJob(job.current)}
|
||||
>
|
||||
{t("Cancel", "取消")}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
disabled={running !== null}
|
||||
onClick={() => void runTask(task)}
|
||||
>
|
||||
{t("Repair", "修复")}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
>
|
||||
{isRunning && progress ? (
|
||||
<ProgressCard
|
||||
progress={progress}
|
||||
|
|
@ -152,61 +186,46 @@ export function MaintenancePage({
|
|||
{logs.slice(-8).join("\n")}
|
||||
</pre>
|
||||
) : null}
|
||||
</div>
|
||||
<span className="maint-estimate">{task.estimate}</span>
|
||||
<span className={`maint-risk ${chipClass}`}>{lang === "zh" ? chipZh : chipEn}</span>
|
||||
{isRunning ? (
|
||||
<Button variant="ghost" size="sm" onClick={() => job.current && void api.cancelJob(job.current)}>
|
||||
{t("Cancel", "取消")}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
disabled={running !== null}
|
||||
onClick={() => void runTask(task)}
|
||||
>
|
||||
{t("Repair", "修复")}
|
||||
</Button>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
{tasks.length === 0 && !error ? (
|
||||
<li className="maint-row is-muted">
|
||||
<Search size={16} />
|
||||
{t("Loading the repair list…", "正在加载修复清单…")}
|
||||
</li>
|
||||
) : null}
|
||||
</ul>
|
||||
</Row>
|
||||
);
|
||||
})}
|
||||
{tasks.length === 0 && !error ? (
|
||||
<p className="row-empty">
|
||||
<Search size={16} /> {t("Loading the repair list…", "正在加载修复清单…")}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
{result ? (
|
||||
<div className={`maint-result ${result.ok ? "is-ok" : "is-fail"}`}>
|
||||
{result.ok ? <Check size={15} /> : <AlertTriangle size={15} />}
|
||||
<div>
|
||||
<b>
|
||||
{result.ok
|
||||
? t("Repair completed", "修复完成")
|
||||
: t("Repair stopped early", "修复提前停止")}
|
||||
</b>
|
||||
<ul>
|
||||
{result.steps.map((step, index) => (
|
||||
<li key={index}>
|
||||
<Activity size={11} /> {step}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{result.outputTail ? (
|
||||
<details>
|
||||
<summary>{t("Command output", "命令输出")}</summary>
|
||||
<pre>{result.outputTail}</pre>
|
||||
</details>
|
||||
) : null}
|
||||
</div>
|
||||
<Button variant="ghost" size="sm" onClick={() => setResult(null)}>
|
||||
<X size={13} />
|
||||
</Button>
|
||||
</div>
|
||||
<Notice
|
||||
tone={result.ok ? "info" : "danger"}
|
||||
icon={result.ok ? <Check size={15} /> : <AlertTriangle size={15} />}
|
||||
actions={
|
||||
<Button variant="ghost" size="sm" onClick={() => setResult(null)}>
|
||||
<X size={13} />
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<strong>
|
||||
{result.ok
|
||||
? t("Repair completed", "修复完成")
|
||||
: t("Repair stopped early", "修复提前停止")}
|
||||
</strong>
|
||||
<ul className="notice-list">
|
||||
{result.steps.map((step, index) => (
|
||||
<li key={index}>
|
||||
<Activity size={11} /> {step}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{result.outputTail ? (
|
||||
<details>
|
||||
<summary>{t("Command output", "命令输出")}</summary>
|
||||
<pre>{result.outputTail}</pre>
|
||||
</details>
|
||||
) : null}
|
||||
</Notice>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,16 @@ import { useCallback, useEffect, useState } from "react";
|
|||
import { api } from "../lib/api";
|
||||
import { useI18n } from "../i18n";
|
||||
import { messageFrom } from "../lib/format";
|
||||
import { Button, InlineError, PageHeader, Toggle, useToast } from "../components/ui";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
InlineError,
|
||||
PageHeader,
|
||||
Row,
|
||||
Section,
|
||||
Toggle,
|
||||
useToast,
|
||||
} from "../components/ui";
|
||||
import type { TweakState } from "../types";
|
||||
|
||||
export function OptimizationPage({
|
||||
|
|
@ -85,19 +94,16 @@ export function OptimizationPage({
|
|||
)}
|
||||
{error ? <InlineError message={error} onDismiss={() => setError(null)} /> : null}
|
||||
|
||||
<section className="optimize-group">
|
||||
<div className="optimize-group-head">
|
||||
<h2>
|
||||
<SlidersHorizontal size={15} /> {t("Everyday privacy & clarity", "常用隐私与界面")}
|
||||
</h2>
|
||||
<span className="tip">
|
||||
{changed > 0
|
||||
? t(`${changed} changed · revertable`, `已更改 ${changed} 项 · 可随时恢复`)
|
||||
: t("Nothing changed yet", "尚未更改任何项")}
|
||||
</span>
|
||||
{/* Embedded (维护 hub): the page header — and with it the restore
|
||||
button — is hidden, so the group head carries it instead. */}
|
||||
{embedded ? (
|
||||
<Section
|
||||
icon={<SlidersHorizontal size={16} />}
|
||||
title={t("Everyday privacy & clarity", "常用隐私与界面")}
|
||||
hint={
|
||||
changed > 0
|
||||
? t(`${changed} changed · revertable`, `已更改 ${changed} 项 · 可随时恢复`)
|
||||
: t("Nothing changed yet", "尚未更改任何项")
|
||||
}
|
||||
actions={
|
||||
embedded ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
|
@ -107,41 +113,44 @@ export function OptimizationPage({
|
|||
>
|
||||
{t("Restore all defaults", "恢复全部默认")}
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
<div className="row-list">
|
||||
{states.map((state) => (
|
||||
<Row
|
||||
key={state.id}
|
||||
selected={state.enabled}
|
||||
title={lang === "zh" ? state.titleZh : state.titleEn}
|
||||
subtitle={lang === "zh" ? state.detailZh : state.detailEn}
|
||||
detail={`${state.hive}\\${state.key} · ${state.value}`}
|
||||
tags={
|
||||
state.restartHint && state.enabled ? (
|
||||
<Badge tone="warning">
|
||||
{t("needs Explorer/Windows restart", "需重启 Explorer/系统生效")}
|
||||
</Badge>
|
||||
) : undefined
|
||||
}
|
||||
trailing={
|
||||
<>
|
||||
<Badge tone={state.risk === "safe" ? "success" : "warning"}>
|
||||
{state.risk === "safe" ? t("Safe", "安全") : t("Read the note", "看说明")}
|
||||
</Badge>
|
||||
<Toggle
|
||||
checked={state.enabled}
|
||||
disabled={busy !== null || state.unreadable}
|
||||
onChange={(next) => void flip(state, next)}
|
||||
label={lang === "zh" ? state.titleZh : state.titleEn}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
{states.length === 0 && !error ? (
|
||||
<p className="row-empty">{t("Loading the catalog…", "正在加载目录…")}</p>
|
||||
) : null}
|
||||
</div>
|
||||
<ul className="optimize-list">
|
||||
{states.map((state) => (
|
||||
<li key={state.id} className={`optimize-row ${state.enabled ? "is-on" : ""}`}>
|
||||
<div className="optimize-copy">
|
||||
<b>
|
||||
{lang === "zh" ? state.titleZh : state.titleEn}
|
||||
{state.restartHint && state.enabled ? (
|
||||
<span className="optimize-restart">
|
||||
{t("needs Explorer/Windows restart", "需重启 Explorer/系统生效")}
|
||||
</span>
|
||||
) : null}
|
||||
</b>
|
||||
<small>{lang === "zh" ? state.detailZh : state.detailEn}</small>
|
||||
<small className="optimize-path">
|
||||
{state.hive}\\{state.key} · {state.value}
|
||||
</small>
|
||||
</div>
|
||||
<span className={`optimize-risk is-${state.risk}`}>
|
||||
{state.risk === "safe" ? t("Safe", "安全") : t("Read the note", "看说明")}
|
||||
</span>
|
||||
<Toggle
|
||||
checked={state.enabled}
|
||||
disabled={busy !== null || state.unreadable}
|
||||
onChange={(next) => void flip(state, next)}
|
||||
label={lang === "zh" ? state.titleZh : state.titleEn}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{states.length === 0 && !error ? (
|
||||
<p className="optimize-empty">{t("Loading the catalog…", "正在加载目录…")}</p>
|
||||
) : null}
|
||||
</section>
|
||||
</Section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@ import {
|
|||
Button,
|
||||
PageHeader,
|
||||
ProgressCard,
|
||||
SectionTitle,
|
||||
Row,
|
||||
Section,
|
||||
Stat,
|
||||
UsageBar,
|
||||
} from "../components/ui";
|
||||
|
||||
|
|
@ -59,11 +61,12 @@ function SpecRow({
|
|||
t: (en: string, zh: string) => string;
|
||||
}) {
|
||||
return (
|
||||
<div className="spec-row">
|
||||
<span className="spec-icon">{icon}</span>
|
||||
<span className="spec-label">{label}</span>
|
||||
<strong title={value || undefined}>{value || t("—", "—")}</strong>
|
||||
</div>
|
||||
<Row
|
||||
className="spec-row"
|
||||
leading={<span className="spec-icon">{icon}</span>}
|
||||
title={label}
|
||||
detail={<span title={value || undefined}>{value || t("—", "—")}</span>}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -274,20 +277,20 @@ export function OverviewPage({
|
|||
) : null}
|
||||
|
||||
{scanned && !scanning ? (
|
||||
<section className="overview-found">
|
||||
<SectionTitle
|
||||
title={t("What the scan found", "扫描发现")}
|
||||
subtitle={t(
|
||||
"Uncheck anything you want to keep.",
|
||||
"不想清理的项目可以随时取消勾选。",
|
||||
)}
|
||||
action={
|
||||
<Button variant="ghost" size="sm" onClick={() => onNavigate("space")}>
|
||||
{t("Open space cleaning", "打开空间清理")}
|
||||
<ChevronRight size={14} />
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<Section
|
||||
className="overview-found"
|
||||
title={t("What the scan found", "扫描发现")}
|
||||
hint={t(
|
||||
"Uncheck anything you want to keep.",
|
||||
"不想清理的项目可以随时取消勾选。",
|
||||
)}
|
||||
actions={
|
||||
<Button variant="ghost" size="sm" onClick={() => onNavigate("space")}>
|
||||
{t("Open space cleaning", "打开空间清理")}
|
||||
<ChevronRight size={14} />
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
{cleanup.result ? (
|
||||
<CategorySummary
|
||||
result={cleanup.result}
|
||||
|
|
@ -296,155 +299,143 @@ export function OverviewPage({
|
|||
onInspect={() => onNavigate("space")}
|
||||
/>
|
||||
) : null}
|
||||
</section>
|
||||
</Section>
|
||||
) : null}
|
||||
|
||||
{/* 指标行 30% / 42% / 28%:处理器+内存共用一框上下分布;存储每盘
|
||||
一行;日常维护三入口竖排放右列,与左两卡等高。独立的「日常维护」
|
||||
区块随此改版取消。 */}
|
||||
<section className="overview-metrics">
|
||||
<div className="metric-panel metric-combo">
|
||||
<div className="m-block">
|
||||
<div className="metric-panel-head">
|
||||
<span className="metric-icon tone-blue">
|
||||
<CircleGauge size={18} />
|
||||
</span>
|
||||
<div>
|
||||
<strong>{t("Processor", "处理器")}</strong>
|
||||
<span>
|
||||
{snapshot
|
||||
? `${snapshot.cpu.physical_cores} ${t("cores", "核")} / ${snapshot.cpu.logical_cores} ${t("threads", "线程")}`
|
||||
: t("Sampling…", "正在采样…")}
|
||||
</span>
|
||||
</div>
|
||||
<b>{Math.round(snapshot?.cpu.total ?? 0)}%</b>
|
||||
</div>
|
||||
<UsageBar used={snapshot?.cpu.total ?? 0} total={100} tone="blue" />
|
||||
<small>
|
||||
{snapshot?.cpu.brand || t("Processor details unavailable", "暂无处理器信息")}
|
||||
</small>
|
||||
</div>
|
||||
<div className="m-block">
|
||||
<div className="metric-panel-head">
|
||||
<span className="metric-icon tone-violet">
|
||||
<Boxes size={18} />
|
||||
</span>
|
||||
<div>
|
||||
<strong>{t("Memory", "内存")}</strong>
|
||||
<span>
|
||||
{snapshot
|
||||
? `${formatMemory(snapshot.memory.used)} / ${formatMemory(memoryInstalled)}`
|
||||
: t("Sampling…", "正在采样…")}
|
||||
</span>
|
||||
</div>
|
||||
<b>
|
||||
{Math.round(
|
||||
snapshot ? percent(snapshot.memory.used, snapshot.memory.total) : 0,
|
||||
)}
|
||||
%
|
||||
</b>
|
||||
</div>
|
||||
<UsageBar
|
||||
used={snapshot ? percent(snapshot.memory.used, snapshot.memory.total) : 0}
|
||||
total={100}
|
||||
tone="violet"
|
||||
/>
|
||||
<small>
|
||||
{memoryReserved > 0
|
||||
? t(
|
||||
`Hardware reserved (integrated graphics): ${formatMemory(memoryReserved)}`,
|
||||
`硬件保留(含核显):${formatMemory(memoryReserved)}`,
|
||||
)
|
||||
: snapshot
|
||||
<Section
|
||||
className="overview-panel overview-performance"
|
||||
icon={<CircleGauge size={16} />}
|
||||
title={t("Live performance", "运行状态")}
|
||||
>
|
||||
<div className="stat-row overview-stat-row">
|
||||
<Stat
|
||||
icon={<Cpu size={15} />}
|
||||
label={t("Processor", "处理器")}
|
||||
value={`${Math.round(snapshot?.cpu.total ?? 0)}%`}
|
||||
hint={
|
||||
snapshot
|
||||
? `${snapshot.cpu.physical_cores} ${t("cores", "核")} / ${snapshot.cpu.logical_cores} ${t("threads", "线程")}`
|
||||
: t("Sampling…", "正在采样…")
|
||||
}
|
||||
>
|
||||
<UsageBar used={snapshot?.cpu.total ?? 0} total={100} tone="blue" />
|
||||
<small className="stat-note">
|
||||
{snapshot?.cpu.brand || t("Processor details unavailable", "暂无处理器信息")}
|
||||
</small>
|
||||
</Stat>
|
||||
<Stat
|
||||
icon={<Boxes size={15} />}
|
||||
label={t("Memory", "内存")}
|
||||
value={`${Math.round(
|
||||
snapshot ? percent(snapshot.memory.used, snapshot.memory.total) : 0,
|
||||
)}%`}
|
||||
hint={
|
||||
snapshot
|
||||
? `${formatMemory(snapshot.memory.used)} / ${formatMemory(memoryInstalled)}`
|
||||
: t("Sampling…", "正在采样…")
|
||||
}
|
||||
>
|
||||
<UsageBar
|
||||
used={snapshot ? percent(snapshot.memory.used, snapshot.memory.total) : 0}
|
||||
total={100}
|
||||
tone="violet"
|
||||
/>
|
||||
<small className="stat-note">
|
||||
{memoryReserved > 0
|
||||
? t(
|
||||
`${formatCount(snapshot.processes)} processes running`,
|
||||
`${formatCount(snapshot.processes)} 个进程正在运行`,
|
||||
`Hardware reserved (integrated graphics): ${formatMemory(memoryReserved)}`,
|
||||
`硬件保留(含核显):${formatMemory(memoryReserved)}`,
|
||||
)
|
||||
: t("Reading activity", "正在读取活动")}
|
||||
</small>
|
||||
: snapshot
|
||||
? t(
|
||||
`${formatCount(snapshot.processes)} processes running`,
|
||||
`${formatCount(snapshot.processes)} 个进程正在运行`,
|
||||
)
|
||||
: t("Reading activity", "正在读取活动")}
|
||||
</small>
|
||||
</Stat>
|
||||
</div>
|
||||
</div>
|
||||
<div className="metric-panel metric-drives">
|
||||
<div className="metric-panel-head">
|
||||
<span className="metric-icon tone-green">
|
||||
<HardDrive size={18} />
|
||||
</span>
|
||||
<div>
|
||||
<strong>{t("Storage", "存储空间")}</strong>
|
||||
<span>
|
||||
{volumes.length > 0
|
||||
? t(
|
||||
`${volumes.length} drives`,
|
||||
`${volumes.length} 个分区`,
|
||||
)
|
||||
: t("Reading volumes…", "正在读取磁盘…")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="drive-list">
|
||||
</Section>
|
||||
<Section
|
||||
className="overview-panel overview-storage"
|
||||
icon={<HardDrive size={16} />}
|
||||
title={t("Storage", "存储空间")}
|
||||
hint={
|
||||
volumes.length > 0
|
||||
? t(`${volumes.length} drives`, `${volumes.length} 个分区`)
|
||||
: t("Reading volumes…", "正在读取磁盘…")
|
||||
}
|
||||
>
|
||||
<div className="row-list">
|
||||
{volumes.slice(0, 4).map((volume) => {
|
||||
const usedPercent = percent(volume.total - volume.free, volume.total);
|
||||
return (
|
||||
<div className="drive-row" key={volume.mount_point}>
|
||||
<strong className="drive-name" title={volume.name || undefined}>
|
||||
{driveLabel(volume)}
|
||||
</strong>
|
||||
<span className="drive-bar">
|
||||
<UsageBar
|
||||
used={usedPercent}
|
||||
total={100}
|
||||
tone={usedPercent > 85 ? "red" : "green"}
|
||||
/>
|
||||
</span>
|
||||
<span className="drive-info">
|
||||
<b className="drive-pct">{Math.round(usedPercent)}%</b>
|
||||
{t(
|
||||
`total ${formatBytes(volume.total)} · ${formatBytes(volume.free)} free`,
|
||||
`总 ${formatBytes(volume.total)} · 可用 ${formatBytes(volume.free)}`,
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<Row
|
||||
key={volume.mount_point}
|
||||
title={
|
||||
<span title={volume.name || undefined}>{driveLabel(volume)}</span>
|
||||
}
|
||||
subtitle={t(
|
||||
`total ${formatBytes(volume.total)} · ${formatBytes(volume.free)} free`,
|
||||
`总 ${formatBytes(volume.total)} · 可用 ${formatBytes(volume.free)}`,
|
||||
)}
|
||||
trailing={<b>{Math.round(usedPercent)}%</b>}
|
||||
>
|
||||
<UsageBar
|
||||
used={usedPercent}
|
||||
total={100}
|
||||
tone={usedPercent > 85 ? "red" : "green"}
|
||||
/>
|
||||
</Row>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<div className="quick-col">
|
||||
<button className="quick-card tone-cyan" onClick={() => onNavigate("applications")}>
|
||||
<span className="quick-icon">
|
||||
<AppWindow size={22} />
|
||||
</span>
|
||||
<span className="quick-copy">
|
||||
<strong>{t("Uninstall apps", "卸载应用")}</strong>
|
||||
<small>{t("Remove apps and their leftovers", "连同残留一起彻底移除")}</small>
|
||||
</span>
|
||||
<ChevronRight size={17} />
|
||||
</button>
|
||||
<button className="quick-card tone-indigo" onClick={() => onOpenSpaceTab?.("big")}>
|
||||
<span className="quick-icon">
|
||||
<HardDrive size={22} />
|
||||
</span>
|
||||
<span className="quick-copy">
|
||||
<strong>{t("Large files", "大文件")}</strong>
|
||||
<small>{t("See what is taking up space", "查看空间都被什么占用")}</small>
|
||||
</span>
|
||||
<ChevronRight size={17} />
|
||||
</button>
|
||||
<button className="quick-card tone-violet" onClick={smartScan}>
|
||||
<span className="quick-icon">
|
||||
<Sparkles size={22} />
|
||||
</span>
|
||||
<span className="quick-copy">
|
||||
<strong>{t("Space cleaning", "空间清理")}</strong>
|
||||
<small>
|
||||
{t(
|
||||
"Caches, logs and build artefacts in one scan",
|
||||
"一次扫描清掉缓存、垃圾与构建产物",
|
||||
)}
|
||||
</small>
|
||||
</span>
|
||||
<ChevronRight size={17} />
|
||||
</button>
|
||||
</div>
|
||||
</Section>
|
||||
<Section
|
||||
className="overview-panel overview-shortcuts"
|
||||
icon={<Sparkles size={16} />}
|
||||
title={t("Shortcuts", "快捷入口")}
|
||||
>
|
||||
<div className="row-list">
|
||||
<Row
|
||||
leading={
|
||||
<span className="quick-icon">
|
||||
<AppWindow size={18} />
|
||||
</span>
|
||||
}
|
||||
title={t("Uninstall apps", "卸载应用")}
|
||||
subtitle={t("Remove apps and their leftovers", "连同残留一起彻底移除")}
|
||||
trailing={<ChevronRight size={16} />}
|
||||
onClick={() => onNavigate("applications")}
|
||||
/>
|
||||
<Row
|
||||
leading={
|
||||
<span className="quick-icon">
|
||||
<HardDrive size={18} />
|
||||
</span>
|
||||
}
|
||||
title={t("Large files", "大文件")}
|
||||
subtitle={t("See what is taking up space", "查看空间都被什么占用")}
|
||||
trailing={<ChevronRight size={16} />}
|
||||
onClick={() => onOpenSpaceTab?.("big")}
|
||||
/>
|
||||
<Row
|
||||
leading={
|
||||
<span className="quick-icon">
|
||||
<Sparkles size={18} />
|
||||
</span>
|
||||
}
|
||||
title={t("Space cleaning", "空间清理")}
|
||||
subtitle={t(
|
||||
"Caches, logs and build artefacts in one scan",
|
||||
"一次扫描清掉缓存、垃圾与构建产物",
|
||||
)}
|
||||
trailing={<ChevronRight size={16} />}
|
||||
onClick={smartScan}
|
||||
/>
|
||||
</div>
|
||||
</Section>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import {
|
|||
ChevronRight,
|
||||
FolderOpen,
|
||||
LayoutGrid,
|
||||
Power,
|
||||
RefreshCw,
|
||||
Search,
|
||||
ShieldCheck,
|
||||
Trash2,
|
||||
X,
|
||||
|
|
@ -17,14 +17,22 @@ import { shortPath } from "../lib/format";
|
|||
import type { PermissionsWorkspace } from "../hooks/usePermissionsWorkspace";
|
||||
import type { StartupItem } from "../types";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Chip,
|
||||
ConfirmDialog,
|
||||
EmptyState,
|
||||
IconButton,
|
||||
InlineError,
|
||||
Notice,
|
||||
PageHeader,
|
||||
SectionTitle,
|
||||
Row,
|
||||
SearchField,
|
||||
Section,
|
||||
Subhead,
|
||||
Tabs,
|
||||
Toggle,
|
||||
Toolbar,
|
||||
} from "../components/ui";
|
||||
|
||||
function scopeLabel(scope: string, t: (en: string, zh: string) => string): string {
|
||||
|
|
@ -315,36 +323,32 @@ export function PermissionsPage({
|
|||
}
|
||||
/>
|
||||
|
||||
<div className="perm-tabs" role="tablist">
|
||||
{tabs.map((tab) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
role="tab"
|
||||
aria-selected={workspace.tab === tab.id}
|
||||
className={`perm-tab ${workspace.tab === tab.id ? "is-active" : ""}`}
|
||||
onClick={() => workspace.setTab(tab.id)}
|
||||
>
|
||||
{tab.label}
|
||||
<b>{tab.count}</b>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<Tabs
|
||||
label={t("Permission sections", "权限管理分区")}
|
||||
value={workspace.tab}
|
||||
onChange={workspace.setTab}
|
||||
items={tabs.map((tab) => ({
|
||||
id: tab.id,
|
||||
label: tab.label,
|
||||
badge: tab.count,
|
||||
}))}
|
||||
/>
|
||||
|
||||
{workspace.error ? (
|
||||
<InlineError message={workspace.error} onDismiss={workspace.dismissError} />
|
||||
) : null}
|
||||
|
||||
{workspace.tab === "startup" ? (
|
||||
<section className="settings-section">
|
||||
<SectionTitle
|
||||
title={t("Startup items", "开机启动项")}
|
||||
subtitle={t(
|
||||
`${view.startupEnabledCount} of ${view.startupCount} entries start with Windows.`,
|
||||
`共 ${view.startupCount} 项,其中 ${view.startupEnabledCount} 项已开启。`,
|
||||
)}
|
||||
/>
|
||||
<div className="perm-startup-bar">
|
||||
<div className="perm-filter" role="tablist" aria-label={t("Status filter", "状态筛选")}>
|
||||
<Section
|
||||
icon={<Power size={16} />}
|
||||
title={t("Startup items", "开机启动项")}
|
||||
hint={t(
|
||||
`${view.startupEnabledCount} of ${view.startupCount} entries start with Windows.`,
|
||||
`共 ${view.startupCount} 项,其中 ${view.startupEnabledCount} 项已开启。`,
|
||||
)}
|
||||
>
|
||||
<Toolbar>
|
||||
<div className="chip-row" role="group" aria-label={t("Status filter", "状态筛选")}>
|
||||
{(
|
||||
[
|
||||
["all", "All", "全部"],
|
||||
|
|
@ -353,22 +357,19 @@ export function PermissionsPage({
|
|||
["leftover", "Leftover", "残留"],
|
||||
] as const
|
||||
).map(([id, en, zh]) => (
|
||||
<button
|
||||
<Chip
|
||||
key={id}
|
||||
role="tab"
|
||||
aria-selected={startupFilter === id}
|
||||
className={`perm-filter-tab ${startupFilter === id ? "is-active" : ""} ${
|
||||
id === "leftover" && counts.leftover > 0 ? "has-leftover" : ""
|
||||
}`}
|
||||
active={startupFilter === id}
|
||||
count={counts[id]}
|
||||
tone={id === "leftover" && counts.leftover > 0 ? "danger" : undefined}
|
||||
onClick={() => setStartupFilter(id)}
|
||||
>
|
||||
{t(en, zh)}
|
||||
<b>{counts[id]}</b>
|
||||
</button>
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
<div className="perm-startup-tools">
|
||||
<label className="perm-system-toggle">
|
||||
<div className="toolbar-group">
|
||||
<label className="toggle-label">
|
||||
<Toggle
|
||||
checked={showSystem}
|
||||
onChange={setShowSystem}
|
||||
|
|
@ -376,16 +377,14 @@ export function PermissionsPage({
|
|||
/>
|
||||
<span>{t("Show system items", "显示系统项")}</span>
|
||||
</label>
|
||||
<label className="search-field">
|
||||
<Search size={14} />
|
||||
<input
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder={t("Filter by name or path…", "按名称或路径筛选…")}
|
||||
/>
|
||||
</label>
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
label={t("Filter startup items", "筛选开机启动项")}
|
||||
placeholder={t("Filter by name or path…", "按名称或路径筛选…")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Toolbar>
|
||||
{orderedGroups.map(([software, items]) => {
|
||||
const onCount = items.filter((item) => item.enabled && !isLeftover(item)).length;
|
||||
const allOn = onCount === items.length;
|
||||
|
|
@ -395,32 +394,39 @@ export function PermissionsPage({
|
|||
return (
|
||||
<div
|
||||
key={software}
|
||||
className={`perm-group-card ${open ? "is-open" : ""} ${
|
||||
leftovers.length > 0 && leftovers.length === items.length ? "is-leftover" : ""
|
||||
}`}
|
||||
className={`perm-group-card ${open ? "is-open" : ""}`}
|
||||
>
|
||||
<h4 className="perm-group" onClick={() => toggleGroupOpen(software)}>
|
||||
<GroupIcon software={software} items={items} neutral={software === otherName} />
|
||||
<span className="perm-group-name">{software}</span>
|
||||
{leftovers.length > 0 ? (
|
||||
<span className="perm-sig is-leftover">
|
||||
{t(`${leftovers.length} leftover`, `${leftovers.length} 个残留`)}
|
||||
</span>
|
||||
) : null}
|
||||
<b className={allOn ? "is-all" : onCount === 0 ? "is-none" : "is-part"}>
|
||||
{allOn
|
||||
<Row
|
||||
className="perm-group-head"
|
||||
leading={
|
||||
<GroupIcon
|
||||
software={software}
|
||||
items={items}
|
||||
neutral={software === otherName}
|
||||
/>
|
||||
}
|
||||
title={
|
||||
<>
|
||||
{software}
|
||||
{leftovers.length > 0 ? (
|
||||
<Badge tone="danger">
|
||||
{t(`${leftovers.length} leftover`, `${leftovers.length} 个残留`)}
|
||||
</Badge>
|
||||
) : null}
|
||||
</>
|
||||
}
|
||||
subtitle={
|
||||
allOn
|
||||
? t("All on", "全部开启")
|
||||
: onCount === 0
|
||||
? t("All off", "已全部关闭")
|
||||
: t(
|
||||
`${onCount}/${items.length} on`,
|
||||
`部分开启 ${onCount}/${items.length}`,
|
||||
)}
|
||||
</b>
|
||||
<span
|
||||
className="perm-group-tail"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
>
|
||||
)
|
||||
}
|
||||
trailing={
|
||||
<span className="row-actions" onClick={(event) => event.stopPropagation()}>
|
||||
<span
|
||||
className="perm-group-count"
|
||||
onClick={(event) => {
|
||||
|
|
@ -442,86 +448,94 @@ export function PermissionsPage({
|
|||
onChange={(next) => void workspace.toggleStartupGroup(groupIds, next)}
|
||||
label={`${software} master ${allOn ? "disable" : "enable"}`}
|
||||
/>
|
||||
</span>
|
||||
</h4>
|
||||
</span>
|
||||
}
|
||||
onClick={() => toggleGroupOpen(software)}
|
||||
/>
|
||||
{open ? (
|
||||
<div className="perm-rows">
|
||||
<div className="row-list perm-rows">
|
||||
{items.map((item) => {
|
||||
const [statusText, statusTone] = statusChip(item, t);
|
||||
const reveal = rowRevealPath(item);
|
||||
return (
|
||||
<div
|
||||
className={`settings-row ${
|
||||
workspace.busyId === item.id ? "is-busy" : ""
|
||||
} ${isLeftover(item) ? "is-leftover-row" : ""}`}
|
||||
<Row
|
||||
key={item.id}
|
||||
>
|
||||
<div className="perm-row perm-row-noicon">
|
||||
<div>
|
||||
<span>
|
||||
{item.name}{" "}
|
||||
<em className={`perm-row-tag ${statusTone}`}>{statusText}</em>
|
||||
</span>
|
||||
<small title={item.command}>
|
||||
{item.sourceLabel} · {scopeLabel(item.scope, t)}
|
||||
{item.command ? ` · ${shortPath(item.command, 72)}` : ""}
|
||||
</small>
|
||||
<small className="perm-row-full" title={item.command}>
|
||||
{item.command || t("(no command line)", "(无命令行记录)")}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div className="perm-row-actions">
|
||||
{isLeftover(item) ? (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="danger"
|
||||
icon={<Trash2 size={13} />}
|
||||
leading={<RowIcon icon={item.icon} label={item.name} />}
|
||||
title={item.name}
|
||||
tags={
|
||||
<Badge
|
||||
tone={
|
||||
statusTone === "is-leftover"
|
||||
? "danger"
|
||||
: item.enabled
|
||||
? "success"
|
||||
: "neutral"
|
||||
}
|
||||
>
|
||||
{statusText}
|
||||
</Badge>
|
||||
}
|
||||
subtitle={`${item.sourceLabel} · ${scopeLabel(item.scope, t)}`}
|
||||
detail={
|
||||
item.command || t("(no command line)", "(无命令行记录)")
|
||||
}
|
||||
muted={isLeftover(item)}
|
||||
busy={workspace.busyId === item.id}
|
||||
trailing={
|
||||
<>
|
||||
{isLeftover(item) ? (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="danger"
|
||||
icon={<Trash2 size={13} />}
|
||||
disabled={workspace.busyId !== null}
|
||||
onClick={() => setRemovingIds([item.id])}
|
||||
>
|
||||
{t("Delete entry", "删除启动项")}
|
||||
</Button>
|
||||
) : null}
|
||||
{reveal ? (
|
||||
<IconButton
|
||||
label={t("Open its folder", "打开所在文件夹")}
|
||||
onClick={() => void api.revealPath(reveal).catch(() => {})}
|
||||
>
|
||||
<FolderOpen size={15} />
|
||||
</IconButton>
|
||||
) : null}
|
||||
<Toggle
|
||||
checked={item.enabled}
|
||||
disabled={workspace.busyId !== null}
|
||||
onClick={() => setRemovingIds([item.id])}
|
||||
>
|
||||
{t("Delete entry", "删除启动项")}
|
||||
</Button>
|
||||
) : null}
|
||||
{reveal ? (
|
||||
<IconButton
|
||||
label={t("Open its folder", "打开所在文件夹")}
|
||||
onClick={() => void api.revealPath(reveal).catch(() => {})}
|
||||
>
|
||||
<FolderOpen size={15} />
|
||||
</IconButton>
|
||||
) : null}
|
||||
<Toggle
|
||||
checked={item.enabled}
|
||||
disabled={workspace.busyId !== null}
|
||||
onChange={(next) => void workspace.toggleStartup(item.id, next)}
|
||||
label={`${item.name} ${item.enabled ? "disable" : "enable"}`}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
onChange={(next) => void workspace.toggleStartup(item.id, next)}
|
||||
label={`${item.name} ${item.enabled ? "disable" : "enable"}`}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{leftovers.length > 0 && leftovers.length < items.length ? (
|
||||
<div className="perm-group-leftover-bar">
|
||||
<AlertTriangle size={13} />
|
||||
<span>
|
||||
{t(
|
||||
`${leftovers.length} leftover entries in this group — their programs are gone.`,
|
||||
`该组有 ${leftovers.length} 个残留项:程序已不存在,只剩启动配置。`,
|
||||
)}
|
||||
</span>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="danger"
|
||||
disabled={workspace.busyId !== null}
|
||||
onClick={() => setRemovingIds(leftovers.map((item) => item.id))}
|
||||
>
|
||||
{t(
|
||||
`Delete ${leftovers.length} leftover(s)`,
|
||||
`删除 ${leftovers.length} 个残留项`,
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
<Notice
|
||||
tone="danger"
|
||||
icon={<AlertTriangle size={13} />}
|
||||
actions={
|
||||
<Button
|
||||
size="sm"
|
||||
variant="danger"
|
||||
disabled={workspace.busyId !== null}
|
||||
onClick={() => setRemovingIds(leftovers.map((item) => item.id))}
|
||||
>
|
||||
{t(
|
||||
`Delete ${leftovers.length} leftover(s)`,
|
||||
`删除 ${leftovers.length} 个残留项`,
|
||||
)}
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
{t(
|
||||
`${leftovers.length} leftover entries in this group — their programs are gone.`,
|
||||
`该组有 ${leftovers.length} 个残留项:程序已不存在,只剩启动配置。`,
|
||||
)}
|
||||
</Notice>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
|
|
@ -529,13 +543,13 @@ export function PermissionsPage({
|
|||
);
|
||||
})}
|
||||
{startup.length === 0 ? (
|
||||
<p className="perm-empty">
|
||||
<p className="row-empty">
|
||||
{counts.all === 0
|
||||
? t("No matches.", "没有匹配的项目。")
|
||||
: t("Nothing here under this filter.", "当前筛选下没有项目。")}
|
||||
</p>
|
||||
) : null}
|
||||
</section>
|
||||
</Section>
|
||||
) : null}
|
||||
|
||||
<ConfirmDialog
|
||||
|
|
@ -563,67 +577,66 @@ export function PermissionsPage({
|
|||
/>
|
||||
|
||||
{workspace.tab === "extensions" ? (
|
||||
<section className="settings-section">
|
||||
<SectionTitle
|
||||
title={t("Context menu handlers", "右键菜单扩展")}
|
||||
subtitle={t(
|
||||
"Unregistered handlers disappear immediately; Squid keeps a restore recipe for each.",
|
||||
"取消注册后右键菜单立即消失;Squid 为每一项保留恢复配方。",
|
||||
)}
|
||||
/>
|
||||
<div className="perm-ext-head">
|
||||
<div className="perm-cats" role="tablist" aria-label={t("Menu surfaces", "菜单位置")}>
|
||||
<Section
|
||||
icon={<LayoutGrid size={16} />}
|
||||
title={t("Context menu handlers", "右键菜单扩展")}
|
||||
hint={t(
|
||||
"Unregistered handlers disappear immediately; Squid keeps a restore recipe for each.",
|
||||
"取消注册后右键菜单立即消失;Squid 为每一项保留恢复配方。",
|
||||
)}
|
||||
>
|
||||
<Toolbar>
|
||||
<div className="chip-row" role="group" aria-label={t("Menu surfaces", "菜单位置")}>
|
||||
{extCategories.map((point) => {
|
||||
const entries = groupedExtensions[point];
|
||||
const on = entries.filter((e) => e.registered).length;
|
||||
return (
|
||||
<button
|
||||
<Chip
|
||||
key={point}
|
||||
role="tab"
|
||||
aria-selected={activeCategory === point}
|
||||
className={`perm-cat ${activeCategory === point ? "is-active" : ""}`}
|
||||
active={activeCategory === point}
|
||||
count={`${on}/${entries.length}`}
|
||||
onClick={() => setExtCat(point)}
|
||||
>
|
||||
{point}
|
||||
<b>
|
||||
{on}/{entries.length}
|
||||
</b>
|
||||
</button>
|
||||
</Chip>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<label className="search-field">
|
||||
<Search size={14} />
|
||||
<input
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder={t("Filter by name, creator or module…", "按名称、创建者或模块筛选…")}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<SearchField
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
label={t("Filter context menu handlers", "筛选右键菜单扩展")}
|
||||
placeholder={t("Filter by name, creator or module…", "按名称、创建者或模块筛选…")}
|
||||
/>
|
||||
</Toolbar>
|
||||
{extGroups.map(([software, items]) => {
|
||||
const onCount = items.filter((entry) => entry.registered).length;
|
||||
const allOn = onCount === items.length;
|
||||
const open = isExtGroupOpen(software);
|
||||
return (
|
||||
<div key={software} className={`perm-group-card ${open ? "is-open" : ""}`}>
|
||||
<h4 className="perm-group" onClick={() => toggleExtGroupOpen(software)}>
|
||||
<GroupIcon software={software} items={items} neutral={software === otherName} />
|
||||
<span className="perm-group-name">{software}</span>
|
||||
<b className={allOn ? "is-all" : onCount === 0 ? "is-none" : "is-part"}>
|
||||
{allOn
|
||||
<Row
|
||||
className="perm-group-head"
|
||||
leading={
|
||||
<GroupIcon
|
||||
software={software}
|
||||
items={items}
|
||||
neutral={software === otherName}
|
||||
/>
|
||||
}
|
||||
title={software}
|
||||
subtitle={
|
||||
allOn
|
||||
? t("All on", "全部开启")
|
||||
: onCount === 0
|
||||
? t("All off", "已全部关闭")
|
||||
: t(
|
||||
`${onCount}/${items.length} on`,
|
||||
`部分开启 ${onCount}/${items.length}`,
|
||||
)}
|
||||
</b>
|
||||
<span
|
||||
className="perm-group-tail"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
>
|
||||
)
|
||||
}
|
||||
trailing={
|
||||
<span className="row-actions" onClick={(event) => event.stopPropagation()}>
|
||||
<span
|
||||
className="perm-group-count"
|
||||
onClick={(event) => {
|
||||
|
|
@ -654,37 +667,41 @@ export function PermissionsPage({
|
|||
}}
|
||||
label={`${software} master ${allOn ? "disable" : "enable"}`}
|
||||
/>
|
||||
</span>
|
||||
</h4>
|
||||
</span>
|
||||
}
|
||||
onClick={() => toggleExtGroupOpen(software)}
|
||||
/>
|
||||
{open ? (
|
||||
<div className="perm-rows">
|
||||
<div className="row-list perm-rows">
|
||||
{items.map((entry) => (
|
||||
<div
|
||||
className={`settings-row ${!entry.registered ? "is-muted" : ""} ${
|
||||
workspace.busyId === entry.id ? "is-busy" : ""
|
||||
}`}
|
||||
<Row
|
||||
key={entry.id}
|
||||
>
|
||||
<div className="perm-row perm-row-noicon">
|
||||
<div>
|
||||
<span>{entry.friendlyName ?? entry.name}</span>
|
||||
<small title={entry.module ?? entry.handler}>
|
||||
{entry.publisher
|
||||
? `${t("Creator", "创建者")} ${entry.publisher} · `
|
||||
: ""}
|
||||
{scopeLabel(entry.scope, t)}
|
||||
{entry.module ? ` · ${shortPath(entry.module, 56)}` : ""}
|
||||
{!entry.registered ? ` · ${t("removed", "已移除")}` : ""}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<Toggle
|
||||
checked={entry.registered}
|
||||
disabled={workspace.busyId !== null}
|
||||
onChange={(next) => void workspace.toggleExtension(entry.id, next)}
|
||||
label={`${entry.name} ${entry.registered ? "remove" : "restore"}`}
|
||||
/>
|
||||
</div>
|
||||
title={entry.friendlyName ?? entry.name}
|
||||
tags={
|
||||
!entry.registered ? (
|
||||
<Badge tone="neutral">{t("removed", "已移除")}</Badge>
|
||||
) : undefined
|
||||
}
|
||||
subtitle={
|
||||
<>
|
||||
{entry.publisher
|
||||
? `${t("Creator", "创建者")} ${entry.publisher} · `
|
||||
: ""}
|
||||
{scopeLabel(entry.scope, t)}
|
||||
</>
|
||||
}
|
||||
detail={entry.module ?? entry.handler}
|
||||
muted={!entry.registered}
|
||||
busy={workspace.busyId === entry.id}
|
||||
trailing={
|
||||
<Toggle
|
||||
checked={entry.registered}
|
||||
disabled={workspace.busyId !== null}
|
||||
onChange={(next) => void workspace.toggleExtension(entry.id, next)}
|
||||
label={`${entry.name} ${entry.registered ? "remove" : "restore"}`}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
|
|
@ -692,19 +709,23 @@ export function PermissionsPage({
|
|||
);
|
||||
})}
|
||||
{extCategories.length === 0 ? (
|
||||
<p className="perm-empty">{t("No matches.", "没有匹配的项目。")}</p>
|
||||
<p className="row-empty">{t("No matches.", "没有匹配的项目。")}</p>
|
||||
) : null}
|
||||
</section>
|
||||
</Section>
|
||||
) : null}
|
||||
|
||||
{workspace.tab === "advanced" ? (
|
||||
<section className="settings-section perm-advanced">
|
||||
<div className="perm-adv-note">
|
||||
<Section
|
||||
className="perm-advanced"
|
||||
icon={<ShieldCheck size={16} />}
|
||||
title={t("Advanced startup", "进阶启动项")}
|
||||
>
|
||||
<Notice tone="warning" icon={<AlertTriangle size={13} />}>
|
||||
{t(
|
||||
"Advanced rows can break boot or logon if changed carelessly — Squid only displays them here, every change records its original value, and nothing is auto-disabled.",
|
||||
"进阶区的项目改错了可能影响系统行为——默认只展示不勾选,每一项带数字签名与位置说明;改动会原样记录,可逐项恢复。",
|
||||
)}
|
||||
</div>
|
||||
</Notice>
|
||||
{workspace.advancedScanning && !workspace.advanced ? (
|
||||
<div className="perm-loading">
|
||||
<RefreshCw size={18} className="perm-spin" />
|
||||
|
|
@ -717,7 +738,7 @@ export function PermissionsPage({
|
|||
</div>
|
||||
) : null}
|
||||
{workspace.advanced && workspace.advanced.entries.length === 0 ? (
|
||||
<p className="perm-empty">
|
||||
<p className="row-empty">
|
||||
{t(
|
||||
"No third-party Winlogon hooks, AppInit DLLs, IFEO debuggers or BHOs found — the machine is clean.",
|
||||
"没有发现第三方 Winlogon 挂钩、AppInit DLL、IFEO 调试器或 BHO——系统很干净。",
|
||||
|
|
@ -735,139 +756,159 @@ export function PermissionsPage({
|
|||
bho: ["Browser helper objects", "浏览器加载项 BHO"],
|
||||
};
|
||||
return (
|
||||
<div className="perm-adv-group" key={kind}>
|
||||
<SectionTitle
|
||||
<div key={kind}>
|
||||
<Subhead
|
||||
title={t(titles[kind][0], titles[kind][1])}
|
||||
subtitle={t(`${rows.length} item(s)`, `发现 ${rows.length} 项`)}
|
||||
hint={t(`${rows.length} item(s)`, `发现 ${rows.length} 项`)}
|
||||
/>
|
||||
{rows.map((entry) => (
|
||||
<div className="perm-adv-row" key={entry.id}>
|
||||
<span className={`perm-sig is-${entry.signature}`} title={entry.signer ?? undefined}>
|
||||
{entry.signature === "microsoft"
|
||||
? t("Microsoft signed", "微软签名")
|
||||
: entry.signature === "vendor"
|
||||
? t("Signed by", "已知厂商")
|
||||
: entry.signature === "unsigned"
|
||||
? t("Not signed", "无数字签名")
|
||||
: entry.signature === "invalid"
|
||||
? t("Signature invalid", "签名无效")
|
||||
: t("Signature n/a", "无签名信息")}
|
||||
</span>
|
||||
<div className="perm-adv-main">
|
||||
<b>{entry.name}</b>
|
||||
<small title={entry.command}>{shortPath(entry.command, 90)}</small>
|
||||
<small className="perm-adv-loc">{entry.location}</small>
|
||||
{entry.warning ? (
|
||||
<small className="perm-adv-warn">{entry.warning}</small>
|
||||
) : null}
|
||||
</div>
|
||||
<Toggle
|
||||
checked={entry.enabled}
|
||||
disabled={workspace.busyId !== null}
|
||||
onChange={(next) => void workspace.toggleAdvanced(entry.id, next)}
|
||||
label={entry.name}
|
||||
<div className="row-list">
|
||||
{rows.map((entry) => (
|
||||
<Row
|
||||
key={entry.id}
|
||||
title={entry.name}
|
||||
tags={
|
||||
<Badge
|
||||
tone={
|
||||
entry.signature === "microsoft"
|
||||
? "success"
|
||||
: entry.signature === "vendor"
|
||||
? "info"
|
||||
: entry.signature === "invalid"
|
||||
? "danger"
|
||||
: "warning"
|
||||
}
|
||||
title={entry.signer ?? undefined}
|
||||
>
|
||||
{entry.signature === "microsoft"
|
||||
? t("Microsoft signed", "微软签名")
|
||||
: entry.signature === "vendor"
|
||||
? t("Signed by", "已知厂商")
|
||||
: entry.signature === "unsigned"
|
||||
? t("Not signed", "无数字签名")
|
||||
: entry.signature === "invalid"
|
||||
? t("Signature invalid", "签名无效")
|
||||
: t("Signature n/a", "无签名信息")}
|
||||
</Badge>
|
||||
}
|
||||
subtitle={shortPath(entry.command, 90)}
|
||||
detail={
|
||||
entry.warning
|
||||
? `${entry.location} · ${entry.warning}`
|
||||
: entry.location
|
||||
}
|
||||
busy={workspace.busyId === entry.id}
|
||||
trailing={
|
||||
<Toggle
|
||||
checked={entry.enabled}
|
||||
disabled={workspace.busyId !== null}
|
||||
onChange={(next) => void workspace.toggleAdvanced(entry.id, next)}
|
||||
label={entry.name}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
: null}
|
||||
{workspace.advanced && workspace.advanced.extras.length > 0 ? (
|
||||
<div className="perm-adv-group">
|
||||
<SectionTitle
|
||||
<div>
|
||||
<Subhead
|
||||
title={t("Automatic services", "服务(自动启动)")}
|
||||
subtitle={t(
|
||||
hint={t(
|
||||
"Services set to start automatically — toggling uses the same rights as Task Manager.",
|
||||
"设置为自动启动的服务;开关与任务管理器同一套权限。",
|
||||
)}
|
||||
/>
|
||||
{workspace.advanced.extras.map((entry) => (
|
||||
<div className="perm-adv-row" key={entry.id}>
|
||||
<span className="perm-scope">{scopeLabel(entry.scope, t)}</span>
|
||||
<div className="perm-adv-main">
|
||||
<b>{entry.displayName || entry.name}</b>
|
||||
<small title={entry.command}>{shortPath(entry.command, 90)}</small>
|
||||
<small className="perm-adv-loc">{entry.sourceLabel}</small>
|
||||
</div>
|
||||
<Toggle
|
||||
checked={entry.enabled}
|
||||
disabled={workspace.busyId !== null}
|
||||
onChange={(next) => void workspace.toggleStartup(entry.id, next)}
|
||||
label={entry.name}
|
||||
<div className="row-list">
|
||||
{workspace.advanced.extras.map((entry) => (
|
||||
<Row
|
||||
key={entry.id}
|
||||
title={entry.displayName || entry.name}
|
||||
tags={<Badge tone="neutral">{scopeLabel(entry.scope, t)}</Badge>}
|
||||
subtitle={shortPath(entry.command, 90)}
|
||||
detail={entry.sourceLabel}
|
||||
busy={workspace.busyId === entry.id}
|
||||
trailing={
|
||||
<Toggle
|
||||
checked={entry.enabled}
|
||||
disabled={workspace.busyId !== null}
|
||||
onChange={(next) => void workspace.toggleStartup(entry.id, next)}
|
||||
label={entry.name}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
</Section>
|
||||
) : null}
|
||||
|
||||
{workspace.tab === "popup" ? (
|
||||
<>
|
||||
<section className="settings-section">
|
||||
<SectionTitle
|
||||
title={t("Popup blocker", "弹窗拦截")}
|
||||
subtitle={t(
|
||||
`Blocked ${workspace.closedTotal} popup windows since install.`,
|
||||
`累计拦截 ${workspace.closedTotal} 次弹窗。`,
|
||||
)}
|
||||
action={
|
||||
<Section
|
||||
icon={<BellRing size={16} />}
|
||||
title={t("Popup blocker", "弹窗拦截")}
|
||||
hint={t(
|
||||
`Blocked ${workspace.closedTotal} popup windows since install.`,
|
||||
`累计拦截 ${workspace.closedTotal} 次弹窗。`,
|
||||
)}
|
||||
actions={
|
||||
<Toggle
|
||||
checked={view.watcherEnabled}
|
||||
onChange={(next) => void workspace.setWatcher(next)}
|
||||
label={t("Popup blocker switch", "弹窗拦截总开关")}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{workspace.recentClosed.length > 0 ? (
|
||||
<div className="perm-recent">
|
||||
<BellRing size={14} />
|
||||
<span>
|
||||
{workspace.recentClosed[0].process} · {workspace.recentClosed[0].title}
|
||||
</span>
|
||||
</div>
|
||||
<Notice icon={<BellRing size={13} />}>
|
||||
{workspace.recentClosed[0].process} · {workspace.recentClosed[0].title}
|
||||
</Notice>
|
||||
) : null}
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<section className="settings-section">
|
||||
<SectionTitle
|
||||
title={t("Rules", "拦截规则")}
|
||||
subtitle={t(
|
||||
"Each rule closes windows from one program whose title contains the text.",
|
||||
"每条规则会关闭指定程序中标题包含该文字的窗口。",
|
||||
)}
|
||||
/>
|
||||
<div className="perm-rows">
|
||||
<Section
|
||||
icon={<ShieldCheck size={16} />}
|
||||
title={t("Rules", "拦截规则")}
|
||||
hint={t(
|
||||
"Each rule closes windows from one program whose title contains the text.",
|
||||
"每条规则会关闭指定程序中标题包含该文字的窗口。",
|
||||
)}
|
||||
>
|
||||
<div className="row-list">
|
||||
{view.rules.map((rule, index) => (
|
||||
<div className="settings-row" key={`${rule.exe}-${index}`}>
|
||||
<div className="perm-row">
|
||||
<Row
|
||||
key={`${rule.exe}-${index}`}
|
||||
leading={
|
||||
<RowIcon icon={rule.icon} label={rule.exe.split(/[\\/]/).pop() ?? rule.exe} />
|
||||
<div>
|
||||
<span>{rule.title}</span>
|
||||
<small title={rule.exe}>
|
||||
{shortPath(rule.exe, 64)} ·{" "}
|
||||
{t(`closed ${rule.closed}×`, `已关闭 ${rule.closed} 次`)}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div className="perm-row-actions">
|
||||
<Toggle
|
||||
checked={rule.enabled}
|
||||
onChange={(next) => void workspace.toggleRule(index, next)}
|
||||
label={`${rule.title} ${rule.enabled ? "disable" : "enable"}`}
|
||||
/>
|
||||
<IconButton
|
||||
label={t("Remove rule", "删除规则")}
|
||||
onClick={() => void workspace.removeRule(index)}
|
||||
>
|
||||
<Trash2 size={15} />
|
||||
</IconButton>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
title={rule.title}
|
||||
subtitle={`${shortPath(rule.exe, 64)} · ${t(
|
||||
`closed ${rule.closed}×`,
|
||||
`已关闭 ${rule.closed} 次`,
|
||||
)}`}
|
||||
trailing={
|
||||
<>
|
||||
<Toggle
|
||||
checked={rule.enabled}
|
||||
onChange={(next) => void workspace.toggleRule(index, next)}
|
||||
label={`${rule.title} ${rule.enabled ? "disable" : "enable"}`}
|
||||
/>
|
||||
<IconButton
|
||||
label={t("Remove rule", "删除规则")}
|
||||
onClick={() => void workspace.removeRule(index)}
|
||||
>
|
||||
<Trash2 size={15} />
|
||||
</IconButton>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
{view.rules.length === 0 ? (
|
||||
<p className="perm-empty">
|
||||
<p className="row-empty">
|
||||
{t(
|
||||
"No rules yet — pick a window below.",
|
||||
"还没有规则,先从下面的当前窗口里“拦截”一个。",
|
||||
|
|
@ -875,16 +916,16 @@ export function PermissionsPage({
|
|||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<section className="settings-section">
|
||||
<SectionTitle
|
||||
title={t("Current windows", "当前窗口")}
|
||||
subtitle={t(
|
||||
"Refresh, then block a noisy window or close it once.",
|
||||
"刷新后可直接拦截某个烦人的窗口,或只关闭这一次。",
|
||||
)}
|
||||
action={
|
||||
<Section
|
||||
icon={<LayoutGrid size={16} />}
|
||||
title={t("Current windows", "当前窗口")}
|
||||
hint={t(
|
||||
"Refresh, then block a noisy window or close it once.",
|
||||
"刷新后可直接拦截某个烦人的窗口,或只关闭这一次。",
|
||||
)}
|
||||
actions={
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
|
@ -893,38 +934,38 @@ export function PermissionsPage({
|
|||
>
|
||||
{t("Refresh", "刷新")}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<div className="perm-rows">
|
||||
}
|
||||
>
|
||||
<div className="row-list">
|
||||
{workspace.windows.map((window) => (
|
||||
<div className="settings-row" key={window.hwnd}>
|
||||
<div className="perm-row">
|
||||
<RowIcon icon={window.icon} label={window.process} />
|
||||
<div>
|
||||
<span>{window.title}</span>
|
||||
<small title={window.exe ?? undefined}>{window.process}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div className="perm-row-actions">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
disabled={!window.exe}
|
||||
onClick={() => void workspace.addRule(window.hwnd, "contains")}
|
||||
>
|
||||
{t("Block", "拦截")}
|
||||
</Button>
|
||||
<IconButton
|
||||
label={t("Close window", "关闭这个窗口")}
|
||||
onClick={() => void workspace.closeWindow(window.hwnd)}
|
||||
>
|
||||
<X size={15} />
|
||||
</IconButton>
|
||||
</div>
|
||||
</div>
|
||||
<Row
|
||||
key={window.hwnd}
|
||||
leading={<RowIcon icon={window.icon} label={window.process} />}
|
||||
title={window.title}
|
||||
subtitle={window.process}
|
||||
detail={window.exe ?? undefined}
|
||||
trailing={
|
||||
<>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
disabled={!window.exe}
|
||||
onClick={() => void workspace.addRule(window.hwnd, "contains")}
|
||||
>
|
||||
{t("Block", "拦截")}
|
||||
</Button>
|
||||
<IconButton
|
||||
label={t("Close window", "关闭这个窗口")}
|
||||
onClick={() => void workspace.closeWindow(window.hwnd)}
|
||||
>
|
||||
<X size={15} />
|
||||
</IconButton>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,11 +4,15 @@ import { api } from "../lib/api";
|
|||
import { useI18n } from "../i18n";
|
||||
import { formatBytes, formatCount, messageFrom } from "../lib/format";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Checkbox,
|
||||
EmptyState,
|
||||
InlineError,
|
||||
Notice,
|
||||
PageHeader,
|
||||
Row,
|
||||
Section,
|
||||
useToast,
|
||||
} from "../components/ui";
|
||||
import type { CleanupItem } from "../types";
|
||||
|
|
@ -150,78 +154,108 @@ export function PrivacyPage({
|
|||
)}
|
||||
{error ? <InlineError message={error} onDismiss={() => setError(null)} /> : null}
|
||||
|
||||
<section className="privacy-grid">
|
||||
{groups.map((group) => {
|
||||
const Icon = SPEC_ICONS[group.ruleId] ?? ShieldQuestion;
|
||||
const allOn = group.indexes.every((index) => picked.has(index));
|
||||
const warn = WARN_COPY[group.ruleId];
|
||||
return (
|
||||
<label
|
||||
key={group.ruleId}
|
||||
className={`privacy-card ${group.locked ? "is-locked" : ""} ${allOn ? "is-picked" : ""}`}
|
||||
onClick={() => toggleGroup(group)}
|
||||
<Section
|
||||
icon={<EyeOff size={16} />}
|
||||
title={t("Privacy traces", "隐私痕迹")}
|
||||
hint={t(
|
||||
"Select what to clear. Locked items need the browser or app closed first.",
|
||||
"选择要清除的痕迹;锁定的项目需要先关闭对应浏览器或应用。",
|
||||
)}
|
||||
actions={
|
||||
<div className="row-actions">
|
||||
<Button variant="ghost" onClick={() => void scan()} disabled={scanning || cleaning}>
|
||||
{scanning ? t("Refreshing…", "正在刷新…") : t("Re-scan", "重新扫描")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="danger"
|
||||
disabled={picked.size === 0 || cleaning || scanning}
|
||||
onClick={() => void clean()}
|
||||
>
|
||||
<Checkbox
|
||||
checked={allOn}
|
||||
disabled={Boolean(group.locked)}
|
||||
onChange={() => toggleGroup(group)}
|
||||
label={group.label}
|
||||
/>
|
||||
<span className="privacy-icon">
|
||||
<Icon size={17} />
|
||||
</span>
|
||||
<span className="privacy-copy">
|
||||
<b>{group.label}</b>
|
||||
<small>{group.detail}</small>
|
||||
{warn && !group.locked ? (
|
||||
<small className="privacy-warn">{lang === "zh" ? warn[0] : warn[1]}</small>
|
||||
) : null}
|
||||
</span>
|
||||
{group.locked ? (
|
||||
<span className="privacy-lock">
|
||||
<Lock size={12} /> {group.locked}
|
||||
</span>
|
||||
) : (
|
||||
<span className="privacy-size">{formatBytes(group.bytes)}</span>
|
||||
)}
|
||||
</label>
|
||||
);
|
||||
})}
|
||||
{loaded && groups.length === 0 && !scanning ? (
|
||||
<EmptyState
|
||||
icon={<EyeOff size={26} />}
|
||||
title={t("Nothing to clean", "没有可清理的痕迹")}
|
||||
description={t(
|
||||
"No browser profiles or trace stores were found on this machine.",
|
||||
"本机没有找到浏览器 profile 或痕迹存储。",
|
||||
)}
|
||||
/>
|
||||
) : null}
|
||||
</section>
|
||||
|
||||
<section className="privacy-footer">
|
||||
<span className="privacy-footer-sum">
|
||||
{cleaning ? t("Cleaning…", "清理中…") : t("Clean now", "立即清理")}
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Notice
|
||||
tone={picked.size > 0 ? "warning" : "info"}
|
||||
actions={
|
||||
<Badge tone={picked.size > 0 ? "warning" : "neutral"}>
|
||||
{picked.size > 0
|
||||
? t(
|
||||
`${formatCount(picked.size)} selected · ${formatBytes(pickedBytes)}`,
|
||||
`已选 ${formatCount(picked.size)} 项 · ${formatBytes(pickedBytes)}`,
|
||||
)
|
||||
: t("Nothing selected", "尚未选择")}
|
||||
</Badge>
|
||||
}
|
||||
>
|
||||
{picked.size > 0
|
||||
? t(
|
||||
`${formatCount(picked.size)} traces selected · ${formatBytes(pickedBytes)} · permanent`,
|
||||
`已选 ${formatCount(picked.size)} 项 · ${formatBytes(pickedBytes)} · 永久删除`,
|
||||
"These deletions skip the Recycle Bin on purpose; History still lists every path.",
|
||||
"这些删除有意绕过回收站;历史记录仍会逐条登记路径与大小。",
|
||||
)
|
||||
: t(
|
||||
"These deletions skip the Recycle Bin on purpose; History still lists every path.",
|
||||
"这些删除有意绕过回收站;历史记录仍会逐条登记路径与大小。",
|
||||
)}
|
||||
</span>
|
||||
<Button variant="ghost" onClick={() => void scan()} disabled={scanning || cleaning}>
|
||||
{scanning ? t("Refreshing…", "正在刷新…") : t("Re-scan", "重新扫描")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="danger"
|
||||
disabled={picked.size === 0 || cleaning || scanning}
|
||||
onClick={() => void clean()}
|
||||
>
|
||||
{cleaning ? t("Cleaning…", "清理中…") : t("Clean now", "立即清理")}
|
||||
</Button>
|
||||
</section>
|
||||
</Notice>
|
||||
<div className="row-list">
|
||||
{groups.map((group) => {
|
||||
const Icon = SPEC_ICONS[group.ruleId] ?? ShieldQuestion;
|
||||
const allOn = group.indexes.every((index) => picked.has(index));
|
||||
const warn = WARN_COPY[group.ruleId];
|
||||
return (
|
||||
<Row
|
||||
key={group.ruleId}
|
||||
selected={allOn}
|
||||
muted={Boolean(group.locked)}
|
||||
onClick={() => toggleGroup(group)}
|
||||
leading={
|
||||
<span className="whitelist-icon">
|
||||
<Icon size={16} />
|
||||
</span>
|
||||
}
|
||||
title={group.label}
|
||||
subtitle={group.detail}
|
||||
tags={
|
||||
warn && !group.locked ? (
|
||||
<Badge tone="warning">{lang === "zh" ? warn[0] : warn[1]}</Badge>
|
||||
) : undefined
|
||||
}
|
||||
trailing={
|
||||
<>
|
||||
{group.locked ? (
|
||||
<Badge tone="neutral" title={group.locked}>
|
||||
<Lock size={11} /> {group.locked}
|
||||
</Badge>
|
||||
) : (
|
||||
<span>{formatBytes(group.bytes)}</span>
|
||||
)}
|
||||
<span onClick={(event) => event.stopPropagation()}>
|
||||
<Checkbox
|
||||
checked={allOn}
|
||||
disabled={Boolean(group.locked)}
|
||||
onChange={() => toggleGroup(group)}
|
||||
label={group.label}
|
||||
/>
|
||||
</span>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{loaded && groups.length === 0 && !scanning ? (
|
||||
<EmptyState
|
||||
icon={<EyeOff size={26} />}
|
||||
title={t("Nothing to clean", "没有可清理的痕迹")}
|
||||
description={t(
|
||||
"No browser profiles or trace stores were found on this machine.",
|
||||
"本机没有找到浏览器 profile 或痕迹存储。",
|
||||
)}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</Section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,14 +26,17 @@ import { formatBytes, formatCount, messageFrom, shortPath } from "../lib/format"
|
|||
import type { Confidence, Finding, SecurityScan, SecurityStatus } from "../types";
|
||||
import type { SecurityWorkspace } from "../hooks/useSecurityWorkspace";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Chip,
|
||||
ConfirmDialog,
|
||||
EmptyState,
|
||||
InlineError,
|
||||
Modal,
|
||||
PageHeader,
|
||||
ProgressCard,
|
||||
SectionTitle,
|
||||
Row,
|
||||
Section,
|
||||
useToast,
|
||||
} from "../components/ui";
|
||||
|
||||
|
|
@ -252,28 +255,25 @@ export function SecurityPage({
|
|||
onToggleScope={() => setShowScope((current) => !current)}
|
||||
/>
|
||||
|
||||
<section className="panel">
|
||||
<SectionTitle
|
||||
title={t("Findings", "发现")}
|
||||
action={
|
||||
scan ? (
|
||||
<div className="chip-row" role="tablist">
|
||||
{filterOptions.map(([key, label, count]) => (
|
||||
<button
|
||||
key={key}
|
||||
role="tab"
|
||||
aria-selected={filter === key}
|
||||
className={`filter-chip ${filter === key ? "is-active" : ""}`}
|
||||
onClick={() => setFilter(key)}
|
||||
>
|
||||
{label}
|
||||
<b>{count}</b>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
/>
|
||||
<Section
|
||||
title={t("Findings", "发现")}
|
||||
actions={
|
||||
scan ? (
|
||||
<div className="chip-row" role="group">
|
||||
{filterOptions.map(([key, label, count]) => (
|
||||
<Chip
|
||||
key={key}
|
||||
active={filter === key}
|
||||
count={count}
|
||||
onClick={() => setFilter(key)}
|
||||
>
|
||||
{label}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
>
|
||||
{!scan ? (
|
||||
<EmptyState
|
||||
icon={<ShieldQuestion size={26} />}
|
||||
|
|
@ -309,7 +309,7 @@ export function SecurityPage({
|
|||
}
|
||||
/>
|
||||
) : (
|
||||
<ul className="item-list">
|
||||
<div className="row-list">
|
||||
{findings.map((finding) => (
|
||||
<FindingRow
|
||||
key={finding.id}
|
||||
|
|
@ -331,9 +331,9 @@ export function SecurityPage({
|
|||
}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<QuarantineCard
|
||||
status={status}
|
||||
|
|
@ -480,18 +480,18 @@ function ProtectionCard({
|
|||
: protection.productName || t("No product reported", "未读到防护产品");
|
||||
|
||||
return (
|
||||
<section className={`panel is-protection ${unknown ? "is-unknown" : ""}`}>
|
||||
<section className={`section is-protection ${unknown ? "is-unknown" : ""}`}>
|
||||
<span className={`metric-icon ${unknown ? "tone-warning" : "tone-primary"}`}>
|
||||
{unknown ? <ShieldQuestion size={22} /> : <ShieldCheck size={22} />}
|
||||
</span>
|
||||
<div className="protection-copy">
|
||||
<div className="protection-head">
|
||||
<strong>{providerName}</strong>
|
||||
<span className={`status-chip is-${unknown ? "neutral" : "info"}`}>
|
||||
<Badge tone={unknown ? "neutral" : "info"}>
|
||||
{unknown
|
||||
? t("Could not be confirmed", "无法确认")
|
||||
: t("Read from the system", "来自系统")}
|
||||
</span>
|
||||
</Badge>
|
||||
</div>
|
||||
<p>
|
||||
{t(
|
||||
|
|
@ -589,7 +589,7 @@ function CoverageCard({
|
|||
: t("Coverage was complete", "覆盖范围完整");
|
||||
|
||||
return (
|
||||
<section className={`panel is-coverage is-${tone}`}>
|
||||
<section className={`section is-coverage is-${tone}`}>
|
||||
<div className="coverage-head">
|
||||
<div>
|
||||
<strong>{title}</strong>
|
||||
|
|
@ -613,7 +613,7 @@ function CoverageCard({
|
|||
)}
|
||||
</p>
|
||||
</div>
|
||||
<span className={`status-chip is-${tone}`}>
|
||||
<Badge tone={tone === "success" ? "success" : tone === "warning" ? "warning" : "neutral"}>
|
||||
{lang === "zh"
|
||||
? !scan
|
||||
? "未扫描"
|
||||
|
|
@ -625,7 +625,7 @@ function CoverageCard({
|
|||
: restricted
|
||||
? "limited"
|
||||
: "complete"}
|
||||
</span>
|
||||
</Badge>
|
||||
</div>
|
||||
|
||||
{access === "denied" || access === "unknown" ? (
|
||||
|
|
@ -684,8 +684,8 @@ function CoverageCard({
|
|||
"signed" because a signature would have been accepted if one had been
|
||||
configured is the kind of green that costs trust later. */}
|
||||
{intel.source === "pack" ? (
|
||||
<span
|
||||
className={`status-chip is-${intel.signed ? "success" : "warning"}`}
|
||||
<Badge
|
||||
tone={intel.signed ? "success" : "warning"}
|
||||
title={
|
||||
intel.signed
|
||||
? t(
|
||||
|
|
@ -701,7 +701,7 @@ function CoverageCard({
|
|||
{intel.signed
|
||||
? t("signature verified", "已校验签名")
|
||||
: t("hash only · not signed", "仅校验哈希 · 未验签")}
|
||||
</span>
|
||||
</Badge>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="coverage-actions">
|
||||
|
|
@ -803,25 +803,31 @@ function FindingRow({
|
|||
const { t } = useI18n();
|
||||
const meta = CONFIDENCE_META[finding.confidence];
|
||||
return (
|
||||
<li
|
||||
className={`item-row is-${meta.tone} ${
|
||||
finding.quarantined || finding.allowlisted ? "is-handled" : ""
|
||||
}`}
|
||||
>
|
||||
<button className="item-main" onClick={onOpen}>
|
||||
<span className="item-copy">
|
||||
<strong>{finding.name}</strong>
|
||||
<small title={finding.displayPath ?? undefined}>
|
||||
{finding.displayPath ?? t("Machine state", "系统状态")}
|
||||
</small>
|
||||
<em>{finding.title}</em>
|
||||
</span>
|
||||
</button>
|
||||
<span className={`status-chip is-${finding.allowlisted ? "neutral" : meta.tone}`}>
|
||||
{finding.allowlisted ? t("Trusted", "已信任") : t(meta.en, meta.zh)}
|
||||
{finding.quarantined ? ` · ${t("held", "已隔离")}` : ""}
|
||||
</span>
|
||||
<div className="item-actions">
|
||||
<Row
|
||||
className={`finding-row is-${meta.tone}`}
|
||||
title={finding.name}
|
||||
tags={
|
||||
<Badge
|
||||
tone={
|
||||
finding.allowlisted
|
||||
? "neutral"
|
||||
: meta.tone === "danger"
|
||||
? "danger"
|
||||
: meta.tone === "warning" || meta.tone === "risky"
|
||||
? "warning"
|
||||
: "info"
|
||||
}
|
||||
>
|
||||
{finding.allowlisted ? t("Trusted", "已信任") : t(meta.en, meta.zh)}
|
||||
{finding.quarantined ? ` · ${t("held", "已隔离")}` : ""}
|
||||
</Badge>
|
||||
}
|
||||
subtitle={finding.title}
|
||||
detail={finding.displayPath ?? t("Machine state", "系统状态")}
|
||||
muted={finding.quarantined || finding.allowlisted}
|
||||
onClick={onOpen}
|
||||
trailing={
|
||||
<div className="row-actions" onClick={(event) => event.stopPropagation()}>
|
||||
{finding.path ? (
|
||||
<button
|
||||
className="icon-button"
|
||||
|
|
@ -872,7 +878,8 @@ function FindingRow({
|
|||
</>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -932,32 +939,31 @@ function QuarantineCard({
|
|||
const { t } = useI18n();
|
||||
const items = status.quarantine;
|
||||
return (
|
||||
<section className="panel">
|
||||
<SectionTitle
|
||||
title={t("Quarantine", "隔离区")}
|
||||
subtitle={
|
||||
items.length
|
||||
? t(
|
||||
`${formatCount(items.length)} items · ${formatBytes(
|
||||
status.quarantineSize,
|
||||
)} · held where they cannot run`,
|
||||
`${formatCount(items.length)} 项 · ${formatBytes(
|
||||
status.quarantineSize,
|
||||
)} · 存放位置无法执行`,
|
||||
)
|
||||
: t("Empty — nothing has been moved out of the way.", "空的——没有文件被移走。")
|
||||
}
|
||||
action={
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon={<FolderOpen size={14} />}
|
||||
onClick={() => void api.openQuarantineFolder().catch(() => undefined)}
|
||||
>
|
||||
{t("Open folder", "打开目录")}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<Section
|
||||
title={t("Quarantine", "隔离区")}
|
||||
hint={
|
||||
items.length
|
||||
? t(
|
||||
`${formatCount(items.length)} items · ${formatBytes(
|
||||
status.quarantineSize,
|
||||
)} · held where they cannot run`,
|
||||
`${formatCount(items.length)} 项 · ${formatBytes(
|
||||
status.quarantineSize,
|
||||
)} · 存放位置无法执行`,
|
||||
)
|
||||
: t("Empty — nothing has been moved out of the way.", "空的——没有文件被移走。")
|
||||
}
|
||||
actions={
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon={<FolderOpen size={14} />}
|
||||
onClick={() => void api.openQuarantineFolder().catch(() => undefined)}
|
||||
>
|
||||
{t("Open folder", "打开目录")}
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
{items.length === 0 ? (
|
||||
<p className="empty-inline">
|
||||
{t(
|
||||
|
|
@ -966,17 +972,16 @@ function QuarantineCard({
|
|||
)}
|
||||
</p>
|
||||
) : (
|
||||
<ul className="item-list">
|
||||
<div className="row-list">
|
||||
{items.map((item) => (
|
||||
<li key={item.id} className="item-row">
|
||||
<div className="item-copy">
|
||||
<strong title={item.originalPath}>{item.displayPath}</strong>
|
||||
<small>
|
||||
{item.title} · {formatBytes(item.size)} ·{" "}
|
||||
{new Date(item.quarantinedMs).toLocaleString()}
|
||||
</small>
|
||||
</div>
|
||||
<div className="item-actions">
|
||||
<Row
|
||||
key={item.id}
|
||||
title={<span title={item.originalPath}>{item.displayPath}</span>}
|
||||
subtitle={`${item.title} · ${formatBytes(item.size)} · ${new Date(
|
||||
item.quarantinedMs,
|
||||
).toLocaleString()}`}
|
||||
trailing={
|
||||
<div className="row-actions">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
|
|
@ -996,11 +1001,12 @@ function QuarantineCard({
|
|||
{t("Delete", "删除")}
|
||||
</Button>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -1015,10 +1021,7 @@ function ActivityCard({
|
|||
const activity = status.activity;
|
||||
if (!activity.length) return null;
|
||||
return (
|
||||
<section className="panel">
|
||||
<SectionTitle
|
||||
title={t("Recent security activity", "最近的安全活动")}
|
||||
/>
|
||||
<Section title={t("Recent security activity", "最近的安全活动")}>
|
||||
<ul className="activity-list">
|
||||
{activity.slice(0, 10).map((entry, index) => (
|
||||
<li key={`${entry.atMs}-${index}`}>
|
||||
|
|
@ -1032,6 +1035,6 @@ function ActivityCard({
|
|||
<HardDriveDownload size={13} />
|
||||
{t("Manage startup items", "管理启动项")}
|
||||
</button>
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import {
|
||||
Check,
|
||||
FileCog,
|
||||
FolderClock,
|
||||
FolderOpen,
|
||||
|
|
@ -33,10 +32,16 @@ import type { SecurityWorkspace } from "../hooks/useSecurityWorkspace";
|
|||
import { SecuritySettingsCard } from "../components/SecuritySettingsCard";
|
||||
import { UpdatePanel } from "../components/UpdatePanel";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
ChoiceCard,
|
||||
IconButton,
|
||||
InlineError,
|
||||
PageHeader,
|
||||
Row,
|
||||
Select,
|
||||
Section,
|
||||
Tabs,
|
||||
Toggle,
|
||||
useToast,
|
||||
} from "../components/ui";
|
||||
|
|
@ -230,150 +235,99 @@ export function SettingsPage({
|
|||
|
||||
{error ? <InlineError message={error} onDismiss={() => setError(null)} /> : null}
|
||||
|
||||
<div
|
||||
className="chip-row page-tabs settings-tabs"
|
||||
role="tablist"
|
||||
aria-label={t("Settings sections", "设置分区")}
|
||||
>
|
||||
{SETTINGS_TABS.map((item) => {
|
||||
<Tabs
|
||||
label={t("Settings sections", "设置分区")}
|
||||
value={tab}
|
||||
onChange={setTab}
|
||||
items={SETTINGS_TABS.map((item) => {
|
||||
const Icon = item.icon;
|
||||
return (
|
||||
<button
|
||||
key={item.id}
|
||||
role="tab"
|
||||
aria-selected={tab === item.id}
|
||||
className={`filter-chip ${tab === item.id ? "is-active" : ""}`}
|
||||
onClick={() => setTab(item.id)}
|
||||
>
|
||||
<Icon size={14} />
|
||||
{t(item.labelEn, item.labelZh)}
|
||||
</button>
|
||||
);
|
||||
return {
|
||||
id: item.id,
|
||||
label: t(item.labelEn, item.labelZh),
|
||||
icon: <Icon size={15} />,
|
||||
};
|
||||
})}
|
||||
</div>
|
||||
/>
|
||||
|
||||
{tab === "general" ? (
|
||||
<div className="settings-grid">
|
||||
<section className="settings-section">
|
||||
<div className="settings-section-head">
|
||||
<div>
|
||||
<h2>
|
||||
<Languages size={18} />
|
||||
{t("Language & appearance", "语言与外观")}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div className="language-picker">
|
||||
<button
|
||||
className={lang === "zh" ? "is-active" : ""}
|
||||
<Section
|
||||
icon={<Languages size={16} />}
|
||||
title={t("Language & appearance", "语言与外观")}
|
||||
>
|
||||
<div className="choice-group" role="radiogroup">
|
||||
<ChoiceCard
|
||||
selected={lang === "zh"}
|
||||
onClick={() => void onLanguageChange("zh")}
|
||||
>
|
||||
<strong>简体中文</strong>
|
||||
<span>Simplified Chinese</span>
|
||||
{lang === "zh" ? <Check size={16} /> : null}
|
||||
</button>
|
||||
<button
|
||||
className={lang === "en" ? "is-active" : ""}
|
||||
icon={<Languages size={18} />}
|
||||
title="简体中文"
|
||||
description="Simplified Chinese"
|
||||
/>
|
||||
<ChoiceCard
|
||||
selected={lang === "en"}
|
||||
onClick={() => void onLanguageChange("en")}
|
||||
>
|
||||
<strong>English</strong>
|
||||
<span>English (US)</span>
|
||||
{lang === "en" ? <Check size={16} /> : null}
|
||||
</button>
|
||||
icon={<Languages size={18} />}
|
||||
title="English"
|
||||
description="English (US)"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<section className="settings-section">
|
||||
<div className="settings-section-head">
|
||||
<div>
|
||||
<h2>
|
||||
<Power size={18} />
|
||||
{t("Startup", "启动")}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div className="settings-row is-first">
|
||||
<div>
|
||||
<strong>{t("Launch Squid at login", "登录时启动 Squid")}</strong>
|
||||
<span>
|
||||
{t(
|
||||
"Only Squid itself; other apps are managed under Startup items.",
|
||||
"仅 Squid 自身,其他程序请到启动项页面管理。",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<Section icon={<Power size={16} />} title={t("Startup", "启动")}>
|
||||
<Row
|
||||
className="is-first"
|
||||
title={t("Launch Squid at login", "登录时启动 Squid")}
|
||||
subtitle={t(
|
||||
"Only Squid itself; other apps are managed under Startup items.",
|
||||
"仅 Squid 自身,其他程序请到启动项页面管理。",
|
||||
)}
|
||||
trailing={
|
||||
<Toggle
|
||||
checked={autostart ?? false}
|
||||
onChange={(enabled) => void setLaunchAtLogin(enabled)}
|
||||
disabled={autostart === null || savingAutostart}
|
||||
label={t("Launch Squid at login", "登录时启动 Squid")}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
/>
|
||||
</Section>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{tab === "cleanup" ? (
|
||||
<div className="settings-grid">
|
||||
<section className="settings-section">
|
||||
<div className="settings-section-head">
|
||||
<div>
|
||||
<h2>
|
||||
<Trash2 size={18} />
|
||||
{t("Deletion safety", "删除安全")}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div className="delete-mode-cards">
|
||||
<button
|
||||
className={settings.deleteMode === "trash" ? "is-active" : ""}
|
||||
<Section icon={<Trash2 size={16} />} title={t("Deletion safety", "删除安全")}>
|
||||
<div className="choice-group" role="radiogroup">
|
||||
<ChoiceCard
|
||||
selected={settings.deleteMode === "trash"}
|
||||
onClick={() => void setMode("trash")}
|
||||
disabled={saving}
|
||||
>
|
||||
<span className="delete-mode-icon">
|
||||
<FolderOpen size={20} />
|
||||
</span>
|
||||
<span>
|
||||
<strong>{t(`Move to ${bin}`, `移入${bin}`)}</strong>
|
||||
<small>
|
||||
{t(
|
||||
"Safer. Restore files later from History.",
|
||||
"更安全,之后可从历史记录还原。",
|
||||
)}
|
||||
</small>
|
||||
</span>
|
||||
<span className="radio-dot" />
|
||||
</button>
|
||||
<button
|
||||
className={settings.deleteMode === "permanent" ? "is-active" : ""}
|
||||
icon={<FolderOpen size={20} />}
|
||||
title={t(`Move to ${bin}`, `移入${bin}`)}
|
||||
description={t(
|
||||
"Safer. Restore files later from History.",
|
||||
"更安全,之后可从历史记录还原。",
|
||||
)}
|
||||
/>
|
||||
<ChoiceCard
|
||||
selected={settings.deleteMode === "permanent"}
|
||||
onClick={() => void setMode("permanent")}
|
||||
disabled={saving}
|
||||
>
|
||||
<span className="delete-mode-icon">
|
||||
<Trash2 size={20} />
|
||||
</span>
|
||||
<span>
|
||||
<strong>{t("Remove permanently", "永久删除")}</strong>
|
||||
<small>
|
||||
{t(
|
||||
"No recovery for caches and rebuildable files.",
|
||||
"缓存与可重建文件无法恢复。",
|
||||
)}
|
||||
</small>
|
||||
</span>
|
||||
<span className="radio-dot" />
|
||||
</button>
|
||||
icon={<Trash2 size={20} />}
|
||||
title={t("Remove permanently", "永久删除")}
|
||||
description={t(
|
||||
"No recovery for caches and rebuildable files.",
|
||||
"缓存与可重建文件无法恢复。",
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="settings-row">
|
||||
<div>
|
||||
<strong>{t("Report allocated size", "显示磁盘实际占用")}</strong>
|
||||
<span>
|
||||
{t(
|
||||
"Prefer on-disk bytes for sparse and compressed files.",
|
||||
"对稀疏和压缩文件优先显示磁盘实际占用。",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<Row
|
||||
title={t("Report allocated size", "显示磁盘实际占用")}
|
||||
subtitle={t(
|
||||
"Prefer on-disk bytes for sparse and compressed files.",
|
||||
"对稀疏和压缩文件优先显示磁盘实际占用。",
|
||||
)}
|
||||
trailing={
|
||||
<button
|
||||
className={`toggle ${settings.showAllocated ? "is-on" : ""}`}
|
||||
aria-label={t("Report allocated size", "显示磁盘实际占用")}
|
||||
|
|
@ -381,11 +335,11 @@ export function SettingsPage({
|
|||
>
|
||||
<span />
|
||||
</button>
|
||||
</div>
|
||||
<div className="settings-row">
|
||||
<div>
|
||||
<strong>{t("History records to keep", "保留历史记录数量")}</strong>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<Row
|
||||
title={t("History records to keep", "保留历史记录数量")}
|
||||
trailing={
|
||||
<Select
|
||||
value={settings.historyKeep}
|
||||
label={t("History records to keep", "保留历史记录数量")}
|
||||
|
|
@ -395,24 +349,18 @@ export function SettingsPage({
|
|||
}))}
|
||||
onChange={(next) => void save({ historyKeep: next })}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
/>
|
||||
</Section>
|
||||
|
||||
<section className="settings-section">
|
||||
<div className="settings-section-head">
|
||||
<div>
|
||||
<h2>
|
||||
<ShieldCheck size={18} />
|
||||
{t("Protected locations", "受保护的位置")}
|
||||
</h2>
|
||||
<p>
|
||||
{t(
|
||||
"Never deleted here, even when a cleanup rule matches. The malware scan still reports inside them.",
|
||||
"这里的内容绝不会被删除。恶意软件扫描仍会检查其中的发现。",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Section
|
||||
icon={<ShieldCheck size={16} />}
|
||||
title={t("Protected locations", "受保护的位置")}
|
||||
hint={t(
|
||||
"Never deleted here, even when a cleanup rule matches. The malware scan still reports inside them.",
|
||||
"这里的内容绝不会被删除。恶意软件扫描仍会检查其中的发现。",
|
||||
)}
|
||||
>
|
||||
<div className="whitelist-add">
|
||||
<input
|
||||
value={whitelistInput}
|
||||
|
|
@ -462,66 +410,67 @@ export function SettingsPage({
|
|||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="whitelist-list">
|
||||
<div className="row-list">
|
||||
{settings.whitelist.length === 0 ? (
|
||||
<p className="settings-empty">
|
||||
{t("No protected folders yet.", "尚未设置受保护的文件夹。")}
|
||||
</p>
|
||||
) : (
|
||||
settings.whitelist.map((pattern) => (
|
||||
<div className="whitelist-row" key={pattern}>
|
||||
<span className="whitelist-icon">
|
||||
<ShieldCheck size={15} />
|
||||
</span>
|
||||
<code title={pattern}>{shortPath(pattern, 88)}</code>
|
||||
{audit ? (
|
||||
<span
|
||||
className={`whitelist-audit-chip ${
|
||||
audit.get(pattern) ? "is-live" : "is-dead"
|
||||
}`}
|
||||
title={t(
|
||||
audit.get(pattern)
|
||||
? "This pattern matched paths Squid knows about on the last scan"
|
||||
: "This pattern has never matched anything — it may be stale",
|
||||
audit.get(pattern)
|
||||
? "最近扫描命中过这条规则保护的位置"
|
||||
: "从未命中任何已知位置,规则可能已经过期",
|
||||
)}
|
||||
>
|
||||
{audit.get(pattern)
|
||||
? t("Recently matched", "最近命中")
|
||||
: t("Never matched", "从未命中")}
|
||||
<Row
|
||||
key={pattern}
|
||||
leading={
|
||||
<span className="whitelist-icon">
|
||||
<ShieldCheck size={15} />
|
||||
</span>
|
||||
) : null}
|
||||
<button
|
||||
className="row-reveal"
|
||||
aria-label={t("Remove protection", "移除保护")}
|
||||
onClick={() => void removeWhitelist(pattern)}
|
||||
disabled={saving}
|
||||
>
|
||||
<X size={14} />
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
title={<code title={pattern}>{shortPath(pattern, 88)}</code>}
|
||||
tags={
|
||||
audit ? (
|
||||
<Badge
|
||||
tone={audit.get(pattern) ? "success" : "neutral"}
|
||||
title={t(
|
||||
audit.get(pattern)
|
||||
? "This pattern matched paths Squid knows about on the last scan"
|
||||
: "This pattern has never matched anything — it may be stale",
|
||||
audit.get(pattern)
|
||||
? "最近扫描命中过这条规则保护的位置"
|
||||
: "从未命中任何已知位置,规则可能已经过期",
|
||||
)}
|
||||
>
|
||||
{audit.get(pattern)
|
||||
? t("Recently matched", "最近命中")
|
||||
: t("Never matched", "从未命中")}
|
||||
</Badge>
|
||||
) : undefined
|
||||
}
|
||||
trailing={
|
||||
<IconButton
|
||||
label={t("Remove protection", "移除保护")}
|
||||
onClick={() => void removeWhitelist(pattern)}
|
||||
disabled={saving}
|
||||
>
|
||||
<X size={14} />
|
||||
</IconButton>
|
||||
}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{tab === "security" ? (
|
||||
<>
|
||||
{bootstrap.platform === "macos" ? (
|
||||
<section className="settings-section">
|
||||
<div className="settings-section-head">
|
||||
<div>
|
||||
<h2>
|
||||
<LockKeyhole size={18} />
|
||||
{t("System permissions", "系统权限")}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div className="permission-check-row">
|
||||
<Section
|
||||
icon={<LockKeyhole size={16} />}
|
||||
title={t("System permissions", "系统权限")}
|
||||
>
|
||||
<Row
|
||||
className="is-first"
|
||||
leading={
|
||||
<span
|
||||
className={`permission-check-icon is-${
|
||||
permission?.fullDiskAccess === "granted" ? "granted" : "optional"
|
||||
|
|
@ -529,37 +478,33 @@ export function SettingsPage({
|
|||
>
|
||||
<LockKeyhole size={18} />
|
||||
</span>
|
||||
<div className="permission-check-copy">
|
||||
<strong>
|
||||
{t("Full Disk Access", "完全磁盘访问权限")}
|
||||
<span
|
||||
className={`permission-state is-${
|
||||
checkingPermission
|
||||
? "checking"
|
||||
: permission?.fullDiskAccess === "granted"
|
||||
? "granted"
|
||||
: permission?.fullDiskAccess === "denied"
|
||||
? "denied"
|
||||
: "unknown"
|
||||
}`}
|
||||
>
|
||||
{checkingPermission
|
||||
? t("Checking…", "检查中…")
|
||||
: permission?.fullDiskAccess === "granted"
|
||||
? t("Granted", "已授权")
|
||||
: permission?.fullDiskAccess === "denied"
|
||||
? t("Needs attention", "需要授权")
|
||||
: t("Not confirmed", "未确认")}
|
||||
</span>
|
||||
</strong>
|
||||
<span>
|
||||
{t(
|
||||
"Enables scans of TCC-protected caches, mail data and app leftovers.",
|
||||
"用于扫描受 TCC 保护的缓存、邮件数据与应用卸载残留。",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="permission-check-actions">
|
||||
}
|
||||
title={t("Full Disk Access", "完全磁盘访问权限")}
|
||||
tags={
|
||||
<Badge
|
||||
tone={
|
||||
permission?.fullDiskAccess === "granted"
|
||||
? "success"
|
||||
: permission?.fullDiskAccess === "denied"
|
||||
? "warning"
|
||||
: "neutral"
|
||||
}
|
||||
>
|
||||
{checkingPermission
|
||||
? t("Checking…", "检查中…")
|
||||
: permission?.fullDiskAccess === "granted"
|
||||
? t("Granted", "已授权")
|
||||
: permission?.fullDiskAccess === "denied"
|
||||
? t("Needs attention", "需要授权")
|
||||
: t("Not confirmed", "未确认")}
|
||||
</Badge>
|
||||
}
|
||||
subtitle={t(
|
||||
"Enables scans of TCC-protected caches, mail data and app leftovers.",
|
||||
"用于扫描受 TCC 保护的缓存、邮件数据与应用卸载残留。",
|
||||
)}
|
||||
trailing={
|
||||
<div className="row-actions">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
|
@ -581,19 +526,20 @@ export function SettingsPage({
|
|||
>
|
||||
{t("Open Settings", "打开系统设置")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</Section>
|
||||
) : null}
|
||||
|
||||
{security.status ? (
|
||||
<SecuritySettingsCard security={security} status={security.status} />
|
||||
) : (
|
||||
<section className="settings-section">
|
||||
<Section title={t("Security settings", "安全设置")}>
|
||||
<p className="settings-empty">
|
||||
{t("Security settings are loading…", "安全设置加载中…")}
|
||||
</p>
|
||||
</section>
|
||||
</Section>
|
||||
)}
|
||||
</>
|
||||
) : null}
|
||||
|
|
@ -608,21 +554,15 @@ export function SettingsPage({
|
|||
) : null}
|
||||
|
||||
{tab === "about" ? (
|
||||
<section className="settings-section about-section">
|
||||
<div className="settings-section-head">
|
||||
<div>
|
||||
<h2>
|
||||
<Info size={18} />
|
||||
{t("About Squid", "关于 Squid")}
|
||||
</h2>
|
||||
<p>
|
||||
{t(
|
||||
"Configuration and history stay local to this computer.",
|
||||
"配置与历史记录仅保存在这台电脑上。",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Section
|
||||
className="about-section"
|
||||
icon={<Info size={16} />}
|
||||
title={t("About Squid", "关于 Squid")}
|
||||
hint={t(
|
||||
"Configuration and history stay local to this computer.",
|
||||
"配置与历史记录仅保存在这台电脑上。",
|
||||
)}
|
||||
>
|
||||
<div className="about-brand">
|
||||
<img className="about-mark" src={brandMarkUrl} alt="" aria-hidden="true" />
|
||||
<div className="about-brand-copy">
|
||||
|
|
@ -636,49 +576,53 @@ export function SettingsPage({
|
|||
{bootstrap.osVersion || bootstrap.osName} · {bootstrap.arch}
|
||||
</span>
|
||||
</div>
|
||||
<div className="path-settings-list">
|
||||
<div className="path-setting-row">
|
||||
<span className="metric-icon tone-primary">
|
||||
<FileCog size={17} />
|
||||
</span>
|
||||
<div>
|
||||
<strong>{t("Configuration", "配置文件")}</strong>
|
||||
<code title={bootstrap.configPath}>{bootstrap.configPath}</code>
|
||||
</div>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() =>
|
||||
void api
|
||||
.revealPath(bootstrap.configPath)
|
||||
.catch((reason) => push(messageFrom(reason), "danger"))
|
||||
}
|
||||
>
|
||||
{t("Show", "显示")}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="path-setting-row">
|
||||
<span className="metric-icon tone-neutral">
|
||||
<FolderClock size={17} />
|
||||
</span>
|
||||
<div>
|
||||
<strong>{t("History", "历史记录")}</strong>
|
||||
<code title={bootstrap.historyPath}>{bootstrap.historyPath}</code>
|
||||
</div>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() =>
|
||||
void api
|
||||
.revealPath(bootstrap.historyPath)
|
||||
.catch((reason) => push(messageFrom(reason), "danger"))
|
||||
}
|
||||
>
|
||||
{t("Show", "显示")}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="row-list">
|
||||
<Row
|
||||
leading={
|
||||
<span className="metric-icon tone-primary">
|
||||
<FileCog size={17} />
|
||||
</span>
|
||||
}
|
||||
title={t("Configuration", "配置文件")}
|
||||
subtitle={<code title={bootstrap.configPath}>{bootstrap.configPath}</code>}
|
||||
trailing={
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() =>
|
||||
void api
|
||||
.revealPath(bootstrap.configPath)
|
||||
.catch((reason) => push(messageFrom(reason), "danger"))
|
||||
}
|
||||
>
|
||||
{t("Show", "显示")}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<Row
|
||||
leading={
|
||||
<span className="metric-icon tone-neutral">
|
||||
<FolderClock size={17} />
|
||||
</span>
|
||||
}
|
||||
title={t("History", "历史记录")}
|
||||
subtitle={<code title={bootstrap.historyPath}>{bootstrap.historyPath}</code>}
|
||||
trailing={
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() =>
|
||||
void api
|
||||
.revealPath(bootstrap.historyPath)
|
||||
.catch((reason) => push(messageFrom(reason), "danger"))
|
||||
}
|
||||
>
|
||||
{t("Show", "显示")}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { CopyX, Eraser, FileArchive } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useI18n } from "../i18n";
|
||||
import { PageHeader } from "../components/ui";
|
||||
import { PageHeader, Tabs } from "../components/ui";
|
||||
import { SpacePage } from "./SpacePage";
|
||||
import { DuplicateFilesPage } from "./DuplicateFilesPage";
|
||||
import { LargeFilesPage } from "./LargeFilesPage";
|
||||
|
|
@ -49,26 +49,20 @@ export function SpaceHubPage({
|
|||
<PageHeader
|
||||
title={t("Space cleaning", "空间清理")}
|
||||
/>
|
||||
<div className="hub-tabs" role="tablist">
|
||||
{TABS.map((item) => {
|
||||
<Tabs
|
||||
label={t("Space cleaning sections", "空间清理分区")}
|
||||
value={tab}
|
||||
onChange={setTab}
|
||||
items={TABS.map((item) => {
|
||||
const Icon = item.icon;
|
||||
const badge = badges[item.id];
|
||||
return (
|
||||
<button
|
||||
key={item.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tab === item.id}
|
||||
className={`hub-tab ${tab === item.id ? "is-active" : ""}`}
|
||||
onClick={() => setTab(item.id)}
|
||||
>
|
||||
<Icon size={15} />
|
||||
{t(item.en, item.zh)}
|
||||
{badge ? <b>{badge}</b> : null}
|
||||
</button>
|
||||
);
|
||||
return {
|
||||
id: item.id,
|
||||
label: t(item.en, item.zh),
|
||||
icon: <Icon size={15} />,
|
||||
badge: badges[item.id] ?? undefined,
|
||||
};
|
||||
})}
|
||||
</div>
|
||||
/>
|
||||
<div className="hub-pane" style={{ display: tab === "junk" ? undefined : "none" }}>
|
||||
<SpacePage
|
||||
embedded
|
||||
|
|
|
|||
|
|
@ -45,14 +45,18 @@ import type { ScanWorkspace } from "../hooks/useScanWorkspace";
|
|||
import { CleanBar } from "../components/CleanBar";
|
||||
import { skipGroupOf } from "../lib/skipGroups";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
CATEGORY_META,
|
||||
CATEGORY_ORDER,
|
||||
Checkbox,
|
||||
ConfirmDialog,
|
||||
InlineError,
|
||||
Notice,
|
||||
ProgressCard,
|
||||
SectionTitle,
|
||||
Row,
|
||||
Section,
|
||||
Segmented,
|
||||
categoryLabel,
|
||||
lockLabel,
|
||||
useToast,
|
||||
|
|
@ -257,55 +261,63 @@ function ClusterRow({
|
|||
const dormancy = clusterDormancy(cluster);
|
||||
return (
|
||||
<>
|
||||
<div className="space-rule" onClick={onOpen}>
|
||||
<Checkbox
|
||||
checked={allOn}
|
||||
disabled={cluster.removable === 0}
|
||||
onChange={() => onTick(!allOn)}
|
||||
label={cluster.label}
|
||||
/>
|
||||
<span className="space-rule-name">{cluster.label}</span>
|
||||
{dormancy !== null && dormancy >= DORMANT_SECS ? (
|
||||
<span className="space-rule-dormant">
|
||||
{t(
|
||||
`${ageLabel(dormancy, "en").replace(" untouched", "")} dormant`,
|
||||
ageLabel(dormancy, "zh").replace("未修改", "未使用"),
|
||||
)}
|
||||
</span>
|
||||
) : null}
|
||||
<span className="space-rule-cnt">
|
||||
{t(
|
||||
`${formatCount(cluster.entries.length)} location(s)`,
|
||||
`${formatCount(cluster.entries.length)} 个位置`,
|
||||
)}
|
||||
</span>
|
||||
<span className="space-rule-acts">
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onIgnore();
|
||||
}}
|
||||
>
|
||||
{t("Ignore", "忽略")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onOpen();
|
||||
}}
|
||||
>
|
||||
{t("Paths", "查看路径")}
|
||||
</button>
|
||||
</span>
|
||||
<span className="space-rule-size">{formatBytes(cluster.total)}</span>
|
||||
<ChevronRight
|
||||
className={`space-rule-chv ${open ? "is-open" : ""}`}
|
||||
size={13}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
<Row
|
||||
className="space-rule"
|
||||
leading={
|
||||
<Checkbox
|
||||
checked={allOn}
|
||||
disabled={cluster.removable === 0}
|
||||
onChange={() => onTick(!allOn)}
|
||||
label={cluster.label}
|
||||
/>
|
||||
}
|
||||
title={cluster.label}
|
||||
tags={
|
||||
dormancy !== null && dormancy >= DORMANT_SECS ? (
|
||||
<Badge tone="warning">
|
||||
{t(
|
||||
`${ageLabel(dormancy, "en").replace(" untouched", "")} dormant`,
|
||||
ageLabel(dormancy, "zh").replace("未修改", "未使用"),
|
||||
)}
|
||||
</Badge>
|
||||
) : undefined
|
||||
}
|
||||
subtitle={t(
|
||||
`${formatCount(cluster.entries.length)} location(s)`,
|
||||
`${formatCount(cluster.entries.length)} 个位置`,
|
||||
)}
|
||||
trailing={
|
||||
<>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onIgnore();
|
||||
}}
|
||||
>
|
||||
{t("Ignore", "忽略")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onOpen();
|
||||
}}
|
||||
>
|
||||
{t("Paths", "查看路径")}
|
||||
</Button>
|
||||
<span className="space-rule-size">{formatBytes(cluster.total)}</span>
|
||||
<ChevronRight
|
||||
className={`space-rule-chv ${open ? "is-open" : ""}`}
|
||||
size={13}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</>
|
||||
}
|
||||
onClick={onOpen}
|
||||
/>
|
||||
{open ? (
|
||||
<div className="space-rule-paths">
|
||||
{cluster.entries.map((entry) => (
|
||||
|
|
@ -328,59 +340,56 @@ function AccItem({ entry }: { entry: Entry }) {
|
|||
const evidence = item.evidence ?? [];
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
<Row
|
||||
className={`space-item ${item.lock ? "is-locked" : ""}`}
|
||||
leading={
|
||||
<Checkbox
|
||||
checked={checked}
|
||||
disabled={Boolean(item.lock)}
|
||||
onChange={() => source.toggleItem(index)}
|
||||
label={item.label}
|
||||
/>
|
||||
}
|
||||
title={item.label}
|
||||
subtitle={
|
||||
item.lock
|
||||
? lockLabel(item.lock, t)
|
||||
: [item.lastWriteSecs != null ? ageLabel(item.lastWriteSecs, lang) : null, item.note]
|
||||
.filter(Boolean)
|
||||
.join(" · ")
|
||||
}
|
||||
detail={shortPath(item.displayPath, 96)}
|
||||
muted={Boolean(item.lock)}
|
||||
tags={
|
||||
evidence.length > 0 ? (
|
||||
<button
|
||||
type="button"
|
||||
className={`chip ${
|
||||
evidence.some(
|
||||
(token) => token.startsWith("modified:") && Number(token.slice(9)) > 0,
|
||||
)
|
||||
? "is-active"
|
||||
: ""
|
||||
}`}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setShowEvidence((current) => !current);
|
||||
}}
|
||||
>
|
||||
{showEvidence
|
||||
? t("Hide evidence", "收起依据")
|
||||
: t("Why safe · evidence", "可删依据")}
|
||||
</button>
|
||||
) : undefined
|
||||
}
|
||||
trailing={
|
||||
<>
|
||||
<span className="space-item-size">{formatBytes(item.onDisk)}</span>
|
||||
<ArrowUpRight className="space-item-go" size={14} />
|
||||
</>
|
||||
}
|
||||
onClick={() => void api.revealPath(item.path).catch(() => undefined)}
|
||||
title={t("Open the location in Explorer", "在资源管理器中打开所在位置")}
|
||||
>
|
||||
<Checkbox
|
||||
checked={checked}
|
||||
disabled={Boolean(item.lock)}
|
||||
onChange={() => source.toggleItem(index)}
|
||||
label={item.label}
|
||||
/>
|
||||
<span className="space-item-name">{item.label}</span>
|
||||
<span className="space-item-path" title={item.displayPath}>
|
||||
{shortPath(item.displayPath, 96)}
|
||||
</span>
|
||||
{item.lock ? (
|
||||
<span className="space-item-meta is-locked">{lockLabel(item.lock, t)}</span>
|
||||
) : null}
|
||||
{item.lastWriteSecs != null ? (
|
||||
<span
|
||||
className={`space-item-meta ${item.lastWriteSecs >= DORMANT_SECS ? "is-dormant" : ""}`}
|
||||
title={t(
|
||||
"Newest last-write inside, from the scan walk",
|
||||
"扫描时记录的内部最新写入时间",
|
||||
)}
|
||||
>
|
||||
{ageLabel(item.lastWriteSecs, lang)}
|
||||
</span>
|
||||
) : null}
|
||||
{evidence.length > 0 ? (
|
||||
<button
|
||||
type="button"
|
||||
className={`space-item-evidence ${
|
||||
evidence.some((token) => token.startsWith("modified:") && Number(token.slice(9)) > 0)
|
||||
? "is-warn"
|
||||
: ""
|
||||
}`}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setShowEvidence((current) => !current);
|
||||
}}
|
||||
>
|
||||
{showEvidence
|
||||
? t("Hide evidence", "收起依据")
|
||||
: t("Why safe · evidence", "可删依据")}
|
||||
</button>
|
||||
) : null}
|
||||
{!item.lock && item.note ? (
|
||||
<span className="space-item-meta">{item.note}</span>
|
||||
) : null}
|
||||
<span className="space-item-size">{formatBytes(item.onDisk)}</span>
|
||||
<ArrowUpRight className="space-item-go" size={14} />
|
||||
</div>
|
||||
/>
|
||||
{showEvidence ? (
|
||||
<div className="space-evidence">
|
||||
<strong>{t("Why Squid judges this folder", "Squid 对该目录的判定依据")}</strong>
|
||||
|
|
@ -886,23 +895,24 @@ export function SpacePage({
|
|||
if (result) {
|
||||
return (
|
||||
<div className="page">
|
||||
<SectionTitle
|
||||
<Section
|
||||
title={t("Cleaning finished", "清理完成")}
|
||||
subtitle={t(
|
||||
hint={t(
|
||||
"Everything else on this machine is untouched.",
|
||||
"机器上的其他内容未被改动。",
|
||||
)}
|
||||
/>
|
||||
<CleanBar
|
||||
spec={{ phase: "done", outcome: result, elapsedMs: elapsed ?? undefined }}
|
||||
progress={null}
|
||||
noun={["个清理项", "items"]}
|
||||
mode={mode}
|
||||
auto={false}
|
||||
showSkips={false}
|
||||
onHistory={onHistory}
|
||||
onDismiss={() => setResult(null)}
|
||||
/>
|
||||
>
|
||||
<CleanBar
|
||||
spec={{ phase: "done", outcome: result, elapsedMs: elapsed ?? undefined }}
|
||||
progress={null}
|
||||
noun={["个清理项", "items"]}
|
||||
mode={mode}
|
||||
auto={false}
|
||||
showSkips={false}
|
||||
onHistory={onHistory}
|
||||
onDismiss={() => setResult(null)}
|
||||
/>
|
||||
</Section>
|
||||
{result.skipped && result.skipped.length > 0 ? (
|
||||
<div className="result-skipped">
|
||||
<div className="result-skipped-head">
|
||||
|
|
@ -994,18 +1004,15 @@ export function SpacePage({
|
|||
<span className="space-config-label">
|
||||
{t("Older than", "仅处理早于")}
|
||||
</span>
|
||||
<div className="space-seg">
|
||||
{AGE_CHOICES.map((days) => (
|
||||
<button
|
||||
key={days}
|
||||
type="button"
|
||||
className={minAge === days ? "is-on" : ""}
|
||||
onClick={() => setMinAge(days)}
|
||||
>
|
||||
{t(`${days} days`, `${days}天`)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<Segmented
|
||||
value={minAge}
|
||||
label={t("Older than", "仅处理早于")}
|
||||
onChange={setMinAge}
|
||||
options={AGE_CHOICES.map((days) => ({
|
||||
value: days,
|
||||
label: t(`${days} days`, `${days}天`),
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
size="lg"
|
||||
|
|
@ -1262,56 +1269,51 @@ export function SpacePage({
|
|||
const hidden = hiddenProtected.get(category) ?? 0;
|
||||
return (
|
||||
<div key={category} className={`space-cat ${open ? "is-open" : ""}`}>
|
||||
<div
|
||||
<Row
|
||||
className="space-cat-head"
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onClick={() => toggleExpanded(category)}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
toggleExpanded(category);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Checkbox
|
||||
checked={groupSelected(category)}
|
||||
disabled={groupDisabled(category)}
|
||||
onChange={() => toggleGroup(category)}
|
||||
label={categoryLabel(category, lang, bin)}
|
||||
/>
|
||||
<span className={`space-cat-icon tone-${meta.tone}`}>
|
||||
<Icon size={15} />
|
||||
</span>
|
||||
<span className="space-cat-name">
|
||||
{categoryLabel(category, lang, bin)}
|
||||
</span>
|
||||
<span className="space-cat-desc">
|
||||
{lang === "zh" ? meta.blurbZh : meta.blurbEn}
|
||||
</span>
|
||||
<span className="space-cat-n">
|
||||
{flat
|
||||
? t(
|
||||
`${formatCount(shown.length)} items`,
|
||||
`${formatCount(shown.length)} 项`,
|
||||
)
|
||||
: t(
|
||||
`${formatCount(clusters.length)} clean-up spots`,
|
||||
`${formatCount(clusters.length)} 个清理点`,
|
||||
leading={
|
||||
<span className="space-cat-lead">
|
||||
<Checkbox
|
||||
checked={groupSelected(category)}
|
||||
disabled={groupDisabled(category)}
|
||||
onChange={() => toggleGroup(category)}
|
||||
label={categoryLabel(category, lang, bin)}
|
||||
/>
|
||||
<span className={`space-cat-icon tone-${meta.tone}`}>
|
||||
<Icon size={15} />
|
||||
</span>
|
||||
</span>
|
||||
}
|
||||
title={categoryLabel(category, lang, bin)}
|
||||
subtitle={lang === "zh" ? meta.blurbZh : meta.blurbEn}
|
||||
trailing={
|
||||
<>
|
||||
<span className="space-cat-n">
|
||||
{flat
|
||||
? t(
|
||||
`${formatCount(shown.length)} items`,
|
||||
`${formatCount(shown.length)} 项`,
|
||||
)
|
||||
: t(
|
||||
`${formatCount(clusters.length)} clean-up spots`,
|
||||
`${formatCount(clusters.length)} 个清理点`,
|
||||
)}
|
||||
</span>
|
||||
<span className={`space-cat-size ${optional ? "is-opt" : ""}`}>
|
||||
{optional ? `${t("optional", "可选")} ` : ""}
|
||||
{formatBytes(
|
||||
shown.reduce((sum, entry) => sum + entry.item.onDisk, 0),
|
||||
)}
|
||||
</span>
|
||||
<span className={`space-cat-size ${optional ? "is-opt" : ""}`}>
|
||||
{optional ? `${t("optional", "可选")} ` : ""}
|
||||
{formatBytes(
|
||||
shown.reduce((sum, entry) => sum + entry.item.onDisk, 0),
|
||||
)}
|
||||
</span>
|
||||
<ChevronRight
|
||||
className="space-cat-chv"
|
||||
size={15}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
</span>
|
||||
<ChevronRight
|
||||
className="space-cat-chv"
|
||||
size={15}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</>
|
||||
}
|
||||
onClick={() => toggleExpanded(category)}
|
||||
/>
|
||||
{open ? (
|
||||
<div className="space-cat-items">
|
||||
{flat
|
||||
|
|
@ -1409,58 +1411,67 @@ export function SpacePage({
|
|||
busy={busy}
|
||||
icon={<Trash2 size={23} />}
|
||||
>
|
||||
<div className="mode-picker">
|
||||
<button
|
||||
className={mode === "trash" ? "is-active" : ""}
|
||||
onClick={() => setMode("trash")}
|
||||
>
|
||||
<FolderOpen size={17} />
|
||||
<span>{bin}</span>
|
||||
</button>
|
||||
<button
|
||||
className={mode === "permanent" ? "is-active" : ""}
|
||||
onClick={() => setMode("permanent")}
|
||||
>
|
||||
<Trash2 size={17} />
|
||||
<span>{t("Permanent", "永久")}</span>
|
||||
</button>
|
||||
</div>
|
||||
<Segmented
|
||||
value={mode}
|
||||
label={t("Deletion mode", "删除方式")}
|
||||
onChange={setMode}
|
||||
options={[
|
||||
{
|
||||
value: "trash",
|
||||
label: (
|
||||
<>
|
||||
<FolderOpen size={17} />
|
||||
{bin}
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
value: "permanent",
|
||||
label: (
|
||||
<>
|
||||
<Trash2 size={17} />
|
||||
{t("Permanent", "永久")}
|
||||
</>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{selectedUpdaters.count > 0 ? (
|
||||
<div className="confirm-updater-banner">
|
||||
<DownloadCloud size={18} />
|
||||
<div>
|
||||
<strong>
|
||||
{t(
|
||||
`Includes ${formatCount(selectedUpdaters.count)} update installers (${formatBytes(selectedUpdaters.total)})`,
|
||||
`其中包含 ${formatCount(selectedUpdaters.count)} 个升级安装包(${formatBytes(selectedUpdaters.total)})`,
|
||||
)}
|
||||
</strong>
|
||||
<span>
|
||||
{t(
|
||||
"Apps re-download them when needed. Delete them too?",
|
||||
"应用需要时会自动重新下载。要一并清理吗?",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="confirm-updater-actions">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
disabled={busy}
|
||||
onClick={() => void cleanSelected({ installerOnly: true })}
|
||||
>
|
||||
{t("Only installers", "只清升级包")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
disabled={busy}
|
||||
onClick={() => void cleanSelected({ skipInstallers: true })}
|
||||
>
|
||||
{t("Skip installers, clean rest", "跳过升级包,只删其余")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<Notice
|
||||
icon={<DownloadCloud size={18} />}
|
||||
actions={
|
||||
<>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
disabled={busy}
|
||||
onClick={() => void cleanSelected({ installerOnly: true })}
|
||||
>
|
||||
{t("Only installers", "只清升级包")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
disabled={busy}
|
||||
onClick={() => void cleanSelected({ skipInstallers: true })}
|
||||
>
|
||||
{t("Skip installers, clean rest", "跳过升级包,只删其余")}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<strong>
|
||||
{t(
|
||||
`Includes ${formatCount(selectedUpdaters.count)} update installers (${formatBytes(selectedUpdaters.total)})`,
|
||||
`其中包含 ${formatCount(selectedUpdaters.count)} 个升级安装包(${formatBytes(selectedUpdaters.total)})`,
|
||||
)}
|
||||
</strong>
|
||||
<br />
|
||||
{t(
|
||||
"Apps re-download them when needed. Delete them too?",
|
||||
"应用需要时会自动重新下载。要一并清理吗?",
|
||||
)}
|
||||
</Notice>
|
||||
) : null}
|
||||
{preflight && preflight.checked > 0 ? (
|
||||
<details className="confirm-preflight">
|
||||
|
|
|
|||
|
|
@ -26,13 +26,18 @@ import type { ProcessSample, SystemSnapshot, WidgetPrefs } from "../types";
|
|||
import type { SecurityWorkspace } from "../hooks/useSecurityWorkspace";
|
||||
import { ProcessTable } from "../components/ProcessTable";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
ConfirmDialog,
|
||||
Gauge,
|
||||
IconButton,
|
||||
InlineError,
|
||||
MetricBar,
|
||||
Notice,
|
||||
PageHeader,
|
||||
SectionTitle,
|
||||
Row,
|
||||
Section,
|
||||
Tabs,
|
||||
Toggle,
|
||||
UsageBar,
|
||||
useToast,
|
||||
|
|
@ -132,37 +137,28 @@ export function SystemPage({
|
|||
<PageHeader
|
||||
title={t("The pulse of your machine", "掌握设备的每一次呼吸")}
|
||||
actions={
|
||||
<button
|
||||
className={`refresh-pill ${loading ? "is-busy" : ""}`}
|
||||
<Button
|
||||
variant="secondary"
|
||||
icon={<RefreshCw size={14} className={loading ? "spin" : ""} />}
|
||||
onClick={() => void refresh()}
|
||||
disabled={loading}
|
||||
>
|
||||
<RefreshCw size={14} className={loading ? "spin" : ""} />
|
||||
{t("Refresh", "刷新")}
|
||||
</button>
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
||||
{error ? <InlineError message={error} /> : null}
|
||||
|
||||
<div className="chip-row page-tabs" role="tablist">
|
||||
{(
|
||||
[
|
||||
["performance", t("Performance", "性能")],
|
||||
["processes", t("Processes", "进程")],
|
||||
] as ["performance" | "processes", string][]
|
||||
).map(([key, label]) => (
|
||||
<button
|
||||
key={key}
|
||||
role="tab"
|
||||
aria-selected={tab === key}
|
||||
className={`filter-chip ${tab === key ? "is-active" : ""}`}
|
||||
onClick={() => setTab(key)}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<Tabs
|
||||
label={t("System sections", "系统分区")}
|
||||
value={tab}
|
||||
onChange={setTab}
|
||||
items={[
|
||||
{ id: "performance", label: t("Performance", "性能") },
|
||||
{ id: "processes", label: t("Processes", "进程") },
|
||||
]}
|
||||
/>
|
||||
|
||||
{tab === "processes" ? (
|
||||
<ProcessTable
|
||||
|
|
@ -174,45 +170,41 @@ export function SystemPage({
|
|||
) : null}
|
||||
|
||||
<div className="system-performance" hidden={tab !== "performance"}>
|
||||
<section className={`system-widget-bar ${widget?.enabled ? "is-on" : ""}`}>
|
||||
<span className="system-widget-icon">
|
||||
<MonitorSmartphone size={18} />
|
||||
</span>
|
||||
<div className="system-widget-copy">
|
||||
<strong>{t("Desktop live monitor", "桌面实时监控")}</strong>
|
||||
<span>
|
||||
{t(
|
||||
"Keep these live stats on your desktop. Open the settings from the top of the widget.",
|
||||
"把实时数据固定在桌面;设置可在小工具顶部下拉打开。",
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
{widget ? (
|
||||
<div className="system-widget-switch">
|
||||
<span>{widget.enabled ? t("On desktop", "已显示") : t("Hidden", "已隐藏")}</span>
|
||||
<Toggle
|
||||
checked={widget.enabled}
|
||||
disabled={widgetBusy}
|
||||
onChange={(next) => void toggleWidget(next)}
|
||||
label={t("Desktop live monitor", "桌面实时监控")}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<span className="system-widget-loading">{t("Reading…", "读取中…")}</span>
|
||||
<Notice
|
||||
icon={<MonitorSmartphone size={17} />}
|
||||
actions={
|
||||
widget ? (
|
||||
<div className="row-actions">
|
||||
<Badge tone={widget.enabled ? "success" : "neutral"}>
|
||||
{widget.enabled ? t("On desktop", "已显示") : t("Hidden", "已隐藏")}
|
||||
</Badge>
|
||||
<Toggle
|
||||
checked={widget.enabled}
|
||||
disabled={widgetBusy}
|
||||
onChange={(next) => void toggleWidget(next)}
|
||||
label={t("Desktop live monitor", "桌面实时监控")}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<span>{t("Reading…", "读取中…")}</span>
|
||||
)
|
||||
}
|
||||
>
|
||||
<strong>{t("Desktop live monitor", "桌面实时监控")}</strong>
|
||||
{" — "}
|
||||
{t(
|
||||
"Keep these live stats on your desktop. Open the settings from the top of the widget.",
|
||||
"把实时数据固定在桌面;设置可在小工具顶部下拉打开。",
|
||||
)}
|
||||
</section>
|
||||
</Notice>
|
||||
|
||||
<div className="system-gauges">
|
||||
<section className="system-gauge-card">
|
||||
<div className="system-gauge-head">
|
||||
<span className="metric-icon tone-primary">
|
||||
<Cpu size={18} />
|
||||
</span>
|
||||
<div>
|
||||
<strong>{t("Processor", "处理器")}</strong>
|
||||
<span>{snapshot?.cpu.brand || t("Reading processor…", "正在读取处理器…")}</span>
|
||||
</div>
|
||||
</div>
|
||||
<Section
|
||||
className="system-gauge-card"
|
||||
icon={<Cpu size={16} />}
|
||||
title={t("Processor", "处理器")}
|
||||
hint={snapshot?.cpu.brand || t("Reading processor…", "正在读取处理器…")}
|
||||
>
|
||||
<Gauge
|
||||
value={snapshot?.cpu.total ?? 0}
|
||||
size={168}
|
||||
|
|
@ -247,24 +239,20 @@ export function SystemPage({
|
|||
</span>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<section className="system-gauge-card">
|
||||
<div className="system-gauge-head">
|
||||
<span className="metric-icon tone-neutral">
|
||||
<Activity size={18} />
|
||||
</span>
|
||||
<div>
|
||||
<strong>{t("Memory", "内存")}</strong>
|
||||
<span>
|
||||
{snapshot
|
||||
? `${formatMemoryBytes(snapshot.memory.used)} / ${formatMemoryBytes(
|
||||
Math.max(snapshot.memory.installed, snapshot.memory.total),
|
||||
)}`
|
||||
: t("Reading memory…", "正在读取内存…")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<Section
|
||||
className="system-gauge-card"
|
||||
icon={<Activity size={16} />}
|
||||
title={t("Memory", "内存")}
|
||||
hint={
|
||||
snapshot
|
||||
? `${formatMemoryBytes(snapshot.memory.used)} / ${formatMemoryBytes(
|
||||
Math.max(snapshot.memory.installed, snapshot.memory.total),
|
||||
)}`
|
||||
: t("Reading memory…", "正在读取内存…")
|
||||
}
|
||||
>
|
||||
<Gauge
|
||||
value={memoryPercent}
|
||||
size={168}
|
||||
|
|
@ -304,20 +292,14 @@ export function SystemPage({
|
|||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<section className="system-gauge-card system-activity-card">
|
||||
<div className="system-gauge-head">
|
||||
<span className="metric-icon tone-primary">
|
||||
<Network size={18} />
|
||||
</span>
|
||||
<div>
|
||||
<strong>{t("Network", "网络")}</strong>
|
||||
<span>
|
||||
{snapshot?.network.primary || t("All interfaces", "全部接口")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<Section
|
||||
className="system-gauge-card system-activity-card"
|
||||
icon={<Network size={16} />}
|
||||
title={t("Network", "网络")}
|
||||
hint={snapshot?.network.primary || t("All interfaces", "全部接口")}
|
||||
>
|
||||
<div className="activity-pair">
|
||||
<div>
|
||||
<span className="activity-arrow is-down">↓</span>
|
||||
|
|
@ -352,135 +334,136 @@ export function SystemPage({
|
|||
)
|
||||
: t("Sampling…", "正在采样…")}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
</div>
|
||||
|
||||
{snapshot?.battery?.present ? (
|
||||
<section className="battery-panel">
|
||||
<div className="battery-icon">
|
||||
<BatteryCharging size={24} />
|
||||
</div>
|
||||
<div className="battery-main">
|
||||
<span className="field-label">{t("Battery", "电池")}</span>
|
||||
<strong>{snapshot.battery.percent}%</strong>
|
||||
<span>
|
||||
<Section
|
||||
className="battery-panel"
|
||||
icon={<BatteryCharging size={16} />}
|
||||
title={t("Battery", "电池")}
|
||||
actions={
|
||||
<Badge tone={snapshot.battery.charging ? "success" : "neutral"}>
|
||||
{snapshot.battery.charging
|
||||
? t("Charging", "正在充电")
|
||||
: snapshot.battery.on_ac
|
||||
? t("Connected to power", "已接通电源")
|
||||
: t("On battery", "使用电池")}
|
||||
</span>
|
||||
</Badge>
|
||||
}
|
||||
>
|
||||
<div className="battery-body">
|
||||
<div className="battery-main">
|
||||
<strong>{snapshot.battery.percent}%</strong>
|
||||
</div>
|
||||
<div className="battery-facts">
|
||||
{snapshot.battery.health_percent !== null ? (
|
||||
<div>
|
||||
<span>{t("Health", "健康度")}</span>
|
||||
<strong>{snapshot.battery.health_percent}%</strong>
|
||||
</div>
|
||||
) : null}
|
||||
{snapshot.battery.cycle_count !== null ? (
|
||||
<div>
|
||||
<span>{t("Cycles", "循环次数")}</span>
|
||||
<strong>{snapshot.battery.cycle_count}</strong>
|
||||
</div>
|
||||
) : null}
|
||||
{snapshot.battery.temperature_c !== null ? (
|
||||
<div>
|
||||
<span>{t("Temperature", "温度")}</span>
|
||||
<strong>{snapshot.battery.temperature_c.toFixed(1)}°C</strong>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="battery-track">
|
||||
<span style={{ width: `${snapshot.battery.percent}%` }} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="battery-facts">
|
||||
{snapshot.battery.health_percent !== null ? (
|
||||
<div>
|
||||
<span>{t("Health", "健康度")}</span>
|
||||
<strong>{snapshot.battery.health_percent}%</strong>
|
||||
</div>
|
||||
) : null}
|
||||
{snapshot.battery.cycle_count !== null ? (
|
||||
<div>
|
||||
<span>{t("Cycles", "循环次数")}</span>
|
||||
<strong>{snapshot.battery.cycle_count}</strong>
|
||||
</div>
|
||||
) : null}
|
||||
{snapshot.battery.temperature_c !== null ? (
|
||||
<div>
|
||||
<span>{t("Temperature", "温度")}</span>
|
||||
<strong>{snapshot.battery.temperature_c.toFixed(1)}°C</strong>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="battery-track">
|
||||
<span style={{ width: `${snapshot.battery.percent}%` }} />
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
) : null}
|
||||
|
||||
<div className="system-lower">
|
||||
<section className="process-panel">
|
||||
<SectionTitle
|
||||
title={t("Top processes", "高占用进程")}
|
||||
action={
|
||||
<Button variant="ghost" size="sm" onClick={() => setTab("processes")}>
|
||||
{t("View all processes", "查看全部进程")}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<div className="process-head">
|
||||
<span />
|
||||
<span>{t("Process", "进程")}</span>
|
||||
<span>CPU</span>
|
||||
<span>{t("Memory", "内存")}</span>
|
||||
<span />
|
||||
</div>
|
||||
<div className="process-list">
|
||||
<Section
|
||||
className="process-panel"
|
||||
title={t("Top processes", "高占用进程")}
|
||||
actions={
|
||||
<Button variant="ghost" size="sm" onClick={() => setTab("processes")}>
|
||||
{t("View all processes", "查看全部进程")}
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<div className="row-list">
|
||||
{(snapshot?.top_processes ?? []).map((process) => (
|
||||
<div className="process-row" key={process.pid}>
|
||||
<span className="process-dot" />
|
||||
<span className="process-name">
|
||||
<strong>{process.name}</strong>
|
||||
<small>PID {process.pid}</small>
|
||||
</span>
|
||||
<span className="process-cpu">{process.cpu.toFixed(1)}%</span>
|
||||
<span className="process-memory">{formatMemoryBytes(process.memory)}</span>
|
||||
<button
|
||||
className="process-stop"
|
||||
title={t("Stop process", "结束进程")}
|
||||
onClick={() => setVictim(process)}
|
||||
>
|
||||
<Power size={13} />
|
||||
</button>
|
||||
</div>
|
||||
<Row
|
||||
key={process.pid}
|
||||
leading={<span className="process-dot" />}
|
||||
title={process.name}
|
||||
subtitle={`PID ${process.pid}`}
|
||||
tags={
|
||||
<>
|
||||
<Badge>CPU {process.cpu.toFixed(1)}%</Badge>
|
||||
<Badge>{formatMemoryBytes(process.memory)}</Badge>
|
||||
</>
|
||||
}
|
||||
trailing={
|
||||
<IconButton
|
||||
label={t("Stop process", "结束进程")}
|
||||
onClick={() => setVictim(process)}
|
||||
>
|
||||
<Power size={13} />
|
||||
</IconButton>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<section className="health-side">
|
||||
<SectionTitle
|
||||
title={t("Volumes", "磁盘卷")}
|
||||
subtitle={t("Mounted storage and free space.", "已挂载存储与可用空间。")}
|
||||
/>
|
||||
<div className="volume-list">
|
||||
<Section
|
||||
className="health-side"
|
||||
title={t("Volumes", "磁盘卷")}
|
||||
hint={t("Mounted storage and free space.", "已挂载存储与可用空间。")}
|
||||
>
|
||||
<div className="row-list">
|
||||
{(snapshot?.volumes ?? []).map((volume) => {
|
||||
const use = percent(volume.total - volume.free, volume.total);
|
||||
return (
|
||||
<div className="volume-row" key={volume.mount_point}>
|
||||
<span className="metric-icon tone-primary">
|
||||
<HardDrive size={17} />
|
||||
</span>
|
||||
<div>
|
||||
<strong>{volume.name || volume.mount_point}</strong>
|
||||
<span>
|
||||
{formatBytes(volume.free)} {t("free of", "可用,共")}{" "}
|
||||
{formatBytes(volume.total)}
|
||||
<Row
|
||||
key={volume.mount_point}
|
||||
leading={
|
||||
<span className="metric-icon tone-primary">
|
||||
<HardDrive size={16} />
|
||||
</span>
|
||||
<UsageBar
|
||||
used={volume.total - volume.free}
|
||||
total={volume.total}
|
||||
tone={use > 88 ? "danger" : "primary"}
|
||||
/>
|
||||
</div>
|
||||
<b>{Math.round(use)}%</b>
|
||||
</div>
|
||||
}
|
||||
title={volume.name || volume.mount_point}
|
||||
subtitle={`${formatBytes(volume.free)} ${t("free of", "可用,共")} ${formatBytes(
|
||||
volume.total,
|
||||
)}`}
|
||||
trailing={<b>{Math.round(use)}%</b>}
|
||||
>
|
||||
<UsageBar
|
||||
used={volume.total - volume.free}
|
||||
total={volume.total}
|
||||
tone={use > 88 ? "danger" : "primary"}
|
||||
/>
|
||||
</Row>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className="host-card">
|
||||
<ShieldAlert size={17} />
|
||||
<div>
|
||||
<strong>{snapshot?.host.hostname || t("This computer", "这台电脑")}</strong>
|
||||
<span>
|
||||
{[
|
||||
snapshot?.host.os_version || snapshot?.host.os_name,
|
||||
snapshot?.host.arch,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · ")}
|
||||
</span>
|
||||
</div>
|
||||
<div className="row-list">
|
||||
<Row
|
||||
leading={
|
||||
<span className="metric-icon tone-neutral">
|
||||
<ShieldAlert size={16} />
|
||||
</span>
|
||||
}
|
||||
title={snapshot?.host.hostname || t("This computer", "这台电脑")}
|
||||
subtitle={[snapshot?.host.os_version || snapshot?.host.os_name, snapshot?.host.arch]
|
||||
.filter(Boolean)
|
||||
.join(" · ")}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
</div>
|
||||
|
||||
<div className="system-process-count">
|
||||
|
|
|
|||
|
|
@ -6,7 +6,15 @@ import { useI18n } from "../i18n";
|
|||
import { api } from "../lib/api";
|
||||
import { messageFrom } from "../lib/format";
|
||||
import type { SystemSnapshot, WidgetCorner, WidgetPrefs } from "../types";
|
||||
import { InlineError, PageHeader, SectionTitle, Toggle } from "../components/ui";
|
||||
import {
|
||||
InlineError,
|
||||
Notice,
|
||||
PageHeader,
|
||||
Row,
|
||||
Section,
|
||||
Select,
|
||||
Toggle,
|
||||
} from "../components/ui";
|
||||
import { WidgetPanels, useHistory } from "../components/WidgetPanels";
|
||||
|
||||
const CORNERS: { id: WidgetCorner; en: string; zh: string }[] = [
|
||||
|
|
@ -140,64 +148,56 @@ export function WidgetPage() {
|
|||
|
||||
{error ? <InlineError message={error} onDismiss={() => setError(null)} /> : null}
|
||||
|
||||
<div className="widget-note">
|
||||
<Notice>
|
||||
{t(
|
||||
"The widget is a borderless desktop-layer window (below your app windows) that never steals focus; it hides itself when every panel or the master switch is off.",
|
||||
"小工具以无边框的桌面层窗口显示:贴在壁纸上、位于其他软件窗口之下,不抢焦点;关闭全部面板或总开关后窗口自动隐藏。",
|
||||
)}
|
||||
</div>
|
||||
</Notice>
|
||||
|
||||
<div className="widget-grid">
|
||||
<section className="settings-section">
|
||||
<SectionTitle
|
||||
title={t("Panels", "面板")}
|
||||
subtitle={t(
|
||||
"Pick the cards that show on the desktop; the order matches the widget.",
|
||||
"选择要出现在桌面小工具里的卡片,顺序与桌面上的排列一致。",
|
||||
)}
|
||||
/>
|
||||
<div className="perm-rows">
|
||||
<Section
|
||||
title={t("Panels", "面板")}
|
||||
hint={t(
|
||||
"Pick the cards that show on the desktop; the order matches the widget.",
|
||||
"选择要出现在桌面小工具里的卡片,顺序与桌面上的排列一致。",
|
||||
)}
|
||||
>
|
||||
<div className="row-list">
|
||||
{panels.map((panel) => (
|
||||
<div className="settings-row" key={panel.key}>
|
||||
<div className="perm-row">
|
||||
<span className="widget-row-ico">{panel.icon}</span>
|
||||
<div>
|
||||
<span>{panel.name}</span>
|
||||
<small>{panel.desc}</small>
|
||||
</div>
|
||||
</div>
|
||||
<Toggle
|
||||
checked={prefs[panel.key]}
|
||||
disabled={!prefs.enabled}
|
||||
onChange={(next) => patch({ [panel.key]: next })}
|
||||
label={panel.name}
|
||||
/>
|
||||
</div>
|
||||
<Row
|
||||
key={panel.key}
|
||||
leading={<span className="widget-row-ico">{panel.icon}</span>}
|
||||
title={panel.name}
|
||||
subtitle={panel.desc}
|
||||
trailing={
|
||||
<Toggle
|
||||
checked={prefs[panel.key]}
|
||||
disabled={!prefs.enabled}
|
||||
onChange={(next) => patch({ [panel.key]: next })}
|
||||
label={panel.name}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<section className="settings-section">
|
||||
<SectionTitle
|
||||
title={t("Appearance & behaviour", "外观与行为")}
|
||||
subtitle={t(
|
||||
"The widget window stays borderless, desktop-layer and focus-free.",
|
||||
"小工具窗口始终无边框、贴在桌面层、不抢焦点。",
|
||||
)}
|
||||
/>
|
||||
<div className="perm-rows">
|
||||
<div className="settings-row">
|
||||
<div className="perm-row">
|
||||
<div>
|
||||
<span>{t("Opacity", "不透明度")}</span>
|
||||
<small>
|
||||
{t(
|
||||
"100% is fully solid; at most 10% of the desktop shows through.",
|
||||
"100% 为完全不透明,最多透出 10% 桌面背景",
|
||||
)}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<Section
|
||||
title={t("Appearance & behaviour", "外观与行为")}
|
||||
hint={t(
|
||||
"The widget window stays borderless, desktop-layer and focus-free.",
|
||||
"小工具窗口始终无边框、贴在桌面层、不抢焦点。",
|
||||
)}
|
||||
>
|
||||
<div className="row-list">
|
||||
<Row
|
||||
title={t("Opacity", "不透明度")}
|
||||
subtitle={t(
|
||||
"100% is fully solid; at most 10% of the desktop shows through.",
|
||||
"100% 为完全不透明,最多透出 10% 桌面背景",
|
||||
)}
|
||||
trailing={
|
||||
<input
|
||||
className="widget-range"
|
||||
type="range"
|
||||
|
|
@ -207,90 +207,73 @@ export function WidgetPage() {
|
|||
disabled={!prefs.enabled}
|
||||
onChange={(event) => patch({ opacity: Number(event.target.value) })}
|
||||
/>
|
||||
</div>
|
||||
<div className="settings-row">
|
||||
<div className="perm-row">
|
||||
<div>
|
||||
<span>{t("Refresh rate", "更新频率")}</span>
|
||||
<small>
|
||||
{t(
|
||||
"Sampling interval; higher rates cost a little more power.",
|
||||
"采样间隔,频率越高越耗电",
|
||||
)}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<select
|
||||
className="settings-select"
|
||||
}
|
||||
/>
|
||||
<Row
|
||||
title={t("Refresh rate", "更新频率")}
|
||||
subtitle={t(
|
||||
"Sampling interval; higher rates cost a little more power.",
|
||||
"采样间隔,频率越高越耗电",
|
||||
)}
|
||||
trailing={
|
||||
<Select
|
||||
value={prefs.intervalMs}
|
||||
label={t("Refresh rate", "更新频率")}
|
||||
options={INTERVALS.map((ms) => ({
|
||||
value: ms,
|
||||
label: t(`${ms / 1000} seconds`, `${ms / 1000} 秒`),
|
||||
}))}
|
||||
disabled={!prefs.enabled}
|
||||
onChange={(event) => patch({ intervalMs: Number(event.target.value) })}
|
||||
>
|
||||
{INTERVALS.map((ms) => (
|
||||
<option key={ms} value={ms}>
|
||||
{t(`${ms / 1000} seconds`, `${ms / 1000} 秒`)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="settings-row">
|
||||
<div className="perm-row">
|
||||
<div>
|
||||
<span>{t("Dock corner", "显示位置")}</span>
|
||||
<small>
|
||||
{t(
|
||||
"Where it lands when opened; drag it anywhere afterwards.",
|
||||
"初次打开停靠的屏幕角,之后可用鼠标拖到任意位置",
|
||||
)}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<select
|
||||
className="settings-select"
|
||||
onChange={(next) => patch({ intervalMs: next })}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Row
|
||||
title={t("Dock corner", "显示位置")}
|
||||
subtitle={t(
|
||||
"Where it lands when opened; drag it anywhere afterwards.",
|
||||
"初次打开停靠的屏幕角,之后可用鼠标拖到任意位置",
|
||||
)}
|
||||
trailing={
|
||||
<Select
|
||||
value={prefs.corner}
|
||||
label={t("Dock corner", "显示位置")}
|
||||
options={CORNERS.map((corner) => ({
|
||||
value: corner.id,
|
||||
label: zh ? corner.zh : corner.en,
|
||||
}))}
|
||||
disabled={!prefs.enabled}
|
||||
onChange={(event) =>
|
||||
patch({ corner: event.target.value as WidgetCorner })
|
||||
}
|
||||
>
|
||||
{CORNERS.map((corner) => (
|
||||
<option key={corner.id} value={corner.id}>
|
||||
{zh ? corner.zh : corner.en}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="settings-row">
|
||||
<div className="perm-row">
|
||||
<div>
|
||||
<span>{t("Remember folded state", "折叠记忆")}</span>
|
||||
<small>
|
||||
{t(
|
||||
"Keep the collapsed/expanded choice across restarts.",
|
||||
"记住上次是否折叠,重启后保持",
|
||||
)}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
onChange={(next) => patch({ corner: next })}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Row
|
||||
title={t("Remember folded state", "折叠记忆")}
|
||||
subtitle={t(
|
||||
"Keep the collapsed/expanded choice across restarts.",
|
||||
"记住上次是否折叠,重启后保持",
|
||||
)}
|
||||
trailing={
|
||||
<Toggle
|
||||
checked={prefs.rememberCollapsed}
|
||||
disabled={!prefs.enabled}
|
||||
onChange={(next) => patch({ rememberCollapsed: next })}
|
||||
label={t("Remember folded state", "折叠记忆")}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
</div>
|
||||
|
||||
<section className="settings-section widget-preview-section">
|
||||
<SectionTitle
|
||||
title={t("Preview", "预览")}
|
||||
subtitle={t(
|
||||
"Live look of the desktop widget (top of the screen).",
|
||||
"桌面小工具的实时效果(屏幕上方)。",
|
||||
)}
|
||||
/>
|
||||
<Section
|
||||
className="widget-preview-section"
|
||||
title={t("Preview", "预览")}
|
||||
hint={t(
|
||||
"Live look of the desktop widget (top of the screen).",
|
||||
"桌面小工具的实时效果(屏幕上方)。",
|
||||
)}
|
||||
>
|
||||
<div className="widget-preview-stage">
|
||||
<div className="widget widget-preview" style={{ opacity: prefs.opacity / 100 }}>
|
||||
<div className="wd-card wd-head">
|
||||
|
|
@ -310,7 +293,7 @@ export function WidgetPage() {
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
974
src/styles.css
974
src/styles.css
|
|
@ -10254,3 +10254,977 @@ html.widget-mode body {
|
|||
line-height: 1.5;
|
||||
text-align: center;
|
||||
}
|
||||
/* ══════════════════════════════════════════════════════════════════════
|
||||
Component library
|
||||
──────────────────────────────────────────────────────────────────────
|
||||
One definition per standard surface. Pages compose these classes (or the
|
||||
matching React primitives in components/ui.tsx); a page may lay them out,
|
||||
but must not restyle them. Anything module-specific belongs in a layout
|
||||
class, not in a second copy of a tab, row, chip or card.
|
||||
══════════════════════════════════════════════════════════════════════ */
|
||||
|
||||
/* Tabs — page sections and in-page sections share one shape. */
|
||||
.tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
height: 31px;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--nex-line);
|
||||
border-radius: 999px;
|
||||
background: var(--nex-paper);
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-2xs);
|
||||
font-weight: var(--nex-weight-medium);
|
||||
white-space: nowrap;
|
||||
transition:
|
||||
border-color 0.14s ease,
|
||||
background 0.14s ease,
|
||||
color 0.14s ease;
|
||||
}
|
||||
|
||||
.tab svg {
|
||||
flex: 0 0 auto;
|
||||
color: var(--nex-muted-soft);
|
||||
}
|
||||
|
||||
.tab:hover:not(:disabled) {
|
||||
border-color: var(--nex-line-strong);
|
||||
color: var(--nex-ink);
|
||||
}
|
||||
|
||||
.tab.is-active {
|
||||
border-color: rgba(var(--nex-primary-rgb), 0.32);
|
||||
background: var(--nex-primary-tint);
|
||||
color: var(--nex-primary-strong);
|
||||
font-weight: var(--nex-weight-semibold);
|
||||
}
|
||||
|
||||
.tab.is-active svg {
|
||||
color: var(--nex-primary);
|
||||
}
|
||||
|
||||
.tab:disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.tab-badge {
|
||||
margin-left: 1px;
|
||||
padding: 0 7px;
|
||||
border-radius: 999px;
|
||||
background: var(--nex-cream);
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
font-weight: var(--nex-weight-semibold);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.tab.is-active .tab-badge {
|
||||
background: rgba(var(--nex-primary-rgb), 0.12);
|
||||
color: var(--nex-primary-strong);
|
||||
}
|
||||
|
||||
/* Chips — a filter toggle inside a panel, visually a lighter sibling of a tab. */
|
||||
.chip-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
height: 27px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid var(--nex-line);
|
||||
border-radius: 999px;
|
||||
background: transparent;
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
font-weight: var(--nex-weight-medium);
|
||||
transition:
|
||||
border-color 0.14s ease,
|
||||
background 0.14s ease,
|
||||
color 0.14s ease;
|
||||
}
|
||||
|
||||
.chip:hover {
|
||||
border-color: var(--nex-line-strong);
|
||||
color: var(--nex-ink);
|
||||
}
|
||||
|
||||
.chip.is-active {
|
||||
border-color: rgba(var(--nex-primary-rgb), 0.3);
|
||||
background: var(--nex-primary-tint);
|
||||
color: var(--nex-primary-strong);
|
||||
}
|
||||
|
||||
.chip-count {
|
||||
color: var(--nex-muted-soft);
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-weight: var(--nex-weight-semibold);
|
||||
}
|
||||
|
||||
.chip.is-active .chip-count {
|
||||
color: var(--nex-primary);
|
||||
}
|
||||
|
||||
.chip.is-danger .chip-count {
|
||||
color: #b0563d;
|
||||
}
|
||||
|
||||
/* Segmented control — mutually exclusive options inside a toolbar. */
|
||||
.segmented {
|
||||
display: inline-flex;
|
||||
padding: 3px;
|
||||
border: 1px solid var(--nex-line);
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.55);
|
||||
}
|
||||
|
||||
.segmented-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
padding: 4px 11px;
|
||||
border-radius: 7px;
|
||||
background: transparent;
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
font-weight: var(--nex-weight-medium);
|
||||
white-space: nowrap;
|
||||
transition:
|
||||
background 0.14s ease,
|
||||
color 0.14s ease,
|
||||
box-shadow 0.14s ease;
|
||||
}
|
||||
|
||||
.segmented-item:hover {
|
||||
color: var(--nex-ink);
|
||||
}
|
||||
|
||||
.segmented-item.is-active {
|
||||
background: var(--nex-paper);
|
||||
color: var(--nex-ink);
|
||||
font-weight: var(--nex-weight-semibold);
|
||||
box-shadow: 0 1px 4px rgba(60, 50, 35, 0.12);
|
||||
}
|
||||
|
||||
/* Section card — the only card shell for grouped content. */
|
||||
.section {
|
||||
margin-bottom: 13px;
|
||||
padding: 18px;
|
||||
border: 1px solid var(--nex-line);
|
||||
border-radius: var(--radius-lg);
|
||||
background: rgba(255, 251, 246, 0.84);
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.section-head-main {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.section-icon {
|
||||
display: inline-grid;
|
||||
flex: 0 0 auto;
|
||||
place-items: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 9px;
|
||||
color: var(--nex-primary-strong);
|
||||
background: var(--nex-primary-tint);
|
||||
}
|
||||
|
||||
.section-copy {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.section-copy h2 {
|
||||
margin: 0;
|
||||
color: var(--nex-ink);
|
||||
font-size: var(--nex-text-xs);
|
||||
font-weight: var(--nex-weight-bold);
|
||||
letter-spacing: -0.018em;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.section-copy p {
|
||||
margin: 3px 0 0;
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
line-height: var(--nex-leading-body);
|
||||
}
|
||||
|
||||
.section-actions {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* Rows — one list row for settings, permissions, history, files and apps. */
|
||||
.row-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 11px 0;
|
||||
border-top: 1px solid var(--nex-line);
|
||||
background: transparent;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.row:first-child,
|
||||
.row.is-first {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.row.is-clickable {
|
||||
border-radius: 10px;
|
||||
transition: background 0.14s ease;
|
||||
}
|
||||
|
||||
.row.is-clickable:hover {
|
||||
background: rgba(var(--nex-primary-rgb), 0.045);
|
||||
}
|
||||
|
||||
.row.is-selected {
|
||||
background: var(--nex-primary-tint);
|
||||
}
|
||||
|
||||
.row.is-muted {
|
||||
opacity: 0.72;
|
||||
}
|
||||
|
||||
.row.is-busy {
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.row-leading {
|
||||
display: inline-grid;
|
||||
flex: 0 0 auto;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.row-copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.row-title {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
color: var(--nex-ink);
|
||||
font-size: var(--nex-text-2xs);
|
||||
font-weight: var(--nex-weight-medium);
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.row-title-text {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.row-sub {
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.row-detail {
|
||||
color: var(--nex-muted-soft);
|
||||
font-family: var(--nex-font-mono);
|
||||
font-size: var(--nex-text-3xs);
|
||||
line-height: 1.4;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.row-trailing {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* Badges — every status pill is one of these five tones. */
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 2px 8px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 999px;
|
||||
background: var(--nex-cream);
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
font-weight: var(--nex-weight-semibold);
|
||||
line-height: 1.5;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.badge.is-success {
|
||||
border-color: rgba(23, 134, 95, 0.18);
|
||||
background: var(--nex-success-soft);
|
||||
color: var(--nex-success-strong);
|
||||
}
|
||||
|
||||
.badge.is-warning {
|
||||
border-color: rgba(169, 119, 41, 0.2);
|
||||
background: var(--nex-warning-soft);
|
||||
color: var(--nex-warning-strong);
|
||||
}
|
||||
|
||||
.badge.is-danger {
|
||||
border-color: rgba(200, 90, 98, 0.2);
|
||||
background: var(--nex-danger-soft);
|
||||
color: var(--nex-danger-strong);
|
||||
}
|
||||
|
||||
.badge.is-info {
|
||||
border-color: rgba(77, 148, 207, 0.18);
|
||||
background: var(--nex-info-soft);
|
||||
color: var(--nex-info-strong);
|
||||
}
|
||||
|
||||
.badge.is-primary {
|
||||
border-color: rgba(var(--nex-primary-rgb), 0.2);
|
||||
background: var(--nex-primary-soft);
|
||||
color: var(--nex-primary-strong);
|
||||
}
|
||||
|
||||
/* Toolbar — filters on the left, search or actions on the right. */
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.toolbar-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* Search field — the one input shape used beside toolbars. */
|
||||
.search-field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
width: 180px;
|
||||
height: 31px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid var(--nex-line);
|
||||
border-radius: 9px;
|
||||
color: var(--nex-muted-soft);
|
||||
background: var(--nex-paper);
|
||||
transition: border-color 0.14s ease;
|
||||
}
|
||||
|
||||
.search-field:focus-within {
|
||||
border-color: rgba(var(--nex-primary-rgb), 0.32);
|
||||
}
|
||||
|
||||
.search-field input {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
color: var(--nex-ink);
|
||||
background: transparent;
|
||||
font-size: var(--nex-text-2xs);
|
||||
}
|
||||
|
||||
/* Notice — inline explanation or warning, never a free-floating paragraph. */
|
||||
.notice {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 9px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--nex-line);
|
||||
border-radius: 11px;
|
||||
background: var(--nex-cream);
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
line-height: var(--nex-leading-body);
|
||||
}
|
||||
|
||||
.notice.is-warning {
|
||||
border-color: rgba(169, 119, 41, 0.28);
|
||||
background: var(--nex-warning-soft);
|
||||
color: var(--nex-warning-strong);
|
||||
}
|
||||
|
||||
.notice.is-danger {
|
||||
border-color: rgba(200, 90, 98, 0.26);
|
||||
background: var(--nex-danger-soft);
|
||||
color: var(--nex-danger-strong);
|
||||
}
|
||||
|
||||
.notice-icon {
|
||||
display: inline-grid;
|
||||
flex: 0 0 auto;
|
||||
place-items: center;
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
||||
.notice-copy {
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.notice-actions {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
/* Stat — one number per tile, used by overview and system. */
|
||||
.stat {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 14px;
|
||||
border: 1px solid var(--nex-line);
|
||||
border-radius: var(--radius-md);
|
||||
background: rgba(255, 251, 246, 0.84);
|
||||
}
|
||||
|
||||
.stat-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
font-weight: var(--nex-weight-medium);
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
display: inline-grid;
|
||||
place-items: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 7px;
|
||||
color: var(--nex-primary-strong);
|
||||
background: var(--nex-primary-tint);
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
color: var(--nex-ink-strong);
|
||||
font-size: var(--nex-text-xl);
|
||||
font-weight: var(--nex-weight-heavy);
|
||||
letter-spacing: -0.03em;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.stat-hint {
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.section-head {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.row {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.search-field {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* Choice card — a radio option that carries a title and a sentence. */
|
||||
.choice-group {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 9px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.choice-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--nex-line);
|
||||
border-radius: 11px;
|
||||
background: var(--nex-paper);
|
||||
text-align: left;
|
||||
transition:
|
||||
border-color 0.14s ease,
|
||||
background 0.14s ease;
|
||||
}
|
||||
|
||||
.choice-card:hover:not(:disabled) {
|
||||
border-color: var(--nex-line-strong);
|
||||
}
|
||||
|
||||
.choice-card.is-active {
|
||||
border-color: rgba(var(--nex-primary-rgb), 0.28);
|
||||
background: var(--nex-primary-tint);
|
||||
}
|
||||
|
||||
.choice-card:disabled {
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.choice-icon {
|
||||
display: grid;
|
||||
flex: 0 0 auto;
|
||||
place-items: center;
|
||||
width: 37px;
|
||||
height: 37px;
|
||||
border-radius: 10px;
|
||||
color: var(--nex-primary-strong);
|
||||
background: var(--nex-primary-soft);
|
||||
}
|
||||
|
||||
.choice-copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.choice-copy strong {
|
||||
color: var(--nex-ink);
|
||||
font-size: var(--nex-text-3xs);
|
||||
font-weight: var(--nex-weight-medium);
|
||||
}
|
||||
|
||||
.choice-copy small {
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
line-height: var(--nex-leading-body);
|
||||
}
|
||||
|
||||
.choice-dot {
|
||||
flex: 0 0 auto;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border: 1.5px solid var(--nex-line-strong);
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.choice-card.is-active .choice-dot {
|
||||
border: 4px solid var(--nex-primary);
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.choice-group {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.row:focus-visible {
|
||||
outline: 2px solid rgba(var(--nex-primary-rgb), 0.45);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.row-empty {
|
||||
padding: 18px 4px;
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.toggle-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-2xs);
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Subhead — a heading inside a section, one step below .section-copy h2. */
|
||||
.subhead {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin: 18px 0 4px;
|
||||
}
|
||||
|
||||
.subhead:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.subhead-copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.subhead-copy h3 {
|
||||
margin: 0;
|
||||
color: var(--nex-ink);
|
||||
font-size: var(--nex-text-2xs);
|
||||
font-weight: var(--nex-weight-bold);
|
||||
}
|
||||
|
||||
.subhead-copy span {
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
}
|
||||
|
||||
.subhead-action {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* Finding rows tint the title by confidence; the shell stays the shared .row. */
|
||||
.finding-row.is-danger .row-title-text {
|
||||
color: var(--nex-danger-strong);
|
||||
}
|
||||
|
||||
.finding-row.is-warning .row-title-text,
|
||||
.finding-row.is-risky .row-title-text {
|
||||
color: var(--nex-warning-strong);
|
||||
}
|
||||
|
||||
.stat-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
margin-bottom: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.stat-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.toolbar-copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
}
|
||||
|
||||
.toolbar-copy b {
|
||||
color: var(--nex-ink);
|
||||
font-size: var(--nex-text-2xs);
|
||||
font-weight: var(--nex-weight-semibold);
|
||||
}
|
||||
|
||||
.toolbar-copy small {
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
line-height: var(--nex-leading-body);
|
||||
}
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════
|
||||
Page layouts
|
||||
──────────────────────────────────────────────────────────────────────
|
||||
Only placement and page-specific composition lives here. Every surface
|
||||
itself comes from the component library above.
|
||||
══════════════════════════════════════════════════════════════════════ */
|
||||
|
||||
.row-copy > .usage-bar,
|
||||
.row-copy > .progress-track {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.row-copy > .notice {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.row .row-actions {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.stat .usage-bar {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.stat-note {
|
||||
display: block;
|
||||
margin-top: 6px;
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
line-height: var(--nex-leading-body);
|
||||
}
|
||||
|
||||
.notice-list {
|
||||
margin: 6px 0 0;
|
||||
padding-left: 16px;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.notice-list li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
/* Overview */
|
||||
|
||||
.overview-page .overview-metrics {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 0.85fr);
|
||||
gap: 16px;
|
||||
align-items: stretch;
|
||||
margin-top: 26px;
|
||||
}
|
||||
|
||||
.overview-panel {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.overview-stat-row {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.overview-stat-row .stat {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.overview-stat-row .stat + .stat {
|
||||
padding-left: 16px;
|
||||
border-left: 1px solid var(--nex-line);
|
||||
}
|
||||
|
||||
.overview-stat-row .stat-value {
|
||||
font-size: var(--nex-text-xl);
|
||||
}
|
||||
|
||||
.overview-stat-row .stat-hint {
|
||||
min-height: 30px;
|
||||
}
|
||||
|
||||
.overview-storage .row-copy > .usage-bar,
|
||||
.health-side .row-copy > .usage-bar {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.overview-shortcuts .row-leading .quick-icon {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.overview-specs .spec-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 2px 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.overview-specs .spec-row .row-copy {
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.overview-specs .spec-row .row-title {
|
||||
flex: 0 0 58px;
|
||||
color: var(--nex-muted);
|
||||
font-size: var(--nex-text-3xs);
|
||||
font-weight: var(--nex-weight-body);
|
||||
}
|
||||
|
||||
.overview-specs .spec-row .row-title-text {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.overview-specs .spec-row .row-detail {
|
||||
flex: 1 1 auto;
|
||||
color: var(--nex-ink-strong);
|
||||
font-family: inherit;
|
||||
font-size: var(--nex-text-2xs);
|
||||
font-weight: var(--nex-weight-bold);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.overview-specs .spec-row .row-leading {
|
||||
width: 22px;
|
||||
}
|
||||
|
||||
/* System */
|
||||
|
||||
.system-gauge-card.section {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
min-height: 297px;
|
||||
}
|
||||
|
||||
.system-gauge-card.section .section-head {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.system-gauge-card.section .gauge {
|
||||
align-self: center;
|
||||
margin: 5px 0 3px;
|
||||
}
|
||||
|
||||
.system-gauge-card.section .gauge-facts,
|
||||
.system-gauge-card.section .core-bars,
|
||||
.system-gauge-card.section .memory-split,
|
||||
.system-gauge-card.section .activity-pair,
|
||||
.system-gauge-card.section .activity-uptime {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.battery-panel.section {
|
||||
display: block;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.battery-body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.battery-body .battery-facts {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.battery-body .battery-track {
|
||||
flex: 1 1 120px;
|
||||
}
|
||||
|
||||
.process-panel.section,
|
||||
.health-side.section {
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.system-lower {
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
/* Settings and permissions */
|
||||
|
||||
.settings-grid > .section {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.perm-group-card {
|
||||
margin-bottom: 9px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--nex-line);
|
||||
background: var(--nex-paper);
|
||||
}
|
||||
|
||||
.perm-group-head {
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.perm-group-head .row-title {
|
||||
font-weight: var(--nex-weight-semibold);
|
||||
}
|
||||
|
||||
.perm-rows {
|
||||
padding: 0 12px 5px;
|
||||
}
|
||||
|
||||
.perm-rows .row:first-child {
|
||||
border-top: 1px solid var(--nex-line);
|
||||
}
|
||||
|
||||
.perm-group-count {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
/* History */
|
||||
|
||||
.history-card.section {
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.history-card.section > .history-head {
|
||||
padding: 14px 18px;
|
||||
}
|
||||
|
||||
.history-card.section > .history-detail {
|
||||
padding: 0 18px 14px;
|
||||
}
|
||||
|
||||
.history-detail > .row-list {
|
||||
max-height: 255px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* Setup dialog */
|
||||
|
||||
.setup-card > .row:first-of-type {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.setup-card > .row {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue