Files
GarminHealthLab/client/src/pages/Today.css
ericwyuan 8430ff335e feat(ui): 今日页日期切换 + 卡片可点 + 路由切换进度条
需求 3.7 / 4.5 / 4.6 / 4.7

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

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-24 00:49:38 +08:00

189 lines
3.8 KiB
CSS

/* Hero -------------------------------------------------------------------- */
.hero {
padding: 1.35rem 1rem 1.15rem;
background: var(--surface-1);
border: 1px solid var(--border);
border-radius: 16px;
box-shadow: var(--shadow);
margin-bottom: 1.5rem;
animation: hero-in 0.5s var(--ease) both;
}
@keyframes hero-in {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: none; }
}
.ring-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.5rem;
}
.ring-cell {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.35rem;
}
/* Proportional figures: tabular-nums makes a large standalone number look
loose, and these sit at display size inside the rings. */
.ring-value {
font-size: 1.18rem;
font-weight: 660;
line-height: 1;
color: var(--text-primary);
letter-spacing: -0.01em;
}
.ring-unit {
font-size: 0.62rem;
color: var(--text-muted);
}
.ring-label {
font-size: 0.82rem;
font-weight: 600;
color: var(--text-primary);
}
.ring-goal {
font-size: 0.68rem;
color: var(--text-muted);
text-align: center;
}
.hero-summary {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 0.75rem;
flex-wrap: wrap;
margin-top: 1.1rem;
padding-top: 0.9rem;
border-top: 1px solid var(--border);
}
.hero-headline {
font-size: 0.95rem;
font-weight: 620;
color: var(--text-primary);
}
.hero-aside {
font-size: 0.76rem;
color: var(--text-muted);
}
.hero-skeleton {
height: 186px;
border-radius: 16px;
background: var(--surface-1);
border: 1px solid var(--border);
margin-bottom: 1.5rem;
}
@media (max-width: 400px) {
.hero { padding: 1.15rem 0.6rem 1rem; }
.ring-row { gap: 0.25rem; }
.ring-value { font-size: 1.02rem; }
.ring-goal { font-size: 0.63rem; }
}
/* Charts ------------------------------------------------------------------ */
.charts-section {
margin-top: 2rem;
}
.charts-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
gap: 1rem;
}
@media (max-width: 700px) {
.hero {
flex-direction: column;
text-align: center;
gap: 1.25rem;
padding: 1.5rem 1rem;
}
.hero-list {
justify-content: center;
gap: 1.5rem;
}
.charts-grid {
grid-template-columns: 1fr;
}
}
@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; }
}