mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
82165855c7
- A list keeps its own order: drag a place by its grip (desktop and phone) or move it with the arrow keys. Reordering is off while a search or filter hides places and the list says why. New PUT /collections/:id/places/reorder and the MCP tool reorder_collection_places; new places go to the end. Client and server now order ties the same way (sort_order, oldest first, id). - Copying saved places into a trip no longer takes their notes and tags along unasked. The picker offers both; a tag taken along becomes a trip tag (a trip tag of the same name is reused), never someone's personal tag. - The source trip and place a saved place names are only kept when the user can open that trip and the place belongs to it. - A KML or KMZ map can be read into a list: the dialog lists every placemark to keep or leave out and says which entries were skipped and why (POST /collections/map/read writes nothing; the import does). - A saved place without coordinates says so and can be looked up on the map from its edit form, on the phone too, where a missing position could not be added at all. A typed address without a pick says it will not be on the map. - The trip map can show the place names beside the pins (desktop and phone, both renderers). Names that would cover another pin or a control give way, the selected place and the planned stops first.
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { Type } from 'lucide-react';
|
|
import { useTranslation } from '../../i18n';
|
|
import { useSettingsStore } from '../../store/settingsStore';
|
|
import { useToast } from '../shared/Toast';
|
|
import { MapTogglePill } from './MapTogglePill';
|
|
import { usePlaceNamesSetting } from './usePlaceNameLayout';
|
|
|
|
/**
|
|
* Turns the place names beside the trip map's pins on and off (#2796). The choice is
|
|
* the reader's own setting, so it holds on every trip and on the other device too.
|
|
*/
|
|
export function PlaceNamesPill() {
|
|
const { t } = useTranslation();
|
|
const on = usePlaceNamesSetting();
|
|
const updateSetting = useSettingsStore((s) => s.updateSetting);
|
|
const toast = useToast();
|
|
// The switch flips at once; a save that fails turns it back and says so.
|
|
const toggle = async () => {
|
|
try {
|
|
await updateSetting('map_place_labels', !on);
|
|
} catch (err) {
|
|
useSettingsStore.setState((s) => ({ settings: { ...s.settings, map_place_labels: on } }));
|
|
toast.error(err instanceof Error ? err.message : t('common.error'));
|
|
}
|
|
};
|
|
return (
|
|
<MapTogglePill
|
|
active={on}
|
|
onToggle={() => {
|
|
void toggle();
|
|
}}
|
|
label={on ? t('map.placeNames.hide') : t('map.placeNames.show')}
|
|
testId="place-names-pill"
|
|
icon={<Type size={17} strokeWidth={2} />}
|
|
/>
|
|
);
|
|
}
|