2026-05-12 14:50:58 +02:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
|
import { Bell, ChevronDown, ShieldAlert } from 'lucide-react';
|
|
|
|
|
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
import { PageHeader } from '@/components/shared/page-header';
|
|
|
|
|
import { AlertsPageShell } from '@/components/alerts/alerts-page-shell';
|
|
|
|
|
import { ReminderList } from '@/components/reminders/reminder-list';
|
|
|
|
|
import { useAlertCount } from '@/components/alerts/use-alerts';
|
2026-06-22 13:49:12 +02:00
|
|
|
import { usePermissions } from '@/hooks/use-permissions';
|
2026-05-12 14:50:58 +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
|
|
|
* Merged "Inbox" surface - replaces the previously-separate /alerts and
|
feat(uat-batch): Group A quick-fixes — 7 items shipped, 5 verified pre-shipped
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>
2026-05-21 21:34:20 +02:00
|
|
|
* /reminders pages. Two stacked sections (Reminders first, Alerts second)
|
2026-05-12 14:50:58 +02:00
|
|
|
* preserve the source distinction (system-flagged vs user-set) while
|
|
|
|
|
* giving reps a single "things demanding my attention" surface.
|
|
|
|
|
*
|
|
|
|
|
* Sections are collapsible; collapsed state persists in localStorage per
|
|
|
|
|
* section so reps can default to the layout they prefer.
|
|
|
|
|
*
|
|
|
|
|
* URL anchors:
|
|
|
|
|
* /inbox#alerts → ensures Alerts section is expanded + scrolls to it
|
|
|
|
|
* /inbox#reminders → ensures Reminders section is expanded + scrolls to it
|
|
|
|
|
*
|
|
|
|
|
* The legacy /alerts and /reminders routes redirect here with the
|
|
|
|
|
* appropriate hash, so old bookmarks land in the right place.
|
|
|
|
|
*/
|
|
|
|
|
export function InboxPageShell() {
|
|
|
|
|
const [alertsOpen, setAlertsOpen] = useState(true);
|
|
|
|
|
const [remindersOpen, setRemindersOpen] = useState(true);
|
|
|
|
|
const { data: alertCount } = useAlertCount();
|
2026-06-22 13:49:12 +02:00
|
|
|
// The deal-alert feed (stale interests, overdue signers, …) is gated on
|
|
|
|
|
// interests.view — operational roles see it; external residential partners
|
|
|
|
|
// don't. Hide the whole section rather than letting its query 403.
|
|
|
|
|
const { can } = usePermissions();
|
|
|
|
|
const canSeeAlerts = can('interests', 'view');
|
2026-05-12 14:50:58 +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
|
|
|
// localStorage hydration on mount - canonical "read from external
|
2026-05-13 11:50:07 +02:00
|
|
|
// store" pattern. setState in effect is intentional.
|
2026-05-12 14:50:58 +02:00
|
|
|
useEffect(() => {
|
|
|
|
|
const a = localStorage.getItem('inbox.alerts.open');
|
|
|
|
|
const r = localStorage.getItem('inbox.reminders.open');
|
2026-05-13 11:50:07 +02:00
|
|
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
2026-05-12 14:50:58 +02:00
|
|
|
if (a === 'false') setAlertsOpen(false);
|
|
|
|
|
if (r === 'false') setRemindersOpen(false);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
// Honor URL hash: ensure the targeted section is expanded then scroll.
|
|
|
|
|
// Runs once on mount AND on hashchange so deep-linking from another tab
|
|
|
|
|
// / page works the same as initial navigation.
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
function applyHash() {
|
|
|
|
|
const hash = window.location.hash.replace('#', '');
|
|
|
|
|
if (hash === 'alerts') {
|
|
|
|
|
setAlertsOpen(true);
|
|
|
|
|
document.getElementById('inbox-section-alerts')?.scrollIntoView({ behavior: 'smooth' });
|
|
|
|
|
} else if (hash === 'reminders') {
|
|
|
|
|
setRemindersOpen(true);
|
|
|
|
|
document.getElementById('inbox-section-reminders')?.scrollIntoView({ behavior: 'smooth' });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
applyHash();
|
|
|
|
|
window.addEventListener('hashchange', applyHash);
|
|
|
|
|
return () => window.removeEventListener('hashchange', applyHash);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
function toggleAlerts() {
|
|
|
|
|
const next = !alertsOpen;
|
|
|
|
|
setAlertsOpen(next);
|
|
|
|
|
localStorage.setItem('inbox.alerts.open', String(next));
|
|
|
|
|
}
|
|
|
|
|
function toggleReminders() {
|
|
|
|
|
const next = !remindersOpen;
|
|
|
|
|
setRemindersOpen(next);
|
|
|
|
|
localStorage.setItem('inbox.reminders.open', String(next));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const activeAlerts = alertCount?.total ?? 0;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-6">
|
|
|
|
|
<PageHeader
|
feat(uat-batch-5): UI polish — dialog width, chart centering, recommender pill, audit link, inbox reorder
Six surgical Wave-2-3 wins:
- UploadForSigningDialog: dialog widened to max-w-[1400px] w-[95vw] so
the place-fields step actually has room; recipient row converts from
fixed grid to flex (name flex-1, email flex-[2] for the longer
string, role w-40, delete shrink-0); invitation-message textarea
rows 3 → 6.
- ChartCard becomes flex-col with flex-1 + items-center on CardContent
so charts vertically center when neighbouring cards make the row
taller (e.g. Pipeline Value's full breakdown).
- Berth recommender pill: drops the "Tier {letter} · " prefix; shows
just the plain-English label ("Open" / "Fall-through" / "Active
interest" / "Late stage") as a Popover trigger that explains the
4-state ladder. HelpCircle icon makes the tooltip discoverable.
- Activity feed gains a "See all" link in the header pointing at
/<port>/admin/audit, permission-gated by `admin.view_audit_log`.
- Inbox section order swaps to Reminders above Alerts (rep-noted
priority); PageHeader title flips to "Reminders & Alerts". Section
ids, deep-link hashes, and localStorage open-state keys untouched.
- Inbox ReminderList (embedded mode only): "New Reminder" button now
shares the filter row (right-aligned via ml-auto) instead of
occupying its own dedicated row above the filters.
tsc clean. 1419/1419 vitest pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 17:28:20 +02:00
|
|
|
title="Reminders & Alerts"
|
2026-05-12 14:50:58 +02:00
|
|
|
eyebrow="Action items"
|
feat(uat-batch-5): UI polish — dialog width, chart centering, recommender pill, audit link, inbox reorder
Six surgical Wave-2-3 wins:
- UploadForSigningDialog: dialog widened to max-w-[1400px] w-[95vw] so
the place-fields step actually has room; recipient row converts from
fixed grid to flex (name flex-1, email flex-[2] for the longer
string, role w-40, delete shrink-0); invitation-message textarea
rows 3 → 6.
- ChartCard becomes flex-col with flex-1 + items-center on CardContent
so charts vertically center when neighbouring cards make the row
taller (e.g. Pipeline Value's full breakdown).
- Berth recommender pill: drops the "Tier {letter} · " prefix; shows
just the plain-English label ("Open" / "Fall-through" / "Active
interest" / "Late stage") as a Popover trigger that explains the
4-state ladder. HelpCircle icon makes the tooltip discoverable.
- Activity feed gains a "See all" link in the header pointing at
/<port>/admin/audit, permission-gated by `admin.view_audit_log`.
- Inbox section order swaps to Reminders above Alerts (rep-noted
priority); PageHeader title flips to "Reminders & Alerts". Section
ids, deep-link hashes, and localStorage open-state keys untouched.
- Inbox ReminderList (embedded mode only): "New Reminder" button now
shares the filter row (right-aligned via ml-auto) instead of
occupying its own dedicated row above the filters.
tsc clean. 1419/1419 vitest pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 17:28:20 +02:00
|
|
|
description="Your scheduled follow-ups plus alerts the system has flagged, in one place."
|
2026-05-12 14:50:58 +02:00
|
|
|
variant="gradient"
|
|
|
|
|
/>
|
|
|
|
|
|
feat(uat-batch-5): UI polish — dialog width, chart centering, recommender pill, audit link, inbox reorder
Six surgical Wave-2-3 wins:
- UploadForSigningDialog: dialog widened to max-w-[1400px] w-[95vw] so
the place-fields step actually has room; recipient row converts from
fixed grid to flex (name flex-1, email flex-[2] for the longer
string, role w-40, delete shrink-0); invitation-message textarea
rows 3 → 6.
- ChartCard becomes flex-col with flex-1 + items-center on CardContent
so charts vertically center when neighbouring cards make the row
taller (e.g. Pipeline Value's full breakdown).
- Berth recommender pill: drops the "Tier {letter} · " prefix; shows
just the plain-English label ("Open" / "Fall-through" / "Active
interest" / "Late stage") as a Popover trigger that explains the
4-state ladder. HelpCircle icon makes the tooltip discoverable.
- Activity feed gains a "See all" link in the header pointing at
/<port>/admin/audit, permission-gated by `admin.view_audit_log`.
- Inbox section order swaps to Reminders above Alerts (rep-noted
priority); PageHeader title flips to "Reminders & Alerts". Section
ids, deep-link hashes, and localStorage open-state keys untouched.
- Inbox ReminderList (embedded mode only): "New Reminder" button now
shares the filter row (right-aligned via ml-auto) instead of
occupying its own dedicated row above the filters.
tsc clean. 1419/1419 vitest pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 17:28:20 +02:00
|
|
|
<section id="inbox-section-reminders" className="rounded-lg border bg-card shadow-xs">
|
|
|
|
|
<SectionHeader
|
|
|
|
|
icon={<Bell className="size-4 text-muted-foreground" aria-hidden />}
|
|
|
|
|
label="Reminders"
|
|
|
|
|
open={remindersOpen}
|
|
|
|
|
onToggle={toggleReminders}
|
|
|
|
|
/>
|
|
|
|
|
{remindersOpen ? (
|
|
|
|
|
<div className="border-t px-4 pb-4 pt-3">
|
|
|
|
|
<ReminderList embedded />
|
|
|
|
|
</div>
|
|
|
|
|
) : null}
|
|
|
|
|
</section>
|
|
|
|
|
|
2026-06-22 13:49:12 +02:00
|
|
|
{canSeeAlerts ? (
|
|
|
|
|
<section id="inbox-section-alerts" className="rounded-lg border bg-card shadow-xs">
|
|
|
|
|
<SectionHeader
|
|
|
|
|
icon={<ShieldAlert className="size-4 text-muted-foreground" aria-hidden />}
|
|
|
|
|
label="Alerts"
|
|
|
|
|
count={activeAlerts}
|
|
|
|
|
open={alertsOpen}
|
|
|
|
|
onToggle={toggleAlerts}
|
|
|
|
|
/>
|
|
|
|
|
{alertsOpen ? (
|
|
|
|
|
<div className="border-t px-4 pb-4 pt-3">
|
|
|
|
|
<AlertsPageShell embedded />
|
|
|
|
|
</div>
|
|
|
|
|
) : null}
|
|
|
|
|
</section>
|
|
|
|
|
) : null}
|
2026-05-12 14:50:58 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SectionHeader({
|
|
|
|
|
icon,
|
|
|
|
|
label,
|
|
|
|
|
count,
|
|
|
|
|
open,
|
|
|
|
|
onToggle,
|
|
|
|
|
}: {
|
|
|
|
|
icon: React.ReactNode;
|
|
|
|
|
label: string;
|
|
|
|
|
count?: number;
|
|
|
|
|
open: boolean;
|
|
|
|
|
onToggle: () => void;
|
|
|
|
|
}) {
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={onToggle}
|
|
|
|
|
aria-expanded={open}
|
|
|
|
|
className={cn(
|
|
|
|
|
'flex w-full items-center justify-between gap-2 px-4 py-3 text-left',
|
|
|
|
|
'min-h-[48px] hover:bg-muted/30',
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<span className="flex items-center gap-2">
|
|
|
|
|
{icon}
|
|
|
|
|
<span className="text-sm font-semibold text-foreground">{label}</span>
|
|
|
|
|
{count !== undefined && count > 0 ? (
|
|
|
|
|
<span className="rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">
|
|
|
|
|
{count}
|
|
|
|
|
</span>
|
|
|
|
|
) : null}
|
|
|
|
|
</span>
|
|
|
|
|
<ChevronDown
|
|
|
|
|
className={cn('size-4 text-muted-foreground transition-transform', open && 'rotate-180')}
|
|
|
|
|
aria-hidden
|
|
|
|
|
/>
|
|
|
|
|
</button>
|
|
|
|
|
);
|
|
|
|
|
}
|