style: 重做界面视觉与信息层级

先截图审视现状,再针对性修改。主要问题与改动如下。

工具栏
- 标签筛选从「平铺全部标签」改为下拉面板,标签多时不再换行挤爆工具栏
- 备份与快捷键帮助移到导航栏 —— 它们是应用级操作,不该挤在看板工具栏里,
  顺带修好了「? 帮助只在看板可用」的问题
- 到期统计(今日到期 / 逾期)合并为可点击的筛选入口,去掉两个独立控件
- 移动端工具栏从占半屏降到三行紧凑布局

卡片
- 优先级从彩色胶囊改为左侧色条,扫视一列时比读文字更快分辨轻重
- 元信息改为「优先级 · 日期 · 标签」的轻量文本行,不再三种胶囊叠在一起
- 完成态用勾选图标 + 降低不透明度

布局
- 今日视图限宽居中(max-w-3xl):此前 1440px 下卡片被拉满整屏,
  标题与元信息之间出现大片空白
- 修复移动端卡片被压成细条:TaskCard 的 overflow-hidden(用于裁切左侧色条)
  会让 flex 项的最小尺寸解析为 0,补 shrink-0 修正;
  同时改为移动端按内容高度堆叠、桌面端列内滚动

其他
- 导航栏品牌改用看板图标,消除「看板」重复出现两次
- 统一卡片阴影、圆角与键盘焦点样式
- 新增 scripts/screenshot.mjs,便于后续对照审视视觉改动

验证:单元测试 452 个、端到端测试 23 个全部通过,lint 与构建无错误。
This commit is contained in:
chenshoulin
2026-10-18 14:05:06 +08:00
parent 4e064e82ea
commit 442cbbd734
23 changed files with 981 additions and 333 deletions
+48 -1
View File
@@ -34,7 +34,8 @@ async function mountApp(initialPath = '/') {
await router.push(initialPath)
const wrapper = mount(App, {
global: { plugins: [pinia, router] },
// 抽屉与面板的内容会被 Teleport 到 body,测试中改为就地渲染以便断言
global: { plugins: [pinia, router], stubs: { teleport: true } },
attachTo: document.body,
})
await router.isReady()
@@ -143,3 +144,49 @@ describe('App 路由', () => {
wrapper.unmount()
})
})
describe('App 应用级面板', () => {
beforeEach(() => {
localStorage.clear()
})
function pressKey(key: string): void {
document.dispatchEvent(new KeyboardEvent('keydown', { key, bubbles: true, cancelable: true }))
}
it('按 ? 打开快捷键帮助,Esc 关闭', async () => {
const { wrapper } = await mountApp()
await nextTick()
pressKey('?')
await nextTick()
expect(wrapper.text()).toContain('聚焦「待办」列的快速新增输入框')
pressKey('Escape')
await nextTick()
expect(wrapper.text()).not.toContain('聚焦「待办」列的快速新增输入框')
wrapper.unmount()
})
it('在今日视图下 ? 同样可用(帮助是应用级的)', async () => {
const { wrapper } = await mountApp('/today')
await nextTick()
pressKey('?')
await nextTick()
expect(wrapper.text()).toContain('聚焦「待办」列的快速新增输入框')
wrapper.unmount()
})
it('导航的备份按钮可打开备份面板', async () => {
const { wrapper } = await mountApp()
await nextTick()
const backupButton = wrapper.findAll('button').find((node) => node.text() === '备份')
await backupButton?.trigger('click')
await nextTick()
expect(wrapper.text()).toContain('导出为 JSON')
wrapper.unmount()
})
})