Sweeps Group A of the 2026-05-21 remaining-plan. Several items the
plan listed as open turned out to already be shipped (annotation gap
in the master doc) — those are confirmed in the commit notes.
Shipped now:
A1 Documenso settings: collapsed `V2_FEATURE_FIELDS` +
`CONTRACT_RESERVATION_FIELDS` (legacy SettingsFormCard) into
`RegistryDrivenForm` sections (`documenso.behavior` +
`documenso.templates`). Every Documenso setting now flows
through the registry path that surfaces the env-fallback /
port / global source badge per field. EOI generation card
retitled to "Templates & signing pathway" since it now covers
EOI + reservation + contract template IDs (registry already
had all three under `documenso.templates`).
A2 WatchersCard empty state: bumped `mb-3 → mb-4 pb-1` so the
"No one is watching yet" line has breathing room above the
"Add a watcher…" select.
A4 /invoices/upload-receipts guide copy: terse luxury-CRM tone.
Drop "Snap a photo", "fancy phone camera", "No typing. No
spreadsheets." Tighten OCR explainer to one sentence;
action-oriented step + best-practices headers.
A5 Pageviews chart X-axis: added `interval="preserveStartEnd"` +
`minTickGap={52}` so multi-week ranges thin out the middle
ticks instead of overlapping. The MM-DD formatter was already
in place from an earlier session.
A7 Inbox doc comment: was stale ("Alerts first, Reminders
second") but the JSX already had Reminders before Alerts.
Fixed the docstring.
A9 CommandList scroll-cap: `max-h-[300px]` now `max-h-[min(300px,
var(--radix-popover-content-available-height,300px))]` so the
cmdk list never extends past the host Popover's available
area. Non-Popover hosts fall through to the 300px static cap.
A10 DropdownMenuContent: `max-h-96` now
`max-h-[min(24rem,var(--radix-dropdown-menu-content-
available-height,24rem))]` for the same available-space
behaviour on long menus near the viewport edge.
A11 Residential InterestsTab (list page): row gets an onClick →
`router.push`; first-cell Link stops propagation so middle-
click / Cmd-click "open in new tab" still works.
A12 StageStepper: gained a stage-name row below the bar showing
every reached stage's short label inline (muted for future
stages). `size="xs"` variant keeps the cramped table-cell
footprint intact (no labels).
Already shipped (just annotation gap in master doc):
A3 EOI "Mark as signed without file" button — line 599 of
interest-eoi-tab.tsx, parent passes onMarkSigned. Master doc
already has `SHIPPED in 52342ee` annotation.
A6 Pageviews vs Sessions explainer — Info popover at line
157-181 of website-analytics-shell.tsx.
A8 BulkAddBerthsWizard CurrencySelect — line 376 (apply-to-all)
+ line 456 (per-row).
Verified: tsc clean, vitest 1454/1454.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
134 lines
4.4 KiB
TypeScript
134 lines
4.4 KiB
TypeScript
'use client';
|
|
|
|
import {
|
|
Area,
|
|
AreaChart,
|
|
CartesianGrid,
|
|
Legend,
|
|
ResponsiveContainer,
|
|
Tooltip,
|
|
XAxis,
|
|
YAxis,
|
|
} from 'recharts';
|
|
|
|
import type { UmamiPageviewsSeries } from '@/lib/services/umami.service';
|
|
|
|
interface Props {
|
|
data: UmamiPageviewsSeries | null;
|
|
}
|
|
|
|
/**
|
|
* Stacks pageviews on top of sessions in a simple area chart. Umami's
|
|
* timeseries comes pre-bucketed (the service picks bucket size based on
|
|
* range span - minute/hour/day/month).
|
|
*
|
|
* X-axis labels are kept short to avoid overflow on dense ranges.
|
|
*/
|
|
export function PageviewsChart({ data }: Props) {
|
|
if (!data || data.pageviews.length === 0) {
|
|
return (
|
|
<div className="flex h-[260px] items-center justify-center text-sm text-muted-foreground">
|
|
No data in this range
|
|
</div>
|
|
);
|
|
}
|
|
|
|
// Merge the two series (Umami returns them separately when `compare` is
|
|
// requested) into one row per bucket so we can drive a single chart.
|
|
// `sessions` is optional on Umami v3 — only present when the request
|
|
// included a comparison directive. Guard the read so an undefined
|
|
// array doesn't crash the chart.
|
|
const byX = new Map<string, { x: string; pageviews: number; sessions: number }>();
|
|
for (const p of data.pageviews) {
|
|
byX.set(p.x, { x: p.x, pageviews: p.y, sessions: 0 });
|
|
}
|
|
for (const s of data.sessions ?? []) {
|
|
const row = byX.get(s.x);
|
|
if (row) row.sessions = s.y;
|
|
else byX.set(s.x, { x: s.x, pageviews: 0, sessions: s.y });
|
|
}
|
|
const merged = Array.from(byX.values()).sort((a, b) => a.x.localeCompare(b.x));
|
|
|
|
return (
|
|
<ResponsiveContainer width="100%" height={260}>
|
|
<AreaChart data={merged} margin={{ top: 8, right: 12, left: 0, bottom: 4 }}>
|
|
<defs>
|
|
<linearGradient id="pvFill" x1="0" y1="0" x2="0" y2="1">
|
|
<stop offset="0%" stopColor="hsl(var(--chart-1))" stopOpacity={0.6} />
|
|
<stop offset="100%" stopColor="hsl(var(--chart-1))" stopOpacity={0.05} />
|
|
</linearGradient>
|
|
<linearGradient id="sessFill" x1="0" y1="0" x2="0" y2="1">
|
|
<stop offset="0%" stopColor="hsl(var(--chart-2))" stopOpacity={0.5} />
|
|
<stop offset="100%" stopColor="hsl(var(--chart-2))" stopOpacity={0.04} />
|
|
</linearGradient>
|
|
</defs>
|
|
<CartesianGrid strokeDasharray="3 3" stroke="hsl(var(--border))" />
|
|
<XAxis
|
|
dataKey="x"
|
|
fontSize={11}
|
|
tick={{ fill: 'hsl(var(--muted-foreground))' }}
|
|
tickFormatter={formatXTick}
|
|
// Anchor first + last ticks then let Recharts thin out the middle —
|
|
// multi-week ranges previously crowded every day-bucket label onto
|
|
// the axis. minTickGap enforces ~52px between rendered ticks.
|
|
interval="preserveStartEnd"
|
|
minTickGap={52}
|
|
/>
|
|
<YAxis
|
|
fontSize={11}
|
|
tick={{ fill: 'hsl(var(--muted-foreground))' }}
|
|
allowDecimals={false}
|
|
/>
|
|
<Tooltip
|
|
contentStyle={{
|
|
background: 'hsl(var(--popover))',
|
|
border: '1px solid hsl(var(--border))',
|
|
borderRadius: '6px',
|
|
fontSize: 12,
|
|
}}
|
|
labelFormatter={formatTooltipLabel}
|
|
/>
|
|
<Legend wrapperStyle={{ fontSize: 12 }} />
|
|
<Area
|
|
type="monotone"
|
|
dataKey="pageviews"
|
|
stroke="hsl(var(--chart-1))"
|
|
fill="url(#pvFill)"
|
|
strokeWidth={2}
|
|
name="Pageviews"
|
|
/>
|
|
<Area
|
|
type="monotone"
|
|
dataKey="sessions"
|
|
stroke="hsl(var(--chart-2))"
|
|
fill="url(#sessFill)"
|
|
strokeWidth={2}
|
|
name="Sessions"
|
|
/>
|
|
</AreaChart>
|
|
</ResponsiveContainer>
|
|
);
|
|
}
|
|
|
|
/** Compact tick labels: drop the timestamp entirely — for multi-day ranges
|
|
* the hour component is meaningless (a "day" bucket aggregates the whole
|
|
* day) and just causes visual crowding. Keep MM-DD. */
|
|
function formatXTick(value: string): string {
|
|
return value.slice(5, 10); // "MM-DD"
|
|
}
|
|
|
|
/** Tooltip header: format "2026-03-30 00:00:00" → "Mar 30, 2026" so the
|
|
* meaningless 00:00:00 timestamp doesn't show. */
|
|
function formatTooltipLabel(value: unknown): string {
|
|
if (typeof value !== 'string') return '';
|
|
const datePart = value.slice(0, 10); // "YYYY-MM-DD"
|
|
const d = new Date(`${datePart}T00:00:00Z`);
|
|
if (isNaN(d.getTime())) return datePart;
|
|
return d.toLocaleDateString('en-US', {
|
|
year: 'numeric',
|
|
month: 'short',
|
|
day: 'numeric',
|
|
timeZone: 'UTC',
|
|
});
|
|
}
|