Skip to content

Commit 269cb5f

Browse files
committed
chore: release v0.18.0
1 parent bcaa843 commit 269cb5f

5 files changed

Lines changed: 20 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 0.18.0
4+
5+
### Minor Changes
6+
7+
- feat(home): 添加命令趋势图表组件
8+
9+
- 新增 CommandTrendChart 组件,使用 recharts 展示命令使用趋势
10+
- 集成到 Home 页面
11+
312
## 0.17.1
413

514
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lovcode",
33
"private": true,
4-
"version": "0.17.1",
4+
"version": "0.18.0",
55
"type": "module",
66
"packageManager": "pnpm@10.18.1",
77
"scripts": {

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lovcode"
3-
version = "0.17.1"
3+
version = "0.18.0"
44
description = "A Tauri App"
55
authors = ["you"]
66
edition = "2021"

src/components/home/CommandTrendChart.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ const COLORS = [
2727
"hsl(160, 40%, 50%)",
2828
];
2929

30-
export function CommandTrendChart({ data, weeks = 12 }: CommandTrendChartProps) {
31-
// Debug: log raw data
32-
console.log("CommandTrendChart raw data:", data);
30+
const MAX_COMMANDS = 8; // Only show top N commands in chart
3331

34-
const { chartData, commands } = useMemo(() => {
32+
export function CommandTrendChart({ data, weeks = 12 }: CommandTrendChartProps) {
33+
const { chartData, commands, totalCommands } = useMemo(() => {
3534
// Collect all week keys from the actual data
3635
const weekKeySet = new Set<string>();
3736
Object.values(data).forEach((weekData) => {
@@ -48,7 +47,9 @@ export function CommandTrendChart({ data, weeks = 12 }: CommandTrendChartProps)
4847
Object.values(weekData).reduce((sum, count) => sum + count, 0),
4948
]);
5049
commandTotals.sort((a, b) => b[1] - a[1]);
51-
const commands = commandTotals.map(([cmd]) => cmd);
50+
const totalCommands = commandTotals.length;
51+
// Only take top N commands for display
52+
const commands = commandTotals.slice(0, MAX_COMMANDS).map(([cmd]) => cmd);
5253

5354
// Build chart data
5455
const chartData = weekKeys.map((week) => {
@@ -59,7 +60,7 @@ export function CommandTrendChart({ data, weeks = 12 }: CommandTrendChartProps)
5960
return point;
6061
});
6162

62-
return { chartData, commands };
63+
return { chartData, commands, totalCommands };
6364
}, [data, weeks]);
6465

6566
if (commands.length === 0) {
@@ -77,7 +78,7 @@ export function CommandTrendChart({ data, weeks = 12 }: CommandTrendChartProps)
7778
Command Trends
7879
</span>
7980
<span className="text-xs text-muted-foreground">
80-
{commands.length} commands
81+
Top {commands.length} of {totalCommands}
8182
</span>
8283
</div>
8384

0 commit comments

Comments
 (0)