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
import { ArrowRight, Bookmark, Loader2, Plus } from 'lucide-react'
import MSheet from '../../../components/MSheet'
import { TileHeader } from '../sheets/MTripSheetUi'
import { useTranslation } from '../../../../i18n'
import { useSaveTripPlacesToList } from '../../../../components/Collections/useSaveTripPlacesToList'
import MSkeleton from '../../../components/MSkeleton'
interface MPlacesSaveToCollectionSheetProps {
open: boolean
tripId: number
placeIds: number[]
onClose: () => void
/** Called after a successful save (clears the pool selection). */
onDone: () => void
}
/**
* Bulk "save to collection" of the places-pool selection toolbar: pick one of
* the user's lists and copy every selected place into it (server dedups) —
* mobile counterpart of SaveTripPlacesToListModal.
*/
export default function MPlacesSaveToCollectionSheet({ open, tripId, placeIds, onClose, onDone }: MPlacesSaveToCollectionSheetProps) {
const { t } = useTranslation()
const { lists, loading, search, setSearch, filtered, busyId, pick } = useSaveTripPlacesToList({
open, tripId, placeIds, onClose, onDone,
})
return (
<MSheet open={open} onClose={onClose} variant="card" material="glass" ariaLabel={t('collections.saveNToList', { count: placeIds.length })}>
<div className="flex-none px-[18px] pt-4">
<TileHeader
icon={<Bookmark size={19} strokeWidth={1.8} />}
title={t('collections.saveNToList', { count: placeIds.length })}
onClose={onClose}
closeLabel={t('common.close')}
/>
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-[14px] pb-[14px] pt-1">
{lists.length > 5 && (
<input
value={search}
onChange={e => setSearch(e.target.value)}
enterKeyHint="search" placeholder={t('common.search')}
className="mt-2 box-border w-full rounded-full border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] px-[13px] py-[10px] text-[0.8125rem] font-medium text-m-ink outline-none placeholder:text-m-faint"
/>
)}
{loading ? (
<MSkeleton variant="rows" count={4} />
) : filtered.length === 0 ? (
<p className="py-8 text-center font-geist text-[0.71875rem] text-m-faint">{t('collections.noOwnLists')}</p>
) : (
filtered.map(list => {
const busy = busyId === list.id
return (
<button
key={list.id}
type="button"
onClick={() => pick(list)}
disabled={busyId != null}
className="mt-2 flex w-full items-center gap-[11px] rounded-[14px] border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] px-3 py-[10px] text-start disabled:opacity-60"
>
<span
className="flex h-9 w-9 flex-none items-center justify-center rounded-xl text-white"
style={{ background: list.color || '#6366f1' }}
>
<Bookmark size={15} strokeWidth={2} />
</span>
<span className="min-w-0 flex-1">
<span className="block truncate text-[0.8125rem] font-semibold text-m-ink">{list.name}</span>
<span className="mt-px block font-geist text-[0.65625rem] text-m-muted">
{t('collections.placeCount', { count: list.place_count ?? 0 })}
</span>
</span>
{busy
? <Loader2 size={15} className="flex-none animate-spin text-m-faint" />
: <ArrowRight size={15} strokeWidth={2} className="flex-none text-m-faint" />}
</button>
)
})
)}
<p className="mt-3 flex items-center gap-[6px] font-geist text-[0.65625rem] text-m-muted">
<Plus size={12} strokeWidth={2.2} className="flex-none" />
{t('collections.saveToListHint')}
</p>
</div>
</MSheet>
)
}