feat(ui): 今日页日期切换 + 卡片可点 + 路由切换进度条

需求 3.7 / 4.5 / 4.6 / 4.7

今日页
- 左右箭头切换日期,中间点开日历选任意一天,范围限定在已有数据内
- 没有记录的日期直接跳过,不会停在一个空白页上
- 一次读一年:往回翻一天不该产生一次请求,卡片的迷你曲线本来也需要前后几天
- 曲线窗口跟着所看的那天结束,卡片上的走势总是通向它上面那个数字
- 卡片改为从 lib/metrics.ts 渲染,点击进入指标详情

路由切换进度条
- 切换本身是瞬时的,用户等的是新页面的第一次请求,没有指示就像点了没反应
- 跑到 90% 停住等页面就位,不谎报完成
- 有最短显示时长,快速跳转时不会闪一下

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
ericwyuan
2026-08-24 00:49:38 +08:00
parent 0c7fecc124
commit 8430ff335e
5 changed files with 308 additions and 66 deletions

View File

@@ -121,3 +121,68 @@
@media (prefers-reduced-motion: reduce) {
.hero { animation: none; }
}
/* Date navigation --------------------------------------------------------- */
.date-nav {
display: flex;
align-items: stretch;
gap: 0.5rem;
margin-bottom: 1rem;
}
.date-arrow {
width: 46px;
border-radius: 12px;
border: 1px solid var(--border);
background: var(--surface-1);
color: var(--text-secondary);
font-size: 1.35rem;
line-height: 1;
cursor: pointer;
font-family: inherit;
flex-shrink: 0;
transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}
.date-arrow:active:not(:disabled) { transform: scale(0.93); background: var(--surface-2); }
.date-arrow:disabled { opacity: 0.3; cursor: default; }
.date-current {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.12rem;
padding: 0.5rem 0.8rem;
border-radius: 12px;
border: 1px solid var(--border);
background: var(--surface-1);
font-family: inherit;
cursor: pointer;
transition: background 0.15s var(--ease);
}
.date-current:active { background: var(--surface-2); }
.date-main {
font-size: 1rem;
font-weight: 640;
color: var(--text-primary);
font-variant-numeric: tabular-nums;
}
.date-sub {
font-size: 0.72rem;
color: var(--text-muted);
display: inline-flex;
align-items: center;
gap: 0.3rem;
}
.date-cal { font-size: 0.65rem; opacity: 0.8; }
@media (prefers-reduced-motion: reduce) {
.date-arrow, .date-current { transition: none; }
.date-arrow:active:not(:disabled) { transform: none; }
}