diff --git a/frontend/src/lib/components/AITravelChat.svelte b/frontend/src/lib/components/AITravelChat.svelte index 5b94db6c..ba971308 100644 --- a/frontend/src/lib/components/AITravelChat.svelte +++ b/frontend/src/lib/components/AITravelChat.svelte @@ -88,7 +88,10 @@ }>(); const MODEL_PREFS_STORAGE_KEY = 'voyage_chat_model_prefs'; - const ACTIVE_CONV_KEY = 'voyage_active_conversation'; + const ACTIVE_CONV_FALLBACK_KEY = 'voyage_active_conversation'; + $: activeConvKey = collectionId + ? `voyage_active_conversation_${collectionId}` + : ACTIVE_CONV_FALLBACK_KEY; $: promptTripContext = collectionName || destination || ''; onMount(() => { @@ -138,9 +141,9 @@ try { if (convId) { - window.localStorage.setItem(ACTIVE_CONV_KEY, convId); + window.localStorage.setItem(activeConvKey, convId); } else { - window.localStorage.removeItem(ACTIVE_CONV_KEY); + window.localStorage.removeItem(activeConvKey); } } catch { // ignore localStorage persistence failures @@ -152,7 +155,7 @@ return; } - const savedId = window.localStorage.getItem(ACTIVE_CONV_KEY); + const savedId = window.localStorage.getItem(activeConvKey); if (!savedId) { return; } diff --git a/frontend/src/routes/collections/[id]/+page.svelte b/frontend/src/routes/collections/[id]/+page.svelte index 8cd7c215..aa4e4d95 100644 --- a/frontend/src/routes/collections/[id]/+page.svelte +++ b/frontend/src/routes/collections/[id]/+page.svelte @@ -209,7 +209,7 @@ type ViewType = 'all' | 'itinerary' | 'map' | 'calendar' | 'recommendations' | 'stats'; let currentView: ViewType = 'itinerary'; let chatPanelOpen = false; - let innerWidth = 0; + let innerWidth = 1024; // Determine if this is a folder view (no dates) or itinerary view (has dates) $: isFolderView = !collection?.start_date && !collection?.end_date; @@ -293,6 +293,10 @@ // Enforce recommendations visibility only for owner/shared users $: availableViews.recommendations = !!canModifyCollection; + $: if (!canModifyCollection && chatPanelOpen) { + chatPanelOpen = false; + } + function deriveCollectionDestination(current: Collection | null): string | undefined { if (!current?.locations?.length) { return undefined; @@ -766,6 +770,12 @@ isImageModalOpen = true; } + function handleImageKeydown(event: KeyboardEvent, imageIndex: number) { + if (event.key === 'Enter') { + openImageModal(imageIndex); + } + } + function formatDate(dateString: string | null) { if (!dateString) return ''; return DateTime.fromISO(dateString).toLocaleString(DateTime.DATE_MED, { locale: 'en-GB' }); @@ -1236,19 +1246,24 @@ {/if} - + {#if canModifyCollection} + + {/if} -