import type { ReactNode } from "react"; import { Ship } from "lucide-react"; import type { Dive } from "@/lib/api/dives"; import { DiveComputerIcon } from "@/components/icons/dive-computer-icon"; import { IconFact, LINE_ICON } from "@/components/ui/icon-fact"; import { formatDiveDateTime } from "@/lib/date-time"; import { recordingCount } from "@/lib/dive-recordings"; /** * The line under a dive's title, on its card and its page's hero alike: when, * in the dive's own timezone, and where - the title names the site, this says * where it is - then the boat, and a dive computer for each one that recorded * the dive. The water and the kind of dive are its title's chips. */ export function diveFacts(dive: Dive): ReactNode[] { const computers = recordingCount(dive); return [ formatDiveDateTime(dive.start_time), dive.dive_sites[0]?.location?.name, dive.boat_name && ( {dive.boat_name} ), computers > 0 && , ].filter(Boolean); } function DiveComputers({ count }: { count: number }) { return ( {Array.from({ length: count }, (_, index) => ( ))} {count === 1 ? "1 dive computer" : `${count} dive computers`} ); }