Skip to content

feat(ui): 增加概览页年度活动热图#716

Open
FFFxueGawaine wants to merge 4 commits into
Open-Less:betafrom
FFFxueGawaine:feat/overview-activity-heatmap
Open

feat(ui): 增加概览页年度活动热图#716
FFFxueGawaine wants to merge 4 commits into
Open-Less:betafrom
FFFxueGawaine:feat/overview-activity-heatmap

Conversation

@FFFxueGawaine

@FFFxueGawaine FFFxueGawaine commented Jun 19, 2026

Copy link
Copy Markdown

摘要

Fixes #。(暂无关联 issue)

本 PR 在「今日概况 / Overview」页面增加年度活动热图,并补充文字历史保留策略配置:用户可以用每日 / 每周 / 累计三种视图查看过去一年的历史记录活跃度,同时默认不再按天数或条数限制文字历史记录。

新增 / 改进

Overview 年度活动热图

  • 新增概览页年度活动热图,支持「每日 / 每周 / 累计」三种视图。
  • 每日、每周、累计都沿用格子化视觉;每周和累计按周离散成 7 个等级展示。
  • 每周 / 累计统计以周一到周日为一周,悬浮提示显示该周的周一日期。
  • 悬浮提示跟随鼠标 / 格子位置显示对应日期、周起始日或累计数据。
  • 切换视图时增加从左到右的快速出现动画。
  • 在「设置 → 通用 → 外观」新增「显示概况活动热图」开关,默认开启。
  • 关闭开关只隐藏概况页年度活动热图,不删除历史记录,也不影响其它概况指标。
  • 移除概况页顶部的一键浅色 / 深色切换入口,主题切换仍保留在外观设置里。

文字历史保留

  • 将文字历史保留天数默认改为无限制。
  • 将文字历史条数上限默认改为无限制。
  • 历史保留设置为空或 0 时,视为无限制。
  • 后端文字历史清理逻辑同步放开,条数无限制时不再回退到旧的 200 条上限。
  • 旧版默认 7 天的配置会自动迁移为无限制;用户手动设置的其他天数不受影响。
  • 本次设置仅影响文字历史记录,不改变本地录音文件的保存策略。

Overview 活动统计

  • 在 Overview 活动摘要中增加时长统计。
  • 时长按 sminh 展示。
  • 非零时长保留 1 位小数,0 时显示为 0s

本地开发与多语言

  • 优化 mock history 分布,让本地开发环境能看到近 7 天柱状图和年度热图效果。
  • 补充 zh-CN / zh-TW / en / ja / ko 文案。

兼容

  • 新增一个默认开启的外观偏好 showOverviewActivityHeatmap
  • 新增历史保留默认迁移标记 historyRetentionDefaultMigrated
  • 生产历史数据读取仍沿用现有 listHistory
  • 不改变本地录音文件保存策略。
  • 不涉及 Provider 凭据持久化、数据库结构、新增 IPC 命令或构建流程变更。

截图

浅色主题

浅色年度活动热图

深色主题

深色年度活动热图

每周 / 累计

每周模式

累计模式

测试计划

  • npm run build
  • cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml
  • cargo test append_with_no_max_entries_keeps_more_than_legacy_cap --target x86_64-pc-windows-msvc
  • 本地概览页预览:每日 / 每周 / 累计切换可用;外观设置开关可隐藏概况页年度热图。

最新提交

  • 7681d92205f9110d7f1de8ce778e5d6732f64d7c

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

(Review updated until commit 7681d92)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible Issue

The date helper functions startOfLocalDay, addDays, and differenceInDays operate on local time, which can produce incorrect day boundaries around DST transitions. For example, in a time zone that observes DST, the day of spring forward has only 23 hours; addDays using setDate may shift the resulting date by one hour, and startOfLocalDay will then zero the time components but could land on the wrong calendar day. This can cause the heatmap grid to skip or duplicate days, misaligning cells and week labels. To reproduce, set a time zone like America/New_York and view the heatmap around March 8–9, 2026 (spring forward). The green cells will not match actual activity days.

function startOfLocalDay(date: Date): Date {
  return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}

function startOfWeek(date: Date): Date {
  return addDays(startOfLocalDay(date), -((date.getDay() + 6) % 7));
}

function addDays(date: Date, days: number): Date {
  return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);
}

function differenceInDays(a: Date, b: Date): number {
  return Math.round((startOfLocalDay(a).getTime() - startOfLocalDay(b).getTime()) / 86400000);
}

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 15f4adf

@FFFxueGawaine

Copy link
Copy Markdown
Author

UI 截图证据

这些截图已随本 PR 提交到 docs/images/pr-716/,不是本地路径。

浅色主题

浅色年度活动热图

深色主题

深色年度活动热图

每周 / 累计 / 悬浮提示

每周模式

累计模式

悬浮提示

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 55037ed

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 2cb22ce

@H-Chris233

Copy link
Copy Markdown
Collaborator

我们决定合并你的pr,但在此之前请给开关用于开关该功能

jiangmuran
jiangmuran previously approved these changes Jun 21, 2026

@jiangmuran jiangmuran left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

非常好代码,使我免于阅读AI Slop之苦

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 141de63

@FFFxueGawaine

FFFxueGawaine commented Jun 21, 2026

Copy link
Copy Markdown
Author

@jiangmuran 谢谢!确实有 GPT-5 帮忙,但我尽量把 diff 控制得小一点、方便 review。

维护者要求的「显示概况活动热图」开关和设置页截图也已经补上了;方便的话麻烦再帮忙 review 一下。来自Codex的回复。

@FFFxueGawaine

Copy link
Copy Markdown
Author

Added the Settings toggle screenshot as well:

Settings toggle

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 1fed45a

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 4588a23

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 1fed45a

@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 7681d92

@FFFxueGawaine

Copy link
Copy Markdown
Author

本次补充更新说明

对应最新提交:7681d92205f9110d7f1de8ce778e5d6732f64d7c

文字历史保留

  • 将文字历史保留天数默认改为无限制。
  • 将文字历史条数上限默认改为无限制。
  • 历史保留设置为空或 0 时,视为无限制。
  • 后端文字历史清理逻辑同步放开,条数无限制时不再回退到旧的 200 条上限。
  • 旧版默认 7 天的配置会自动迁移为无限制;用户手动设置的其他天数不受影响。
  • 本次设置仅影响文字历史记录,不改变本地录音文件的保存策略。

Overview 活动统计

  • 在 Overview 活动摘要中增加时长统计。
  • 时长按 sminh 展示。
  • 非零时长保留 1 位小数,0 时显示为 0s

验证

  • npm run build
  • cargo test append_with_no_max_entries_keeps_more_than_legacy_cap --target x86_64-pc-windows-msvc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants