fix: remove only saved location suggestions
Some checks are pending
Playwright Tests / test (push) Waiting to run
Test and SonarQube / quality (push) Waiting to run

This commit is contained in:
mARTin-B78 2026-09-05 08:32:49 +02:00
parent 69b47a8d94
commit d3a990270b
5 changed files with 28 additions and 9 deletions

View File

@ -2,6 +2,13 @@
All notable changes to this project are documented in this file. 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 ## [1.116.1] - 2026-09-05
### Fixed ### Fixed

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "my-weekly-todo-list", "name": "my-weekly-todo-list",
"version": "1.116.1", "version": "1.116.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "my-weekly-todo-list", "name": "my-weekly-todo-list",
"version": "1.116.1", "version": "1.116.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@auth/prisma-adapter": "^2.11.1", "@auth/prisma-adapter": "^2.11.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "my-weekly-todo-list", "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", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -91,6 +91,7 @@ interface CalendarEventModalProps {
language?: string; language?: string;
savedLocations?: string[]; savedLocations?: string[];
onSaveLocation?: (loc: string) => void; onSaveLocation?: (loc: string) => void;
onRemoveLocation?: (loc: string) => void;
customReminderMinutes?: number[]; customReminderMinutes?: number[];
onSaveCustomReminder?: (minutes: number) => void; onSaveCustomReminder?: (minutes: number) => void;
onClose: () => void; onClose: () => void;
@ -108,6 +109,7 @@ export default function CalendarEventModal({
language = 'en', language = 'en',
savedLocations = [], savedLocations = [],
onSaveLocation, onSaveLocation,
onRemoveLocation,
customReminderMinutes = [], customReminderMinutes = [],
onSaveCustomReminder, onSaveCustomReminder,
onClose, onClose,
@ -208,10 +210,11 @@ export default function CalendarEventModal({
const locationSearchTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null); const locationSearchTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const locationAbortRef = useRef<AbortController | null>(null); const locationAbortRef = useRef<AbortController | null>(null);
const dismissedLocationSuggestionsRef = useRef<Set<string>>(new Set()); const dismissedLocationSuggestionsRef = useRef<Set<string>>(new Set());
const dismissLocationSuggestion = useCallback((label: string) => { const dismissLocationSuggestion = useCallback((suggestion: LocationSuggestion) => {
dismissedLocationSuggestionsRef.current.add(label.toLowerCase()); dismissedLocationSuggestionsRef.current.add(suggestion.label.toLowerCase());
setLocationSuggestions(current => current.filter(suggestion => suggestion.label !== label)); setLocationSuggestions(current => current.filter(item => item.label !== suggestion.label));
}, []); if (suggestion.source === 'saved') onRemoveLocation?.(suggestion.label);
}, [onRemoveLocation]);
const dismissLocationSuggestions = useCallback(() => { const dismissLocationSuggestions = useCallback(() => {
++locationRequestRef.current; ++locationRequestRef.current;
locationAbortRef.current?.abort(); locationAbortRef.current?.abort();
@ -891,13 +894,15 @@ export default function CalendarEventModal({
<MapPin size={11} style={{ opacity: 0.4, flexShrink: 0 }} /> <MapPin size={11} style={{ opacity: 0.4, flexShrink: 0 }} />
<span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{suggestion.label}</span> <span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{suggestion.label}</span>
{suggestion.source === 'openstreetmap' && ( {suggestion.source === 'openstreetmap' && (
<>
<span style={{ marginLeft: 'auto', fontSize: '0.65rem', opacity: 0.5, whiteSpace: 'nowrap' }}>OpenStreetMap</span> <span style={{ marginLeft: 'auto', fontSize: '0.65rem', opacity: 0.5, whiteSpace: 'nowrap' }}>OpenStreetMap</span>
)}
{suggestion.source === 'saved' && (
<>
<button <button
type="button" type="button"
aria-label={language === 'de' ? 'Vorschlag entfernen' : 'Remove suggestion'} aria-label={language === 'de' ? 'Vorschlag entfernen' : 'Remove suggestion'}
title={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={{ style={{
border: 'none', background: 'transparent', color: 'var(--weekly-text-light)', border: 'none', background: 'transparent', color: 'var(--weekly-text-light)',
cursor: 'pointer', padding: '0 2px', fontSize: '0.9rem', lineHeight: 1, cursor: 'pointer', padding: '0 2px', fontSize: '0.9rem', lineHeight: 1,

View File

@ -9303,6 +9303,13 @@ export default function WeeklyView() {
setProfile((p: any) => ({ ...p, viewSettings: newVS })); setProfile((p: any) => ({ ...p, viewSettings: newVS }));
saveSetting('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) => { onSaveCustomReminder={(minutes: number) => {
const current: number[] = (profile.viewSettings as any)?.customReminderMinutes || []; const current: number[] = (profile.viewSettings as any)?.customReminderMinutes || [];
if (current.includes(minutes)) return; if (current.includes(minutes)) return;