diff --git a/client/scripts/feature-pairs.json b/client/scripts/feature-pairs.json index bbc3041f2..715941df0 100644 --- a/client/scripts/feature-pairs.json +++ b/client/scripts/feature-pairs.json @@ -1236,6 +1236,7 @@ "src/mobile/screens/collections/MCollListPickerSheet.tsx": "Phone list picker sheet; the move or copy action comes through onPick from useCollections.", "src/mobile/screens/collections/MCollSheetKit.tsx": "Phone only sheet UI primitives for the collections screens (header, footer, pill, eyebrow).", "src/mobile/screens/collections/collectionsMobileModel.ts": "Visual constants only the phone collections screens use (category and status specs, swatches, cover gradient).", + "src/mobile/screens/collections/savedListFilterCount.ts": "Counts the active filters shown on the phone saved-list toolbar and filter sheet.", "src/mobile/screens/dashboard/MUserMenu.tsx": "Phone avatar menu with a three state theme cycle the desktop navbar does not have.", "src/mobile/screens/journey/MDawarichDaySheet.tsx": "Markup only; the phone frame the Dawarich day sheets (route and stays) render their shared review in.", "src/mobile/screens/journey/MJourneyCreateSheet.tsx": "The phone form receives the journey and trip selection state from MJourney, which shares useJourney with the desktop list.", @@ -1311,6 +1312,7 @@ "src/mobile/screens/trip/sheets/PlSheetChrome.tsx": "Phone form sheet chrome primitives (header, footer, field classes).", "src/mobile/screens/trip/sheets/PlTags.tsx": "Markup only; the tag picker's state comes through props from MPlaceEditSheet, which runs usePlaceTags, and the chips of the place sheet draw the tags the place carries.", "src/mobile/screens/trip/sheets/PlTimeFields.tsx": "Phone time fields that already share timeCollisions with the desktop PlaceFormModal.", + "src/mobile/screens/trip/sheets/formOptionClass.ts": "Phone-only styling for the shared sheet option buttons.", "src/mobile/screens/trip/sheets/tourSheetOpen.ts": "Phone only context for MTourDetailShell: whether the tour sheet is open and the name it carries.", "src/mobile/screens/trip/tabs/MCollabTab.tsx": "Phone collab sub-tab router for the chat and boards.", "src/mobile/screens/trip/tabs/MFilesBoard.tsx": "Markup only; the trip's files as tiles and the picked file's preview on a wide window, with the files and their actions handed in through props from MFilesTab.", @@ -1322,6 +1324,7 @@ "src/mobile/screens/trip/tabs/MTripTabPanel.tsx": "Phone tab router that mounts the per tab screens and plugin frames, with no logic of its own.", "src/mobile/screens/trip/tabs/collabPanes.ts": "Phone only; decides whether the collab tab shows the chat beside a board on a wide window, a layout question of the touch shell that the desktop planner does not have.", "src/mobile/screens/trip/tabs/listsModel.ts": "Priority colour and label constants only the phone to-do list and task sheet use.", + "src/mobile/screens/trip/tabs/reservationHeaderTint.ts": "Renders the header tint used by the phone booking and transport cards.", "src/mobile/screens/trip/tabs/tabChrome.tsx": "Phone tab chrome primitives (scroller, section headers, fields, traveler chips, plugin slots).", "src/mobile/screens/trip/tabs/tabModel.ts": "Phone tab prop type and status colour tokens only the phone tabs use.", "src/mobile/screens/trip/tabs/transportsModel.ts": "Phone transport card readers (metadata, day and time cells) for MTransportsTab and MBookingsTab.", diff --git a/client/src/components/Budget/CostsPanel.test.tsx b/client/src/components/Budget/CostsPanel.test.tsx index 904af97f5..51e035531 100644 --- a/client/src/components/Budget/CostsPanel.test.tsx +++ b/client/src/components/Budget/CostsPanel.test.tsx @@ -2443,7 +2443,7 @@ describe('CostsPanel: a bill entered in the display currency (#2525)', () => { const card = (await screen.findByRole('region', { name: 'Final budget' })) as HTMLElement await user.click(await within(card).findByRole('button', { name: /You/ })) - expect(within(card).getAllByText('+$791.55')).toHaveLength(2) + await waitFor(() => expect(within(card).getAllByText('+$791.55')).toHaveLength(2)) expect(within(card).getByText('Aparthotel Silver')).toBeInTheDocument() expect(within(card).getByText('$801.76')).toBeInTheDocument() }) diff --git a/client/src/components/Collections/usePlacesLibrary.ts b/client/src/components/Collections/usePlacesLibrary.ts index 9591737fc..f728735c7 100644 --- a/client/src/components/Collections/usePlacesLibrary.ts +++ b/client/src/components/Collections/usePlacesLibrary.ts @@ -87,17 +87,27 @@ function failureOf(err: unknown, t: TranslationFn): { error: string | null; offl } /** The filters of "All places". */ -function useLibraryFilters(initial?: PlacesLibraryFilters) { - const [search, setSearch] = useState(initial?.search ?? ''); - const [query, setQuery] = useState(initial?.search.trim() ?? ''); - const [kind, setKind] = useState(initial?.kind ?? 'all'); - const [categoryId, setCategoryId] = useState(initial?.categoryId ?? 'all'); - const [sort, setSort] = useState(initial?.sort ?? 'name'); - const [status, setStatus] = useState(initial?.status ?? 'all'); +const DEFAULT_LIBRARY_FILTERS: PlacesLibraryFilters = { + search: '', + kind: 'all', + categoryId: 'all', + sort: 'name', + status: 'all', + minRating: 'all', + tagNames: [], +}; + +function useLibraryFilters(initial = DEFAULT_LIBRARY_FILTERS) { + const [search, setSearch] = useState(initial.search); + const [query, setQuery] = useState(initial.search.trim()); + const [kind, setKind] = useState(initial.kind); + const [categoryId, setCategoryId] = useState(initial.categoryId); + const [sort, setSort] = useState(initial.sort); + const [status, setStatus] = useState(initial.status); // At least this many stars on the average of the votes, as the lists filter; unrated places drop out. - const [minRating, setMinRating] = useState(initial?.minRating ?? 'all'); + const [minRating, setMinRating] = useState(initial.minRating); // PLC-21: tag names of the lists and trips, any of which an entry must carry, whatever their case. - const [tagNames, setTagNames] = useState(initial?.tagNames ?? []); + const [tagNames, setTagNames] = useState(initial.tagNames); const toggleTagName = useCallback( (name: string) => setTagNames((names) => { diff --git a/client/src/components/Journey/JourneyEntryComments.tsx b/client/src/components/Journey/JourneyEntryComments.tsx index 470d84e4a..c3280454e 100644 --- a/client/src/components/Journey/JourneyEntryComments.tsx +++ b/client/src/components/Journey/JourneyEntryComments.tsx @@ -35,6 +35,27 @@ interface Props { mobile?: boolean; } +const COMMENT_APPEARANCE = { + phone: { + toggle: + 'flex min-h-11 w-full items-center gap-2 rounded-xl bg-m-sheetop px-3 text-start text-control font-medium text-m-ink', + controls: 'flex flex-none items-center gap-0.5', + controlSize: 'size-11', + field: 'min-h-11 border-m-rowbr bg-m-sheetop text-m-ink placeholder:text-m-muted', + submit: 'size-11 bg-m-act text-m-actfg', + hint: 'font-normal text-m-muted', + }, + desktop: { + toggle: + 'inline-flex items-center gap-1.5 self-start text-caption font-medium text-content-faint transition-colors hover:text-content', + controls: 'flex flex-none items-center gap-0.5 opacity-40 transition-opacity group-hover:opacity-100', + controlSize: 'size-7', + field: 'min-h-[38px] border-edge bg-surface text-content placeholder:text-content-faint focus:border-content-faint', + submit: 'size-[38px] bg-accent text-accent-text hover:bg-accent-hover', + hint: 'text-content-faint', + }, +}; + const GUEST_NAME_KEY = 'trek.journey.guestName'; function rememberedName(): string { @@ -80,11 +101,15 @@ export default function JourneyEntryComments({ const [message, setMessage] = useState(null); if (!canWrite && comments.length === 0) return null; + const appearance = COMMENT_APPEARANCE[mobile ? 'phone' : 'desktop']; const open = expanded ?? Boolean(defaultOpen || (mobile && comments.length)); + const needsGuestName = guest && !name.trim(); + const cannotSubmit = busy || !body.trim() || needsGuestName; + const submit = async (e: FormEvent) => { e.preventDefault(); - if (busy || !body.trim() || (guest && !name.trim())) return; + if (cannotSubmit) return; // Only a bot fills the field people never see: it is told all went well. if (trap) { setBody(''); @@ -105,7 +130,10 @@ export default function JourneyEntryComments({ const dateOf = (iso: string | null | undefined) => iso ? new Date(iso).toLocaleDateString(locale || undefined, { day: 'numeric', month: 'short' }) : ''; - const toggle = ( + const renderPublicHint = () => + publicHint && !guest &&

{t('journey.comments.publicHint')}

; + + const renderCollapsed = () => ( ); - if (!open) return toggle; + if (!open) return renderCollapsed(); return ( // The thread sits inside clickable cards: a click in it must not open the entry.
e.stopPropagation()} role="presentation"> - {!defaultOpen && !mobile && toggle} + {!defaultOpen && !mobile && renderCollapsed()} {comments.length > 0 && (
    {comments.map((c) => { @@ -156,13 +180,7 @@ export default function JourneyEntryComments({

    {c.body}

{(mayHide || mayDelete) && ( -
+
{mayHide && ( void onHide?.(c.id, !c.hidden)} - className={`flex ${mobile ? 'size-11' : 'size-7'} items-center justify-center rounded-full text-content-faint hover:bg-surface-secondary hover:text-content`} + className={`flex ${appearance.controlSize} items-center justify-center rounded-full text-content-faint hover:bg-surface-secondary hover:text-content`} > {c.hidden ? : } @@ -184,7 +202,7 @@ export default function JourneyEntryComments({ type="button" aria-label={t('common.delete')} onClick={() => void onDelete?.(c.id)} - className={`flex ${mobile ? 'size-11' : 'size-7'} items-center justify-center rounded-full text-content-faint hover:bg-danger-soft hover:text-danger`} + className={`flex ${appearance.controlSize} items-center justify-center rounded-full text-content-faint hover:bg-danger-soft hover:text-danger`} > @@ -230,20 +248,16 @@ export default function JourneyEntryComments({ placeholder={t('journey.comments.write')} aria-label={t('journey.comments.write')} className={`max-h-40 min-w-0 flex-1 resize-none rounded-xl border px-3 py-2 text-body outline-none [field-sizing:content] ${ - mobile - ? 'min-h-11 border-m-rowbr bg-m-sheetop text-m-ink placeholder:text-m-muted' - : 'min-h-[38px] border-edge bg-surface text-content placeholder:text-content-faint focus:border-content-faint' + appearance.field }`} />
{message &&

{message}

} - {publicHint && !guest && ( -

- {t('journey.comments.publicHint')} -

- )} + {renderPublicHint()} )}
diff --git a/client/src/components/Planner/IcsSubscribeModal.tsx b/client/src/components/Planner/IcsSubscribeModal.tsx index 985b0c788..c6e7c8e4a 100644 --- a/client/src/components/Planner/IcsSubscribeModal.tsx +++ b/client/src/components/Planner/IcsSubscribeModal.tsx @@ -1,4 +1,5 @@ -import { useState, useEffect, useId, type ReactNode } from 'react' +import { useId, type ReactNode } from 'react' +import { useIcsSubscription } from './useIcsSubscription' import { RefreshCw, Calendar, Power } from 'lucide-react' import { SubscribeLinks } from './SubscribeLinks' import ToggleSwitch from '../Settings/ToggleSwitch' @@ -13,24 +14,6 @@ export interface IcsSubscribeModalProps { onClose: () => void } -// A server that has no APP_URL configured hands back a host-relative path; the -// webcal:// handoff and Google deep link need an absolute URL, so resolve it -// against the current origin as a fallback. -function absolutize(url: string): string { - if (!url) return '' - if (/^https?:\/\//i.test(url)) return url - if (url.startsWith('/')) return window.location.origin + url - return url -} - -// The feeds take days=0 to leave out the all-day summary every day with -// untimed places or notes gets (#2602). The choice lives in the link itself, -// so a calendar keeps what it subscribed to and the token stays one per trip. -function withDayEvents(url: string, dayEvents: boolean): string { - if (!url || dayEvents) return url - return `${url}${url.includes('?') ? '&' : '?'}days=0` -} - /** The switch for those summaries, above the links it changes, on both shells. */ export function DayEventsSwitch({ on, onToggle }: { on: boolean; onToggle: () => void }) { const { t } = useTranslation() @@ -48,46 +31,6 @@ export function DayEventsSwitch({ on, onToggle }: { on: boolean; onToggle: () => ) } -/** Opening reads the token. Creating or changing it always takes an explicit action. */ -export function useIcsSubscription(endpoint: string) { - const tokenUrl = `${endpoint}/token` - const [feedUrl, setFeedUrl] = useState(null) - const [loadedTokenUrl, setLoadedTokenUrl] = useState(null) - const [busy, setBusy] = useState(false) - const [dayEvents, setDayEvents] = useState(true) - const toggleDayEvents = () => setDayEvents(on => !on) - - const httpsUrl = feedUrl ? withDayEvents(absolutize(feedUrl), dayEvents) : '' - const webcalUrl = httpsUrl ? httpsUrl.replace(/^https?:\/\//, 'webcal://') : '' - - useEffect(() => { - let active = true - void fetch(tokenUrl, { credentials: 'include' }) - .then(async res => res.ok ? (await res.json() as { feed_url: string | null }).feed_url : null) - .catch(() => null) - .then(url => { - if (!active) return - setFeedUrl(url) - setLoadedTokenUrl(tokenUrl) - }) - return () => { active = false } - }, [tokenUrl]) - - const mutate = async (method: 'POST' | 'PUT' | 'DELETE') => { - setBusy(true) - try { - const res = await fetch(tokenUrl, { method, credentials: 'include' }) - if (res.ok) { - const data = await res.json() as { feed_url: string | null } - setFeedUrl(data.feed_url) - } - } catch { /* ignore */ } - setBusy(false) - } - - return { loading: loadedTokenUrl !== tokenUrl, busy, feedUrl, httpsUrl, webcalUrl, mutate, dayEvents, toggleDayEvents } -} - export function IcsSubscribeModal({ endpoint, title, description, onClose }: IcsSubscribeModalProps) { const titleId = useId() const { loading, busy, feedUrl, httpsUrl, webcalUrl, mutate, dayEvents, toggleDayEvents } = useIcsSubscription(endpoint) diff --git a/client/src/components/Planner/PlaceImagePicker.tsx b/client/src/components/Planner/PlaceImagePicker.tsx index 367ddb270..c33e7832c 100644 --- a/client/src/components/Planner/PlaceImagePicker.tsx +++ b/client/src/components/Planner/PlaceImagePicker.tsx @@ -89,51 +89,59 @@ export default function PlaceImagePicker({ /> ); const showUploadRow = mobile && !own?.pendingPreview; - const showTiles = Boolean(current || attached.length || photos.length || (upload && !showUploadRow)); + + const renderGallery = () => { + const showTiles = Boolean(current || attached.length || photos.length || (upload && !showUploadRow)); + return ( + <> + {showTiles && ( +
+ {!showUploadRow && upload} + {current && ( + + )} + {attached.map((file) => ( + own?.onPickAttached(file)} + onHover={(on) => setHovered(on ? { kind: 'own', label: file.original_name } : null)} + dialog={dialog} + /> + ))} + {photos.map((photo) => ( + setHovered(on ? { kind: 'photo', photo } : null)} + dialog={dialog} + t={t} + /> + ))} +
+ )} + + ); + }; return ( <> {showUploadRow && upload} - {showTiles && ( -
- {!showUploadRow && upload} - {current && ( - - )} - {attached.map((file) => ( - own?.onPickAttached(file)} - onHover={(on) => setHovered(on ? { kind: 'own', label: file.original_name } : null)} - dialog={dialog} - /> - ))} - {photos.map((photo) => ( - setHovered(on ? { kind: 'photo', photo } : null)} - dialog={dialog} - t={t} - /> - ))} -
- )} + {renderGallery()} {(shown || removable) && ( )} diff --git a/client/src/components/Planner/SubscribeLinks.tsx b/client/src/components/Planner/SubscribeLinks.tsx index fe40fb6e4..791ee5411 100644 --- a/client/src/components/Planner/SubscribeLinks.tsx +++ b/client/src/components/Planner/SubscribeLinks.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react' +import { useSubscribeLinks } from './useSubscribeLinks' import { Copy, Check, CalendarPlus, Calendar } from 'lucide-react' import { useTranslation } from '../../i18n' @@ -7,45 +7,6 @@ interface SubscribeLinksProps { webcalUrl: string } -/** - * The provider links and clipboard behavior shared by both subscription dialogs. - */ -export function useSubscribeLinks(httpsUrl: string, webcalUrl: string) { - const { t } = useTranslation() - const [copied, setCopied] = useState<'https' | 'webcal' | null>(null) - - // Google Calendar's add-by-URL deep link. The cid must carry the webcal:// - // scheme (not https), URL-encoded, and the feed must be served over HTTPS. - const googleUrl = `https://www.google.com/calendar/render?cid=${encodeURIComponent(webcalUrl)}` - - const copy = async (url: string, which: 'https' | 'webcal') => { - try { - if (navigator.clipboard && window.isSecureContext) { - await navigator.clipboard.writeText(url) - } else { - // Fallback for non-secure contexts (plain HTTP) where navigator.clipboard is unavailable - const ta = document.createElement('textarea') - ta.value = url - ta.style.position = 'fixed' - ta.style.left = '-9999px' - document.body.appendChild(ta) - ta.focus() - ta.select() - document.execCommand('copy') - document.body.removeChild(ta) - } - setCopied(which) - setTimeout(() => setCopied(null), 2000) - } catch { /* ignore */ } - } - - const manualLinks = [ - { label: 'Google Calendar', hint: t('dashboard.ics.pasteFromUrl'), url: httpsUrl, copied: copied === 'https', onCopy: () => void copy(httpsUrl, 'https') }, - { label: 'Apple Calendar / Outlook', hint: 'webcal://', url: webcalUrl, copied: copied === 'webcal', onCopy: () => void copy(webcalUrl, 'webcal') }, - ] - return { googleUrl, manualLinks } -} - export function SubscribeLinks({ httpsUrl, webcalUrl }: SubscribeLinksProps) { const { t } = useTranslation() const { googleUrl, manualLinks } = useSubscribeLinks(httpsUrl, webcalUrl) diff --git a/client/src/components/Planner/TransitSearchPanel.tsx b/client/src/components/Planner/TransitSearchPanel.tsx index 2e3a1904a..0e4193de3 100644 --- a/client/src/components/Planner/TransitSearchPanel.tsx +++ b/client/src/components/Planner/TransitSearchPanel.tsx @@ -483,6 +483,36 @@ function ItineraryCard({ it, tzFrom, tzTo, is12h, expanded, onToggle, onAdd, add // the TransportModal (and could embed anywhere else). The host owns the modal // chrome and closes itself once onAdd resolves. +function TransitStopFields({ mobile, isMobile, from, to, setFrom, setTo, quickPicks, near }: { + mobile: boolean + isMobile: boolean + from: PickedPlace | null + to: PickedPlace | null + setFrom: (place: PickedPlace | null) => void + setTo: (place: PickedPlace | null) => void + quickPicks: PickedPlace[] + near: string | null +}) { + const { t } = useTranslation() + return ( +
+ + {!mobile && !isMobile && ( + + )} + +
+ ) +} + interface TransitSearchPanelProps { day: Day days: Day[] @@ -688,22 +718,8 @@ export default function TransitSearchPanel({ day, days, places, accommodations = return (
- {/* from / to — stacked tight on mobile, swap button on desktop only */} -
- - {!mobile && !isMobile && ( - - )} - -
+ {mobile ? ( <> diff --git a/client/src/components/Planner/useIcsSubscription.ts b/client/src/components/Planner/useIcsSubscription.ts new file mode 100644 index 000000000..0cdb38c53 --- /dev/null +++ b/client/src/components/Planner/useIcsSubscription.ts @@ -0,0 +1,72 @@ +import { useEffect, useState } from 'react'; + +// A server that has no APP_URL configured hands back a host-relative path; the +// webcal:// handoff and Google deep link need an absolute URL, so resolve it +// against the current origin as a fallback. +function absolutize(url: string): string { + if (!url) return ''; + if (/^https?:\/\//i.test(url)) return url; + if (url.startsWith('/')) return window.location.origin + url; + return url; +} + +// The feeds take days=0 to leave out the all-day summary every day with +// untimed places or notes gets (#2602). The choice lives in the link itself, +// so a calendar keeps what it subscribed to and the token stays one per trip. +function withDayEvents(url: string, dayEvents: boolean): string { + if (!url || dayEvents) return url; + return `${url}${url.includes('?') ? '&' : '?'}days=0`; +} + +/** Opening reads the token. Creating or changing it always takes an explicit action. */ +export function useIcsSubscription(endpoint: string) { + const tokenUrl = `${endpoint}/token`; + const [feedUrl, setFeedUrl] = useState(null); + const [loadedTokenUrl, setLoadedTokenUrl] = useState(null); + const [busy, setBusy] = useState(false); + const [dayEvents, setDayEvents] = useState(true); + const toggleDayEvents = () => setDayEvents((on) => !on); + + const httpsUrl = feedUrl ? withDayEvents(absolutize(feedUrl), dayEvents) : ''; + const webcalUrl = httpsUrl ? httpsUrl.replace(/^https?:\/\//, 'webcal://') : ''; + + useEffect(() => { + let active = true; + void fetch(tokenUrl, { credentials: 'include' }) + .then(async (res) => (res.ok ? ((await res.json()) as { feed_url: string | null }).feed_url : null)) + .catch(() => null) + .then((url) => { + if (!active) return; + setFeedUrl(url); + setLoadedTokenUrl(tokenUrl); + }); + return () => { + active = false; + }; + }, [tokenUrl]); + + const mutate = async (method: 'POST' | 'PUT' | 'DELETE') => { + setBusy(true); + try { + const res = await fetch(tokenUrl, { method, credentials: 'include' }); + if (res.ok) { + const data = (await res.json()) as { feed_url: string | null }; + setFeedUrl(data.feed_url); + } + } catch { + /* ignore */ + } + setBusy(false); + }; + + return { + loading: loadedTokenUrl !== tokenUrl, + busy, + feedUrl, + httpsUrl, + webcalUrl, + mutate, + dayEvents, + toggleDayEvents, + }; +} diff --git a/client/src/components/Planner/useSubscribeLinks.ts b/client/src/components/Planner/useSubscribeLinks.ts new file mode 100644 index 000000000..9e5776ba8 --- /dev/null +++ b/client/src/components/Planner/useSubscribeLinks.ts @@ -0,0 +1,55 @@ +import { useState } from 'react'; +import { useTranslation } from '../../i18n'; + +/** + * The provider links and clipboard behavior shared by both subscription dialogs. + */ +export function useSubscribeLinks(httpsUrl: string, webcalUrl: string) { + const { t } = useTranslation(); + const [copied, setCopied] = useState<'https' | 'webcal' | null>(null); + + // Google Calendar's add-by-URL deep link. The cid must carry the webcal:// + // scheme (not https), URL-encoded, and the feed must be served over HTTPS. + const googleUrl = `https://www.google.com/calendar/render?cid=${encodeURIComponent(webcalUrl)}`; + + const copy = async (url: string, which: 'https' | 'webcal') => { + try { + if (navigator.clipboard && window.isSecureContext) { + await navigator.clipboard.writeText(url); + } else { + // Fallback for non-secure contexts (plain HTTP) where navigator.clipboard is unavailable + const ta = document.createElement('textarea'); + ta.value = url; + ta.style.position = 'fixed'; + ta.style.left = '-9999px'; + document.body.appendChild(ta); + ta.focus(); + ta.select(); + document.execCommand('copy'); + document.body.removeChild(ta); + } + setCopied(which); + setTimeout(() => setCopied(null), 2000); + } catch { + /* ignore */ + } + }; + + const manualLinks = [ + { + label: 'Google Calendar', + hint: t('dashboard.ics.pasteFromUrl'), + url: httpsUrl, + copied: copied === 'https', + onCopy: () => void copy(httpsUrl, 'https'), + }, + { + label: 'Apple Calendar / Outlook', + hint: 'webcal://', + url: webcalUrl, + copied: copied === 'webcal', + onCopy: () => void copy(webcalUrl, 'webcal'), + }, + ]; + return { googleUrl, manualLinks }; +} diff --git a/client/src/hooks/useRouteCalculation.ts b/client/src/hooks/useRouteCalculation.ts index 47db53db5..134a84831 100644 --- a/client/src/hooks/useRouteCalculation.ts +++ b/client/src/hooks/useRouteCalculation.ts @@ -167,9 +167,23 @@ export function useRouteCalculation(tripStore: Pick { + if (!selectedDayId) { setRoute(null); setRouteWalking([]); setRouteSegments([]); setRouteVias([]); return } + updateRouteForDay(selectedDayId) + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [selectedDayId, selectedDayAssignments, transportSignature, enabled, profile, accommodations, optimizeFromAccommodation, distanceUnit, selectedDayDefaultMode, mirrorServiceStops, toursEnabled, places, viaKey, tourStageStops, includeLocatedBookings]) + + return { route, routeWalking, routeSegments, routeVias, routeInfo, setRoute, setRouteInfo, updateRouteForDay } +} + +function useTransportSignature(reservationsForSignature: TripStoreState['reservations'], selectedDayId: number | null, includeLocatedBookings?: boolean) { // Stable signature for transport reservations on the selected day — changes when a transport // is added, removed, or repositioned, ensuring route recalc fires even on transport-only reorders. - const transportSignature = useMemo(() => { + return useMemo(() => { if (!selectedDayId) return '' return reservationsForSignature .filter(r => TRANSPORT_TYPES.includes(r.type) || (includeLocatedBookings && r.place_id != null)) @@ -182,14 +196,4 @@ export function useRouteCalculation(tripStore: Pick (a < b ? -1 : a > b ? 1 : 0)) .join('|') }, [reservationsForSignature, selectedDayId, includeLocatedBookings]) - - // Recalculate when assignments or transport positions for the SELECTED day change - const selectedDayAssignments = selectedDayId ? tripStore.assignments?.[String(selectedDayId)] : null - useEffect(() => { - if (!selectedDayId) { setRoute(null); setRouteWalking([]); setRouteSegments([]); setRouteVias([]); return } - updateRouteForDay(selectedDayId) - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [selectedDayId, selectedDayAssignments, transportSignature, enabled, profile, accommodations, optimizeFromAccommodation, distanceUnit, selectedDayDefaultMode, mirrorServiceStops, toursEnabled, places, viaKey, tourStageStops, includeLocatedBookings]) - - return { route, routeWalking, routeSegments, routeVias, routeInfo, setRoute, setRouteInfo, updateRouteForDay } } diff --git a/client/src/mobile/components/NativeImportSheet.tsx b/client/src/mobile/components/NativeImportSheet.tsx index 125ef7bfb..8f474746f 100644 --- a/client/src/mobile/components/NativeImportSheet.tsx +++ b/client/src/mobile/components/NativeImportSheet.tsx @@ -256,23 +256,9 @@ export default function NativeImportSheet(): React.ReactElement | null { const sourceName = link?.title ?? file?.name; const close = () => setFile(null); const back = picked && choices.length > 1 && savingTrip == null ? () => setPick(null) : undefined; - const loading = tripsStatus === 'loading' || (!asking && !showTrips && !nowhere); - return ( - - - - - ) - } - title={title} - subtitle={sourceName && {sourceName}} - onClose={close} - closeLabel={t('common.close')} - /> + const renderImportStep = () => { + const loading = tripsStatus === 'loading' || (!asking && !showTrips && !nowhere); + return ( {tripsStatus === 'error' ? (
@@ -303,6 +289,30 @@ export default function NativeImportSheet(): React.ReactElement | null { ) )} + ); + }; + + const renderImportHeader = () => ( + + + + ) + } + title={title} + subtitle={sourceName && {sourceName}} + onClose={close} + closeLabel={t('common.close')} + /> + ); + + return ( + + {renderImportHeader()} + {renderImportStep()} ); } diff --git a/client/src/mobile/components/useSheetDrag.ts b/client/src/mobile/components/useSheetDrag.ts index 1add814bf..4db672666 100644 --- a/client/src/mobile/components/useSheetDrag.ts +++ b/client/src/mobile/components/useSheetDrag.ts @@ -178,7 +178,7 @@ export function useSheetDrag({ enabled, panelRef, scrimRef, onDismiss }: SheetDr useEffect(() => { const panel = panelRef.current; if (!enabled || !panel) return; - return attachContentDrag(panel, drag, frame, follow, release, cancelDrag); + return attachContentDrag({ panel, drag, frame, follow, release, cancelDrag }); }, [enabled, panelRef, follow, release, cancelDrag]); return { @@ -197,14 +197,21 @@ export function useSheetDrag({ enabled, panelRef, scrimRef, onDismiss }: SheetDr * The content's half of the drag: a finger (touch events) or a mouse or pen * (pointer events), claimed on the first move or let go. Returns the detach. */ -function attachContentDrag( - panel: HTMLElement, - drag: MutableRefObject, - frame: MutableRefObject, - follow: (dy: number) => void, - release: (d: Drag, lastY: number, time: number) => void, - cancelDrag: () => void -): () => void { +function attachContentDrag({ + panel, + drag, + frame, + follow, + release, + cancelDrag, +}: { + panel: HTMLElement; + drag: MutableRefObject; + frame: MutableRefObject; + follow: (dy: number) => void; + release: (d: Drag, lastY: number, time: number) => void; + cancelDrag: () => void; +}): () => void { /** Set by a claimed drag: the click the browser sends after it is not a tap. */ let swallowClick = false; diff --git a/client/src/mobile/screens/atlas/MAtlasCountryPopup.tsx b/client/src/mobile/screens/atlas/MAtlasCountryPopup.tsx index 69769b0ee..5baee5af0 100644 --- a/client/src/mobile/screens/atlas/MAtlasCountryPopup.tsx +++ b/client/src/mobile/screens/atlas/MAtlasCountryPopup.tsx @@ -61,6 +61,48 @@ export default function MAtlasCountryPopup({ atlas }: MAtlasCountryPopupProps) { const unmarking = a?.type === 'unmark' || unmarkingRegion const confirming = a?.type === 'mark' || unmarking + const renderActions = (action: NonNullable) => ( + + {(action.type === 'choose' || choosingRegion) && ( +
+ void markRegion(true) : () => void markCountry()} + /> + setConfirmAction({ ...action, type: 'bucket' })} + /> + {!choosingRegion && onWishlist && ( + void removeBucket()} + /> + )} +
+ )} + {confirming && ( + +

+ {t(unmarkingRegion ? 'atlas.confirmUnmarkRegion' : unmarking ? 'atlas.confirmUnmark' : 'atlas.confirmMark')} +

+
+ )} + {action.type === 'bucket' && ( + + + + )} +
+ ) + return ( {a && ( @@ -76,45 +118,7 @@ export default function MAtlasCountryPopup({ atlas }: MAtlasCountryPopupProps) { onClose={close} closeLabel={t('common.close')} /> - - {(a.type === 'choose' || choosingRegion) && ( -
- void markRegion(true) : () => void markCountry()} - /> - setConfirmAction({ ...a, type: 'bucket' })} - /> - {!choosingRegion && onWishlist && ( - void removeBucket()} - /> - )} -
- )} - {confirming && ( - -

- {t(unmarkingRegion ? 'atlas.confirmUnmarkRegion' : unmarking ? 'atlas.confirmUnmark' : 'atlas.confirmMark')} -

-
- )} - {a.type === 'bucket' && ( - - - - )} -
+ {renderActions(a)} {a.type === 'mark' && ( void executeConfirmAction()} submitLabel={t('atlas.markVisited')} /> diff --git a/client/src/mobile/screens/collections/MLibraryPlaceSheet.tsx b/client/src/mobile/screens/collections/MLibraryPlaceSheet.tsx index f2a467730..9f6124171 100644 --- a/client/src/mobile/screens/collections/MLibraryPlaceSheet.tsx +++ b/client/src/mobile/screens/collections/MLibraryPlaceSheet.tsx @@ -133,6 +133,25 @@ export default function MLibraryPlaceSheet({ const tags = usePlaceTags({ data, onChanged: onNotesSaved, t }); const edit = usePlaceEdit({ data, onSaved: onNotesSaved, t }); const rating = usePlaceRating({ data, onChanged: onNotesSaved, t }); + const renderControls = () => + entry && + edit.canEdit && + !edit.editing && ( + + + + ); + const renderEditFooter = () => + entry && + edit.editing && ( + void edit.save()} + submitLabel={t('common.save')} + submitDisabled={edit.saving} + /> + ); return ( - - - ) - } - editFooter={ - entry && - edit.editing && ( - void edit.save()} - submitLabel={t('common.save')} - submitDisabled={edit.saving} - /> - ) - } + controls={renderControls()} + editFooter={renderEditFooter()} footer={ entry && !edit.editing && ( diff --git a/client/src/mobile/screens/collections/MPlaceSheetShell.tsx b/client/src/mobile/screens/collections/MPlaceSheetShell.tsx index f21dbc324..83e9eba26 100644 --- a/client/src/mobile/screens/collections/MPlaceSheetShell.tsx +++ b/client/src/mobile/screens/collections/MPlaceSheetShell.tsx @@ -106,57 +106,63 @@ export default function MPlaceSheetShell({ ); const closeLabel = t('common.close'); + const renderPlaceHeader = () => ( + <> + {cover ? ( +
+ +
+
+ {controls} + + + +
+
+ {head ? ( +
{head}
+ ) : ( + placeName && ( + <> +

{placeName}

+ + + ) + )} +
+
+ ) : ( + + + {location} + + ) + } + trailing={controls &&
{controls}
} + onClose={onClose} + closeLabel={closeLabel} + /> + )} + + ); + return ( <> - {cover ? ( -
- -
-
- {controls} - - - -
-
- {head ? ( -
{head}
- ) : ( - placeName && ( - <> -

{placeName}

- - - ) - )} -
-
- ) : ( - - - {location} - - ) - } - trailing={controls &&
{controls}
} - onClose={onClose} - closeLabel={closeLabel} - /> - )} + {renderPlaceHeader()} {category && ( ); + const renderPhotosAndLocation = () => ( + <> + {lead && ( +
+
+ {photoTile(lead, 0, 'block aspect-video max-h-[34vh] w-full')} + {lead.caption && ( +
+ {lead.caption} +
+ )} +
+ {photos.length > 1 && ( +
+ {photos.slice(1).map((photo, index) => photoTile(photo, index + 1, 'size-16 shrink-0'))} +
+ )} +
+ )} + {entry.location_name && entry.location_name !== title && ( +

+ + {entry.location_name} +

+ )} + + ); + return ( <> @@ -103,31 +133,7 @@ export default function MJourneyEntryRead({ } /> - {lead && ( -
-
- {photoTile(lead, 0, 'block aspect-video max-h-[34vh] w-full')} - {lead.caption && ( -
- {lead.caption} -
- )} -
- {photos.length > 1 && ( -
- {photos.slice(1).map((photo, index) => photoTile(photo, index + 1, 'size-16 shrink-0'))} -
- )} -
- )} - {entry.location_name && entry.location_name !== title && ( -

- - {entry.location_name} -

- )} + {renderPhotosAndLocation()} {entry.story?.trim() && (
diff --git a/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx b/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx index b457ccb56..a1d25f441 100644 --- a/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx +++ b/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx @@ -53,13 +53,12 @@ interface MJourneySettingsSheetProps { export default function MJourneySettingsSheet({ journey, onClose, onSaved, onOpenInvite, inviteOpen, onRefresh, onRestoreSuggestions, recordingPrep, }: MJourneySettingsSheetProps) { - const { t, locale } = useTranslation() + const { t } = useTranslation() + const settings = useJourneySettings({ journey, onSaved, onRefresh, onContentChanged: onRefresh }) const { - title, setTitle, subtitle, setSubtitle, saving, archiving, unlinkTarget, setUnlinkTarget, showDeleteConfirm, - setShowDeleteConfirm, savingTracks, savingField, handleSave, handleCoverUpload, handleArchiveToggle, - handleTracksToggle, handleFieldToggle, handleDelete, handleRemoveContributor, confirmUnlink, - statusChoice, savingStatus, handleStatusChange, savingPhotoLocation, handlePhotoLocationToggle, - } = useJourneySettings({ journey, onSaved, onRefresh, onContentChanged: onRefresh }) + title, setTitle, setSubtitle, saving, unlinkTarget, setUnlinkTarget, showDeleteConfirm, + setShowDeleteConfirm, handleSave, handleDelete, handleRemoveContributor, confirmUnlink, + } = settings const [area, setArea] = useState(null) const [pendingContributor, setPendingContributor] = useState(null) const formId = useId() @@ -71,8 +70,6 @@ export default function MJourneySettingsSheet({ onRefresh() }, }) - const coverRef = useRef(null) - const coverSrc = journeyCoverSrc(journey.cover_image) const openAddTrip = async () => { @@ -107,12 +104,98 @@ export default function MJourneySettingsSheet({ setSubtitle(journey.subtitle ?? '') back() } - const statusOptions: Array<{ value: JourneyStatusChoice; label: string }> = [ - { value: 'auto', label: t('journey.settings.statusAuto') }, - { value: 'draft', label: t('journey.status.draft') }, - { value: 'live', label: t('journey.frontpage.live') }, - { value: 'completed', label: t('journey.status.completed') }, - ] + + const renderArea = () => { + switch (area) { + case null: + return ( + + ) + case 'profile': + return + case 'trips': + return + case 'linkTrip': + return ( + + {loadingTrips || unlinkedTrips.length === 0 ? ( +

+ {t(loadingTrips ? 'common.loading' : 'journey.trips.noTripsAvailable')} +

+ ) : ( +
+ {unlinkedTrips.map(trip => ( +
+ + {trip.title} + +
+ ))} +
+ )} +
+ ) + case 'people': + return ( + <> +
+ {journey.contributors.map(c => ( +
+ +
+ {c.username} + {t(c.role === 'owner' ? 'members.owner' : c.role === 'editor' ? 'journey.invite.editor' : 'journey.invite.viewer')} +
+ {c.role !== 'owner' && ( + setPendingContributor(c)} + ariaLabel={t('journey.contributors.remove')} + > + + + )} +
+ ))} +
+ + + + ) + case 'share': + return + case 'entries': + return + case 'map': + return + case 'status': + return + } + } return ( <> @@ -129,229 +212,7 @@ export default function MJourneySettingsSheet({ /> - {!area && ( - - )} - - {area === 'profile' && ( - <> - -
- - -
-
- - - - - - - )} - - {area === 'trips' && ( -
- {journey.trips.map(trip => ( -
- -
- {trip.title} -
- {trip.start_date && {formatDate(trip.start_date, locale)}} - {t('mobileJourney.placesCount', { count: trip.place_count ?? 0 })} -
-
- setUnlinkTarget({ trip_id: trip.trip_id, title: trip.title })} - ariaLabel={t('journey.trips.unlinkTrip')} - > - - -
- ))} - {journey.trips.length === 0 && ( -

{t('journey.trips.noTripsLinkedSettings')}

- )} -
- )} - - {area === 'linkTrip' && ( - - {loadingTrips || unlinkedTrips.length === 0 ? ( -

- {t(loadingTrips ? 'common.loading' : 'journey.trips.noTripsAvailable')} -

- ) : ( -
- {unlinkedTrips.map(trip => ( -
- - {trip.title} - -
- ))} -
- )} -
- )} - - {area === 'people' && ( - <> -
- {journey.contributors.map(c => ( -
- -
- {c.username} - {t(c.role === 'owner' ? 'members.owner' : c.role === 'editor' ? 'journey.invite.editor' : 'journey.invite.viewer')} -
- {c.role !== 'owner' && ( - setPendingContributor(c)} - ariaLabel={t('journey.contributors.remove')} - > - - - )} -
- ))} -
- - - - )} - - {area === 'share' && } - - {area === 'entries' && ( - <> - - {([ - ['show_verdict', t('journey.settings.showVerdict')], - ['show_mood', t('journey.settings.showMood')], - ['show_weather', t('journey.settings.showWeather')], - ] as const).map(([field, label]) => ( - handleFieldToggle(field, next)} - disabled={savingField !== null} - /> - ))} - {/* Only when there is something to bring back */} - {onRestoreSuggestions && (journey.dismissed_count ?? 0) > 0 && ( - - )} - - - { void handlePhotoLocationToggle() }} - disabled={savingPhotoLocation} - /> - - - )} - - {area === 'map' && ( - <> - - - - - {recordingPrep && ( - - - - )} - - )} - - {area === 'status' && ( - <> - -
- {statusOptions.map(({ value, label }) => ( - - ))} -
-

- {t(statusChoice === 'auto' ? 'journey.settings.statusAutoHint' : 'journey.settings.statusManualHint')} -

-
- -
- - -
-
- - )} + {renderArea()}
{(area === 'trips' || area === 'people') && ( @@ -411,6 +272,199 @@ export default function MJourneySettingsSheet({ ) } +type JourneySettings = ReturnType + +function JourneyProfileFields({ formId, coverSrc, settings }: { + formId: string + coverSrc: string | null + settings: JourneySettings +}) { + const { t } = useTranslation() + const { title, setTitle, subtitle, setSubtitle, handleCoverUpload } = settings + const coverRef = useRef(null) + return ( + <> + +
+ + +
+
+ + + + + + + ) +} + +function JourneyLinkedTrips({ trips, onUnlink }: { + trips: JourneyDetail['trips'] + onUnlink: JourneySettings['setUnlinkTarget'] +}) { + const { t, locale } = useTranslation() + return ( +
+ {trips.map(trip => ( +
+ +
+ {trip.title} +
+ {trip.start_date && {formatDate(trip.start_date, locale)}} + {t('mobileJourney.placesCount', { count: trip.place_count ?? 0 })} +
+
+ onUnlink({ trip_id: trip.trip_id, title: trip.title })} + ariaLabel={t('journey.trips.unlinkTrip')} + > + + +
+ ))} + {trips.length === 0 && ( +

{t('journey.trips.noTripsLinkedSettings')}

+ )} +
+ ) +} + +function JourneyEntryFields({ journey, onRestoreSuggestions, settings }: { + journey: JourneyDetail + onRestoreSuggestions: MJourneySettingsSheetProps['onRestoreSuggestions'] + settings: JourneySettings +}) { + const { t } = useTranslation() + const { savingField, handleFieldToggle, savingPhotoLocation, handlePhotoLocationToggle } = settings + return ( + <> + + {([ + ['show_verdict', t('journey.settings.showVerdict')], + ['show_mood', t('journey.settings.showMood')], + ['show_weather', t('journey.settings.showWeather')], + ] as const).map(([field, label]) => ( + handleFieldToggle(field, next)} + disabled={savingField !== null} + /> + ))} + {/* Only when there is something to bring back */} + {onRestoreSuggestions && (journey.dismissed_count ?? 0) > 0 && ( + + )} + + + { void handlePhotoLocationToggle() }} + disabled={savingPhotoLocation} + /> + + + ) +} + +function JourneyMapSettings({ journey, recordingPrep, settings }: { + journey: JourneyDetail + recordingPrep: MJourneySettingsSheetProps['recordingPrep'] + settings: JourneySettings +}) { + const { t } = useTranslation() + const { savingTracks, handleTracksToggle } = settings + return ( + <> + + + + + {recordingPrep && ( + + + + )} + + ) +} + +function JourneyStatusSettings({ journey, settings }: { + journey: JourneyDetail + settings: JourneySettings +}) { + const { t } = useTranslation() + const { archiving, setShowDeleteConfirm, handleArchiveToggle, statusChoice, savingStatus, handleStatusChange } = settings + const statusOptions: Array<{ value: JourneyStatusChoice; label: string }> = [ + { value: 'auto', label: t('journey.settings.statusAuto') }, + { value: 'draft', label: t('journey.status.draft') }, + { value: 'live', label: t('journey.frontpage.live') }, + { value: 'completed', label: t('journey.status.completed') }, + ] + return ( + <> + +
+ {statusOptions.map(({ value, label }) => ( + + ))} +
+

+ {t(statusChoice === 'auto' ? 'journey.settings.statusAutoHint' : 'journey.settings.statusManualHint')} +

+
+ +
+ + +
+
+ + ) +} + function JourneyPersonAvatar({ username, avatar }: { username: string; avatar?: string | null }) { const src = avatarSrc(avatar) return src ? : ( diff --git a/client/src/mobile/screens/notifications/MNotificationRow.tsx b/client/src/mobile/screens/notifications/MNotificationRow.tsx index 9010b27ae..48f5339fd 100644 --- a/client/src/mobile/screens/notifications/MNotificationRow.tsx +++ b/client/src/mobile/screens/notifications/MNotificationRow.tsx @@ -31,15 +31,7 @@ export default function MNotificationRow({ notification }: MNotificationRowProps const summary = ( <> - {notification.sender_avatar ? ( - - ) : ( - - {notification.sender_username - ? notification.sender_username.charAt(0).toUpperCase() - : } - - )} + {title} {body && {body}} @@ -109,3 +101,19 @@ export default function MNotificationRow({ notification }: MNotificationRowProps ) } + +function NotificationAvatar({ notification }: MNotificationRowProps) { + return ( + <> + {notification.sender_avatar ? ( + + ) : ( + + {notification.sender_username + ? notification.sender_username.charAt(0).toUpperCase() + : } + + )} + + ) +} diff --git a/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx b/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx index a346fe096..f49475c75 100644 --- a/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx +++ b/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx @@ -418,41 +418,13 @@ function PlanDayPage({ planner, shell, dayId: pageDayId, active, editing, legMen )} {tl.rows.length === 0 && !editing && ( -
- -

{t('dayplan.emptyDay')}

- {day && planner.can('place_edit', planner.trip) && planner.can('day_edit', planner.trip) && ( - - )} -
+ )}
{editing && day && ( -
- {canEditPlaces && ( - - )} - -
+ setDayMenu({ kind: 'add', open: true })} t={t} /> )}
@@ -460,6 +432,56 @@ function PlanDayPage({ planner, shell, dayId: pageDayId, active, editing, legMen ) } +function EmptyDayGuide({ allowAdd, onAddPlace, t }: { + allowAdd: boolean + onAddPlace: () => void + t: MPlanTimelineProps['planner']['t'] +}) { + return ( +
+ +

{t('dayplan.emptyDay')}

+ {allowAdd && ( + + )} +
+ ) +} + +function DayEditFooter({ canEditPlaces, onAddPlace, onOpenMenu, t }: { + canEditPlaces: boolean + onAddPlace: () => void + onOpenMenu: () => void + t: MPlanTimelineProps['planner']['t'] +}) { + return ( +
+ {canEditPlaces && ( + + )} + +
+ ) +} + /** Go mode: the next stop with a live countdown (only counting down on today's day). */ function UpNextCard({ tl, t, onOpen }: { tl: MPlanTimelineController diff --git a/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx b/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx index b62c70426..766db8c6b 100644 --- a/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx +++ b/client/src/mobile/screens/trip/plan/MPlanTimelineRows.tsx @@ -1,4 +1,4 @@ -import { BedDouble, ChevronDown, ChevronRight, ChevronUp, Footprints, MoreHorizontal, Pencil, StickyNote, Ticket, TramFront, Zap } from 'lucide-react' +import { BedDouble, ChevronDown, ChevronRight, ChevronUp, Footprints, MoreHorizontal, Ticket, TramFront, Zap } from 'lucide-react' import { routeModeIcon } from '../../../../components/Planner/routeModes' import type { ReactNode, MouseEvent, CSSProperties } from 'react' import PlaceAvatar from '../../../../components/shared/PlaceAvatar' diff --git a/client/src/mobile/screens/trip/roadtrip/MRoadtripTab.tsx b/client/src/mobile/screens/trip/roadtrip/MRoadtripTab.tsx index 0856b4a8b..9c2e1e0e4 100644 --- a/client/src/mobile/screens/trip/roadtrip/MRoadtripTab.tsx +++ b/client/src/mobile/screens/trip/roadtrip/MRoadtripTab.tsx @@ -155,7 +155,7 @@ function RoadtripStagePage({ planner, shell, dayId: pageDayId, alts, chrome }: O const addStop = canEditStage && stageDayId != null ? () => planner.openNewPlaceForDay(stageDayId) : undefined - const addStopButton = addStop && ( + const renderAddStop = () => addStop && ( ) } + +function useExportDisclosures(open: boolean) { + const [subscribeOpen, setSubscribeOpen] = useState(false) + const [formatsOpen, setFormatsOpen] = useState(false) + if (!open && (subscribeOpen || formatsOpen)) { + setSubscribeOpen(false) + setFormatsOpen(false) + } + return { subscribeOpen, setSubscribeOpen, formatsOpen, setFormatsOpen } +} diff --git a/client/src/mobile/screens/trip/sheets/MIcsSubscribeSheet.tsx b/client/src/mobile/screens/trip/sheets/MIcsSubscribeSheet.tsx index 6873731ae..13057ef16 100644 --- a/client/src/mobile/screens/trip/sheets/MIcsSubscribeSheet.tsx +++ b/client/src/mobile/screens/trip/sheets/MIcsSubscribeSheet.tsx @@ -1,9 +1,6 @@ import { Calendar, LockKeyhole, Power, RefreshCw } from 'lucide-react'; -import { - DayEventsSwitch, - useIcsSubscription, - type IcsSubscribeModalProps, -} from '../../../../components/Planner/IcsSubscribeModal'; +import { DayEventsSwitch, type IcsSubscribeModalProps } from '../../../../components/Planner/IcsSubscribeModal'; +import { useIcsSubscription } from '../../../../components/Planner/useIcsSubscription'; import { useTranslation } from '../../../../i18n'; import MSheet from '../../../components/MSheet'; import MSubscribeLinks from './MSubscribeLinks'; diff --git a/client/src/mobile/screens/trip/sheets/MNoteSheet.tsx b/client/src/mobile/screens/trip/sheets/MNoteSheet.tsx index 558389dcd..85a27bb81 100644 --- a/client/src/mobile/screens/trip/sheets/MNoteSheet.tsx +++ b/client/src/mobile/screens/trip/sheets/MNoteSheet.tsx @@ -118,6 +118,96 @@ export default function MNoteSheet({ planner, open, payload, onClose }: MNoteShe } } + const renderNoteFields = () => ( + + + setTitle(e.target.value)} + required maxLength={500} className={FIELD_CLS} /> + +
+ + +
+ +