2026-05-12 14:50:58 +02:00
|
|
|
'use client';
|
|
|
|
|
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
import { useMemo, useSyncExternalStore } from 'react';
|
2026-05-12 14:50:58 +02:00
|
|
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
|
|
|
|
|
|
|
|
import { apiFetch } from '@/lib/api/client';
|
|
|
|
|
import { DASHBOARD_WIDGETS, type DashboardWidget } from '@/components/dashboard/widget-registry';
|
|
|
|
|
import { useDashboardIntegrations } from '@/hooks/use-dashboard-integrations';
|
|
|
|
|
|
|
|
|
|
interface PreferencesResponse {
|
|
|
|
|
data?: {
|
|
|
|
|
dashboardWidgets?: Record<string, boolean>;
|
2026-05-21 23:32:21 +02:00
|
|
|
/**
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
* Ordered widget ids for the desktop (xl, >= 1280px) split layout.
|
|
|
|
|
* When present, visible widgets are sorted by this order first;
|
|
|
|
|
* unlisted widgets fall through to the registry's declared order.
|
2026-05-21 23:32:21 +02:00
|
|
|
*/
|
|
|
|
|
dashboardWidgetOrder?: string[];
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
/**
|
|
|
|
|
* Ordered widget ids for the stacked layout (< 1280px). Falls back
|
|
|
|
|
* to `dashboardWidgetOrder` then registry order when unset.
|
|
|
|
|
*/
|
|
|
|
|
dashboardWidgetOrderMobile?: string[];
|
2026-05-12 14:50:58 +02:00
|
|
|
// Other fields exist (timezone, locale, …) but we don't need them
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
// here - the typed access is intentionally narrow.
|
2026-05-12 14:50:58 +02:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-12 16:14:12 +02:00
|
|
|
interface UseDashboardWidgetsOptions {
|
|
|
|
|
/** SSR-prefetched visibility map. When provided, seeds the react-query
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
* cache so the first render uses the rep's saved layout - no reflow when
|
2026-05-12 16:14:12 +02:00
|
|
|
* the client fetch resolves. Pass `null` (not `undefined`) when the
|
|
|
|
|
* caller has confirmed there is no stored preference so we don't keep
|
|
|
|
|
* showing the loading layout. */
|
|
|
|
|
initialVisibility?: Record<string, boolean> | null;
|
|
|
|
|
}
|
|
|
|
|
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
// xl breakpoint matches Tailwind's `xl:` modifier and the dashboard
|
|
|
|
|
// shell's actual layout-flip point (charts | rails side-by-side at
|
|
|
|
|
// >= 1280, stacked below). Reading from `useSyncExternalStore` keeps
|
|
|
|
|
// renders pure so the React Compiler can lift the call.
|
|
|
|
|
const XL_QUERY = '(min-width: 1280px)';
|
|
|
|
|
function subscribeXl(callback: () => void): () => void {
|
|
|
|
|
if (typeof window === 'undefined') return () => {};
|
|
|
|
|
const mq = window.matchMedia(XL_QUERY);
|
|
|
|
|
mq.addEventListener('change', callback);
|
|
|
|
|
return () => mq.removeEventListener('change', callback);
|
|
|
|
|
}
|
|
|
|
|
function getXlSnapshot(): boolean {
|
|
|
|
|
return window.matchMedia(XL_QUERY).matches;
|
|
|
|
|
}
|
|
|
|
|
function getXlServerSnapshot(): boolean {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
function useIsXlLayout(): boolean {
|
|
|
|
|
return useSyncExternalStore(subscribeXl, getXlSnapshot, getXlServerSnapshot);
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-12 14:50:58 +02:00
|
|
|
/**
|
|
|
|
|
* Returns the dashboard widget list filtered by the user's visibility
|
|
|
|
|
* preferences and exposes a toggle. Single source of truth for "what's
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
* showing on the dashboard right now" - used by both `DashboardShell`
|
2026-05-12 14:50:58 +02:00
|
|
|
* and the settings UI.
|
|
|
|
|
*
|
|
|
|
|
* Stored shape: `preferences.dashboardWidgets: { [widgetId]: boolean }`.
|
|
|
|
|
* Missing keys fall back to the registry's `defaultVisible`, so a newly
|
|
|
|
|
* added widget surfaces for everyone without a migration.
|
|
|
|
|
*/
|
2026-05-12 16:14:12 +02:00
|
|
|
export function useDashboardWidgets(options: UseDashboardWidgetsOptions = {}) {
|
2026-05-12 14:50:58 +02:00
|
|
|
const queryClient = useQueryClient();
|
|
|
|
|
const integrations = useDashboardIntegrations();
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
const isXl = useIsXlLayout();
|
2026-05-12 14:50:58 +02:00
|
|
|
|
|
|
|
|
const { data, isLoading } = useQuery<PreferencesResponse>({
|
|
|
|
|
queryKey: ['me', 'preferences', 'dashboard-widgets'],
|
|
|
|
|
queryFn: () => apiFetch<PreferencesResponse>('/api/v1/users/me/preferences'),
|
|
|
|
|
staleTime: 60_000,
|
2026-05-12 16:14:12 +02:00
|
|
|
initialData:
|
|
|
|
|
options.initialVisibility !== undefined
|
|
|
|
|
? ({ data: { dashboardWidgets: options.initialVisibility ?? {} } } as PreferencesResponse)
|
|
|
|
|
: undefined,
|
2026-05-12 14:50:58 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// The registry is the universe of declared widgets. `availableWidgets`
|
|
|
|
|
// is the universe filtered down to what actually CAN render right now
|
|
|
|
|
// (i.e. its required integration is connected). The picker iterates
|
|
|
|
|
// this list, and the visible-widgets render path filters off the same
|
|
|
|
|
// list so flipping on a widget whose service isn't wired up does
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
// nothing silently - the toggle simply isn't shown.
|
2026-05-12 14:50:58 +02:00
|
|
|
const availableWidgets: DashboardWidget[] = useMemo(
|
feat: round 2 — stage prompts, berth header, EOI inline edit, measurement units
Berth surfaces
- New compact mooring-chip header (colored plate + status pill, dock-label
in tooltip) replaces the redundant "Berth B1 / Sold / B DOCK" stack
- Berth list gains a "Latest deal stage" column showing the most-advanced
pipeline stage of any active linked interest (server-aggregated, ranks by
PIPELINE_STAGES index)
- "Linked prospect" Select on the status-change dialog rebuilt as a Command
combobox: search, recent-first sort, stage-coloured pills
Pipeline UX
- Reverting an interest to Open with linked berths now prompts: keep the
links, unlink and reset, or cancel. Silent when no berths are linked
- Activity feed + entity-activity feed normalise enum field values via
STAGE_LABELS / formatSource: "deposit_10pct → contract_sent" reads as
"10% Deposit → Contract Sent"
EOI generate dialog
- Inline-editable rows for client name, nationality (country combobox), and
yacht name — pencil affordance saves directly via clients/yachts PATCH
- Replaces the single "Edit on client's page" link with two contextual links
framed by short copy explaining what's inline vs what needs the canonical
page
- Backend EoiContext now includes client.id + yacht.id so the dialog can
PATCH without an extra round-trip
Company form
- New "Connections" section lets the rep attach members (clients) and yachts
during create. Yacht attach uses the existing transfer endpoint so audit
log + ownership history capture the change
- Inline "+ New client" / "+ New yacht" buttons open the canonical forms
stacked over the company sheet
- After save, the form chains to a yacht pull-in prompt (if any attached
client owns yachts not yet linked) and an optional "Create interest" step
pre-filled with the first attached client
Admin
- /admin landing gains a searchable index — typed query flattens groups into
a result list matching label + description + group title
- "Documenso & EOI" card relabelled to "EOI signing service" (consistent
with the user-facing language rename from round 1)
Measurement units (migration 0053)
- interests gains desired_*_m columns + desired_*_unit discriminators so
the rep's literal entry (ft OR m) is preserved verbatim instead of being
reconstructed from a single canonical column on every render
- yachts + berths gain matching *_unit columns alongside their existing
ft + m pairs; defaults to 'ft' so legacy rows still render normally
- Interest form POST/PATCH now sends both ft + m + unit; computed m is
derived from the ft canonical to keep the recommender SQL unchanged
Misc
- Active-deals tile + topbar type their Link href as `Route` instead of `any`
- Unused REPORT_TYPE_LABELS const dropped from generate-report-form
- Test fixtures (fill-eoi-form, documenso-payload, public-berths) updated
to include the new id + unit fields on the EoiContext / Berth shapes
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 15:28:22 +02:00
|
|
|
() => DASHBOARD_WIDGETS.filter((w) => !w.requires || integrations.available[w.requires]),
|
2026-05-12 14:50:58 +02:00
|
|
|
[integrations],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const visibility: Record<string, boolean> = useMemo(() => {
|
|
|
|
|
const stored = data?.data?.dashboardWidgets ?? {};
|
|
|
|
|
const merged: Record<string, boolean> = {};
|
|
|
|
|
for (const w of availableWidgets) {
|
|
|
|
|
merged[w.id] = stored[w.id] ?? w.defaultVisible;
|
|
|
|
|
}
|
|
|
|
|
return merged;
|
|
|
|
|
}, [data, availableWidgets]);
|
|
|
|
|
|
2026-05-21 23:32:21 +02:00
|
|
|
// Order map: widgetId → rank. Unlisted widgets get +Infinity so they
|
|
|
|
|
// fall after the explicitly-ordered ones in stable registry order.
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
// The active list is the viewport-matched one; the stacked layout
|
|
|
|
|
// (< xl) falls back to the desktop order when the rep hasn't yet
|
|
|
|
|
// customized mobile, so a partially-configured user sees consistent
|
|
|
|
|
// ordering across devices instead of an unstyled jumble.
|
2026-05-21 23:32:21 +02:00
|
|
|
const orderRank: Record<string, number> = useMemo(() => {
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
const desktopOrder = data?.data?.dashboardWidgetOrder ?? [];
|
|
|
|
|
const mobileOrder = data?.data?.dashboardWidgetOrderMobile;
|
|
|
|
|
const order = isXl ? desktopOrder : (mobileOrder ?? desktopOrder);
|
2026-05-21 23:32:21 +02:00
|
|
|
const map: Record<string, number> = {};
|
|
|
|
|
order.forEach((id, idx) => {
|
|
|
|
|
map[id] = idx;
|
|
|
|
|
});
|
|
|
|
|
return map;
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
}, [data, isXl]);
|
2026-05-21 23:32:21 +02:00
|
|
|
|
|
|
|
|
const visibleWidgets: DashboardWidget[] = useMemo(() => {
|
|
|
|
|
const visible = availableWidgets.filter((w) => visibility[w.id]);
|
|
|
|
|
return visible.sort((a, b) => {
|
|
|
|
|
const ra = orderRank[a.id] ?? Number.POSITIVE_INFINITY;
|
|
|
|
|
const rb = orderRank[b.id] ?? Number.POSITIVE_INFINITY;
|
|
|
|
|
if (ra !== rb) return ra - rb;
|
|
|
|
|
// Tie-break by registry index so the original order surfaces for
|
|
|
|
|
// widgets the rep hasn't explicitly placed.
|
|
|
|
|
return availableWidgets.indexOf(a) - availableWidgets.indexOf(b);
|
|
|
|
|
});
|
|
|
|
|
}, [availableWidgets, visibility, orderRank]);
|
2026-05-12 14:50:58 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Persists a single widget's visibility. Optimistically updates the
|
|
|
|
|
* cache so the dashboard reflows instantly; the server PATCH races in
|
|
|
|
|
* the background. On failure the cache invalidates and re-reads the
|
|
|
|
|
* authoritative value.
|
|
|
|
|
*/
|
|
|
|
|
const mutation = useMutation({
|
|
|
|
|
mutationFn: async (next: Record<string, boolean>) =>
|
|
|
|
|
apiFetch<PreferencesResponse>('/api/v1/users/me/preferences', {
|
|
|
|
|
method: 'PATCH',
|
|
|
|
|
body: { dashboardWidgets: next },
|
|
|
|
|
}),
|
|
|
|
|
onMutate: async (next) => {
|
|
|
|
|
await queryClient.cancelQueries({ queryKey: ['me', 'preferences', 'dashboard-widgets'] });
|
|
|
|
|
const previous = queryClient.getQueryData<PreferencesResponse>([
|
|
|
|
|
'me',
|
|
|
|
|
'preferences',
|
|
|
|
|
'dashboard-widgets',
|
|
|
|
|
]);
|
|
|
|
|
queryClient.setQueryData<PreferencesResponse>(
|
|
|
|
|
['me', 'preferences', 'dashboard-widgets'],
|
|
|
|
|
(old) => ({
|
|
|
|
|
data: { ...(old?.data ?? {}), dashboardWidgets: next },
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
return { previous };
|
|
|
|
|
},
|
|
|
|
|
onError: (_err, _next, ctx) => {
|
|
|
|
|
if (ctx?.previous) {
|
|
|
|
|
queryClient.setQueryData(['me', 'preferences', 'dashboard-widgets'], ctx.previous);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onSettled: () => {
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: ['me', 'preferences', 'dashboard-widgets'] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function setVisible(id: string, visible: boolean) {
|
|
|
|
|
mutation.mutate({ ...visibility, [id]: visible });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setAll(visible: boolean) {
|
|
|
|
|
const next: Record<string, boolean> = {};
|
|
|
|
|
for (const w of availableWidgets) next[w.id] = visible;
|
|
|
|
|
mutation.mutate(next);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Restores each widget's visibility to its registry `defaultVisible`.
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
* Different from `setAll(true)` - it keeps the "off by default" widgets
|
2026-05-12 14:50:58 +02:00
|
|
|
* (KPI tiles, Berth Status donut, Source Conversion, Hot Deals) off so
|
|
|
|
|
* reps end up with the original out-of-the-box dashboard. Scoped to
|
|
|
|
|
* `availableWidgets` so disconnected integrations don't sneak in.
|
|
|
|
|
*/
|
|
|
|
|
function resetToDefaults() {
|
|
|
|
|
const next: Record<string, boolean> = {};
|
|
|
|
|
for (const w of availableWidgets) next[w.id] = w.defaultVisible;
|
|
|
|
|
mutation.mutate(next);
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-21 23:32:21 +02:00
|
|
|
// Persist the order list. Optimistic so the dashboard reflows on
|
|
|
|
|
// drop; the PATCH races behind. Falls back to invalidating on error.
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
// The mutation accepts a `{ scope }` so it writes to the right field
|
|
|
|
|
// (xl → dashboardWidgetOrder, stacked → dashboardWidgetOrderMobile).
|
2026-05-21 23:32:21 +02:00
|
|
|
const orderMutation = useMutation({
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
mutationFn: async ({
|
|
|
|
|
nextOrder,
|
|
|
|
|
scope,
|
|
|
|
|
}: {
|
|
|
|
|
nextOrder: string[];
|
|
|
|
|
scope: 'desktop' | 'mobile';
|
|
|
|
|
}) =>
|
2026-05-21 23:32:21 +02:00
|
|
|
apiFetch<PreferencesResponse>('/api/v1/users/me/preferences', {
|
|
|
|
|
method: 'PATCH',
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
body:
|
|
|
|
|
scope === 'desktop'
|
|
|
|
|
? { dashboardWidgetOrder: nextOrder }
|
|
|
|
|
: { dashboardWidgetOrderMobile: nextOrder },
|
2026-05-21 23:32:21 +02:00
|
|
|
}),
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
onMutate: async ({ nextOrder, scope }) => {
|
2026-05-21 23:32:21 +02:00
|
|
|
await queryClient.cancelQueries({ queryKey: ['me', 'preferences', 'dashboard-widgets'] });
|
|
|
|
|
const previous = queryClient.getQueryData<PreferencesResponse>([
|
|
|
|
|
'me',
|
|
|
|
|
'preferences',
|
|
|
|
|
'dashboard-widgets',
|
|
|
|
|
]);
|
|
|
|
|
queryClient.setQueryData<PreferencesResponse>(
|
|
|
|
|
['me', 'preferences', 'dashboard-widgets'],
|
|
|
|
|
(old) => ({
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
data: {
|
|
|
|
|
...(old?.data ?? {}),
|
|
|
|
|
...(scope === 'desktop'
|
|
|
|
|
? { dashboardWidgetOrder: nextOrder }
|
|
|
|
|
: { dashboardWidgetOrderMobile: nextOrder }),
|
|
|
|
|
},
|
2026-05-21 23:32:21 +02:00
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
return { previous };
|
|
|
|
|
},
|
|
|
|
|
onError: (_err, _next, ctx) => {
|
|
|
|
|
if (ctx?.previous) {
|
|
|
|
|
queryClient.setQueryData(['me', 'preferences', 'dashboard-widgets'], ctx.previous);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onSettled: () => {
|
|
|
|
|
void queryClient.invalidateQueries({ queryKey: ['me', 'preferences', 'dashboard-widgets'] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
/**
|
|
|
|
|
* Persist a new visible-widget order to the field that matches the
|
|
|
|
|
* current viewport - desktop (xl+) gets one order, the stacked layout
|
|
|
|
|
* gets its own. The hook decides the scope based on `useIsXlLayout()`
|
|
|
|
|
* so callers (the modal) don't need to repeat the breakpoint logic.
|
|
|
|
|
*/
|
2026-05-21 23:32:21 +02:00
|
|
|
function setOrder(nextOrder: string[]) {
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
orderMutation.mutate({ nextOrder, scope: isXl ? 'desktop' : 'mobile' });
|
2026-05-21 23:32:21 +02:00
|
|
|
}
|
|
|
|
|
|
2026-05-12 14:50:58 +02:00
|
|
|
return {
|
|
|
|
|
isLoading,
|
|
|
|
|
/**
|
|
|
|
|
* Widgets that can render right now (registry minus those whose
|
|
|
|
|
* required integration isn't connected). Use this for the picker
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
* AND for the dashboard render - both surfaces stay in sync.
|
2026-05-12 14:50:58 +02:00
|
|
|
*/
|
|
|
|
|
allWidgets: availableWidgets,
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
/** Visible widgets, sorted by the rep's order for the active
|
|
|
|
|
* layout tier (desktop vs stacked) then by registry index. */
|
2026-05-12 14:50:58 +02:00
|
|
|
visibleWidgets,
|
chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged:
- Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances)
- country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that
never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk
after the per-subpath dynamic-import approach silently failed in webpack)
- Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index,
redirects (ocr to ai, reports to dashboard, invitations to users),
docs/admin-ia-proposal.md
- Per-template email tester (registry + endpoint + UI on Email admin page)
- Cancel-document mode picker (delete-from-Documenso vs keep-for-audit)
- Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers
- Customize-widgets per-region sortables at xl+ (charts/rails/feed); single
flat sortable below xl when the layout stacks; per-viewport saved orders
- Audit doc updates capturing each shipped item
- Lint fixes: react-compiler immutability in DonutChart (reduce instead of
let-reassign), set-state-in-effect disables in CountryFlag and
UploadForSigning preview-bytes effect, unused 'confirm' destructures in
interest contract + reservation tabs, unescaped apostrophe in test-template
card copy
2026-05-23 00:52:59 +02:00
|
|
|
/** True when the dashboard's xl two-column layout is active. Lets
|
|
|
|
|
* callers (the customize modal) tailor copy and split into region-
|
|
|
|
|
* scoped sortables vs a single flat list. */
|
|
|
|
|
isXlLayout: isXl,
|
2026-05-12 14:50:58 +02:00
|
|
|
/** Map of widgetId → visible. Use for switch state binding. */
|
|
|
|
|
visibility,
|
2026-05-21 23:32:21 +02:00
|
|
|
/** Current rank per widget id (for SortableContext keying). */
|
|
|
|
|
orderRank,
|
2026-05-12 14:50:58 +02:00
|
|
|
setVisible,
|
|
|
|
|
setAll,
|
2026-05-21 23:32:21 +02:00
|
|
|
setOrder,
|
2026-05-12 14:50:58 +02:00
|
|
|
resetToDefaults,
|
2026-05-21 23:32:21 +02:00
|
|
|
isSaving: mutation.isPending || orderMutation.isPending,
|
2026-05-12 14:50:58 +02:00
|
|
|
};
|
|
|
|
|
}
|