fix(ci): one save-to-list mapping for both All places views

lint:dup found the trip place to save dialog mapping copied in the desktop and phone views of All places; it is now saveDraftOf in libraryPairs, with a test.
This commit is contained in:
Maurice
2026-11-29 18:16:27 +01:00
parent 587f5f6bb6
commit 2b0ef098fd
4 changed files with 38 additions and 32 deletions
@@ -16,6 +16,7 @@ import {
} from 'lucide-react';
import { useMemo, useState } from 'react';
import CollectionMap from '../../../components/Collections/CollectionMap';
import { saveDraftOf } from '../../../components/Collections/libraryPairs';
import { originName } from '../../../components/Collections/originName';
import { usePlaceDuplicates } from '../../../components/Collections/usePlaceDuplicates';
import { usePlacesLibrary, type LibraryKindFilter } from '../../../components/Collections/usePlacesLibrary';
@@ -429,21 +430,7 @@ export default function MPlacesLibrary({ categories, language, dark, view, onVie
onClose={lib.close}
onOpenList={(collectionId, placeId) => navigate(`${placesPath(collectionId)}?place=${placeId}`)}
onOpenTrip={(tripId, placeId) => navigate(`/trips/${tripId}?place=${placeId}`)}
onSaveToList={(origin, d) =>
openSave({
name: d.info.name,
source_trip_id: origin.trip_id,
source_place_id: origin.place_id,
description: d.info.description,
lat: d.info.lat,
lng: d.info.lng,
address: d.info.address,
category_id: lib.detail?.entry.category?.id ?? null,
image_url: d.info.image_url,
website: d.info.website,
phone: d.info.phone,
})
}
onSaveToList={(origin, d) => openSave(saveDraftOf(origin, d, lib.detail?.entry.category?.id))}
onCopyToTrip={(id) => {
lib.close();
setCopyId(id);