claude-usage-dashboard 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -32,8 +32,8 @@ Open http://localhost:3000 in your browser.
|
|
|
32
32
|
### From Source
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
git clone https://github.com/ludengz/
|
|
36
|
-
cd
|
|
35
|
+
git clone https://github.com/ludengz/claude-usage-dashboard.git
|
|
36
|
+
cd claude-usage-dashboard
|
|
37
37
|
npm install
|
|
38
38
|
npm start
|
|
39
39
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-usage-dashboard",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Dashboard that visualizes Claude Code usage from local session logs",
|
|
5
5
|
"main": "server/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/ludengz/
|
|
29
|
+
"url": "https://github.com/ludengz/claude-usage-dashboard.git"
|
|
30
30
|
},
|
|
31
31
|
"type": "module",
|
|
32
32
|
"dependencies": {
|
|
@@ -20,13 +20,21 @@ export function renderModelDistribution(container, data) {
|
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const containerWidth = container.clientWidth;
|
|
24
|
+
const size = Math.min(containerWidth * 0.45, 200);
|
|
24
25
|
const radius = size / 2;
|
|
25
26
|
const innerRadius = radius * 0.55;
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
+
const isNarrow = containerWidth < 280;
|
|
29
|
+
const wrapper = el.append('div')
|
|
30
|
+
.style('display', 'flex')
|
|
31
|
+
.style('flex-direction', isNarrow ? 'column' : 'row')
|
|
32
|
+
.style('align-items', 'center')
|
|
33
|
+
.style('gap', isNarrow ? '8px' : '20px');
|
|
28
34
|
|
|
29
|
-
const svg = wrapper.append('svg')
|
|
35
|
+
const svg = wrapper.append('svg')
|
|
36
|
+
.attr('width', size).attr('height', size)
|
|
37
|
+
.style('flex-shrink', '0')
|
|
30
38
|
.append('g').attr('transform', `translate(${size / 2},${size / 2})`);
|
|
31
39
|
|
|
32
40
|
const total = d3.sum(data.models, d => d.total_tokens);
|
|
@@ -15,7 +15,18 @@ export function renderProjectDistribution(container, data) {
|
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
// Measure longest project name to set left margin dynamically
|
|
19
|
+
const tempSvg = el.append('svg').style('position', 'absolute').style('visibility', 'hidden');
|
|
20
|
+
const tempText = tempSvg.append('text').style('font-size', '12px');
|
|
21
|
+
let maxLabelWidth = 120;
|
|
22
|
+
for (const p of data.projects) {
|
|
23
|
+
tempText.text(p.name);
|
|
24
|
+
maxLabelWidth = Math.max(maxLabelWidth, tempText.node().getComputedTextLength());
|
|
25
|
+
}
|
|
26
|
+
tempSvg.remove();
|
|
27
|
+
const leftMargin = Math.ceil(maxLabelWidth) + 16;
|
|
28
|
+
|
|
29
|
+
const margin = { top: 10, right: 360, bottom: 10, left: leftMargin };
|
|
19
30
|
const barHeight = 24;
|
|
20
31
|
const gap = 8;
|
|
21
32
|
const height = data.projects.length * (barHeight + gap) + margin.top + margin.bottom;
|