ccusage-ui 0.1.4 β 0.1.6
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/package.json +7 -3
- package/public/index.html +84 -52
- package/public/screenshot.png +0 -0
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccusage-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"main": "server.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ccusage-ui": "server.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"start": "node server.js",
|
|
10
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"deploy": "gh-pages -d public"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [],
|
|
13
14
|
"author": "Doha Park",
|
|
@@ -23,5 +24,8 @@
|
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"ccusage": "^18.0.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"gh-pages": "^6.3.0"
|
|
26
30
|
}
|
|
27
|
-
}
|
|
31
|
+
}
|
package/public/index.html
CHANGED
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
<div>
|
|
281
281
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
282
282
|
<h2 style="margin:0; font-size:18px;">Usage Trend</h2>
|
|
283
|
-
<span class="tier-info" data-tippy-content="
|
|
283
|
+
<span class="tier-info" data-tippy-content="β¬ Iron: <5M<br>π« Bronze: 5M+<br>β¬ Silver: 10M+<br>π‘ Gold: 30M+<br>π Platinum: 50M+<br>π Emerald: 100M+<br>π Diamond: 300M+<br>π΄ Master: 500M+<br>π Grandmaster: 1B+<br>π Challenger: 1.5B+ (μΈκ³ 1μκΈ)">?</span>
|
|
284
284
|
</div>
|
|
285
285
|
|
|
286
286
|
<div id="userLevel" style="font-size:12px; color:#0071e3; margin-top:4px; font-weight:500;"></div>
|
|
@@ -493,11 +493,16 @@
|
|
|
493
493
|
let displayHTML = "";
|
|
494
494
|
|
|
495
495
|
const getLevelName = (val) => {
|
|
496
|
-
if (val >=
|
|
497
|
-
if (val >=
|
|
498
|
-
if (val >=
|
|
499
|
-
if (val >=
|
|
500
|
-
return "
|
|
496
|
+
if (val >= 1500) return "π Challenger";
|
|
497
|
+
if (val >= 1000) return "π Grandmaster";
|
|
498
|
+
if (val >= 500) return "π΄ Master";
|
|
499
|
+
if (val >= 300) return "π Diamond";
|
|
500
|
+
if (val >= 100) return "π Emerald";
|
|
501
|
+
if (val >= 50) return "π Platinum";
|
|
502
|
+
if (val >= 30) return "π‘ Gold";
|
|
503
|
+
if (val >= 10) return "β¬ Silver";
|
|
504
|
+
if (val >= 5) return "π« Bronze";
|
|
505
|
+
return "β¬ Iron";
|
|
501
506
|
};
|
|
502
507
|
|
|
503
508
|
// Only project if the last data point is the current month
|
|
@@ -534,50 +539,67 @@
|
|
|
534
539
|
{
|
|
535
540
|
id: 'custom_lines',
|
|
536
541
|
beforeDraw: (chart) => {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
};
|
|
542
|
+
const ctx = chart.ctx;
|
|
543
|
+
const yAxis = chart.scales.y;
|
|
544
|
+
const xAxis = chart.scales.x;
|
|
545
|
+
|
|
546
|
+
const drawLine = (value, color, text) => {
|
|
547
|
+
const y = yAxis.getPixelForValue(value);
|
|
548
|
+
if (y <= yAxis.bottom && y >= yAxis.top) {
|
|
549
|
+
ctx.save();
|
|
550
|
+
ctx.beginPath();
|
|
551
|
+
ctx.strokeStyle = color;
|
|
552
|
+
ctx.lineWidth = 2;
|
|
553
|
+
ctx.setLineDash([5, 5]);
|
|
554
|
+
ctx.moveTo(xAxis.left, y);
|
|
555
|
+
ctx.lineTo(xAxis.right, y);
|
|
556
|
+
ctx.stroke();
|
|
557
|
+
|
|
558
|
+
ctx.fillStyle = color;
|
|
559
|
+
ctx.font = "bold 11px -apple-system";
|
|
560
|
+
ctx.fillText(text, xAxis.left + 5, y - 6);
|
|
561
|
+
ctx.restore();
|
|
562
|
+
}
|
|
563
|
+
};
|
|
560
564
|
|
|
565
|
+
if (currentMetric === 'tokens') {
|
|
561
566
|
if (currentView === 'monthly') {
|
|
562
|
-
drawLine(
|
|
563
|
-
drawLine(
|
|
564
|
-
drawLine(
|
|
567
|
+
drawLine(30, '#ffd700', 'Gold (30M)');
|
|
568
|
+
drawLine(100, '#00e5a0', 'Emerald (100M)');
|
|
569
|
+
drawLine(300, '#00bcd4', 'Diamond (300M)');
|
|
570
|
+
drawLine(500, '#e74c3c', 'Master (500M)');
|
|
571
|
+
drawLine(1000, '#ff9800', 'Grandmaster (1B)');
|
|
572
|
+
drawLine(1500, '#9b59b6', 'Challenger (1.5B)');
|
|
565
573
|
} else {
|
|
566
574
|
// Daily Benchmarks
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
//
|
|
570
|
-
drawLine(
|
|
571
|
-
//
|
|
572
|
-
drawLine(
|
|
573
|
-
//
|
|
574
|
-
drawLine(
|
|
575
|
-
|
|
576
|
-
|
|
575
|
+
// Challenger (1.5B/mo -> ~50M/day)
|
|
576
|
+
drawLine(50, 'rgba(155, 89, 182, 0.5)', 'Challenger (50M)');
|
|
577
|
+
// Grandmaster (1B/mo -> ~33M/day)
|
|
578
|
+
drawLine(33, 'rgba(255, 152, 0, 0.5)', 'Grandmaster (33M)');
|
|
579
|
+
// Master (500M/mo -> ~16.7M/day)
|
|
580
|
+
drawLine(16.7, 'rgba(231, 76, 60, 0.5)', 'Master (16.7M)');
|
|
581
|
+
// Diamond (300M/mo -> ~10M/day)
|
|
582
|
+
drawLine(10, 'rgba(0, 188, 212, 0.5)', 'Diamond (10M)');
|
|
583
|
+
// Gold (30M/mo -> ~1M/day)
|
|
584
|
+
drawLine(1, 'rgba(255, 215, 0, 0.5)', 'Gold (1M)');
|
|
585
|
+
|
|
586
|
+
// User Average
|
|
577
587
|
const sum = datasetData.reduce((a, b) => a + b, 0);
|
|
578
588
|
const avg = sum / datasetData.length;
|
|
579
589
|
drawLine(avg, '#0071e3', `My Avg (${avg.toFixed(1)}M)`);
|
|
580
590
|
}
|
|
591
|
+
} else if (currentMetric === 'cost') {
|
|
592
|
+
// Subscription plan benchmarks
|
|
593
|
+
if (currentView === 'monthly') {
|
|
594
|
+
drawLine(20, '#34c759', '$20 (Free tier value)');
|
|
595
|
+
drawLine(100, '#ff9500', '$100 Pro');
|
|
596
|
+
drawLine(200, '#ff3b30', '$200 Max');
|
|
597
|
+
} else {
|
|
598
|
+
// Daily cost benchmarks
|
|
599
|
+
drawLine(0.67, 'rgba(52, 199, 89, 0.5)', '$20/mo (~$0.67/day)');
|
|
600
|
+
drawLine(3.3, 'rgba(255, 149, 0, 0.5)', '$100 Pro (~$3.3/day)');
|
|
601
|
+
drawLine(6.7, 'rgba(255, 59, 48, 0.5)', '$200 Max (~$6.7/day)');
|
|
602
|
+
}
|
|
581
603
|
}
|
|
582
604
|
}
|
|
583
605
|
}
|
|
@@ -753,18 +775,28 @@
|
|
|
753
775
|
}
|
|
754
776
|
|
|
755
777
|
const getLevelName = (val) => {
|
|
756
|
-
if (val >=
|
|
757
|
-
if (val >=
|
|
758
|
-
if (val >=
|
|
759
|
-
if (val >=
|
|
760
|
-
return "
|
|
778
|
+
if (val >= 1500) return "Challenger";
|
|
779
|
+
if (val >= 1000) return "Grandmaster";
|
|
780
|
+
if (val >= 500) return "Master";
|
|
781
|
+
if (val >= 300) return "Diamond";
|
|
782
|
+
if (val >= 100) return "Emerald";
|
|
783
|
+
if (val >= 50) return "Platinum";
|
|
784
|
+
if (val >= 30) return "Gold";
|
|
785
|
+
if (val >= 10) return "Silver";
|
|
786
|
+
if (val >= 5) return "Bronze";
|
|
787
|
+
return "Iron";
|
|
761
788
|
};
|
|
762
|
-
|
|
789
|
+
|
|
763
790
|
const level = getLevelName(projected);
|
|
764
|
-
const levelId = projected >=
|
|
765
|
-
projected >=
|
|
766
|
-
projected >=
|
|
767
|
-
projected >=
|
|
791
|
+
const levelId = projected >= 1500 ? 'challenger' :
|
|
792
|
+
projected >= 1000 ? 'grandmaster' :
|
|
793
|
+
projected >= 500 ? 'master' :
|
|
794
|
+
projected >= 300 ? 'diamond' :
|
|
795
|
+
projected >= 100 ? 'emerald' :
|
|
796
|
+
projected >= 50 ? 'platinum' :
|
|
797
|
+
projected >= 30 ? 'gold' :
|
|
798
|
+
projected >= 10 ? 'silver' :
|
|
799
|
+
projected >= 5 ? 'bronze' : 'iron';
|
|
768
800
|
|
|
769
801
|
const shareUrl = `https://sowonlabs.github.io/ccusage-ui/share/${levelId}.html`;
|
|
770
802
|
|
|
Binary file
|