Skip to content

Commit a4cc136

Browse files
authored
fix(web): show all usage breakdown periods (pingdotgg#7219)
1 parent 33a8b07 commit a4cc136

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎apps/web/src/components/usage/UsagePage.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ export function UsagePage() {
6161
: enumerateHourStarts(window.sinceTime, window.untilTime),
6262
[window.sinceTime, window.untilTime],
6363
);
64-
const recentPeriods = useMemo<readonly (DailyTotals | HourlyTotals)[]>(
65-
() => (isPast24Hours ? merged.hourly : merged.daily).toReversed().slice(0, 8),
64+
// Newest first: the window can run 90 periods, so the interesting end
65+
// belongs at the top of the table.
66+
const breakdownPeriods = useMemo<readonly (DailyTotals | HourlyTotals)[]>(
67+
() => (isPast24Hours ? merged.hourly : merged.daily).toReversed(),
6668
[isPast24Hours, merged.daily, merged.hourly],
6769
);
6870

@@ -393,14 +395,14 @@ export function UsagePage() {
393395
</tr>
394396
</thead>
395397
<tbody>
396-
{recentPeriods.length === 0 ? (
398+
{breakdownPeriods.length === 0 ? (
397399
<tr>
398400
<td colSpan={5} className="py-6 text-center text-muted-foreground">
399401
No activity in this window.
400402
</td>
401403
</tr>
402404
) : (
403-
recentPeriods.map((period) => (
405+
breakdownPeriods.map((period) => (
404406
<tr
405407
key={"hourStart" in period ? period.hourStart : period.day}
406408
className="border-b border-border/50"

0 commit comments

Comments
 (0)