feat(launch-readiness-batch): UAT drains, navigation refactor, launch infra, trackers
Bundles the rest of the in-flight work from this UAT round into one
checkpoint. Each sub-area is independent; see the headings below.
UAT polish (drained 11 findings from active-uat.md):
- Dialog primitive default bumped sm:max-w-xl/lg:max-w-3xl →
sm:max-w-2xl/lg:max-w-4xl so multi-field forms + PDF previews
aren't cramped at 1440-1920px.
- Notes tab badge aggregation: new countFor{Client,Yacht,Company}
Aggregated helpers in notes.service mirror the listFor*Aggregated
symmetric-reach joins. yacht-tabs + company-tabs render the
badge; client-tabs already had badge support.
- Supplemental-info form polish bundle: BrandedAuthShell gains a
`width: 'sm' | 'md'` prop (md uses min-h-dvh scroll instead of
fixed inset-0 pin so long forms scroll naturally). Form picks up
port branding (logoUrl + backgroundUrl + appName) via
loadByToken. Address fields completed (street + city + region +
postal + country). Port name eyebrow + success-state copy added.
- new-document-menu Upload-file landing toast: per-file completion
emits toast.success with action link to the destination entity
or folder.
- interest-tabs OverviewTab "from client" pill on Email + Phone
rows via new EditableRow `inheritedFrom` prop.
- create-document-wizard subject picker → segmented button strip
(5 types visible at once).
Launch infra:
- UTM column wiring (Init 1b step 4): migration
0089_website_submissions_utm.sql adds utm_source/medium/campaign/
term/content + composite index (port_id, utm_source, received_at)
for per-campaign rollups. website-inquiries intake accepts the
five fields. Residential intake intentionally untouched per audit
scope.
- Invoicing module gate (Init 1c spike): new
invoices-module.service + invoices layout guard + registry entry
invoices_module_enabled (default false). Audit conclusion in
launch-readiness.md: payments table is canonical money path;
/invoices flow is parallel infrastructure now hidden by default.
Smart-back navigation refactor:
- Replaced breadcrumb component with history-aware Back button.
New route-labels.ts + use-smart-back hook +
navigation-history-tracker so back falls through to the parent
route when there's no prior page in history.
- Sidebar / topbar / mobile-topbar adopt the new pattern; old
breadcrumb-store kept for back-compat consumers but the
breadcrumbs component is gone.
- 6 detail pages (admin/errors per-id + codes, invoices/
upload-receipts, reports kind, tenancies detail, analytics
metric, client detail) migrated.
Trackers + docs:
- docs/launch-readiness.md — master pre-launch tracker. Includes
the reports gap audit (cross-cutting filter set, Marketing +
Financial blockers, custom builder remaining entities, scheduled
CSV/XLSX, template scope picker).
- docs/superpowers/audits/active-uat.md — 15 findings flipped
OPEN → SHIPPED locally with fix-applied notes; 4 OPEN remaining
(each blocked on user input or cross-repo).
- CLAUDE.md — minor session notes carried forward.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -372,6 +372,14 @@ const GROUPS: AdminGroup[] = [
|
||||
keywords: [
|
||||
'client portal',
|
||||
'client portal enabled',
|
||||
'tenancies',
|
||||
'tenancies module',
|
||||
'tenancy',
|
||||
'tenancy tracker',
|
||||
'lease',
|
||||
'lease windows',
|
||||
'renewals',
|
||||
'transfers',
|
||||
'ai',
|
||||
'ai interest scoring',
|
||||
'ai email drafts',
|
||||
|
||||
@@ -1,22 +1,38 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { useParams } from 'next/navigation';
|
||||
import type { Route } from 'next';
|
||||
import { ArrowRight, Eye, Send } from 'lucide-react';
|
||||
import { ArrowRight, Eye, RefreshCw, Send } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { apiFetch } from '@/lib/api/client';
|
||||
|
||||
interface PreviewResponse {
|
||||
data: { subject: string; html: string };
|
||||
}
|
||||
|
||||
interface TemplateRegistryResponse {
|
||||
data: Array<{ id: string; label: string; description: string }>;
|
||||
}
|
||||
|
||||
// Sentinel value for the Generic preview option. Select forbids empty-string
|
||||
// values, so we use a literal that the GET handler doesn't recognise as a
|
||||
// templateId and falls through to the generic sample.
|
||||
const GENERIC_VALUE = '__generic__';
|
||||
|
||||
/**
|
||||
* Live preview of the branded transactional email shell plus a
|
||||
* "send a test" affordance. Both use the current port's branding so
|
||||
@@ -31,18 +47,45 @@ export function EmailPreviewCard() {
|
||||
const [loadingPreview, setLoadingPreview] = useState(false);
|
||||
const [testEmail, setTestEmail] = useState('');
|
||||
const [sending, setSending] = useState(false);
|
||||
const [templates, setTemplates] = useState<TemplateRegistryResponse['data']>([]);
|
||||
const [templateId, setTemplateId] = useState<string>(GENERIC_VALUE);
|
||||
|
||||
async function refreshPreview() {
|
||||
setLoadingPreview(true);
|
||||
try {
|
||||
const res = await apiFetch<PreviewResponse>('/api/v1/admin/branding/email-preview');
|
||||
setSubject(res.data.subject);
|
||||
setHtml(res.data.html);
|
||||
} catch (err: unknown) {
|
||||
toast.error(err instanceof Error ? err.message : 'Preview failed');
|
||||
} finally {
|
||||
setLoadingPreview(false);
|
||||
}
|
||||
// Pull the registry once on mount so the dropdown reflects every
|
||||
// transactional template the system can emit. The same list backs the
|
||||
// per-template tester on /admin/email - this card surfaces it inline
|
||||
// with the branding controls so the visual feedback loop is tight.
|
||||
useEffect(() => {
|
||||
apiFetch<TemplateRegistryResponse>('/api/v1/admin/email/test-template')
|
||||
.then((res) => setTemplates(res.data))
|
||||
.catch(() => {
|
||||
/* non-fatal - the generic preview still works without the registry */
|
||||
});
|
||||
}, []);
|
||||
|
||||
const refreshPreview = useCallback(
|
||||
async (id: string = templateId) => {
|
||||
setLoadingPreview(true);
|
||||
try {
|
||||
const qs = id === GENERIC_VALUE ? '' : `?templateId=${encodeURIComponent(id)}`;
|
||||
const res = await apiFetch<PreviewResponse>(`/api/v1/admin/branding/email-preview${qs}`);
|
||||
setSubject(res.data.subject);
|
||||
setHtml(res.data.html);
|
||||
} catch (err: unknown) {
|
||||
toast.error(err instanceof Error ? err.message : 'Preview failed');
|
||||
} finally {
|
||||
setLoadingPreview(false);
|
||||
}
|
||||
},
|
||||
[templateId],
|
||||
);
|
||||
|
||||
function onTemplateChange(next: string) {
|
||||
setTemplateId(next);
|
||||
// Auto-refresh when the user picks a different template so they don't
|
||||
// have to chase a separate "Refresh" click for every selection. Save +
|
||||
// re-render of branding fields still requires the visible Refresh
|
||||
// button (we can't auto-detect a save).
|
||||
void refreshPreview(next);
|
||||
}
|
||||
|
||||
async function sendTest() {
|
||||
@@ -51,7 +94,10 @@ export function EmailPreviewCard() {
|
||||
try {
|
||||
await apiFetch('/api/v1/admin/branding/email-preview', {
|
||||
method: 'POST',
|
||||
body: { recipient: testEmail },
|
||||
body: {
|
||||
recipient: testEmail,
|
||||
templateId: templateId === GENERIC_VALUE ? null : templateId,
|
||||
},
|
||||
});
|
||||
toast.success(`Test email queued to ${testEmail}`);
|
||||
} catch (err: unknown) {
|
||||
@@ -68,17 +114,45 @@ export function EmailPreviewCard() {
|
||||
<div>
|
||||
<CardTitle>Preview & test</CardTitle>
|
||||
<CardDescription>
|
||||
Renders a sample transactional email with the current port's branding. Save
|
||||
changes first, then refresh the preview to see them.
|
||||
Renders a sample transactional email with the current port's branding. Switch
|
||||
templates to see how each one looks. Save branding changes first, then click Refresh
|
||||
to pick up the new logo / colour / background.
|
||||
</CardDescription>
|
||||
</div>
|
||||
<Button variant="outline" size="sm" onClick={refreshPreview} disabled={loadingPreview}>
|
||||
<Eye className="mr-1.5 h-4 w-4" />
|
||||
{loadingPreview ? 'Loading…' : html ? 'Refresh preview' : 'Show preview'}
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => refreshPreview()}
|
||||
disabled={loadingPreview}
|
||||
>
|
||||
{html ? (
|
||||
<RefreshCw className="mr-1.5 h-4 w-4" aria-hidden />
|
||||
) : (
|
||||
<Eye className="mr-1.5 h-4 w-4" aria-hidden />
|
||||
)}
|
||||
{loadingPreview ? 'Loading…' : html ? 'Refresh' : 'Show preview'}
|
||||
</Button>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Label htmlFor="template-select" className="text-xs font-medium text-muted-foreground">
|
||||
Template
|
||||
</Label>
|
||||
<Select value={templateId} onValueChange={onTemplateChange}>
|
||||
<SelectTrigger id="template-select" className="w-full sm:w-[320px]">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value={GENERIC_VALUE}>Generic sample (branding only)</SelectItem>
|
||||
{templates.map((t) => (
|
||||
<SelectItem key={t.id} value={t.id}>
|
||||
{t.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
{html ? (
|
||||
<div className="space-y-2">
|
||||
<div className="text-xs text-muted-foreground">
|
||||
|
||||
@@ -55,6 +55,14 @@ const KNOWN_SETTINGS: Array<{
|
||||
type: 'boolean',
|
||||
defaultValue: false,
|
||||
},
|
||||
{
|
||||
key: 'expenses_module_enabled',
|
||||
label: 'Expenses Module',
|
||||
description:
|
||||
'Enable the expenses + receipt-upload surface for this port. Disabling hides both sidebar entries (Expenses and How to upload receipts) and blocks the routes with a "module disabled" page, so bookmarks land somewhere meaningful instead of 404-ing. Previously-recorded expense rows are preserved if you re-enable.',
|
||||
type: 'boolean',
|
||||
defaultValue: true,
|
||||
},
|
||||
{
|
||||
key: 'ai_interest_scoring',
|
||||
label: 'AI Interest Scoring',
|
||||
|
||||
Reference in New Issue
Block a user