feat: 统计页面添加分类筛选与搜索优化

- 统计页面添加分类多选筛选功能
- 点击分类可跳转到搜索页面查看详情
- 搜索页面添加 URL 同步与自动搜索
- 提取 useCategories hook 消除重复代码
- 修复自定义分类图标显示问题
- 添加 useMemo 优化计算性能

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Developer
2026-03-17 13:35:40 +08:00
co-authored by Claude Opus 4.6
parent b5f9a238bb
commit a89d4f2402
6 changed files with 345 additions and 60 deletions
+101 -8
View File
@@ -1207,14 +1207,6 @@ textarea:focus-visible {
gap: 10px;
}
.search-stat {
padding: 13px;
background: rgba(246, 248, 252, 0.82);
border: 1px solid rgba(148, 163, 184, 0.14);
display: grid;
gap: 6px;
}
.section-card--search .results-count {
padding: 0 2px;
font-weight: 600;
@@ -1591,6 +1583,18 @@ textarea:focus-visible {
background: rgba(246, 248, 252, 0.8);
}
.stats-category-item--clickable {
cursor: pointer;
border: none;
width: 100%;
text-align: left;
transition: background 0.2s ease;
}
.stats-category-item--clickable:hover {
background: rgba(37, 99, 235, 0.1);
}
.stats-category-header {
display: flex;
justify-content: space-between;
@@ -1622,6 +1626,95 @@ textarea:focus-visible {
background: linear-gradient(90deg, var(--primary), #60a5fa);
}
/* 统计页面总额显示 */
.stats-total {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
background: var(--card-bg);
border-radius: 8px;
margin-bottom: 12px;
}
.stats-total-label {
font-size: 14px;
color: var(--text-secondary);
}
.stats-total-amount {
font-size: 20px;
font-weight: 600;
color: var(--text-primary);
}
/* 分类选择chips */
.category-chips {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 12px;
}
.category-chip {
padding: 6px 12px;
border-radius: 16px;
border: 1px solid var(--border-color);
background: var(--card-bg);
color: var(--text-secondary);
font-size: 13px;
cursor: pointer;
transition: all 0.2s ease;
}
.category-chip:hover {
border-color: var(--primary);
color: var(--primary);
}
.category-chip.selected {
background: var(--primary);
border-color: var(--primary);
color: white;
}
/* 已选分类标签 */
.selected-chips {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 12px;
}
.selected-chip {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 8px 4px 12px;
border-radius: 16px;
background: var(--primary);
color: white;
font-size: 13px;
}
.selected-chip-remove {
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
border-radius: 50%;
border: none;
background: rgba(255, 255, 255, 0.3);
color: white;
cursor: pointer;
padding: 0;
}
.selected-chip-remove:hover {
background: rgba(255, 255, 255, 0.5);
}
.category-item .category-name {
white-space: nowrap;
overflow: hidden;