fix: remove only saved location suggestions
This commit is contained in:
parent
69b47a8d94
commit
d3a990270b
@ -2,6 +2,13 @@
|
||||
|
||||
All notable changes to this project are documented in this file.
|
||||
|
||||
## [1.116.2] - 2026-09-05
|
||||
|
||||
### Fixed
|
||||
- The remove action now applies to saved local location suggestions only.
|
||||
OpenStreetMap search results remain available, while removed saved locations
|
||||
are deleted from the user's stored location list.
|
||||
|
||||
## [1.116.1] - 2026-09-05
|
||||
|
||||
### Fixed
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "my-weekly-todo-list",
|
||||
"version": "1.116.1",
|
||||
"version": "1.116.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "my-weekly-todo-list",
|
||||
"version": "1.116.1",
|
||||
"version": "1.116.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@auth/prisma-adapter": "^2.11.1",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "my-weekly-todo-list",
|
||||
"version": "1.116.1",
|
||||
"version": "1.116.2",
|
||||
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@ -91,6 +91,7 @@ interface CalendarEventModalProps {
|
||||
language?: string;
|
||||
savedLocations?: string[];
|
||||
onSaveLocation?: (loc: string) => void;
|
||||
onRemoveLocation?: (loc: string) => void;
|
||||
customReminderMinutes?: number[];
|
||||
onSaveCustomReminder?: (minutes: number) => void;
|
||||
onClose: () => void;
|
||||
@ -108,6 +109,7 @@ export default function CalendarEventModal({
|
||||
language = 'en',
|
||||
savedLocations = [],
|
||||
onSaveLocation,
|
||||
onRemoveLocation,
|
||||
customReminderMinutes = [],
|
||||
onSaveCustomReminder,
|
||||
onClose,
|
||||
@ -208,10 +210,11 @@ export default function CalendarEventModal({
|
||||
const locationSearchTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const locationAbortRef = useRef<AbortController | null>(null);
|
||||
const dismissedLocationSuggestionsRef = useRef<Set<string>>(new Set());
|
||||
const dismissLocationSuggestion = useCallback((label: string) => {
|
||||
dismissedLocationSuggestionsRef.current.add(label.toLowerCase());
|
||||
setLocationSuggestions(current => current.filter(suggestion => suggestion.label !== label));
|
||||
}, []);
|
||||
const dismissLocationSuggestion = useCallback((suggestion: LocationSuggestion) => {
|
||||
dismissedLocationSuggestionsRef.current.add(suggestion.label.toLowerCase());
|
||||
setLocationSuggestions(current => current.filter(item => item.label !== suggestion.label));
|
||||
if (suggestion.source === 'saved') onRemoveLocation?.(suggestion.label);
|
||||
}, [onRemoveLocation]);
|
||||
const dismissLocationSuggestions = useCallback(() => {
|
||||
++locationRequestRef.current;
|
||||
locationAbortRef.current?.abort();
|
||||
@ -891,13 +894,15 @@ export default function CalendarEventModal({
|
||||
<MapPin size={11} style={{ opacity: 0.4, flexShrink: 0 }} />
|
||||
<span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{suggestion.label}</span>
|
||||
{suggestion.source === 'openstreetmap' && (
|
||||
<span style={{ marginLeft: 'auto', fontSize: '0.65rem', opacity: 0.5, whiteSpace: 'nowrap' }}>OpenStreetMap</span>
|
||||
)}
|
||||
{suggestion.source === 'saved' && (
|
||||
<>
|
||||
<span style={{ marginLeft: 'auto', fontSize: '0.65rem', opacity: 0.5, whiteSpace: 'nowrap' }}>OpenStreetMap</span>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={language === 'de' ? 'Vorschlag entfernen' : 'Remove suggestion'}
|
||||
title={language === 'de' ? 'Vorschlag entfernen' : 'Remove suggestion'}
|
||||
onMouseDown={e => { e.preventDefault(); e.stopPropagation(); dismissLocationSuggestion(suggestion.label); }}
|
||||
onMouseDown={e => { e.preventDefault(); e.stopPropagation(); dismissLocationSuggestion(suggestion); }}
|
||||
style={{
|
||||
border: 'none', background: 'transparent', color: 'var(--weekly-text-light)',
|
||||
cursor: 'pointer', padding: '0 2px', fontSize: '0.9rem', lineHeight: 1,
|
||||
|
||||
@ -9303,6 +9303,13 @@ export default function WeeklyView() {
|
||||
setProfile((p: any) => ({ ...p, viewSettings: newVS }));
|
||||
saveSetting('viewSettings', newVS);
|
||||
}}
|
||||
onRemoveLocation={(loc: string) => {
|
||||
const current: string[] = (profile.viewSettings as any)?.savedLocations || [];
|
||||
const updated = current.filter(saved => saved !== loc);
|
||||
const newVS = { ...(profile.viewSettings as any), savedLocations: updated };
|
||||
setProfile((p: any) => ({ ...p, viewSettings: newVS }));
|
||||
saveSetting('viewSettings', newVS);
|
||||
}}
|
||||
onSaveCustomReminder={(minutes: number) => {
|
||||
const current: number[] = (profile.viewSettings as any)?.customReminderMinutes || [];
|
||||
if (current.includes(minutes)) return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user