feat(dashboard): custom date range + KPI port-hydration gate

DateRangePicker grows a "Custom range" mode (From/To inputs capped
at today, mutually-bounded so From <= To). dashboard-shell threads
the range through to /api/v1/analytics, which validates calendar
dates via ISO round-trip and enforces a 365-day cap as a backstop
against the occupancy timeline N+1.

KpiCards now gates its query on currentPortId so the early
unhydrated-store fetch can't cache a zeroed/error response and
display "-" until staleTime expires.

MyRemindersRail drops xl:h-full so the rail no longer stretches
past its grid row and overlaps ActivityFeed below.

useRealtimeInvalidation switches to partial-prefix queryKeys so a
realtime mutation invalidates every cached range bucket at once
instead of just the one currently visible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Ciaccio
2026-05-04 22:54:55 +02:00
parent e598cc0708
commit 77ad10ced1
7 changed files with 260 additions and 30 deletions

View File

@@ -36,7 +36,7 @@ const PRIORITY_BADGE: Record<string, string> = {
/**
* Compact reminders rail for the dashboard sidebar. Lists reminders assigned
* to the current user (overdue first, then upcoming). Each item links to its
* subject interest preferred, then client, then the generic entity ref.
* subject - interest preferred, then client, then the generic entity ref.
*
* Limited to 6 items; "View all" routes to /reminders.
*/
@@ -67,11 +67,13 @@ export function MyRemindersRail() {
return `/${portSlug}/reminders`;
}
// `h-full` only at xl: where the dashboard grid pairs this rail with
// a sibling chart column. On mobile (stacked) it produced a weirdly
// tall empty card.
// Natural height - the parent dashboard grid uses `items-start` so the
// aside column no longer forces this rail to fill the chart column's
// height. Stretching here pushed AlertRail out of the aside's box and
// into the territory below where ActivityFeed renders, producing a
// visible overlap on tall viewports.
return (
<Card className="xl:h-full">
<Card>
<CardHeader className="flex flex-row items-start justify-between gap-2 space-y-0 pb-3">
<div className="space-y-0.5">
<CardTitle className="flex items-center gap-1.5 text-base">
@@ -100,7 +102,7 @@ export function MyRemindersRail() {
</div>
) : sorted.length === 0 ? (
<p className="py-3 text-center text-sm text-muted-foreground">
All caught up no reminders.
All caught up - no reminders.
</p>
) : (
<ul className="space-y-1">