概览页改版:指标行 30/42/28 三列、右上角智能扫描按钮移除、开始扫描跳转空间清理执行

- 处理器与内存合并进同一卡片上下分布(虚线分隔、各占一半垂直空间);
  存储空间卡加宽到 42%,每个盘符收成一行的表格感排版(盘符 | 进度条拉满 |
  百分比+总/可用),不再盘符与进度条上下两行;日常维护三个入口取消独立
  区块,改为竖排三卡放进指标行右列(28%),与左两卡等高均分;窄屏回退为
  横向三卡占满一行
- 页头右上角「智能扫描」大按钮移除(与 hero 的开始智能扫描重复)
- 「开始智能扫描」/「空间清理」快捷卡不再在本页起扫描:先跳转空间清理页,
  两阶段扫描(缓存垃圾 → 构建残留)在目标页继续跑(工作区是应用级共享的);
  扫描中重复点击不再触发第三轮;扫描中/已扫完按钮语义不变
- 区块间距 14 → 26px,卡片描边对齐暖色主题,整页更透气
- demo 断言 12 项全过(列宽比例实测 30.0/42.0/28.0、单行盘符几何、右列竖排、
  头部按钮移除、点击触发两阶段且重复点击无效)
dev
lijunjie 2026-11-25 10:28:20 +08:00
parent 26ec54a4e8
commit 5cb6b79d04
2 changed files with 167 additions and 128 deletions

View File

@ -104,11 +104,13 @@ export function OverviewPage({
: 0),
0,
);
// 智能扫描 lives on the 空间清理 page now; the workspaces are app-level so
// kicking both stages from here simply continues on that page. It uses the
// default deep-scan settings — tweak them there and re-scan if needed.
// 智能扫描 is an entry point, not a resident process: the moment it is
// pressed we hand the page over to 空间清理 and launch both scan stages
// there (SpacePage owns the settings — age threshold, auto-discovery).
// A finished scan keeps the button as a shortcut back to the results.
const smartScan = () => {
if (!scanned) {
onNavigate("space");
if (!scanned && !scanning) {
void cleanup.runScan().then(() =>
purge.runScan({
// Empty = engine auto-discovery of project containers.
@ -118,7 +120,6 @@ export function OverviewPage({
}),
);
}
onNavigate("space");
};
const hardware = bootstrap.hardwareInfo;
@ -174,19 +175,6 @@ export function OverviewPage({
"One safe scan for clutter, storage and everyday performance.",
"一次安全扫描,整理垃圾、空间与日常性能。",
)}
actions={
<Button
variant="primary"
size="lg"
icon={<Sparkles size={17} />}
onClick={smartScan}
disabled={scanning}
>
{scanned
? t("Review scan", "查看扫描结果")
: t("Smart scan", "智能扫描")}
</Button>
}
/>
<section className="overview-hero">
@ -315,65 +303,70 @@ export function OverviewPage({
</section>
) : null}
{/* 指标行 30% / 42% / 28%:处理器+内存共用一框上下分布;存储每盘
一行;日常维护三入口竖排放右列,与左两卡等高。独立的「日常维护」
区块随此改版取消。 */}
<section className="overview-metrics">
<div className="metric-panel">
<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…", "正在采样…")}
<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>
<b>{Math.round(snapshot?.cpu.total ?? 0)}%</b>
<UsageBar used={snapshot?.cpu.total ?? 0} total={100} tone="blue" />
<small>
{snapshot?.cpu.brand || t("Processor details unavailable", "暂无处理器信息")}
</small>
</div>
<UsageBar used={snapshot?.cpu.total ?? 0} total={100} tone="blue" />
<small>
{snapshot?.cpu.brand || t("Processor details unavailable", "暂无处理器信息")}
</small>
</div>
<div className="metric-panel">
<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…", "正在采样…")}
<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>
<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
<UsageBar
used={snapshot ? percent(snapshot.memory.used, snapshot.memory.total) : 0}
total={100}
tone="violet"
/>
<small>
{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>
</div>
</div>
<div className="metric-panel metric-drives">
<div className="metric-panel-head">
@ -397,39 +390,29 @@ export function OverviewPage({
const usedPercent = percent(volume.total - volume.free, volume.total);
return (
<div className="drive-row" key={volume.mount_point}>
<div className="drive-line">
<strong>
{driveLabel(volume)}
{volume.name && volume.name !== driveLabel(volume)
? ` · ${volume.name}`
: ""}
</strong>
<span>
<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>
<UsageBar
used={usedPercent}
total={100}
tone={usedPercent > 85 ? "red" : "green"}
/>
<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>
);
})}
</div>
</div>
</section>
<section className="quick-actions">
<SectionTitle
title={t("Everyday care", "日常维护")}
subtitle={t("The right tool for the next five minutes.", "用几分钟完成最常用的事。")}
/>
<div className="quick-grid">
<div className="quick-col">
<button className="quick-card tone-cyan" onClick={() => onNavigate("applications")}>
<span className="quick-icon">
<AppWindow size={22} />
@ -440,10 +423,7 @@ export function OverviewPage({
</span>
<ChevronRight size={17} />
</button>
<button
className="quick-card tone-indigo"
onClick={() => onOpenSpaceTab?.("big")}
>
<button className="quick-card tone-indigo" onClick={() => onOpenSpaceTab?.("big")}>
<span className="quick-icon">
<HardDrive size={22} />
</span>

View File

@ -4807,6 +4807,12 @@ select:focus-visible,
grid-column: 1 / -1;
}
/* Narrow widths drop the quick trio to a full-width horizontal row. */
.overview-metrics .quick-col {
grid-column: 1 / -1;
flex-direction: row;
}
.apps-layout {
grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.9fr);
}
@ -5245,10 +5251,32 @@ select:focus-visible,
overflow-wrap: anywhere;
}
/* Metrics row: three equal panels; usage bars keep breathing room on both
sides instead of spanning the full card width. */
/* Metrics row: 30% CPU+memory combo / 42% drives / 28% quick cards.
The row replaces the old standalone 日常维护 block — quick entries sit
in the right column, stretching to the panels' height. */
.overview-metrics {
grid-template-columns: repeat(3, minmax(0, 1fr));
grid-template-columns: minmax(0, 30fr) minmax(0, 42fr) minmax(0, 28fr);
gap: 18px;
}
/* One panel, two stacked metric blocks split by a dashed rule. Each half
centers its content; together they stretch with the row's height. */
.metric-combo {
display: flex;
flex-direction: column;
padding: 6px 14px;
}
.metric-combo .m-block {
flex: 1 1 0;
display: flex;
flex-direction: column;
justify-content: center;
padding: 12px 0;
}
.metric-combo .m-block + .m-block {
border-top: 1px dashed rgba(96, 82, 60, 0.18);
}
.overview-metrics .usage-bar {
@ -5261,45 +5289,65 @@ select:focus-visible,
.drive-list {
display: grid;
gap: 9px;
margin-top: 10px;
gap: 0;
margin-top: 4px;
}
/* One row per volume: drive letter | bar (fills the row) | usage + sizes. */
.drive-row {
display: grid;
gap: 5px;
display: flex;
align-items: center;
gap: 14px;
padding: 13px 2px;
}
.metric-drives .usage-bar {
.drive-row + .drive-row {
border-top: 1px solid rgba(96, 82, 60, 0.08);
}
.drive-name {
flex: 0 0 auto;
color: var(--nex-ink);
font-size: var(--nex-text-2xs);
font-weight: var(--nex-weight-bold);
}
.drive-bar {
flex: 1 1 auto;
min-width: 60px;
}
.drive-bar .usage-bar {
margin-inline: 0;
height: 5px;
}
.drive-line {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 10px;
}
.drive-line strong {
overflow: hidden;
color: var(--nex-ink);
font-size: var(--nex-text-2xs);
text-overflow: ellipsis;
white-space: nowrap;
}
.drive-line span {
.drive-info {
flex: 0 0 auto;
color: var(--nex-muted);
font-size: var(--nex-text-3xs);
text-align: right;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.drive-line .drive-pct {
.drive-info .drive-pct {
margin-right: 7px;
color: var(--nex-ink-strong);
font-size: var(--nex-text-2xs);
font-weight: var(--nex-weight-bold);
font-variant-numeric: tabular-nums;
}
/* Quick entries: vertical trio mirroring the tall panels on its left. */
.quick-col {
display: flex;
flex-direction: column;
gap: 18px;
}
.quick-col .quick-card {
flex: 1 1 0;
min-height: 64px;
}
/* Application list + plan header use the real icon when the scan provided one. */
@ -5358,11 +5406,22 @@ select:focus-visible,
}
.overview-page .overview-metrics {
margin-top: 14px;
margin-top: 26px;
}
.overview-page .metric-panel {
padding: 12px 14px;
background: #fffdf8;
border: 1px solid rgba(196, 168, 120, 0.22);
border-radius: 16px;
}
.overview-page .metric-combo {
padding: 6px 14px;
}
.overview-page .quick-col {
gap: 18px;
}
.overview-page .metric-panel-head {