feat(interests): EOI/contract/reservation tabs + contact log + berth interest milestone + interest list overhaul
Major interest workflow expansion driven by the rapid-fire UX session.
EOI / Contract / Reservation tabs replace the generic Documents tab when
the deal is at the relevant stage — workspace pattern with active-doc
hero, signing progress, paper-signed upload, and history strip. Stage-
conditional visibility wired through interest-tabs.tsx so the tab set
shrinks/expands as the deal moves through the pipeline.
Contact log: per-interaction structured log (channel/direction/summary/
optional follow-up reminder). New `interest_contact_log` table + service
+ tab UI (timeline with channel-coded icons + compose dialog).
auto-creates a reminder when followUpAt is set.
Berth Interest milestone: first milestone in the OverviewTab's pipeline
strip, completes the moment any berth is linked via the junction. Drives
the "have we captured what they want?" sanity check for general_interest
leads before they move to EOI.
Stage-conditional milestones: past phases collapse into a one-liner
strip, current phase expands, future phases hide behind a "Show
upcoming" toggle. Inline stage picker now defers reason capture to an
override-confirm view (only required for illegal transitions, not the
default flow).
Notes blob → threaded: dropped `interests.notes` column entirely; the
threaded `interest_notes` table is the single source of truth. Latest-
note teaser on Overview links into the dedicated Notes tab. Polymorphic
notes service gains aggregated client view (unions client + interest +
yacht notes with source chips and group-by-source toggle).
Berth interest list overhaul:
- Configurable columns via ColumnPicker (18 toggleable, 5 default-on)
- Natural-sort SQL ORDER BY on mooring number (A1, A2, A10 not A10, A2)
- Per-letter row tinting via colored left-border accent + dot in cell
- Documents tab merged Files (single attachments section)
Topbar improvements:
- Always-visible back arrow on detail pages (path depth > 2)
- Breadcrumb-hint store + useBreadcrumbHint hook so detail pages can
push their entity hierarchy (Clients › Mary Smith › Interest › B17)
- Tighter spacing, softer separators, 160px crumb truncation
DataTable upgrades:
- Page-size selector with All option (validator cap raised to 1000)
- getRowClassName slot for per-row styling (used by berth tinting)
- Fixed Radix SelectItem crash on empty-string values via __any__
sentinel (was crashing every list page that opened a select filter)
Interest list:
- Configurable columns picker
- Stage cell clickable into detail
- TagPicker + SavedViewsDropdown sized h-8 to match adjacent buttons
- Save view moved into ColumnPicker menu; Views button hidden when
no views are saved
- Pipeline kanban board endpoint at /api/v1/interests/board with
minimal projection, 5000-row cap + truncated banner, filter
pass-through
Mobile chrome + sidebar collapse removed (always-expanded design choice).
User management lists super-admins (was inner-joined on user_port_roles
which excluded global super-admins).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
type ColumnDef,
|
||||
type Row,
|
||||
type RowSelectionState,
|
||||
type VisibilityState,
|
||||
} from '@tanstack/react-table';
|
||||
import { ArrowDown, ArrowUp, ArrowUpDown, Loader2 } from 'lucide-react';
|
||||
|
||||
@@ -51,6 +52,12 @@ interface DataTableProps<TData> {
|
||||
isLoading?: boolean;
|
||||
getRowId?: (row: TData) => string;
|
||||
onRowClick?: (row: TData) => void;
|
||||
/**
|
||||
* Optional row class hook — return a string of Tailwind utilities
|
||||
* applied to the `<TableRow>`. Use for visual grouping (e.g. tinting
|
||||
* berths by mooring letter so the kanban-like grid reads at a glance).
|
||||
*/
|
||||
getRowClassName?: (row: TData) => string | undefined;
|
||||
/**
|
||||
* Mobile card renderer. When provided, the table is hidden below `lg:`
|
||||
* and replaced with a vertical list of cards built from this callback.
|
||||
@@ -58,6 +65,13 @@ interface DataTableProps<TData> {
|
||||
* sort, and selection stay in sync across the breakpoint.
|
||||
*/
|
||||
cardRender?: (row: Row<TData>) => React.ReactNode;
|
||||
/**
|
||||
* Per-column visibility map. Keys are column IDs, values mean
|
||||
* "currently visible". Columns absent from the map are visible by
|
||||
* default — newly-added columns surface for existing users without
|
||||
* needing a preferences migration.
|
||||
*/
|
||||
columnVisibility?: VisibilityState;
|
||||
}
|
||||
|
||||
export function DataTable<TData>({
|
||||
@@ -74,7 +88,9 @@ export function DataTable<TData>({
|
||||
isLoading,
|
||||
getRowId,
|
||||
onRowClick,
|
||||
getRowClassName,
|
||||
cardRender,
|
||||
columnVisibility,
|
||||
}: DataTableProps<TData>) {
|
||||
const [internalSelection, setInternalSelection] = useState<RowSelectionState>({});
|
||||
const rowSelectionState = externalSelection ?? internalSelection;
|
||||
@@ -122,6 +138,7 @@ export function DataTable<TData>({
|
||||
pagination: pagination
|
||||
? { pageIndex: pagination.page - 1, pageSize: pagination.pageSize }
|
||||
: undefined,
|
||||
columnVisibility,
|
||||
},
|
||||
onRowSelectionChange: (updater) => {
|
||||
const newSelection = typeof updater === 'function' ? updater(rowSelectionState) : updater;
|
||||
@@ -215,7 +232,7 @@ export function DataTable<TData>({
|
||||
<TableRow
|
||||
key={row.id}
|
||||
data-state={row.getIsSelected() && 'selected'}
|
||||
className={cn(onRowClick && 'cursor-pointer')}
|
||||
className={cn(onRowClick && 'cursor-pointer', getRowClassName?.(row.original))}
|
||||
onClick={() => onRowClick?.(row.original)}
|
||||
>
|
||||
{row.getVisibleCells().map((cell) => (
|
||||
@@ -247,34 +264,61 @@ export function DataTable<TData>({
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{/* Pagination */}
|
||||
{pagination && pagination.totalPages > 1 && (
|
||||
<div className="flex items-center justify-between px-2">
|
||||
{/* Pagination — render whenever pagination is defined so the
|
||||
page-size selector is reachable even on single-page tables.
|
||||
Prev/Next group only renders when there's actually more than
|
||||
one page. */}
|
||||
{pagination && (
|
||||
<div className="flex items-center justify-between px-2 gap-3 flex-wrap">
|
||||
<div className="text-sm text-muted-foreground">
|
||||
{selectedIds.length > 0
|
||||
? `${selectedIds.length} of ${pagination.total} row(s) selected`
|
||||
: `${pagination.total} row(s) total`}
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={pagination.page <= 1}
|
||||
onClick={() => onPaginationChange?.(pagination.page - 1, pagination.pageSize)}
|
||||
>
|
||||
Previous
|
||||
</Button>
|
||||
<span className="text-sm text-muted-foreground">
|
||||
Page {pagination.page} of {pagination.totalPages}
|
||||
</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={pagination.page >= pagination.totalPages}
|
||||
onClick={() => onPaginationChange?.(pagination.page + 1, pagination.pageSize)}
|
||||
>
|
||||
Next
|
||||
</Button>
|
||||
<div className="flex items-center gap-3">
|
||||
{/* Page-size selector — "All" maps to the validator's
|
||||
max(1000) cap. If a port has more than 1000 active rows
|
||||
the user paginates; we don't quietly drop rows. */}
|
||||
<label className="text-sm text-muted-foreground inline-flex items-center gap-1.5">
|
||||
Show
|
||||
<select
|
||||
value={String(pagination.pageSize)}
|
||||
onChange={(e) => {
|
||||
const next = e.target.value === 'all' ? 1000 : Number(e.target.value);
|
||||
onPaginationChange?.(1, next);
|
||||
}}
|
||||
className="h-8 rounded-md border border-input bg-background px-2 text-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
||||
>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
<option value="250">250</option>
|
||||
<option value="all">All</option>
|
||||
</select>
|
||||
</label>
|
||||
{pagination.totalPages > 1 && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={pagination.page <= 1}
|
||||
onClick={() => onPaginationChange?.(pagination.page - 1, pagination.pageSize)}
|
||||
>
|
||||
Previous
|
||||
</Button>
|
||||
<span className="text-sm text-muted-foreground">
|
||||
Page {pagination.page} of {pagination.totalPages}
|
||||
</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={pagination.page >= pagination.totalPages}
|
||||
onClick={() => onPaginationChange?.(pagination.page + 1, pagination.pageSize)}
|
||||
>
|
||||
Next
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user