Skip to content

feat: Add date range event dashboard charts 🤖 #1161

Open
mrjbj wants to merge 1 commit intoHiEventsDev:developfrom
mrjbj:feature/dashboard-date-range-selector
Open

feat: Add date range event dashboard charts 🤖 #1161
mrjbj wants to merge 1 commit intoHiEventsDev:developfrom
mrjbj:feature/dashboard-date-range-selector

Conversation

@mrjbj
Copy link
Copy Markdown

@mrjbj mrjbj commented Apr 12, 2026

What changes I've made

Added date range selector buttons to event dashboard charts with four presets: Week, Month, Quarter, and Event. Event is based upon start and end date of event so archived and ended events don't show flat lines at 0 as they age and time goes by.

Backend:

  • GetEventStatsAction accepts a ?date_range= query parameter (week, month, quarter, event)
  • EventStatsFetchService computes date ranges anchored to the event's start date (adjusted for any early transactions), using event dates and event_daily_statistics bounds
  • EventStatsRequestDTO updated with nullable dates and a date_range_preset field

Frontend:

  • SegmentedControl widget added above the chart cards on the event dashboard
  • useGetEventStats hook and API client pass the selected preset; query key includes it for automatic refetch
  • Translations added for all 16 supported locales

Why I've made these changes

The dashboard charts previously used a hardcoded 7-day lookback from the current date, which meant ended events showed empty charts and the date range had no relation to the event's actual timeline. This change anchors chart ranges to the event lifecycle:

  • Week/Month/Quarter show the first 7/30/90 days from the event's adjusted start date
  • Event spans the full lifecycle from first activity to event end (extended by late transactions like refunds, but not beyond the last relevant date for ended events)
  • Defaults to Event for ended/archived events and Month for live/upcoming events

How I've tested these changes

  • Verified on live, ended, and upcoming events that the selector toggles chart date ranges correctly
  • Confirmed ended events using the "Event" preset stop at max(event_end, last_transaction) and do not extend to today
  • Confirmed fallback behavior when events have no dates or no daily statistics
  • php artisan test --testsuite=Unit — all 353 tests pass
  • npx tsc --noEmit — no new TypeScript errors

Checklist

  • I have read the contributing guidelines.
  • My code follows the coding standards of the project.
  • I have tested my changes, and they work as expected.
  • I understand that this PR will be closed if I do not follow the [contributor guidelines (https://github.com/HiEventsDev/hi.events/blob/develop/CONTRIBUTING.md) and if this PR template is left unedited.

Replace hardcoded 7-day lookback with a SegmentedControl (Week/Month/Quarter/Event)
anchored to the event's start date. Defaults to "Event" for ended/archived events
and "Month" for live/upcoming events. The "Event" preset spans the full lifecycle
including early sales and late refunds, stopping at max(event_end, last_transaction)
rather than extending to today for ended events.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mrjbj mrjbj changed the title feat: Add date range event dashboard charts feat: Add date range event dashboard charts 🤖 Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant