ccusage-ui
Advanced tools
+1
-1
| { | ||
| "name": "ccusage-ui", | ||
| "version": "0.1.16", | ||
| "version": "0.1.17", | ||
| "main": "server.js", | ||
@@ -5,0 +5,0 @@ "bin": { |
+20
-3
@@ -330,2 +330,5 @@ <!DOCTYPE html> | ||
| </div> | ||
| <button id="showMoreBtn" onclick="toggleTableRows()" style="margin-top: 16px; padding: 8px 16px; background: #f5f5f7; border: 1px solid #e5e5e7; border-radius: 8px; cursor: pointer; font-size: 13px; color: #0071e3; width: 100%;"> | ||
| Show More (30 days) | ||
| </button> | ||
| </div> | ||
@@ -736,8 +739,11 @@ | ||
| let showAllDays = false; | ||
| function renderTable() { | ||
| const tbody = document.querySelector('#dataTable tbody'); | ||
| tbody.innerHTML = ''; | ||
| // Sort by date descending (newest first) and take top 10 | ||
| const recent = [...dailyData].sort((a, b) => b.date.localeCompare(a.date)).slice(0, 10); | ||
| // Sort by date descending (newest first), show 7 or 30 days | ||
| const count = showAllDays ? 30 : 7; | ||
| const recent = [...dailyData].sort((a, b) => b.date.localeCompare(a.date)).slice(0, count); | ||
| recent.forEach(d => { | ||
@@ -754,4 +760,15 @@ const tr = document.createElement('tr'); | ||
| }); | ||
| // Update button text | ||
| const btn = document.getElementById('showMoreBtn'); | ||
| if (btn) { | ||
| btn.textContent = showAllDays ? 'Show Less (7 days)' : 'Show More (30 days)'; | ||
| } | ||
| } | ||
| function toggleTableRows() { | ||
| showAllDays = !showAllDays; | ||
| renderTable(); | ||
| } | ||
@@ -758,0 +775,0 @@ function shareStats() { |
3062036
0.02%