import type { PlaceActivity, PlacesLibraryEntry } from '@trek/shared'; import { Link2, Plus, Route, Ticket, X } from 'lucide-react'; import React from 'react'; import { useNavigate } from 'react-router'; import type { TranslationFn } from '../../types'; import { Tooltip } from '../shared/Tooltip'; import PlaceCard from './PlaceCard'; import { activityLine } from './placeExtrasText'; import { activityHref, usePlaceActivities } from './usePlaceActivities'; const ICON_BTN = 'grid h-7 w-7 flex-none place-items-center rounded-lg text-content-muted hover:bg-surface-secondary hover:text-content disabled:opacity-50'; function ActivityIcon({ type }: { type: PlaceActivity['type'] }) { return type === 'booking' ? : ; } /** * The tours and bookings of a place of All places in the desktop sheet (PLC-18): * each one opens where it lives, a said link can be taken off again, and "+ Link" * offers the bookings and tours of the trips and lists the reader may link in. * Not there at all while there is nothing linked and nothing to link. */ export function PlaceActivitiesView({ state: a, language, t, }: { state: ReturnType; language: string; t: TranslationFn; }): React.ReactElement | null { const navigate = useNavigate(); if (a.activities.length === 0 && !a.canLink) return null; return ( void a.openPicker()} disabled={a.busy} className="col-detail-action"> {t('placeActivities.link')} ) } rows={a.activities.length > 0} > {a.activities.map((act) => (
{act.can_unlink ? ( ) : ( {t('placeActivities.atThisPlace')} )}
))} {a.activities.length === 0 && !a.picking && ( )} {a.picking && (
{t('placeActivities.pickTitle')} {a.picking.every((g) => g.candidates.length === 0) && ( {t('placeActivities.nothingToLink')} )} {a.picking.map((g) => g.candidates.map((c) => ( )) )}
)}
); } export default function PlaceActivitiesSection({ entry, language, t, }: { entry: PlacesLibraryEntry; language: string; t: TranslationFn; }): React.ReactElement | null { const a = usePlaceActivities({ entry, t }); return ; }