feat(uat-b1): ship Wave A-E of Bucket 1 audit findings
Wave A (Interest+EOI form quick wins): - Auto-select yacht after inline-create from interest form - EOI generate dialog: "View EOI" action toast - Interest form berth picker: formatBerthRange compact label - Remove "Generate EOI" button from Documents tab (clean removal) - Interest auto-assign: only sales_agent/sales_manager auto-claim ownership on create (explicit role check via user_port_roles join) - LinkedBerthRowItem dims: drop "D" suffix + "L × W" format - ExternalEoiUploadDialog: prefillSignatories prop threaded from active EOI signers - EOI signature progress on Overview milestone card footer Wave B (a11y + i18n sweeps): - aria-live on supplemental-info error state - text-[10px] -> text-xs in client-pipeline-summary - Currency formatter: locale default removed (Intl uses runtime) - en-US/en-GB hardcoded toLocaleString swept across 13 components Wave C (Primary berth always in EOI bundle): - Service guard strengthened on update path - Migration 0083 backfills historical primary rows Wave D (Onboarding super_admin discoverability): - /api/v1/admin/onboarding/status endpoint + shared service - Topbar OnboardingBanner (super_admin, session-dismissible) - OnboardingTile dashboard widget (rail group, self-hides at 100%) - Celebration toast + invalidate of shared status on last tick Wave E (Branded post-completion email idempotency): - Verified handleDocumentCompleted already owns the email fan-out - Added regression test for the polling path + idempotency Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,8 +30,8 @@ function rangeLabel(range: DateRange): string {
|
||||
year: 'numeric',
|
||||
timeZone: 'UTC',
|
||||
};
|
||||
const from = new Date(`${range.from}T00:00:00.000Z`).toLocaleDateString('en-US', fmt);
|
||||
const to = new Date(`${range.to}T00:00:00.000Z`).toLocaleDateString('en-US', fmt);
|
||||
const from = new Date(`${range.from}T00:00:00.000Z`).toLocaleDateString(undefined, fmt);
|
||||
const to = new Date(`${range.to}T00:00:00.000Z`).toLocaleDateString(undefined, fmt);
|
||||
return `${from} – ${to}`;
|
||||
}
|
||||
return PRESET_LABELS[range];
|
||||
|
||||
@@ -32,7 +32,7 @@ function formatCustom(range: { from: string; to: string }): string {
|
||||
const fmt: Intl.DateTimeFormatOptions = sameYear
|
||||
? { month: 'short', day: 'numeric', timeZone: 'UTC' }
|
||||
: { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC' };
|
||||
return `${from.toLocaleDateString('en-US', fmt)} – ${to.toLocaleDateString('en-US', fmt)}`;
|
||||
return `${from.toLocaleDateString(undefined, fmt)} – ${to.toLocaleDateString(undefined, fmt)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
83
src/components/dashboard/onboarding-tile.tsx
Normal file
83
src/components/dashboard/onboarding-tile.tsx
Normal file
@@ -0,0 +1,83 @@
|
||||
'use client';
|
||||
|
||||
import Link from 'next/link';
|
||||
import { useParams } from 'next/navigation';
|
||||
import { ChevronRight, Sparkles } from 'lucide-react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Progress } from '@/components/ui/progress';
|
||||
import { usePermissions } from '@/hooks/use-permissions';
|
||||
import { useOnboardingStatus } from '@/hooks/use-onboarding-status';
|
||||
|
||||
/**
|
||||
* Compact dashboard tile that surfaces onboarding progress for super_admins
|
||||
* while the checklist is incomplete. Collapses (returns null) once setup is
|
||||
* 100% complete so the dashboard doesn't stay cluttered after the org is
|
||||
* past the initial onboarding phase. Non-super-admin users never see it.
|
||||
*/
|
||||
export function OnboardingTile() {
|
||||
const params = useParams<{ portSlug: string }>();
|
||||
const portSlug = params?.portSlug ?? '';
|
||||
const { isSuperAdmin } = usePermissions();
|
||||
const { data, isLoading } = useOnboardingStatus({ enabled: isSuperAdmin });
|
||||
|
||||
if (!isSuperAdmin) return null;
|
||||
if (isLoading) {
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2 text-sm">
|
||||
<Sparkles className="size-4 text-brand-600" aria-hidden />
|
||||
Setup checklist
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Progress value={0} className="h-2" />
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
if (!data || data.isComplete) return null;
|
||||
|
||||
return (
|
||||
<Card className="border-brand-200 bg-brand-50/30">
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="flex items-center gap-2 text-sm">
|
||||
<Sparkles className="size-4 text-brand-600" aria-hidden />
|
||||
Setup checklist
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3">
|
||||
<div className="space-y-1">
|
||||
<Progress value={data.percent} className="h-2" />
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{data.completed} of {data.total} steps complete ({data.percent}%)
|
||||
</p>
|
||||
</div>
|
||||
{data.nextStep ? (
|
||||
<div className="rounded-md border border-dashed border-brand-200 bg-white/60 p-2">
|
||||
<p className="text-[10px] font-semibold uppercase tracking-wide text-brand-700">
|
||||
Next step
|
||||
</p>
|
||||
<p className="mt-0.5 text-xs text-foreground">{data.nextStep.label}</p>
|
||||
</div>
|
||||
) : null}
|
||||
{portSlug ? (
|
||||
<Button asChild size="sm" variant="outline" className="w-full">
|
||||
<Link
|
||||
href={
|
||||
(data.nextStep
|
||||
? `/${portSlug}/admin/${data.nextStep.href}`
|
||||
: `/${portSlug}/admin/onboarding`) as never
|
||||
}
|
||||
>
|
||||
{data.nextStep ? 'Continue setup' : 'Open checklist'}
|
||||
<ChevronRight className="ml-1 size-3" aria-hidden />
|
||||
</Link>
|
||||
</Button>
|
||||
) : null}
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import dynamic from 'next/dynamic';
|
||||
|
||||
import { ActiveDealsTile } from './active-deals-tile';
|
||||
import { ActivityFeed } from './activity-feed';
|
||||
import { OnboardingTile } from './onboarding-tile';
|
||||
import { BerthHeatWidget } from './berth-heat-widget';
|
||||
import { ClientsByCountryWidget } from './clients-by-country-widget';
|
||||
import { HotDealsCard } from './hot-deals-card';
|
||||
@@ -105,6 +106,19 @@ export interface DashboardWidget {
|
||||
}
|
||||
|
||||
export const DASHBOARD_WIDGETS: readonly DashboardWidget[] = [
|
||||
// ── Onboarding (rail, super_admin-only) ─────────────────────────────
|
||||
// Self-collapses when the checklist hits 100% and self-hides for
|
||||
// non-super-admin users so most reps never see this tile at all.
|
||||
{
|
||||
id: 'onboarding_checklist',
|
||||
label: 'Setup checklist',
|
||||
description:
|
||||
'Progress + next-step nudge while the org is still going through Documenso / branding / users setup. Hidden once 100% complete.',
|
||||
render: () => <OnboardingTile />,
|
||||
group: 'rail',
|
||||
defaultVisible: true,
|
||||
},
|
||||
|
||||
// ── KPI tiles (rail) ────────────────────────────────────────────────
|
||||
// Off by default - keep the existing dashboard layout unchanged for
|
||||
// users on first paint after the upgrade; reps can flip them on from
|
||||
|
||||
Reference in New Issue
Block a user