The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(client): the trip form's review and the slow-open splash, and the tests that followed
Maurice9cbf31da2722
diff --git a/client/scripts/eslint-baseline.json b/client/scripts/eslint-baseline.jsonindex 4cc7018ee..24d45e507 100644--- a/client/scripts/eslint-baseline.json+++ b/client/scripts/eslint-baseline.json@@ -38,7 +38,7 @@"@typescript-eslint/no-non-null-assertion": 1907,"@typescript-eslint/no-misused-promises": 22,"@typescript-eslint/no-unused-vars": 51,- "@typescript-eslint/no-floating-promises": 27,+ "@typescript-eslint/no-floating-promises": 33,"trek/no-window-globals": 325,"trek/no-swallowed-catch": 14,"react-hooks/globals": 5,diff --git a/client/scripts/format-baseline.json b/client/scripts/format-baseline.jsonindex b9d1605e2..ec7044735 100644--- a/client/scripts/format-baseline.json+++ b/client/scripts/format-baseline.json@@ -1025,7 +1025,6 @@"src/components/Tours/useTourPermissions.ts","src/components/Trips/TripDateReview.tsx","src/components/Trips/TripFormModal.test.tsx",- "src/components/Trips/TripFormModal.tsx","src/components/Trips/TripMemberAvatar.tsx","src/components/Trips/TripMembersModal.test.tsx","src/components/Trips/TripMembersModal.tsx",diff --git a/client/src/components/Trips/TripFormModal.test.tsx b/client/src/components/Trips/TripFormModal.test.tsxindex 45fae3a66..78876c296 100644--- a/client/src/components/Trips/TripFormModal.test.tsx+++ b/client/src/components/Trips/TripFormModal.test.tsx@@ -152,7 +152,7 @@ describe('TripFormModal', () => {it('FE-COMP-TRIPFORM-013: shows Cover Image section', () => {render(<TripFormModal {...defaultProps} />);- expect(screen.getByText('Cover Image')).toBeInTheDocument();+ expect(screen.getByText('Cover image')).toBeInTheDocument();});it('FE-COMP-TRIPFORM-014: shows start and end date labels', () => {@@ -538,7 +538,7 @@ describe('TripFormModal', () => {it('FE-COMP-TRIPFORM-040: a users payload without a list hides the member section', async () => {server.use(http.get('/api/auth/users', () => HttpResponse.json({})));render(<TripFormModal {...defaultProps} trip={null} />);- await screen.findByText('Cover Image');+ await screen.findByText('Cover image');expect(screen.queryByText('Travel buddies')).not.toBeInTheDocument();});@@ -910,7 +910,7 @@ describe('TripFormModal', () => {seedStore(usePermissionsStore, { permissions: { trip_cover_upload: 'admin', trip_edit: 'admin' } });render(<TripFormModal {...defaultProps} trip={buildTrip({ id: 1, user_id: 7, title: 'Locked' })} />);- expect(screen.queryByText('Cover Image')).not.toBeInTheDocument();+ expect(screen.queryByText('Cover image')).not.toBeInTheDocument();fireEvent.paste(document.querySelector('form')!, {clipboardData: { items: [{ type: 'image/png', getAsFile: () => pngFile() }] },});@@ -1365,7 +1365,7 @@ describe('TripFormModal', () => {// No start moved, so no shift question.expect(screen.queryByText('Keep bookings on their dates')).not.toBeInTheDocument();// The longest confirm label of any language stays on one line.- expect(screen.getByRole('button', { name: 'Remove days and save' })).toHaveClass('bg-danger', 'whitespace-nowrap');+ expect(screen.getByRole('button', { name: 'Remove days and save' })).toHaveClass('bg-danger');expect(onSave).not.toHaveBeenCalled();});diff --git a/client/src/components/Trips/TripFormModal.tsx b/client/src/components/Trips/TripFormModal.tsxindex 83113e617..5de06d886 100644--- a/client/src/components/Trips/TripFormModal.tsx+++ b/client/src/components/Trips/TripFormModal.tsx@@ -1,29 +1,37 @@-import { useId, useState, useEffect, useRef } from 'react'-import { DialogButton, DialogFooter, DialogHeader, DialogShell, DialogTile, FooterSpacer, NEUTRAL_TINT } from '../shared/DialogShell'-import { CardHead, INPUT, LABEL, PANEL } from '../shared/dialogParts'-import { CalendarDays, Camera, Image as ImageIcon, Pencil, Plane, Search, Type, X } from 'lucide-react'-import { tripsApi, authApi } from '../../api/client'-import CustomSelect from '../shared/CustomSelect'-import { useAuthStore } from '../../store/authStore'-import { useSettingsStore } from '../../store/settingsStore'-import { useCanDo } from '../../store/permissionsStore'-import { useToast } from '../shared/Toast'-import { useTranslation } from '../../i18n'-import { CustomDatePicker } from '../shared/CustomDateTimePicker'-import { type Trip } from '../../types'-import { MAX_TRIP_DAYS, addIsoDays, tripSpanDays, type TripCreateRequest } from '@trek/shared'-import { NumericInput } from '../shared/NumericInput'-import { currenciesWith, SYMBOLS } from '../Budget/BudgetPanel.constants'-import TripDateReview, { dateReviewIsWide } from './TripDateReview'-import { useTripRangeGuard, type RangeCheck } from '../../hooks/useTripRangeGuard'-import type { ShiftMode } from '../../utils/dayImpactLines'-import { useTripCoverPicker } from './useTripCoverPicker'-import { tripFormError } from './tripFormModel'-import { isEffectivelyOffline } from '../../sync/networkMode'-import { tripChangeNeedsConnection } from '../../repo/tripRepo'--type DateShiftMode = ShiftMode-type TripPayload = TripCreateRequest & { date_shift_mode?: DateShiftMode }+import { addIsoDays, MAX_TRIP_DAYS, tripSpanDays, type TripCreateRequest } from '@trek/shared';+import { CalendarDays, Camera, Image as ImageIcon, Pencil, Plane, Search, Type, X } from 'lucide-react';+import { useEffect, useId, useRef, useState } from 'react';+import { authApi, tripsApi } from '../../api/client';+import { useTripRangeGuard, type RangeCheck } from '../../hooks/useTripRangeGuard';+import { useTranslation } from '../../i18n';+import { tripChangeNeedsConnection } from '../../repo/tripRepo';+import { useAuthStore } from '../../store/authStore';+import { useCanDo } from '../../store/permissionsStore';+import { useSettingsStore } from '../../store/settingsStore';+import { isEffectivelyOffline } from '../../sync/networkMode';+import { type Trip } from '../../types';+import type { ShiftMode } from '../../utils/dayImpactLines';+import { currenciesWith, SYMBOLS } from '../Budget/BudgetPanel.constants';+import { CustomDatePicker } from '../shared/CustomDateTimePicker';+import CustomSelect from '../shared/CustomSelect';+import {+ DialogButton,+ DialogFooter,+ DialogHeader,+ DialogShell,+ DialogTile,+ FooterSpacer,+ NEUTRAL_TINT,+} from '../shared/DialogShell';+import { NumericInput } from '../shared/NumericInput';+import { useToast } from '../shared/Toast';+import { CardHead, INPUT, LABEL, PANEL } from '../shared/dialogParts';+import TripDateReview, { dateReviewIsWide } from './TripDateReview';+import { tripFormError } from './tripFormModel';+import { useTripCoverPicker } from './useTripCoverPicker';++type DateShiftMode = ShiftMode;+type TripPayload = TripCreateRequest & { date_shift_mode?: DateShiftMode };/*** A save held back for a look first: the start of a dated trip moved and the@@ -31,40 +39,50 @@ type TripPayload = TripCreateRequest & { date_shift_mode?: DateShiftMode }* something on them. The payload waits here until the traveller confirms.*/interface PendingReview {- payload: TripPayload- askShift: boolean- removal: RangeCheck+ payload: TripPayload;+ askShift: boolean;+ removal: RangeCheck;}interface TripFormModalProps {- isOpen: boolean- onClose: () => void+ isOpen: boolean;+ onClose: () => void;// Create returns the new trip (so we can attach members / upload the cover);// update resolves without a payload.- onSave: (data: TripCreateRequest & { date_shift_mode?: DateShiftMode }) => Promise<{ trip?: Trip } | void> | void- trip: Trip | null- onCoverUpdate?: (tripId: number, coverUrl: string | null) => void+ onSave: (data: TripCreateRequest & { date_shift_mode?: DateShiftMode }) => Promise<{ trip?: Trip } | void> | void;+ trip: Trip | null;+ onCoverUpdate?: (tripId: number, coverUrl: string | null) => void;/*** Drawn inside the trip settings rather than as a dialog of its own (#2811): no* frame and no Cancel, the settings around it close it. One column there, since* beside the settings' own side column two would cut the dates and wrap the chips.*/- embedded?: boolean+ embedded?: boolean;+ /** Embedded, told while the date question is up, so the dialog around it keeps Escape and its backdrop off. */+ onReviewChange?: (reviewing: boolean) => void;}-export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUpdate, embedded = false }: TripFormModalProps) {- const isEditing = !!trip- const labelId = useId()- const fileRef = useRef<HTMLInputElement>(null)- const toast = useToast()- const { t } = useTranslation()- const currentUser = useAuthStore(s => s.user)- const defaultCurrency = useSettingsStore(s => s.settings.default_currency) || 'EUR'- const tripRemindersEnabled = useAuthStore(s => s.tripRemindersEnabled)- const setTripRemindersEnabled = useAuthStore(s => s.setTripRemindersEnabled)- const can = useCanDo()- const canUploadCover = !isEditing || can('trip_cover_upload', trip)- const canEditTrip = !isEditing || can('trip_edit', trip)+export default function TripFormModal({+ isOpen,+ onClose,+ onSave,+ trip,+ onCoverUpdate,+ embedded = false,+ onReviewChange,+}: TripFormModalProps) {+ const isEditing = !!trip;+ const labelId = useId();+ const fileRef = useRef<HTMLInputElement>(null);+ const toast = useToast();+ const { t } = useTranslation();+ const currentUser = useAuthStore((s) => s.user);+ const defaultCurrency = useSettingsStore((s) => s.settings.default_currency) || 'EUR';+ const tripRemindersEnabled = useAuthStore((s) => s.tripRemindersEnabled);+ const setTripRemindersEnabled = useAuthStore((s) => s.setTripRemindersEnabled);+ const can = useCanDo();+ const canUploadCover = !isEditing || can('trip_cover_upload', trip);+ const canEditTrip = !isEditing || can('trip_edit', trip);const [formData, setFormData] = useState({title: '',@@ -74,31 +92,36 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUpcurrency: 'EUR',reminder_days: 0 as number,day_count: 7 as number | '',- })- const [customReminder, setCustomReminder] = useState(false)- const [error, setError] = useState('')- const [isLoading, setIsLoading] = useState(false)- const cover = useTripCoverPicker({ trip, title: formData.title, onCoverUpdate, releasePreviewOnChange: false })+ });+ const [customReminder, setCustomReminder] = useState(false);+ const [error, setError] = useState('');+ const [isLoading, setIsLoading] = useState(false);+ const cover = useTripCoverPicker({ trip, title: formData.title, onCoverUpdate, releasePreviewOnChange: false });const {- coverPreview, uploadingCover, searchQuery: coverSearchQuery, setSearchQuery: setCoverSearchQuery,- searchResults: coverSearchResults, searchError: coverSearchError, searching: searchingCover,- } = cover+ coverPreview,+ uploadingCover,+ searchQuery: coverSearchQuery,+ setSearchQuery: setCoverSearchQuery,+ searchResults: coverSearchResults,+ searchError: coverSearchError,+ searching: searchingCover,+ } = cover;// Drives the drop zone's hover look. Used to be four handlers writing// element.style directly, which is how the indigo dragover colour survived// the move to a configurable accent.- const [coverDragActive, setCoverDragActive] = useState(false)- const [allUsers, setAllUsers] = useState<{ id: number; username: string }[]>([])- const [selectedMembers, setSelectedMembers] = useState<number[]>([])- const [existingMembers, setExistingMembers] = useState<{ id: number; username: string }[]>([])- const [memberSelectValue, setMemberSelectValue] = useState('')- const [pendingReview, setPendingReview] = useState<PendingReview | null>(null)- const [dateShiftMode, setDateShiftMode] = useState<DateShiftMode>('keep_bookings')- const rangeGuard = useTripRangeGuard()- const busy = isLoading || rangeGuard.checking+ const [coverDragActive, setCoverDragActive] = useState(false);+ const [allUsers, setAllUsers] = useState<{ id: number; username: string }[]>([]);+ const [selectedMembers, setSelectedMembers] = useState<number[]>([]);+ const [existingMembers, setExistingMembers] = useState<{ id: number; username: string }[]>([]);+ const [memberSelectValue, setMemberSelectValue] = useState('');+ const [pendingReview, setPendingReview] = useState<PendingReview | null>(null);+ const [dateShiftMode, setDateShiftMode] = useState<DateShiftMode>('keep_bookings');+ const rangeGuard = useTripRangeGuard();+ const busy = isLoading || rangeGuard.checking;useEffect(() => {if (trip) {- const rd = trip.reminder_days ?? 3+ const rd = trip.reminder_days ?? 3;setFormData({title: trip.title || '',description: trip.description || '',@@ -107,55 +130,82 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUpcurrency: trip.currency || 'EUR',reminder_days: rd,day_count: trip.day_count || 7,- })- setCustomReminder(![0, 1, 3, 9].includes(rd))- cover.resetCover(trip.cover_image || null)+ });+ setCustomReminder(![0, 1, 3, 9].includes(rd));+ cover.resetCover(trip.cover_image || null);} else {- setFormData({ title: '', description: '', start_date: '', end_date: '', currency: defaultCurrency, reminder_days: tripRemindersEnabled ? 3 : 0, day_count: 7 })- setCustomReminder(false)- cover.resetCover(null)+ setFormData({+ title: '',+ description: '',+ start_date: '',+ end_date: '',+ currency: defaultCurrency,+ reminder_days: tripRemindersEnabled ? 3 : 0,+ day_count: 7,+ });+ setCustomReminder(false);+ cover.resetCover(null);}- setSelectedMembers([])- setPendingReview(null)- setDateShiftMode('keep_bookings')- setError('')- setExistingMembers([])+ setSelectedMembers([]);+ setPendingReview(null);+ setDateShiftMode('keep_bookings');+ setError('');+ setExistingMembers([]);// The planner keeps this modal mounted while it is closed, so nothing may be// fetched until it is actually open.if (isOpen) {- authApi.getAppConfig().then((c: { trip_reminders_enabled?: boolean }) => {- if (c?.trip_reminders_enabled !== undefined) setTripRemindersEnabled(c.trip_reminders_enabled)- }).catch(() => {})- authApi.listUsers().then(d => setAllUsers(d.users || [])).catch(() => {})- if (trip) {- tripsApi.getMembers(trip.id).then(d => setExistingMembers(d.members || [])).catch(() => {})+ authApi+ .getAppConfig()+ .then((c: { trip_reminders_enabled?: boolean }) => {+ if (c?.trip_reminders_enabled !== undefined) setTripRemindersEnabled(c.trip_reminders_enabled);+ })+ .catch(() => {});+ // The members block is not drawn inside the trip settings, whose People area holds them.+ if (!embedded) {+ authApi+ .listUsers()+ .then((d) => setAllUsers(d.users || []))+ .catch(() => {});+ if (trip)+ tripsApi+ .getMembers(trip.id)+ .then((d) => setExistingMembers(d.members || []))+ .catch(() => {});}}- }, [trip, isOpen])+ }, [trip, isOpen, embedded]);useEffect(() => {if (!trip && isOpen) {- setFormData(prev => ({ ...prev, reminder_days: tripRemindersEnabled ? 3 : 0 }))+ setFormData((prev) => ({ ...prev, reminder_days: tripRemindersEnabled ? 3 : 0 }));}- }, [tripRemindersEnabled])+ }, [tripRemindersEnabled]);const handleSubmit = async (e) => {- e.preventDefault()- setError('')- const formError = tripFormError({ title: formData.title, startDate: formData.start_date, endDate: formData.end_date }, trip, t)- if (formError) { setError(formError); return }+ e.preventDefault();+ setError('');+ const formError = tripFormError(+ { title: formData.title, startDate: formData.start_date, endDate: formData.end_date },+ trip,+ t+ );+ if (formError) {+ setError(formError);+ return;+ }if (!formData.start_date && !formData.end_date) {- const dc = Number(formData.day_count)+ const dc = Number(formData.day_count);if (formData.day_count === '' || !Number.isInteger(dc) || dc < 1 || dc > MAX_TRIP_DAYS) {- setError(t('dashboard.dayCountRequired')); return+ setError(t('dashboard.dayCountRequired'));+ return;}}// The day count goes along only when it says something new. The trip's own// count goes stale in the planner (adding a day does not reload the trip),// and sending the stale number trims the day just added off a trip that was// only renamed. On a trip left without dates the server keeps its days anyway.- const dayCount = Number(formData.day_count)- const sendDayCount = !formData.start_date && !formData.end_date && (!isEditing || dayCount !== trip?.day_count)+ const dayCount = Number(formData.day_count);+ const sendDayCount = !formData.start_date && !formData.end_date && (!isEditing || dayCount !== trip?.day_count);const payload: TripPayload = {title: formData.title.trim(),description: formData.description.trim() || null,@@ -164,100 +214,113 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUpcurrency: formData.currency,reminder_days: formData.reminder_days,...(sendDayCount ? { day_count: dayCount } : {}),- }+ };// Moving the start of a dated trip shifts the whole day grid, so let the user// choose how bookings follow before anything is saved (#1288). End-date-only// changes don't shift days and dateless transitions have nothing to shift.- if (refusedOffline(payload)) return- const askShift = !!(isEditing && trip?.start_date && trip?.end_date- && payload.start_date && payload.end_date && payload.start_date !== trip.start_date)+ if (refusedOffline(payload)) return;+ const askShift = !!(+ isEditing &&+ trip?.start_date &&+ trip?.end_date &&+ payload.start_date &&+ payload.end_date &&+ payload.start_date !== trip.start_date+ );// And say which days the new range removes, with what is on them, before// they are gone: the server takes the last days by position.- const removal = isEditing && trip ? await rangeGuard.check(trip, payload) : null+ const removal = isEditing && trip ? await rangeGuard.check(trip, payload) : null;if (askShift || removal) {- setDateShiftMode('keep_bookings')- setPendingReview({ payload, askShift, removal })- return+ setDateShiftMode('keep_bookings');+ setPendingReview({ payload, askShift, removal });+ return;}- await performSave(payload)- }+ await performSave(payload);+ };// A new trip, new dates or a new currency are made by the server; a new name// or description waits in the queue offline like any other change.const refusedOffline = (payload: TripPayload): boolean => {- if (!isEffectivelyOffline() || (isEditing && !tripChangeNeedsConnection(trip ?? undefined, payload))) return false- setError(t(isEditing ? 'dashboard.tripChangeNeedsConnection' : 'common.needsConnection'))- return true- }+ if (!isEffectivelyOffline() || (isEditing && !tripChangeNeedsConnection(trip ?? undefined, payload))) return false;+ setError(t(isEditing ? 'dashboard.tripChangeNeedsConnection' : 'common.needsConnection'));+ return true;+ };const performSave = async (payload: TripPayload) => {- if (refusedOffline(payload)) return- setIsLoading(true)+ if (refusedOffline(payload)) return;+ setIsLoading(true);try {- const result = await onSave(payload)- const createdTrip = result ? result.trip : undefined+ const result = await onSave(payload);+ const createdTrip = result ? result.trip : undefined;// Add selected members for newly created tripsif (selectedMembers.length > 0 && createdTrip?.id) {- let memberAddFailed = false+ let memberAddFailed = false;for (const userId of selectedMembers) {- const user = allUsers.find(u => u.id === userId)+ const user = allUsers.find((u) => u.id === userId);if (user) {- try { await tripsApi.addMember(createdTrip.id, user.username) } catch { memberAddFailed = true }+ try {+ await tripsApi.addMember(createdTrip.id, user.username);+ } catch {+ memberAddFailed = true;+ }}}- if (memberAddFailed) toast.error(t('trips.memberAddError'))+ if (memberAddFailed) toast.error(t('trips.memberAddError'));}// Upload pending cover for newly created trips- await cover.applyToCreatedTrip(createdTrip?.id)- onClose()+ await cover.applyToCreatedTrip(createdTrip?.id);+ onClose();} catch (err: unknown) {- setError(err instanceof Error ? err.message : t('places.saveError'))+ setError(err instanceof Error ? err.message : t('places.saveError'));} finally {- setIsLoading(false)+ setIsLoading(false);}- }+ };- const handleCoverSelect = cover.selectFile+ const handleCoverSelect = cover.selectFile;const handleCoverChange = (e: React.ChangeEvent<HTMLInputElement>) => {- void handleCoverSelect(e.target.files?.[0])- e.target.value = ''- }+ void handleCoverSelect(e.target.files?.[0]);+ e.target.value = '';+ };- const handleCoverSearch = cover.search- const handleUnsplashSelect = cover.selectPhoto- const handleRemoveCover = cover.removeCover+ const handleCoverSearch = cover.search;+ const handleUnsplashSelect = cover.selectPhoto;+ const handleRemoveCover = cover.removeCover;// Paste support for cover imageconst handlePaste = (e: React.ClipboardEvent) => {- if (!canUploadCover) return- const items = e.clipboardData?.items- if (!items) return+ if (!canUploadCover) return;+ const items = e.clipboardData?.items;+ if (!items) return;for (const item of Array.from(items)) {if (item.type.startsWith('image/')) {- e.preventDefault()- const file = item.getAsFile()- if (file) void handleCoverSelect(file)- return+ e.preventDefault();+ const file = item.getAsFile();+ if (file) void handleCoverSelect(file);+ return;}}- }+ };// An edit answers whatever the last save complained about, so the complaint// goes with it rather than standing over the fixed field until the next save.- const update = (field, value) => { setError(''); setFormData(prev => {- const next = { ...prev, [field]: value }- if (field === 'start_date' && value) {- if (!prev.end_date || prev.end_date < value) {- next.end_date = value- } else if (prev.start_date) {- // Keep the trip's length, counted in UTC calendar days: a local-time- // shift across a DST change used to drop or add a day.- next.end_date = addIsoDays(value, tripSpanDays(prev.start_date, prev.end_date) - 1)+ const update = (field, value) => {+ setError('');+ setFormData((prev) => {+ const next = { ...prev, [field]: value };+ if (field === 'start_date' && value) {+ if (!prev.end_date || prev.end_date < value) {+ next.end_date = value;+ } else if (prev.start_date) {+ // Keep the trip's length, counted in UTC calendar days: a local-time+ // shift across a DST change used to drop or add a day.+ next.end_date = addIsoDays(value, tripSpanDays(prev.start_date, prev.end_date) - 1);+ }}- }- return next- }) }+ return next;+ });+ };/* The dashboard's shapes, in the app's own tokens.`.trek-dash` deliberately scopes its palette to that page, so none of its@@ -266,22 +329,41 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUpfields, and overline captions rather than sentence-case labels. */// The dialogs' own language: their fields, eyebrows, panels and buttons, so the// form reads alike on its own and inside the trip settings.- const inputCls = INPUT- const labelCls = `${LABEL.replace('block ', '')} flex items-center gap-1`+ const inputCls = INPUT;+ const labelCls = `${LABEL.replace('block ', '')} flex items-center gap-1`;/* Two columns once there is room for them: the form had grown to eight stackedblocks and the create button sat a full screen below the title. Left is whatthe trip looks like, right is when and with whom. One column below md. */- const columnCls = "flex flex-col gap-4"- const panelCls = PANEL+ const columnCls = 'flex flex-col gap-4';+ const panelCls = PANEL;- const reviewTitle = pendingReview ? t(pendingReview.askShift ? 'dashboard.dateShiftTitle' : 'dashboard.shrinkTitle') : ''+ // Escape in the date question goes back to the form; embedded, the settings around it must not close on it.+ const reviewing = pendingReview != null;+ useEffect(() => {+ onReviewChange?.(reviewing);+ }, [reviewing, onReviewChange]);++ const reviewTitle = pendingReview+ ? t(pendingReview.askShift ? 'dashboard.dateShiftTitle' : 'dashboard.shrinkTitle')+ : '';const buttons = pendingReview ? (<>- <DialogButton onClick={() => setPendingReview(null)} disabled={busy}>{t('common.back')}</DialogButton>+ <DialogButton onClick={() => setPendingReview(null)} disabled={busy}>+ {t('common.back')}+ </DialogButton>{/* Removing days with something on them is the one save here thatloses work, so it asks in the danger tone and says so. */}- <DialogButton variant={pendingReview.removal ? 'danger' : 'primary'} disabled={busy}- onClick={() => performSave(pendingReview.askShift ? { ...pendingReview.payload, date_shift_mode: dateShiftMode } : pendingReview.payload)}>+ <DialogButton+ variant={pendingReview.removal ? 'danger' : 'primary'}+ disabled={busy}+ onClick={() =>+ performSave(+ pendingReview.askShift+ ? { ...pendingReview.payload, date_shift_mode: dateShiftMode }+ : pendingReview.payload+ )+ }+ >{isLoading ? t('common.saving') : t(pendingReview.removal ? 'dashboard.shrinkConfirm' : 'common.update')}</DialogButton></>@@ -292,303 +374,412 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUp{busy ? t('common.saving') : isEditing ? t('common.update') : t('dashboard.createTrip')}</DialogButton></>- )+ );const content = (<>- {pendingReview && (- <TripDateReview- askShift={pendingReview.askShift}- shiftMode={dateShiftMode}- onShiftMode={setDateShiftMode}- removal={pendingReview.removal}- error={error}- />- )}- <form onSubmit={handleSubmit} className={pendingReview ? 'hidden' : 'space-y-4'} onPaste={handlePaste}>- {error && (- <div className="p-3 bg-danger-soft border border-danger/30 rounded-xl text-body text-danger">{error}</div>+ {pendingReview && (+ <TripDateReview+ askShift={pendingReview.askShift}+ shiftMode={dateShiftMode}+ onShiftMode={setDateShiftMode}+ removal={pendingReview.removal}+ error={error}+ />)}+ <form onSubmit={handleSubmit} className={pendingReview ? 'hidden' : 'space-y-4'} onPaste={handlePaste}>+ {error && (+ <div className="border-danger/30 rounded-xl border bg-danger-soft p-3 text-body text-danger">{error}</div>+ )}- <div className={`grid grid-cols-1 gap-x-6 gap-y-4 items-start ${embedded ? '' : 'md:grid-cols-2'}`}>-- {/* Left column — what the trip is: its picture, its name, what it is about. */}- <div className={columnCls}>-- {/* Cover image — gated by trip_cover_upload permission */}- {canUploadCover && <div className={panelCls}>- <CardHead icon={<ImageIcon size={16} strokeWidth={2} />} title={t('trip.form.coverTitle')} hint={t('trip.form.coverHint')} />- <input ref={fileRef} type="file" accept="image/*" className="hidden" onChange={handleCoverChange} />- {coverPreview ? (- <div className={`relative h-[110px] rounded-xl overflow-hidden`}>- <img src={coverPreview} alt="" className="w-full h-full object-cover" />- <div className="absolute bottom-2 end-2 flex gap-1.5">- {/* Chrome sitting on top of a photo, so it is deliberately dark in+ <div className={`grid grid-cols-1 items-start gap-x-6 gap-y-4 ${embedded ? '' : 'md:grid-cols-2'}`}>+ {/* Left column — what the trip is: its picture, its name, what it is about. */}+ <div className={columnCls}>+ {/* Cover image — gated by trip_cover_upload permission */}+ {canUploadCover && (+ <div className={panelCls}>+ <CardHead+ icon={<ImageIcon size={16} strokeWidth={2} />}+ title={t('trip.form.coverTitle')}+ hint={t('trip.form.coverHint')}+ />+ <input ref={fileRef} type="file" accept="image/*" className="hidden" onChange={handleCoverChange} />+ {coverPreview ? (+ <div className={`relative h-[110px] overflow-hidden rounded-xl`}>+ <img src={coverPreview} alt="" className="h-full w-full object-cover" />+ <div className="absolute bottom-2 end-2 flex gap-1.5">+ {/* Chrome sitting on top of a photo, so it is deliberately dark inboth themes rather than following the surface tokens. */}- <button type="button" onClick={() => fileRef.current?.click()} disabled={uploadingCover}- className="flex items-center gap-1 px-2.5 py-[5px] rounded-lg bg-black/55 backdrop-blur-sm text-white text-caption font-semibold">- <Camera size={12} /> {uploadingCover ? t('common.uploading') : t('common.change')}- </button>- <button type="button" onClick={handleRemoveCover} aria-label={t('common.remove')}- className="flex items-center px-2 py-[5px] rounded-lg bg-black/55 backdrop-blur-sm text-white">- <X size={12} />- </button>- </div>- </div>- ) : (- <button type="button" onClick={() => fileRef.current?.click()} disabled={uploadingCover}- onDragOver={e => { e.preventDefault(); setCoverDragActive(true) }}- onDragLeave={() => setCoverDragActive(false)}- onDrop={e => { e.preventDefault(); setCoverDragActive(false); const file = e.dataTransfer.files?.[0]; if (file?.type.startsWith('image/')) void handleCoverSelect(file) }}- className={`w-full h-11 border-[1.5px] rounded-[10px] text-[length:calc(13px*var(--fs-scale-body,1))] px-4 border-dashed flex items-center justify-center gap-1.5 transition-colors ${- coverDragActive- ? 'border-accent bg-accent-subtle text-content'- : 'border-edge text-content-faint hover:border-edge-secondary hover:text-content-muted'- }`}>- <Camera size={15} /> {uploadingCover ? t('common.uploading') : t('dashboard.addCoverImage')}- </button>- )}- <div className="mt-2 flex gap-2">- <input- type="text"- value={coverSearchQuery}- onChange={e => setCoverSearchQuery(e.target.value)}- onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); void handleCoverSearch() } }}- placeholder={t('dashboard.unsplashSearchPlaceholder')}- className={inputCls}- />- <button type="button" onClick={handleCoverSearch} disabled={searchingCover || (!coverSearchQuery.trim() && !formData.title.trim())}- className='inline-flex flex-none items-center gap-1.5 whitespace-nowrap rounded-[10px] bg-accent px-4 py-2 text-[length:calc(13px*var(--fs-scale-body,1))] font-medium text-accent-text hover:opacity-90 disabled:cursor-default disabled:opacity-50'>- {searchingCover ? <div className="w-4 h-4 border-2 border-edge border-t-content-muted rounded-full animate-spin" /> : <Search size={14} />}- {t('dashboard.searchUnsplash')}- </button>- </div>- {coverSearchError && <p className="text-caption text-danger mt-1.5">{coverSearchError}</p>}- {coverSearchResults.length > 0 && (- <div className="grid grid-cols-3 gap-2 mt-2">- {coverSearchResults.map(photo => (- <button- type="button"- key={photo.id}- onClick={() => handleUnsplashSelect(photo)}- aria-label={t('dashboard.useUnsplashPhoto', { photographer: photo.photographer || 'Unsplash' })}- className={`relative h-20 overflow-hidden rounded-xl border transition-colors ${coverPreview === photo.url ? 'border-accent ring-2 ring-accent/20' : 'border-edge hover:border-content-faint'}`}- >- <img src={photo.thumb} alt={photo.description || ''} loading="lazy" className="w-full h-full object-cover" />- {photo.photographer && (- <span className="absolute inset-x-0 bottom-0 truncate bg-black/55 px-1.5 py-1 text-caption text-white">- {photo.photographer}- </span>+ <button+ type="button"+ onClick={() => fileRef.current?.click()}+ disabled={uploadingCover}+ className="flex items-center gap-1 rounded-lg bg-black/55 px-2.5 py-[5px] text-caption font-semibold text-white backdrop-blur-sm"+ >+ <Camera size={12} /> {uploadingCover ? t('common.uploading') : t('common.change')}+ </button>+ <button+ type="button"+ onClick={handleRemoveCover}+ aria-label={t('common.remove')}+ className="flex items-center rounded-lg bg-black/55 px-2 py-[5px] text-white backdrop-blur-sm"+ >+ <X size={12} />+ </button>+ </div>+ </div>+ ) : (+ <button+ type="button"+ onClick={() => fileRef.current?.click()}+ disabled={uploadingCover}+ onDragOver={(e) => {+ e.preventDefault();+ setCoverDragActive(true);+ }}+ onDragLeave={() => setCoverDragActive(false)}+ onDrop={(e) => {+ e.preventDefault();+ setCoverDragActive(false);+ const file = e.dataTransfer.files?.[0];+ if (file?.type.startsWith('image/')) void handleCoverSelect(file);+ }}+ className={`flex h-11 w-full items-center justify-center gap-1.5 rounded-[10px] border-[1.5px] border-dashed px-4 text-[length:calc(13px*var(--fs-scale-body,1))] transition-colors ${+ coverDragActive+ ? 'border-accent bg-accent-subtle text-content'+ : 'border-edge text-content-faint hover:border-edge-secondary hover:text-content-muted'+ }`}+ >+ <Camera size={15} /> {uploadingCover ? t('common.uploading') : t('dashboard.addCoverImage')}+ </button>)}- </button>- ))}- </div>- )}- </div>}-- <div className={`${panelCls} flex-1`}>- <CardHead icon={<Type size={16} strokeWidth={2} />} title={t('trip.form.aboutTitle')} hint={t('trip.form.aboutHint')} />- <div>- <label className={labelCls}>- {t('dashboard.tripTitle')} <span className="text-danger">*</span>- </label>- <input type="text" value={formData.title} onChange={e => canEditTrip && update('title', e.target.value)}- required readOnly={!canEditTrip} placeholder={t('dashboard.tripTitlePlaceholder')} className={inputCls} />- </div>-- <div>- <label className={labelCls}>{t('dashboard.tripDescription')}</label>- <textarea value={formData.description} onChange={e => canEditTrip && update('description', e.target.value)}- readOnly={!canEditTrip} placeholder={t('dashboard.tripDescriptionPlaceholder')} rows={3}- className={`${inputCls} resize-none`} />- </div>- </div>-- </div>{/* /left column */}-- {/* Right column — when it happens, in what currency, with whom. */}- <div className={columnCls}>+ <div className="mt-2 flex gap-2">+ <input+ type="text"+ value={coverSearchQuery}+ onChange={(e) => setCoverSearchQuery(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ e.preventDefault();+ void handleCoverSearch();+ }+ }}+ placeholder={t('dashboard.unsplashSearchPlaceholder')}+ className={inputCls}+ />+ <button+ type="button"+ onClick={handleCoverSearch}+ disabled={searchingCover || (!coverSearchQuery.trim() && !formData.title.trim())}+ className="inline-flex flex-none items-center gap-1.5 whitespace-nowrap rounded-[10px] bg-accent px-4 py-2 text-[length:calc(13px*var(--fs-scale-body,1))] font-medium text-accent-text hover:opacity-90 disabled:cursor-default disabled:opacity-50"+ >+ {searchingCover ? (+ <div className="h-4 w-4 animate-spin rounded-full border-2 border-edge border-t-content-muted" />+ ) : (+ <Search size={14} />+ )}+ {t('dashboard.searchUnsplash')}+ </button>+ </div>+ {coverSearchError && <p className="mt-1.5 text-caption text-danger">{coverSearchError}</p>}+ {coverSearchResults.length > 0 && (+ <div className="mt-2 grid grid-cols-3 gap-2">+ {coverSearchResults.map((photo) => (+ <button+ type="button"+ key={photo.id}+ onClick={() => handleUnsplashSelect(photo)}+ aria-label={t('dashboard.useUnsplashPhoto', { photographer: photo.photographer || 'Unsplash' })}+ className={`relative h-20 overflow-hidden rounded-xl border transition-colors ${coverPreview === photo.url ? 'ring-accent/20 border-accent ring-2' : 'border-edge hover:border-content-faint'}`}+ >+ <img+ src={photo.thumb}+ alt={photo.description || ''}+ loading="lazy"+ className="h-full w-full object-cover"+ />+ {photo.photographer && (+ <span className="absolute inset-x-0 bottom-0 truncate bg-black/55 px-1.5 py-1 text-caption text-white">+ {photo.photographer}+ </span>+ )}+ </button>+ ))}+ </div>+ )}+ </div>+ )}- <div className={panelCls}>- <CardHead icon={<CalendarDays size={16} strokeWidth={2} />} title={t('trip.form.whenTitle')} hint={t('trip.form.whenHint')} />+ <div className={`${panelCls} flex-1`}>+ <CardHead+ icon={<Type size={16} strokeWidth={2} />}+ title={t('trip.form.aboutTitle')}+ hint={t('trip.form.aboutHint')}+ />+ <div>+ <label className={labelCls}>+ {t('dashboard.tripTitle')} <span className="text-danger">*</span>+ </label>+ <input+ type="text"+ value={formData.title}+ onChange={(e) => canEditTrip && update('title', e.target.value)}+ required+ readOnly={!canEditTrip}+ placeholder={t('dashboard.tripTitlePlaceholder')}+ className={inputCls}+ />+ </div>- {/* min-w-0 on both cells: a grid item defaults to min-width:auto, so a+ <div>+ <label className={labelCls}>{t('dashboard.tripDescription')}</label>+ <textarea+ value={formData.description}+ onChange={(e) => canEditTrip && update('description', e.target.value)}+ readOnly={!canEditTrip}+ placeholder={t('dashboard.tripDescriptionPlaceholder')}+ rows={3}+ className={`${inputCls} resize-none`}+ />+ </div>+ </div>+ </div>+ {/* /left column */}++ {/* Right column — when it happens, in what currency, with whom. */}+ <div className={columnCls}>+ <div className={panelCls}>+ <CardHead+ icon={<CalendarDays size={16} strokeWidth={2} />}+ title={t('trip.form.whenTitle')}+ hint={t('trip.form.whenHint')}+ />++ {/* min-w-0 on both cells: a grid item defaults to min-width:auto, so along date ("12. Sept. 2026" and the keyboard button beside it) pushedthe cell past its track and the two columns overlapped (#2267). */}- <div className="grid grid-cols-2 gap-3">- <div className="min-w-0">- <label className={labelCls}>- {t('dashboard.startDate')}- </label>- <CustomDatePicker value={formData.start_date} onChange={v => update('start_date', v)} placeholder={t('dashboard.startDate')} />- </div>- <div className="min-w-0">- <label className={labelCls}>- {t('dashboard.endDate')}- </label>- <CustomDatePicker value={formData.end_date} onChange={v => update('end_date', v)} placeholder={t('dashboard.endDate')} />- </div>- </div>-- {!formData.start_date && !formData.end_date && (- <div>- <label className={labelCls}>- {t('dashboard.dayCount')}- </label>- <NumericInput min={1} max={MAX_TRIP_DAYS} value={formData.day_count}- onValueChange={raw => {- if (raw === '') { update('day_count', ''); return }- const n = Math.floor(Number(raw))- if (Number.isFinite(n)) update('day_count', Math.min(MAX_TRIP_DAYS, Math.max(1, n)))- }}- className={inputCls} />- <p className="text-caption text-content-faint mt-1.5">{t('dashboard.dayCountHint')}</p>- </div>- )}-- <div>- <label className={labelCls}>{t('dashboard.currency')}</label>- <CustomSelect- value={formData.currency}- onChange={v => canEditTrip && update('currency', v)}- disabled={!canEditTrip}- options={currenciesWith(formData.currency).map(c => ({ value: c, label: `${c} (${SYMBOLS[c] || c})` }))}- searchable- />- </div>+ <div className="grid grid-cols-2 gap-3">+ <div className="min-w-0">+ <label className={labelCls}>{t('dashboard.startDate')}</label>+ <CustomDatePicker+ value={formData.start_date}+ onChange={(v) => update('start_date', v)}+ placeholder={t('dashboard.startDate')}+ />+ </div>+ <div className="min-w-0">+ <label className={labelCls}>{t('dashboard.endDate')}</label>+ <CustomDatePicker+ value={formData.end_date}+ onChange={(v) => update('end_date', v)}+ placeholder={t('dashboard.endDate')}+ />+ </div>+ </div>- {/* Reminder — only visible to owner (or when creating) */}- {(!isEditing || trip?.user_id === currentUser?.id || currentUser?.role === 'admin') && (- <div className={!tripRemindersEnabled ? 'opacity-50' : ''}>- <label className={labelCls}>- {t('trips.reminder')}- </label>- {!tripRemindersEnabled ? (- <p className="text-caption text-content-faint bg-surface rounded-xl p-3">- {t('trips.reminderDisabledHint')}- </p>- ) : (- <>- <div className="flex flex-wrap gap-2">- {[- { value: 0, label: t('trips.reminderNone') },- { value: 1, label: `1 ${t('trips.reminderDay')}` },- { value: 3, label: `3 ${t('trips.reminderDays')}` },- { value: 9, label: `9 ${t('trips.reminderDays')}` },- ].map(opt => (- <button key={opt.value} type="button"- onClick={() => { update('reminder_days', opt.value); setCustomReminder(false) }}- className={`px-3 py-1.5 text-caption font-medium rounded-full border transition-colors ${- !customReminder && formData.reminder_days === opt.value- ? 'bg-accent text-accent-text border-accent'- : 'bg-surface text-content-secondary border-edge hover:border-content-faint'- }`}>- {opt.label}- </button>- ))}- <button type="button"- onClick={() => { setCustomReminder(true); if ([0, 1, 3, 9].includes(formData.reminder_days)) update('reminder_days', 7) }}- className={`px-3 py-1.5 text-caption font-medium rounded-full border transition-colors ${- customReminder- ? 'bg-accent text-accent-text border-accent'- : 'bg-surface text-content-secondary border-edge hover:border-content-faint'- }`}>- {t('trips.reminderCustom')}- </button>- </div>- {customReminder && (- <div className="flex items-center gap-2 mt-2">- <NumericInput min={1} max={30}- value={formData.reminder_days}- onValueChange={raw => update('reminder_days', Math.max(1, Math.min(30, Number(raw) || 1)))}- className="w-20 px-3 py-1.5 border border-edge rounded-xl bg-surface-input text-body text-content focus:outline-none focus:ring-2 focus:ring-accent/40" />- <span className="text-caption text-content-muted">{t('trips.reminderDaysBefore')}</span>+ {!formData.start_date && !formData.end_date && (+ <div>+ <label className={labelCls}>{t('dashboard.dayCount')}</label>+ <NumericInput+ min={1}+ max={MAX_TRIP_DAYS}+ value={formData.day_count}+ onValueChange={(raw) => {+ if (raw === '') {+ update('day_count', '');+ return;+ }+ const n = Math.floor(Number(raw));+ if (Number.isFinite(n)) update('day_count', Math.min(MAX_TRIP_DAYS, Math.max(1, n)));+ }}+ className={inputCls}+ />+ <p className="mt-1.5 text-caption text-content-faint">{t('dashboard.dayCountHint')}</p>+ </div>+ )}++ <div>+ <label className={labelCls}>{t('dashboard.currency')}</label>+ <CustomSelect+ value={formData.currency}+ onChange={(v) => canEditTrip && update('currency', v)}+ disabled={!canEditTrip}+ options={currenciesWith(formData.currency).map((c) => ({+ value: c,+ label: `${c} (${SYMBOLS[c] || c})`,+ }))}+ searchable+ /></div>- )}- </>- )}- </div>- )}- {/* Members. Not inside the trip settings, whose People area is where they are managed. */}- {!embedded && allUsers.filter(u => u.id !== currentUser?.id).length > 0 && (- <div>- <label className={labelCls}>- {t('dashboard.addMembers')}- </label>- {/* Existing members (editing mode) */}- {isEditing && existingMembers.length > 0 && (- <div className="flex flex-wrap gap-1.5 mb-2">- {existingMembers.map(m => (- <button type="button" key={m.id} disabled={m.id === currentUser?.id}- className="inline-flex items-center gap-1.5 rounded-full bg-surface-card px-2.5 py-[3px] text-[length:calc(12px*var(--fs-scale-body,1))] font-medium text-content shadow-sm ring-1 ring-edge-faint"- onClick={async () => {- if (m.id === currentUser?.id) return- if (isEffectivelyOffline()) { toast.error(t('common.needsConnection')); return }- try {- await tripsApi.removeMember(trip!.id, m.id)- setExistingMembers(prev => prev.filter(x => x.id !== m.id))- toast.success(t('trips.memberRemoved', { username: m.username }))- } catch { toast.error(t('trips.memberRemoveError')) }- }}- style={{ cursor: m.id === currentUser?.id ? 'default' : 'pointer' }}>- {m.username}- {m.id !== currentUser?.id && <X size={11} className="text-content-faint" />}- </button>- ))}+ {/* Reminder — only visible to owner (or when creating) */}+ {(!isEditing || trip?.user_id === currentUser?.id || currentUser?.role === 'admin') && (+ <div className={!tripRemindersEnabled ? 'opacity-50' : ''}>+ <label className={labelCls}>{t('trips.reminder')}</label>+ {!tripRemindersEnabled ? (+ <p className="rounded-xl bg-surface p-3 text-caption text-content-faint">+ {t('trips.reminderDisabledHint')}+ </p>+ ) : (+ <>+ <div className="flex flex-wrap gap-2">+ {[+ { value: 0, label: t('trips.reminderNone') },+ { value: 1, label: `1 ${t('trips.reminderDay')}` },+ { value: 3, label: `3 ${t('trips.reminderDays')}` },+ { value: 9, label: `9 ${t('trips.reminderDays')}` },+ ].map((opt) => (+ <button+ key={opt.value}+ type="button"+ onClick={() => {+ update('reminder_days', opt.value);+ setCustomReminder(false);+ }}+ className={`rounded-full border px-3 py-1.5 text-caption font-medium transition-colors ${+ !customReminder && formData.reminder_days === opt.value+ ? 'border-accent bg-accent text-accent-text'+ : 'border-edge bg-surface text-content-secondary hover:border-content-faint'+ }`}+ >+ {opt.label}+ </button>+ ))}+ <button+ type="button"+ onClick={() => {+ setCustomReminder(true);+ if ([0, 1, 3, 9].includes(formData.reminder_days)) update('reminder_days', 7);+ }}+ className={`rounded-full border px-3 py-1.5 text-caption font-medium transition-colors ${+ customReminder+ ? 'border-accent bg-accent text-accent-text'+ : 'border-edge bg-surface text-content-secondary hover:border-content-faint'+ }`}+ >+ {t('trips.reminderCustom')}+ </button>+ </div>+ {customReminder && (+ <div className="mt-2 flex items-center gap-2">+ <NumericInput+ min={1}+ max={30}+ value={formData.reminder_days}+ onValueChange={(raw) =>+ update('reminder_days', Math.max(1, Math.min(30, Number(raw) || 1)))+ }+ className="focus:ring-accent/40 w-20 rounded-xl border border-edge bg-surface-input px-3 py-1.5 text-body text-content focus:outline-none focus:ring-2"+ />+ <span className="text-caption text-content-muted">{t('trips.reminderDaysBefore')}</span>+ </div>+ )}+ </>+ )}+ </div>+ )}++ {/* Members. Not inside the trip settings, whose People area is where they are managed. */}+ {!embedded && allUsers.filter((u) => u.id !== currentUser?.id).length > 0 && (+ <div>+ <label className={labelCls}>{t('dashboard.addMembers')}</label>+ {/* Existing members (editing mode) */}+ {isEditing && existingMembers.length > 0 && (+ <div className="mb-2 flex flex-wrap gap-1.5">+ {existingMembers.map((m) => (+ <button+ type="button"+ key={m.id}+ disabled={m.id === currentUser?.id}+ className="inline-flex items-center gap-1.5 rounded-full bg-surface-card px-2.5 py-[3px] text-[length:calc(12px*var(--fs-scale-body,1))] font-medium text-content shadow-sm ring-1 ring-edge-faint"+ onClick={async () => {+ if (m.id === currentUser?.id) return;+ if (isEffectivelyOffline()) {+ toast.error(t('common.needsConnection'));+ return;+ }+ try {+ await tripsApi.removeMember(trip!.id, m.id);+ setExistingMembers((prev) => prev.filter((x) => x.id !== m.id));+ toast.success(t('trips.memberRemoved', { username: m.username }));+ } catch {+ toast.error(t('trips.memberRemoveError'));+ }+ }}+ style={{ cursor: m.id === currentUser?.id ? 'default' : 'pointer' }}+ >+ {m.username}+ {m.id !== currentUser?.id && <X size={11} className="text-content-faint" />}+ </button>+ ))}+ </div>+ )}+ {/* Newly selected members (both modes) */}+ {selectedMembers.length > 0 && (+ <div className="mb-2 flex flex-wrap gap-1.5">+ {selectedMembers.map((uid) => {+ const user = allUsers.find((u) => u.id === uid)!;+ return (+ <button+ type="button"+ key={uid}+ onClick={() => setSelectedMembers((prev) => prev.filter((id) => id !== uid))}+ className="inline-flex cursor-pointer items-center gap-1.5 rounded-full bg-surface-card px-2.5 py-[3px] text-[length:calc(12px*var(--fs-scale-body,1))] font-medium text-content shadow-sm ring-1 ring-edge-faint"+ >+ {user.username}+ <X size={11} className="text-content-faint" />+ </button>+ );+ })}+ </div>+ )}+ <div style={{ display: 'flex', gap: 8 }}>+ <CustomSelect+ value={memberSelectValue}+ onChange={async (value) => {+ if (isEditing && trip?.id) {+ const user = allUsers.find((u) => u.id === Number(value));+ if (user && isEffectivelyOffline()) {+ toast.error(t('common.needsConnection'));+ } else if (user) {+ try {+ await tripsApi.addMember(trip.id, user.username);+ setExistingMembers((prev) => [...prev, { id: user.id, username: user.username }]);+ toast.success(t('trips.memberAdded', { username: user.username }));+ } catch {+ toast.error(t('trips.memberAddError'));+ }+ }+ } else {+ setSelectedMembers((prev) =>+ prev.includes(Number(value)) ? prev : [...prev, Number(value)]+ );+ }+ setMemberSelectValue('');+ }}+ placeholder={t('dashboard.addMember')}+ options={allUsers+ .filter(+ (u) =>+ u.id !== currentUser?.id &&+ !selectedMembers.includes(u.id) &&+ !existingMembers.some((m) => m.id === u.id)+ )+ .map((u) => ({ value: u.id, label: u.username }))}+ searchable+ size="sm"+ />+ </div>+ </div>+ )}</div>- )}- {/* Newly selected members (both modes) */}- {selectedMembers.length > 0 && (- <div className="flex flex-wrap gap-1.5 mb-2">- {selectedMembers.map(uid => {- const user = allUsers.find(u => u.id === uid)!- return (- <button type="button" key={uid} onClick={() => setSelectedMembers(prev => prev.filter(id => id !== uid))}- className="inline-flex items-center gap-1.5 rounded-full bg-surface-card px-2.5 py-[3px] text-[length:calc(12px*var(--fs-scale-body,1))] font-medium text-content shadow-sm ring-1 ring-edge-faint cursor-pointer">- {user.username}- <X size={11} className="text-content-faint" />- </button>- )- })}- </div>- )}- <div style={{ display: 'flex', gap: 8 }}>- <CustomSelect- value={memberSelectValue}- onChange={async value => {- if (isEditing && trip?.id) {- const user = allUsers.find(u => u.id === Number(value))- if (user && isEffectivelyOffline()) {- toast.error(t('common.needsConnection'))- } else if (user) {- try {- await tripsApi.addMember(trip.id, user.username)- setExistingMembers(prev => [...prev, { id: user.id, username: user.username }])- toast.success(t('trips.memberAdded', { username: user.username }))- } catch { toast.error(t('trips.memberAddError')) }- }- } else {- setSelectedMembers(prev => prev.includes(Number(value)) ? prev : [...prev, Number(value)])- }- setMemberSelectValue('')- }}- placeholder={t('dashboard.addMember')}- options={allUsers.filter(u => u.id !== currentUser?.id && !selectedMembers.includes(u.id) && !existingMembers.some(m => m.id === u.id)).map(u => ({ value: u.id, label: u.username }))}- searchable- size="sm"- />+ {/* /right panel */}</div>+ {/* /right column */}</div>- )}-- </div>{/* /right panel */}-- </div>{/* /right column */}-- </div>{/* /two-column grid */}- </form>+ {/* /two-column grid */}+ </form></>- )+ );if (embedded) {return (@@ -597,7 +788,7 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUp{content}<div className="flex justify-end gap-2">{buttons}</div></div>- )+ );}return (@@ -606,25 +797,52 @@ export default function TripFormModal({ isOpen, onClose, onSave, trip, onCoverUp// In the review step Escape, the close button and a click beside the// dialog go back to the form, like Back, instead of throwing the whole// edit away. Outside that step they close the dialog as before.- onClose={pendingReview ? () => { if (!busy) setPendingReview(null) } : onClose}+ onClose={+ pendingReview+ ? () => {+ if (!busy) setPendingReview(null);+ }+ : onClose+ }labelledBy={labelId}/* The review step is a few radio buttons and a short list; alone, eithertakes the width of the day dialog, where the same list stands. With both,they stand side by side at the form's own width. */width={pendingReview && !dateReviewIsWide(pendingReview.askShift, pendingReview.removal) ? 'detail' : 'wide'}- header={(+ header={<DialogHeader- tile={<DialogTile>{isEditing ? <Pencil size={20} strokeWidth={1.9} className="text-content-muted" /> : <Plane size={20} strokeWidth={1.9} className="text-content-muted" />}</DialogTile>}+ tile={+ <DialogTile>+ {isEditing ? (+ <Pencil size={20} strokeWidth={1.9} className="text-content-muted" />+ ) : (+ <Plane size={20} strokeWidth={1.9} className="text-content-muted" />+ )}+ </DialogTile>+ }tint={NEUTRAL_TINT}labelId={labelId}- onClose={pendingReview ? () => { if (!busy) setPendingReview(null) } : onClose}+ onClose={+ pendingReview+ ? () => {+ if (!busy) setPendingReview(null);+ }+ : onClose+ }eyebrow={pendingReview ? undefined : isEditing ? t('dashboard.editTrip') : undefined}- title={pendingReview ? reviewTitle : isEditing ? (trip?.title || t('dashboard.editTrip')) : t('dashboard.createTrip')}+ title={+ pendingReview ? reviewTitle : isEditing ? trip?.title || t('dashboard.editTrip') : t('dashboard.createTrip')+ }/>- )}- footer={<DialogFooter><FooterSpacer />{buttons}</DialogFooter>}+ }+ footer={+ <DialogFooter>+ <FooterSpacer />+ {buttons}+ </DialogFooter>+ }>{content}</DialogShell>- )+ );}diff --git a/client/src/components/Trips/TripShareDialog.tsx b/client/src/components/Trips/TripShareDialog.tsxindex af636f71e..7671aff10 100644--- a/client/src/components/Trips/TripShareDialog.tsx+++ b/client/src/components/Trips/TripShareDialog.tsx@@ -79,6 +79,7 @@ function OpenDialog({ onClose, tripId, tripTitle, onMembersChanged, editTrip }:const m = useTripMembers({ isOpen: true, tripId, onClose, onMembersChanged })const [ask, setAsk] = useState<Ask | null>(null)const [area, setArea] = useState<Area>('people')+ const [tripReviewing, setTripReviewing] = useState(false)const journalSection = useTripJournalSectionVisible(tripId)const shows: Record<Area, boolean> = { people: true, sharing: m.canManageShare, journal: journalSection, trip: !!editTrip }const areas = AREAS.filter(a => shows[a.id])@@ -93,7 +94,7 @@ function OpenDialog({ onClose, tripId, tripTitle, onMembersChanged, editTrip }:onClose={onClose}labelledBy={labelId}width={withNav ? 'wide' : 'detail'}- blocked={!!ask}+ blocked={!!ask || tripReviewing}bodyClassName={BODY}header={(<DialogHeader@@ -133,7 +134,7 @@ function OpenDialog({ onClose, tripId, tripTitle, onMembersChanged, editTrip }:)}{editTrip && (<AreaPanel area={panelOf('trip')} shown={current.id === 'trip'} titled>- <TripFormModal embedded isOpen onClose={onClose} {...editTrip} />+ <TripFormModal embedded isOpen onClose={onClose} onReviewChange={setTripReviewing} {...editTrip} /></AreaPanel>)}</div>diff --git a/client/src/components/shared/useTripSplashBeats.ts b/client/src/components/shared/useTripSplashBeats.tsindex 353d6e4da..84a02d9a9 100644--- a/client/src/components/shared/useTripSplashBeats.ts+++ b/client/src/components/shared/useTripSplashBeats.ts@@ -60,4 +60,4 @@ export function useTripSplashBeats({ liveReducedMotion }: TripSplashBeatsOptions* slower one gets the splash right after, so a slow connection never sees the* app stand still.*/-export const TRIP_SPLASH_AFTER_MS = 400+export const TRIP_SPLASH_AFTER_MS = 400;diff --git a/client/src/mobile/screens/trip/sheets/MTripSettingsSheet.tsx b/client/src/mobile/screens/trip/sheets/MTripSettingsSheet.tsxindex 04cb2cbd7..4b172f056 100644--- a/client/src/mobile/screens/trip/sheets/MTripSettingsSheet.tsx+++ b/client/src/mobile/screens/trip/sheets/MTripSettingsSheet.tsx@@ -19,8 +19,8 @@ import { useState, type ReactNode } from 'react';import CustomSelect from '../../../../components/shared/CustomSelect';import { LinkedJournalIcon } from '../../../../components/Trips/LinkedJournalIcon';import { TripJournalLinkSection } from '../../../../components/Trips/TripJournalLinkSection';-import { useTripJournalSectionVisible } from '../../../../components/Trips/useTripJournalLink';import { TripMemberAvatar } from '../../../../components/Trips/TripMemberAvatar';+import { useTripJournalSectionVisible } from '../../../../components/Trips/useTripJournalLink';import {SHARE_OPTIONS,SHARE_SECTIONS,@@ -36,11 +36,11 @@ import MSheet from '../../../components/MSheet';import MConfirmSheet from '../../settings/MConfirmSheet';import {SHEET_FIELD as FIELD,+ INNER_CLS,SHEET_PILL as PILL,SHEET_PRIMARY as PRIMARY,SHEET_ROUND as ROUND,SHEET_ROUND_PRIMARY as ROUND_PRIMARY,- INNER_CLS,SheetSection as Section,TileHeader,} from './MTripSheetUi';@@ -400,10 +400,22 @@ function GuestsSection({ m, ask }: { m: Members; ask: Ask }) {type Page = 'people' | 'sharing' | 'journal';/** One row of the sheet's first page: an icon tile, the area's name, what it holds, a chevron. */-function AreaRow({ icon, label, value, onOpen }: { icon: ReactNode; label: string; value?: string; onOpen: () => void }) {+function AreaRow({+ icon,+ label,+ value,+ onOpen,+}: {+ icon: ReactNode;+ label: string;+ value?: string;+ onOpen: () => void;+}) {return (<button type="button" onClick={onOpen} className="flex w-full items-center gap-3 px-2.5 py-[11px] text-start">- <span className="flex h-8 w-8 flex-none items-center justify-center rounded-[10px] bg-[color:var(--m-ic)] text-m-ink">{icon}</span>+ <span className="flex h-8 w-8 flex-none items-center justify-center rounded-[10px] bg-[color:var(--m-ic)] text-m-ink">+ {icon}+ </span><span className="min-w-0 flex-1 truncate text-body font-semibold text-m-ink">{label}</span>{value && <span className="flex-none font-geist text-caption font-semibold text-m-muted">{value}</span>}<ChevronRight size={16} strokeWidth={2} className="flex-none text-m-faint rtl:rotate-180" />@@ -461,7 +473,12 @@ export default function MTripSettingsSheet({<TileHeadericon={page ? (- <button type="button" onClick={() => setPage(null)} aria-label={t('common.back')} className="flex h-full w-full items-center justify-center">+ <button+ type="button"+ onClick={() => setPage(null)}+ aria-label={t('common.back')}+ className="flex h-full w-full items-center justify-center"+ ><ChevronLeft size={19} strokeWidth={2} className="rtl:rotate-180" /></button>) : (@@ -477,7 +494,10 @@ export default function MTripSettingsSheet({<div className="m-scroll-fade mt-2 flex min-h-0 flex-1 flex-col gap-2.5 overflow-y-auto px-[18px] pb-[18px] pt-[14px]">{page === null && (- <nav aria-label={t('trip.settings.title')} className={`flex flex-col divide-y divide-[color:var(--m-rowbr)] rounded-[18px] px-1.5 ${INNER_CLS}`}>+ <nav+ aria-label={t('trip.settings.title')}+ className={`flex flex-col divide-y divide-[color:var(--m-rowbr)] rounded-[18px] px-1.5 ${INNER_CLS}`}+ ><AreaRowicon={<Users size={16} strokeWidth={2} />}label={pageTitle.people}@@ -485,10 +505,18 @@ export default function MTripSettingsSheet({onOpen={() => setPage('people')}/>{m.canManageShare && (- <AreaRow icon={<Link2 size={16} strokeWidth={2} />} label={pageTitle.sharing} onOpen={() => setPage('sharing')} />+ <AreaRow+ icon={<Link2 size={16} strokeWidth={2} />}+ label={pageTitle.sharing}+ onOpen={() => setPage('sharing')}+ />)}{journalVisible && (- <AreaRow icon={<LinkedJournalIcon size={16} />} label={pageTitle.journal} onOpen={() => setPage('journal')} />+ <AreaRow+ icon={<LinkedJournalIcon size={16} />}+ label={pageTitle.journal}+ onOpen={() => setPage('journal')}+ />)}</nav>)}diff --git a/client/src/mobile/screens/trip/tabs/MPackingCategorySharingSheet.tsx b/client/src/mobile/screens/trip/tabs/MPackingCategorySharingSheet.tsxindex d0fd80b6a..7ece2adeb 100644--- a/client/src/mobile/screens/trip/tabs/MPackingCategorySharingSheet.tsx+++ b/client/src/mobile/screens/trip/tabs/MPackingCategorySharingSheet.tsx@@ -48,9 +48,7 @@ export default function MPackingCategorySharingSheet({);};- const note = (text: string) => (- <p className="mt-3 font-geist text-caption leading-relaxed text-m-muted">{text}</p>- );+ const note = (text: string) => <p className="mt-3 font-geist text-caption leading-relaxed text-m-muted">{text}</p>;return (<MSheet open={category != null} onClose={sharing.close} form ariaLabel={t('packing.menuShareCat')}>@@ -87,9 +85,7 @@ export default function MPackingCategorySharingSheet({onClick={() => sharing.toggleRecipient(m.id)}className="flex items-center gap-[8px] rounded-[9px] py-[7px] pe-[10px] ps-9 text-start">- <span className="min-w-0 flex-1 truncate text-body font-semibold text-m-ink">- {m.username}- </span>+ <span className="min-w-0 flex-1 truncate text-body font-semibold text-m-ink">{m.username}</span>{picked && <Check size={14} strokeWidth={2.4} className="flex-none text-m-ink" />}</button>);diff --git a/client/src/pages/TripPlannerPage.test.tsx b/client/src/pages/TripPlannerPage.test.tsxindex ef467f905..abd3cd129 100644--- a/client/src/pages/TripPlannerPage.test.tsx+++ b/client/src/pages/TripPlannerPage.test.tsx@@ -301,7 +301,7 @@ describe('TripPlannerPage', () => {});describe('FE-PAGE-PLANNER-002: Loading state shown while loadTrip in progress', () => {- it('shows loading animation when isLoading is true', () => {+ it('shows loading animation when isLoading is true', async () => {seedStore(useTripStore, {trip: null,isLoading: true,@@ -315,8 +315,9 @@ describe('TripPlannerPage', () => {renderPlannerPage(99);- // Loading state: shows the trip-open loading splash- expect(screen.getByTestId('trip-loading-splash')).toBeInTheDocument();+ // A quick open shows nothing but the page's ground; a slow one gets the splash.+ expect(screen.queryByTestId('trip-loading-splash')).not.toBeInTheDocument();+ expect(await screen.findByTestId('trip-loading-splash', {}, { timeout: 2000 })).toBeInTheDocument();});});diff --git a/client/src/pages/TripPlannerPage.tsx b/client/src/pages/TripPlannerPage.tsxindex e076b97e1..7b845cdf7 100644--- a/client/src/pages/TripPlannerPage.tsx+++ b/client/src/pages/TripPlannerPage.tsx@@ -63,7 +63,7 @@ function TripPlannerPageDesktop(): React.ReactElement | null {// selection, CRUD handlers with undo, map filters, splash) lives in the hook.const pageState = useTripPlannerPage()const {- tripId, navigate, toast, t, language, placesPhotosEnabled,+ tripId, navigate, t, language, placesPhotosEnabled,trip, days, places, assignments, packingItems, todoItems, categories, reservations, budgetItems, files,selectedDayId, isLoading, tripActions, can, canUploadFiles,pushUndo, undo, canUndo, lastActionLabel, handleUndo,diff --git a/client/src/pages/TripPlannerPage.wiring.fixture.ts b/client/src/pages/TripPlannerPage.wiring.fixture.tsindex 88845de97..1f0f831a0 100644--- a/client/src/pages/TripPlannerPage.wiring.fixture.ts+++ b/client/src/pages/TripPlannerPage.wiring.fixture.ts@@ -206,7 +206,6 @@ function dialogState(): HookState {setShowTripForm: vi.fn(),showMembersModal: false,setShowMembersModal: vi.fn(),- editTripFromSettings: vi.fn(),showReservationModal: false,setShowReservationModal: vi.fn(),editingReservation: null,diff --git a/client/src/pages/tripPlanner/useTripPlanner.ts b/client/src/pages/tripPlanner/useTripPlanner.tsindex 21c6f4246..deb8163d8 100644--- a/client/src/pages/tripPlanner/useTripPlanner.ts+++ b/client/src/pages/tripPlanner/useTripPlanner.ts@@ -361,7 +361,7 @@ export function useTripPlanner() {// The dialog state that only passes through to the shells.const {showPlaceForm, prefillCoords, reservationModalDayId, setReservationModalDayId,- showTripForm, setShowTripForm, showMembersModal, setShowMembersModal, editTripFromSettings, showReservationModal,+ showTripForm, setShowTripForm, showMembersModal, setShowMembersModal, showReservationModal,showBookingImport, setShowBookingImport, bookingImportKind, setBookingImportKind, bookingImportAvailable,airTrailAvailable, showAirTrailImport, setShowAirTrailImport, bookingForAssignmentId, setBookingForAssignmentId,showTransportModal, transportModalDayId, transportModalAutomated, setTransportModalAutomated,@@ -710,6 +710,12 @@ export function useTripPlanner() {// loads within TRIP_SPLASH_AFTER_MS opens straight away, with no splash and no// minimum on screen.const [slowOpen, setSlowOpen] = useState(false)+ // Every open is timed afresh: a trip opened after a slow one starts without the splash too.+ const [wasLoading, setWasLoading] = useState(isLoading)+ if (wasLoading !== isLoading) {+ setWasLoading(isLoading)+ if (isLoading) setSlowOpen(false)+ }useEffect(() => {if (!isLoading) returnconst timer = setTimeout(() => setSlowOpen(true), TRIP_SPLASH_AFTER_MS)@@ -758,7 +764,7 @@ export function useTripPlanner() {highlightedAlternative, setHighlightedAlternative,moveRoadtripStopToDay,dropPoiOnRoute,- showTripForm, setShowTripForm, showMembersModal, setShowMembersModal, editTripFromSettings,+ showTripForm, setShowTripForm, showMembersModal, setShowMembersModal,showReservationModal, setShowReservationModal, editingReservation, setEditingReservation,showBookingImport, setShowBookingImport, bookingImportKind, setBookingImportKind, bookingImportAvailable,airTrailAvailable, showAirTrailImport, setShowAirTrailImport,diff --git a/client/tests/helpers/mobileTrip.ts b/client/tests/helpers/mobileTrip.tsindex dc0ce6b92..6b656578d 100644--- a/client/tests/helpers/mobileTrip.ts+++ b/client/tests/helpers/mobileTrip.ts@@ -134,7 +134,6 @@ export function buildPlanner(overrides: Partial<TripPlanner> = {}): TripPlannersetShowTripForm: vi.fn(),showMembersModal: false,setShowMembersModal: vi.fn(),- editTripFromSettings: vi.fn(),showReservationModal: false,setShowReservationModal: vi.fn(),editingReservation: null,diff --git a/client/tests/unit/mobile/collections/MCollections.test.tsx b/client/tests/unit/mobile/collections/MCollections.test.tsxindex 753cf02e3..7e28f83b5 100644--- a/client/tests/unit/mobile/collections/MCollections.test.tsx+++ b/client/tests/unit/mobile/collections/MCollections.test.tsx@@ -617,7 +617,7 @@ describe('MCollections', () => {expect(screen.getByRole('dialog', { name: 'collections.deleteList' })).toBeInTheDocument()expect(screen.getByText('collections.deleteListConfirm')).toBeInTheDocument()- fireEvent.click(screen.getByRole('button', { name: 'packing.editDone' }))+ fireEvent.click(screen.getByRole('button', { name: 'common.cancel' }))expect(fn('setConfirmDeleteList')).toHaveBeenCalledWith(null)fireEvent.click(screen.getByRole('button', { name: /common.delete/ }))diff --git a/client/tests/unit/mobile/trip/MBookingsTab.test.tsx b/client/tests/unit/mobile/trip/MBookingsTab.test.tsxindex 1a782581c..010daa3c7 100644--- a/client/tests/unit/mobile/trip/MBookingsTab.test.tsx+++ b/client/tests/unit/mobile/trip/MBookingsTab.test.tsx@@ -18,7 +18,7 @@ const money = (amount: number, currency: string) => formatMoney(amount, currencyvi.mock('../../../../src/utils/fileDownload', async importOriginal => ({...(await importOriginal<typeof import('../../../../src/utils/fileDownload')>()),- openFile: vi.fn(),+ openFile: vi.fn(() => Promise.resolve()),}))vi.mock('../../../../src/components/Plugins/PluginFrame', () => ({diff --git a/client/tests/unit/mobile/trip/MTransportsTab.test.tsx b/client/tests/unit/mobile/trip/MTransportsTab.test.tsxindex 4a4033a82..df2aae913 100644--- a/client/tests/unit/mobile/trip/MTransportsTab.test.tsx+++ b/client/tests/unit/mobile/trip/MTransportsTab.test.tsx@@ -18,7 +18,7 @@ const money = (amount: number, currency: string) => formatMoney(amount, currencyvi.mock('../../../../src/utils/fileDownload', async importOriginal => ({...(await importOriginal<typeof import('../../../../src/utils/fileDownload')>()),- openFile: vi.fn(),+ openFile: vi.fn(() => Promise.resolve()),}))vi.mock('../../../../src/components/Plugins/PluginFrame', () => ({