import { redirect } from 'next/navigation'; import { Sailboat } from 'lucide-react'; import type { Metadata } from 'next'; import { getPortalSession } from '@/lib/portal/auth'; import { getPortalUserYachts } from '@/lib/services/portal.service'; import { Badge } from '@/components/ui/badge'; export const metadata: Metadata = { title: 'My Yachts' }; const STATUS_COLORS: Record = { active: 'default', retired: 'secondary', sold_away: 'outline', }; export default async function PortalMyYachtsPage() { const session = await getPortalSession(); if (!session) redirect('/portal/login'); const yachts = await getPortalUserYachts(session.clientId, session.portId); return (

My Yachts

Vessels you own directly or through a company

{yachts.length === 0 ? (

No yachts on file

Yachts owned by you or a company you are a member of will appear here.

) : (
{yachts.map((y) => (

{y.name}

{y.hullNumber ? `Hull ${y.hullNumber}` : 'No hull number'} {y.flag ? ` · ${y.flag}` : ''} {y.yearBuilt ? ` · ${y.yearBuilt}` : ''}

{y.ownerContext === 'company' && y.ownerCompanyName && (

Owned by {y.ownerCompanyName}

)}
{y.status.replace(/_/g, ' ')}
{(y.lengthFt || y.widthFt || y.registration) && (
{y.registration && Reg: {y.registration}} {y.lengthFt && Length: {y.lengthFt}ft} {y.widthFt && Beam: {y.widthFt}ft}
)}
))}
)}
); }