Rewrite StatisticPage with factual date-range analytics and KPI sections#47
Rewrite StatisticPage with factual date-range analytics and KPI sections#47IanTheMitten wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d7154c5c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <tbody className="divide-y divide-gray-200"> | ||
| {bestDays.map((row) => ( | ||
| <tr key={row.dayKey}> | ||
| <td className="p-2 text-gray-900">{new Date(row.dayKey).toLocaleDateString('en-US')}</td> |
There was a problem hiding this comment.
Parse best-day keys as local dates
row.dayKey is produced in local calendar time (YYYY-MM-DD), but new Date(row.dayKey) parses that format as UTC; in US time zones this shifts many rows to the previous day (for example, 2026-04-01 can display as 3/31/2026). That makes the Best Days table show incorrect dates for the revenue/transaction totals it is summarizing, so users can act on the wrong day-level insight.
Useful? React with 👍 / 👎.
Motivation
today,thisWeek,thisMonth,allTime,custom) so metric values reflect the selected boundaries.filteredTransactionssource and keepselectedPeriodIdfor period drill-downs.Description
StatisticDateRangetype includingtoday,thisWeek,thisMonth,allTime, andcustom.filteredTransactionsonce withgetDateBounds(...)and used it across all computed analytics includingtotalRevenue,unitsSold,transactionCount,avgBasketSize, weekday totals, time-period totals, top products, best days, and top customers.Total Revenue,Units Sold,Transactions, andAvg Basket Size.selectedPeriodIddrill-down), selected-period running revenue chart, top products table, best days table, and top customers table.samplingSeed, sampled modes/options,WeekdayRevenueBarChart,TimePeriodRevenueBarChart,TimePeriodCumulativeLine,ProductAverageRevenueTable, andanalyticsSamplingusages) and adopted inline chart/table rendering driven byfilteredTransactions.Testing
npm run build, which completed successfully (Vite build succeeded).Codex Task