2026-05-05 03:05:22 +02:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { useState } from 'react';
|
|
|
|
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
|
|
|
import { Eye, EyeOff, Loader2 } from 'lucide-react';
|
|
|
|
|
|
|
|
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
|
import {
|
|
|
|
|
Dialog,
|
|
|
|
|
DialogContent,
|
|
|
|
|
DialogDescription,
|
|
|
|
|
DialogFooter,
|
|
|
|
|
DialogHeader,
|
|
|
|
|
DialogTitle,
|
|
|
|
|
} from '@/components/ui/dialog';
|
|
|
|
|
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
|
|
|
|
|
import { Label } from '@/components/ui/label';
|
|
|
|
|
import { apiFetch } from '@/lib/api/client';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
|
|
|
|
|
interface AddBerthToInterestDialogProps {
|
|
|
|
|
interestId: string;
|
|
|
|
|
berth: { berthId: string; mooringNumber: string };
|
|
|
|
|
open: boolean;
|
|
|
|
|
onOpenChange: (open: boolean) => void;
|
|
|
|
|
onAdded?: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RoleChoice = 'specific' | 'exploring';
|
|
|
|
|
|
|
|
|
|
export function AddBerthToInterestDialog({
|
|
|
|
|
interestId,
|
|
|
|
|
berth,
|
|
|
|
|
open,
|
|
|
|
|
onOpenChange,
|
|
|
|
|
onAdded,
|
|
|
|
|
}: AddBerthToInterestDialogProps) {
|
|
|
|
|
const queryClient = useQueryClient();
|
|
|
|
|
const [choice, setChoice] = useState<RoleChoice>('specific');
|
|
|
|
|
|
|
|
|
|
const mutation = useMutation({
|
|
|
|
|
mutationFn: async (isSpecificInterest: boolean) =>
|
|
|
|
|
apiFetch(`/api/v1/interests/${interestId}/berths`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: { berthId: berth.berthId, isSpecificInterest },
|
|
|
|
|
}),
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
// Invalidate the recommender cache + linked-berths cache so both
|
|
|
|
|
// surfaces re-fetch immediately. (See plan §5.3 / §5.5.)
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: ['berth-recommendations', interestId] });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: ['interest-berths', interestId] });
|
|
|
|
|
queryClient.invalidateQueries({ queryKey: ['interests', interestId] });
|
|
|
|
|
onAdded?.();
|
|
|
|
|
onOpenChange(false);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const handleSubmit = () => {
|
|
|
|
|
mutation.mutate(choice === 'specific');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
|
|
|
<DialogContent>
|
|
|
|
|
<DialogHeader>
|
|
|
|
|
<DialogTitle>Add berth {berth.mooringNumber} to interest</DialogTitle>
|
|
|
|
|
<DialogDescription>
|
|
|
|
|
Choose how this berth relates to the deal. This drives whether it shows as “Under
|
|
|
|
|
Offer” on the public map.
|
|
|
|
|
</DialogDescription>
|
|
|
|
|
</DialogHeader>
|
|
|
|
|
|
|
|
|
|
<RadioGroup
|
|
|
|
|
value={choice}
|
|
|
|
|
onValueChange={(v) => setChoice(v as RoleChoice)}
|
|
|
|
|
className="gap-3"
|
|
|
|
|
>
|
|
|
|
|
<RoleCard
|
|
|
|
|
value="specific"
|
|
|
|
|
checked={choice === 'specific'}
|
|
|
|
|
title="Pitching specifically"
|
|
|
|
|
description="The client is pitched on this exact berth."
|
|
|
|
|
consequence="This berth will appear as under interest on the public map."
|
fix(audit-wave-10): aria-hidden sweep on decorative Lucide icons (#69)
Mechanical codemod added \`aria-hidden\` to 444 self-closing single-line
Lucide icon JSX elements across 267 .tsx files in:
- shared/, layout/, dashboard/
- admin/ (all sections)
- clients/, berths/, yachts/, companies/, interests/, documents/
- reminders/, reservations/, residential/, expenses/, email/
The regex targeted only the safe pattern \`<IconName className="..." />\`
(no other props, self-closing, capitalized component name). Every match
inspected is a decorative companion to visible text or sits inside a
button whose accessible name comes from \`aria-label\` / sr-only text
— the icon itself should not be announced.
Screen readers no longer double-read the icon + the adjacent label
text (e.g. "Pencil Pencil Edit" → just "Edit"). The existing
@axe-core/playwright smoke test (\`20-accessibility.spec.ts\`) continues
to pass.
Test suite stays at 1315/1315 vitest. typescript clean.
Closes task #69 (aria-hidden sweep) from the AUDIT-2026-05-12 follow-ups
backlog.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 12:37:22 +02:00
|
|
|
icon={<Eye className="size-4" aria-hidden />}
|
2026-05-05 03:05:22 +02:00
|
|
|
/>
|
|
|
|
|
<RoleCard
|
|
|
|
|
value="exploring"
|
|
|
|
|
checked={choice === 'exploring'}
|
|
|
|
|
title="Just exploring"
|
|
|
|
|
description="The berth is being considered or covered by the EOI bundle, but not pitched specifically."
|
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
|
|
|
consequence="This berth stays marked “Available” on the public map - the link is internal only."
|
fix(audit-wave-10): aria-hidden sweep on decorative Lucide icons (#69)
Mechanical codemod added \`aria-hidden\` to 444 self-closing single-line
Lucide icon JSX elements across 267 .tsx files in:
- shared/, layout/, dashboard/
- admin/ (all sections)
- clients/, berths/, yachts/, companies/, interests/, documents/
- reminders/, reservations/, residential/, expenses/, email/
The regex targeted only the safe pattern \`<IconName className="..." />\`
(no other props, self-closing, capitalized component name). Every match
inspected is a decorative companion to visible text or sits inside a
button whose accessible name comes from \`aria-label\` / sr-only text
— the icon itself should not be announced.
Screen readers no longer double-read the icon + the adjacent label
text (e.g. "Pencil Pencil Edit" → just "Edit"). The existing
@axe-core/playwright smoke test (\`20-accessibility.spec.ts\`) continues
to pass.
Test suite stays at 1315/1315 vitest. typescript clean.
Closes task #69 (aria-hidden sweep) from the AUDIT-2026-05-12 follow-ups
backlog.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 12:37:22 +02:00
|
|
|
icon={<EyeOff className="size-4" aria-hidden />}
|
2026-05-05 03:05:22 +02:00
|
|
|
/>
|
|
|
|
|
</RadioGroup>
|
|
|
|
|
|
|
|
|
|
{mutation.isError ? (
|
|
|
|
|
<p className="text-sm text-destructive">
|
|
|
|
|
{(mutation.error as Error)?.message ?? 'Failed to add berth.'}
|
|
|
|
|
</p>
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
<DialogFooter>
|
|
|
|
|
<Button
|
|
|
|
|
type="button"
|
|
|
|
|
variant="outline"
|
|
|
|
|
onClick={() => onOpenChange(false)}
|
|
|
|
|
disabled={mutation.isPending}
|
|
|
|
|
>
|
|
|
|
|
Cancel
|
|
|
|
|
</Button>
|
|
|
|
|
<Button type="button" onClick={handleSubmit} disabled={mutation.isPending}>
|
fix(audit-wave-10): aria-hidden sweep on decorative Lucide icons (#69)
Mechanical codemod added \`aria-hidden\` to 444 self-closing single-line
Lucide icon JSX elements across 267 .tsx files in:
- shared/, layout/, dashboard/
- admin/ (all sections)
- clients/, berths/, yachts/, companies/, interests/, documents/
- reminders/, reservations/, residential/, expenses/, email/
The regex targeted only the safe pattern \`<IconName className="..." />\`
(no other props, self-closing, capitalized component name). Every match
inspected is a decorative companion to visible text or sits inside a
button whose accessible name comes from \`aria-label\` / sr-only text
— the icon itself should not be announced.
Screen readers no longer double-read the icon + the adjacent label
text (e.g. "Pencil Pencil Edit" → just "Edit"). The existing
@axe-core/playwright smoke test (\`20-accessibility.spec.ts\`) continues
to pass.
Test suite stays at 1315/1315 vitest. typescript clean.
Closes task #69 (aria-hidden sweep) from the AUDIT-2026-05-12 follow-ups
backlog.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 12:37:22 +02:00
|
|
|
{mutation.isPending ? (
|
|
|
|
|
<Loader2 className="mr-1.5 size-3.5 animate-spin" aria-hidden />
|
|
|
|
|
) : null}
|
2026-05-05 03:05:22 +02:00
|
|
|
Add berth to interest
|
|
|
|
|
</Button>
|
|
|
|
|
</DialogFooter>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
</Dialog>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface RoleCardProps {
|
|
|
|
|
value: RoleChoice;
|
|
|
|
|
checked: boolean;
|
|
|
|
|
title: string;
|
|
|
|
|
description: string;
|
|
|
|
|
consequence: string;
|
|
|
|
|
icon: React.ReactNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function RoleCard({ value, checked, title, description, consequence, icon }: RoleCardProps) {
|
|
|
|
|
return (
|
|
|
|
|
<Label
|
|
|
|
|
htmlFor={`role-${value}`}
|
|
|
|
|
className={cn(
|
|
|
|
|
'flex cursor-pointer items-start gap-3 rounded-lg border p-3 transition-colors',
|
|
|
|
|
checked ? 'border-brand-300 bg-brand-50/50 ring-1 ring-brand-200' : 'border-border',
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<RadioGroupItem value={value} id={`role-${value}`} className="mt-1" />
|
|
|
|
|
<div className="flex-1 space-y-1">
|
|
|
|
|
<div className="flex items-center gap-1.5 text-sm font-semibold">
|
|
|
|
|
{icon}
|
|
|
|
|
{title}
|
|
|
|
|
</div>
|
|
|
|
|
<p className="text-xs text-muted-foreground">{description}</p>
|
|
|
|
|
<p className="text-xs font-medium text-foreground/80">{consequence}</p>
|
|
|
|
|
</div>
|
|
|
|
|
</Label>
|
|
|
|
|
);
|
|
|
|
|
}
|