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(mobile): a stay can be added to a trip that has no place yet
Maurice73a7c4843b0c
diff --git a/client/src/mobile/screens/trip/sheets/MAccommodationSheet.tsx b/client/src/mobile/screens/trip/sheets/MAccommodationSheet.tsxindex 0a7d84308..1f46d1748 100644--- a/client/src/mobile/screens/trip/sheets/MAccommodationSheet.tsx+++ b/client/src/mobile/screens/trip/sheets/MAccommodationSheet.tsx@@ -1,5 +1,5 @@import { useEffect, useState } from 'react'-import { ArrowRight, Check, Hotel, MapPin, X } from 'lucide-react'+import { ArrowRight, Check, Hotel, MapPin, Plus, X } from 'lucide-react'import MSheet from '../../../components/MSheet'import MIconBtn from '../../../components/MIconBtn'import CustomSelect from '../../../../components/shared/CustomSelect'@@ -88,6 +88,15 @@ export default function MAccommodationSheet({ planner, shell }: MTripSheetsPropsconst filteredPlaces = stayPlaceChoices(places, form.place_id, categoryFilter)+ // Same opener as the places tab's add button: a blank form, no prefilled position.+ const canAddPlace = planner.can('place_edit', planner.trip)+ const openAddPlace = () => {+ planner.setEditingPlace(null)+ planner.setEditingAssignmentId(null)+ planner.setPrefillCoords(null)+ planner.setShowPlaceForm(true)+ }+const save = async () => {setSaving(true)const body = stayRequestBody(form, range)@@ -204,9 +213,21 @@ export default function MAccommodationSheet({ planner, shell }: MTripSheetsProps{/* Place picker */}<Eyebrow className="mb-[6px] mt-3">{t('reservations.meta.pickHotel')}</Eyebrow>{filteredPlaces.length === 0 ? (- <p className="rounded-[14px] bg-[color:var(--m-ic)] px-3 py-6 text-center font-geist text-[0.75rem] text-m-faint">- {t('day.noPlacesForHotel')}- </p>+ <div className="flex flex-col items-center gap-2.5 rounded-[14px] bg-[color:var(--m-ic)] px-3 py-5 text-center">+ <p className="font-geist text-[0.75rem] text-m-faint">{t('day.noPlacesForHotel')}</p>+ {/* A new trip has no place yet, and the stay needs one: the place form+ opens over this sheet and its place is listed here once saved. */}+ {canAddPlace && (+ <button+ type="button"+ onClick={openAddPlace}+ className="flex items-center gap-1.5 rounded-full bg-m-act px-3.5 py-[7px] text-[0.75rem] font-semibold text-m-actfg"+ >+ <Plus size={13} strokeWidth={2.4} />+ {t('planner.addPlace')}+ </button>+ )}+ </div>) : (<div className="flex flex-col gap-1.5">{filteredPlaces.map(p => {diff --git a/client/tests/unit/mobile/trip/MAccommodationSheet.test.tsx b/client/tests/unit/mobile/trip/MAccommodationSheet.test.tsxindex 331209e0f..295840fb1 100644--- a/client/tests/unit/mobile/trip/MAccommodationSheet.test.tsx+++ b/client/tests/unit/mobile/trip/MAccommodationSheet.test.tsx@@ -8,7 +8,7 @@ import { useSettingsStore } from '../../../../src/store/settingsStore'import { isBlurred } from '../../../helpers/bookingCodeBlur'import { act, fireEvent, render, screen, waitFor } from '../../../helpers/render'-// FE-MOB-ACCSH-001 to FE-MOB-ACCSH-031+// FE-MOB-ACCSH-001 to FE-MOB-ACCSH-033// The pickers have their own suites; here they only need to be addressable, so// they render as plain controls. data-value keeps the requested value readable@@ -256,6 +256,22 @@ describe('MAccommodationSheet', () => {expect(screen.getByText('Add places to your trip first')).toBeInTheDocument()})+ it('FE-MOB-ACCSH-032: a trip without places offers to add one instead of a dead end', () => {+ const { planner } = setup(makePlanner({ places: [] }))+ expect(screen.getByText('Add places to your trip first')).toBeInTheDocument()++ fireEvent.click(screen.getByRole('button', { name: 'Add place/activity' }))++ expect(planner.setEditingPlace).toHaveBeenCalledWith(null)+ expect(planner.setShowPlaceForm).toHaveBeenCalledWith(true)+ })++ it('FE-MOB-ACCSH-033: without the right to add places the hint stays a hint', () => {+ setup(makePlanner({ places: [], can: vi.fn(() => false) }))+ expect(screen.getByText('Add places to your trip first')).toBeInTheDocument()+ expect(screen.queryByRole('button', { name: 'Add place/activity' })).toBeNull()+ })+it('FE-MOB-ACCSH-018: without categories there are no filter chips', () => {setup(makePlanner({ categories: [] }))expect(screen.queryByRole('button', { name: 'Hotels' })).not.toBeInTheDocument()