From c5939e29578494f916b790f571e4b73313a7b5a3 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 8 Mar 2026 14:42:32 +0000 Subject: [PATCH] feat(frontend): apply itinerary UI and docs refinements --- README.md | 4 +- documentation/docs/intro/voyage_overview.md | 2 +- documentation/docs/usage/usage.md | 4 +- documentation/index.md | 2 +- .../lib/components/cards/LocationCard.svelte | 29 +- .../lib/components/cards/LodgingCard.svelte | 27 +- .../cards/TransportationCard.svelte | 156 +++++----- .../CollectionItineraryPlanner.svelte | 288 +++++++----------- .../collections/CollectionStats.svelte | 17 +- .../locations/LocationDetails.svelte | 42 --- .../components/locations/LocationModal.svelte | 3 - .../components/lodging/LodgingDetails.svelte | 43 --- .../components/lodging/LodgingModal.svelte | 2 - .../TransportationDetails.svelte | 41 --- .../transportation/TransportationModal.svelte | 2 - frontend/src/lib/types.ts | 3 - frontend/src/routes/locations/+page.svelte | 6 +- .../src/routes/locations/[id]/+page.svelte | 17 -- frontend/src/routes/lodging/[id]/+page.svelte | 67 +--- frontend/src/routes/map/+page.svelte | 33 +- .../routes/transportations/[id]/+page.svelte | 55 ---- 21 files changed, 239 insertions(+), 604 deletions(-) diff --git a/README.md b/README.md index 33001a98..efdde3ef 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Voyage aims to be simple, beautiful, and open to everyone — inheriting Adventu Locations

Displays the locations you have visited and the ones you plan to embark on. You can also filter and sort the locations.

Location Details -

Shows specific details about a location, including the name, date, location, description, and rating.

+

Shows specific details about a location, including the name, date, location, and description.

Edit Modal Location Details

View all of your locations on a map, with the ability to filter by visit status and add new ones by click on the map

@@ -99,7 +99,7 @@ Voyage aims to be simple, beautiful, and open to everyone — inheriting Adventu - **Plan Your Next Trip** 📃: Take the guesswork out of planning your next adventure with an easy-to-use itinerary planner. - Itineraries can be created for any number of days and can include multiple destinations. - A timeline-style day view shows ordered stops with numbered markers and compact location cards (no image banners) for a dense overview. Lodging placement follows directional rules: on check-in day lodging appears after the last stop, on check-out day it appears before the first stop, and on days with no locations a single lodging card is shown (or two cards when a checkout and checkin are different lodgings). Lodging cards use the same compact style (no image header) as location cards within the itinerary. - - Connector rows between consecutive locations display distance and travel time powered by [OSRM](https://project-osrm.org/) routing (walking if ≤ 20 min, driving otherwise), with automatic haversine fallback when OSRM is unavailable. Self-hosted OSRM instances are supported via the `OSRM_BASE_URL` environment variable. Transportation items appear as separate compact connector rows showing mode, duration, and distance. Boundary transitions between lodging and adjacent stops are also shown as connector rows. + - Connector rows between adjacent items display distance and travel time powered by [OSRM](https://project-osrm.org/) routing (walking if ≤ 20 min, driving otherwise), with automatic haversine fallback when OSRM is unavailable. Self-hosted OSRM instances are supported via the `OSRM_BASE_URL` environment variable. Transportation items appear as compact cards (same style as location cards — no image banners) showing mode, duration, and distance; connector routing uses the transportation's origin coordinates when approaching and destination coordinates when departing. Boundary transitions between lodging and adjacent stops are also shown as connector rows. - Each day has a single `+ Add` control to insert new places, and day-level quick actions include Auto-fill and an Optimize placeholder. Lodging added from within a day is automatically scheduled to that day. - Itineraries include many planning features like flight information, notes, checklists, and links to external resources. - Itineraries can be shared with friends and family for collaborative planning. diff --git a/documentation/docs/intro/voyage_overview.md b/documentation/docs/intro/voyage_overview.md index 37f72aad..124f43b7 100644 --- a/documentation/docs/intro/voyage_overview.md +++ b/documentation/docs/intro/voyage_overview.md @@ -15,7 +15,7 @@ Voyage is a full-fledged travel companion. With Voyage, you can log your adventu - **Plan Your Next Trip** 📃: Take the guesswork out of planning your next adventure with an easy-to-use itinerary planner. - Itineraries can be created for any number of days and can include multiple destinations. - A timeline-style day view shows ordered stops with numbered markers and compact location cards (no image banners) for a dense overview. Lodging placement follows directional rules: on check-in day lodging appears after the last stop, on check-out day it appears before the first stop, and on days with no locations a single lodging card is shown (or two cards when a checkout and checkin are different lodgings). Lodging cards use the same compact style (no image header) as location cards within the itinerary. - - Connector rows between consecutive locations display distance and travel time powered by [OSRM](https://project-osrm.org/) routing (walking if ≤ 20 min, driving otherwise), with automatic haversine fallback when OSRM is unavailable. Self-hosted OSRM instances are supported via the `OSRM_BASE_URL` environment variable. Transportation items appear as separate compact connector rows showing mode, duration, and distance. Boundary transitions between lodging and adjacent stops are also shown as connector rows. + - Connector rows between adjacent items display distance and travel time powered by [OSRM](https://project-osrm.org/) routing (walking if ≤ 20 min, driving otherwise), with automatic haversine fallback when OSRM is unavailable. Self-hosted OSRM instances are supported via the `OSRM_BASE_URL` environment variable. Transportation items appear as compact cards (same style as location cards — no image banners) showing mode, duration, and distance; connector routing uses the transportation's origin coordinates when approaching and destination coordinates when departing. Boundary transitions between lodging and adjacent stops are also shown as connector rows. - Each day has a single `+ Add` control to insert new places, and day-level quick actions include Auto-fill and an Optimize placeholder. Lodging added from within a day is automatically scheduled to that day. - Itineraries include many planning features like flight information, notes, checklists, and links to external resources. - Itineraries can be shared with friends and family for collaborative planning. diff --git a/documentation/docs/usage/usage.md b/documentation/docs/usage/usage.md index 1fb907d0..a62f1698 100644 --- a/documentation/docs/usage/usage.md +++ b/documentation/docs/usage/usage.md @@ -22,8 +22,8 @@ The term "Location" is now used instead of "Adventure" - the usage remains the s #### Collections -- **Collection**: a collection is a way to group locations together. Collections are flexible and can be used in many ways. When no start or end date is added to a collection, it acts like a folder to group locations together. When a start and end date is added to a collection, it acts like a trip to group locations together that were visited during that time period. With start and end dates, the collection is transformed into a full itinerary with a timeline-style day view — each day displays numbered stops as compact cards (without image banners), connector rows between consecutive locations showing distance and travel time via OSRM routing (walking if ≤ 20 min, driving otherwise) with automatic haversine fallback when OSRM is unavailable, and a single `+ Add` control for inserting new places. Lodging placement follows directional rules: on check-in day it appears after the last stop, on check-out day it appears before the first stop, and on days with no locations a single lodging card is shown (or two cards when a checkout and checkin are different lodgings). Connector rows link lodging to adjacent locations. Day-level quick actions include Auto-fill (populates an empty itinerary from dated records) and an Optimize placeholder for future route optimization. The itinerary also includes a map showing the route taken between locations. Your most recently updated collections also appear on the dashboard. For example, you could have a collection for a trip to Europe with dates so you can plan where you want to visit, a collection of local hiking trails, or a collection for a list of restaurants you want to try. -- **Transportation**: a transportation is a collection exclusive feature that allows you to add transportation information to your trip. In the itinerary timeline view, transportation items appear as compact connector rows between stops — showing the travel mode, duration, and distance. This can be used to show the route taken between locations and the mode of transportation used. It can also be used to track flight information, such as flight number and departure time. +- **Collection**: a collection is a way to group locations together. Collections are flexible and can be used in many ways. When no start or end date is added to a collection, it acts like a folder to group locations together. When a start and end date is added to a collection, it acts like a trip to group locations together that were visited during that time period. With start and end dates, the collection is transformed into a full itinerary with a timeline-style day view — each day displays numbered stops as compact cards (without image banners), connector rows between adjacent items showing distance and travel time via OSRM routing (walking if ≤ 20 min, driving otherwise) with automatic haversine fallback when OSRM is unavailable, and a single `+ Add` control for inserting new places. Lodging placement follows directional rules: on check-in day it appears after the last stop, on check-out day it appears before the first stop, and on days with no locations a single lodging card is shown (or two cards when a checkout and checkin are different lodgings). Connector rows link lodging to adjacent locations. Day-level quick actions include Auto-fill (populates an empty itinerary from dated records) and an Optimize placeholder for future route optimization. The itinerary also includes a map showing the route taken between locations. Your most recently updated collections also appear on the dashboard. For example, you could have a collection for a trip to Europe with dates so you can plan where you want to visit, a collection of local hiking trails, or a collection for a list of restaurants you want to try. +- **Transportation**: a transportation is a collection exclusive feature that allows you to add transportation information to your trip. In the itinerary timeline view, transportation items appear as compact cards (same style as location cards — no image banners) showing the travel mode, duration, and distance. Connector rows adjacent to transportation use directional coordinates: the row before a transportation segment measures distance to the transportation's origin, while the row after measures distance from its destination. This can be used to show the route taken between locations and the mode of transportation used. It can also be used to track flight information, such as flight number and departure time. - **Lodging**: a lodging is a collection exclusive feature that allows you to add lodging information to your trip. This can be used to plan where you will stay during your trip and add notes about the lodging location. It can also be used to track reservation information, such as reservation number and check-in time. In the itinerary timeline view, lodging is displayed as compact cards (without image headers) using directional placement: on check-in day the lodging card appears after the last stop, on check-out day it appears before the first stop, and on days with no locations a single card is shown unless the checkout and checkin are different lodgings (in which case both appear). Lodging added from within a specific day is automatically scheduled to that day. Connector rows show boundary transitions between lodging and adjacent locations. - **Note**: a note is a collection exclusive feature that allows you to add notes to your trip. This can be used to add additional information about your trip, such as a summary of the trip or a list of things to do. Notes can be assigned to a specific day of the trip to help organize the information. - **Checklist**: a checklist is a collection exclusive feature that allows you to add a checklist to your trip. This can be used to create a list of things to do during your trip or for planning purposes like packing lists. Checklists can be assigned to a specific day of the trip to help organize the information. diff --git a/documentation/index.md b/documentation/index.md index 5ab638e1..2a39299c 100644 --- a/documentation/index.md +++ b/documentation/index.md @@ -50,7 +50,7 @@ Manage your full list of locations with ease. View upcoming and past trips, filt ::: ::: details 📋 **Detailed Adventure Logs** -Capture rich details for every location: name, dates, precise locations, vivid descriptions, personal ratings, photos, and customizable categories. Your memories deserve to be more than just map pins — keep them alive with full, organized logs. +Capture rich details for every location: name, dates, precise locations, vivid descriptions, photos, and customizable categories. Your memories deserve to be more than just map pins — keep them alive with full, organized logs. Detailed Adventure Logs ::: diff --git a/frontend/src/lib/components/cards/LocationCard.svelte b/frontend/src/lib/components/cards/LocationCard.svelte index be4d894b..e0a2e2a0 100644 --- a/frontend/src/lib/components/cards/LocationCard.svelte +++ b/frontend/src/lib/components/cards/LocationCard.svelte @@ -23,8 +23,6 @@ import DeleteWarning from '../DeleteWarning.svelte'; import CardCarousel from '../CardCarousel.svelte'; import { t } from 'svelte-i18n'; - import Star from '~icons/mdi/star'; - import StarOutline from '~icons/mdi/star-outline'; import Eye from '~icons/mdi/eye'; import EyeOff from '~icons/mdi/eye-off'; import CollectionItineraryPlanner from '../collections/CollectionItineraryPlanner.svelte'; @@ -112,16 +110,6 @@ ? `${adventure.user.first_name} ${adventure.user.last_name || ''}`.trim() : adventure.user?.username || 'Unknown User'; - // Helper functions for display - - function renderStars(rating: number) { - const stars = []; - for (let i = 1; i <= 5; i++) { - stars.push(i <= rating); - } - return stars; - } - function changeDay() { dispatch('changeDay', { type: 'location', item: adventure, forcePicker: true }); } @@ -577,7 +565,7 @@ - +
{/if} - {#if adventure.rating} -
-
- {#each renderStars(adventure.rating) as filled} - {#if filled} - - {:else} - - {/if} - {/each} -
- ({adventure.rating}/5) -
- {/if} - {#if adventurePriceLabel} 💰 {adventurePriceLabel} {/if} diff --git a/frontend/src/lib/components/cards/LodgingCard.svelte b/frontend/src/lib/components/cards/LodgingCard.svelte index 1c5cdb25..b5d0978b 100644 --- a/frontend/src/lib/components/cards/LodgingCard.svelte +++ b/frontend/src/lib/components/cards/LodgingCard.svelte @@ -14,8 +14,6 @@ import CardCarousel from '../CardCarousel.svelte'; import Eye from '~icons/mdi/eye'; import EyeOff from '~icons/mdi/eye-off'; - import Star from '~icons/mdi/star'; - import StarOutline from '~icons/mdi/star-outline'; import MapMarker from '~icons/mdi/map-marker'; import DotsHorizontal from '~icons/mdi/dots-horizontal'; import CalendarRemove from '~icons/mdi/calendar-remove'; @@ -61,14 +59,6 @@ } } - function renderStars(rating: number) { - const stars = []; - for (let i = 1; i <= 5; i++) { - stars.push(i <= rating); - } - return stars; - } - export let lodging: Lodging; export let user: User | null = null; export let collection: Collection | null = null; @@ -532,23 +522,8 @@
{/if} - +
- {#if lodging.rating} -
-
- {#each renderStars(lodging.rating) as filled} - {#if filled} - - {:else} - - {/if} - {/each} -
- ({lodging.rating}/5) -
- {/if} - {#if lodging.user == user?.uuid || (collection && user && collection.shared_with?.includes(user.uuid))} {#if lodging.reservation_number} diff --git a/frontend/src/lib/components/cards/TransportationCard.svelte b/frontend/src/lib/components/cards/TransportationCard.svelte index fc3bf55c..7e6ca637 100644 --- a/frontend/src/lib/components/cards/TransportationCard.svelte +++ b/frontend/src/lib/components/cards/TransportationCard.svelte @@ -15,8 +15,6 @@ import Eye from '~icons/mdi/eye'; import EyeOff from '~icons/mdi/eye-off'; - import Star from '~icons/mdi/star'; - import StarOutline from '~icons/mdi/star-outline'; import Calendar from '~icons/mdi/calendar'; import DotsHorizontal from '~icons/mdi/dots-horizontal'; import CalendarRemove from '~icons/mdi/calendar-remove'; @@ -59,14 +57,6 @@ } } - function renderStars(rating: number) { - const stars = []; - for (let i = 1; i <= 5; i++) { - stars.push(i <= rating); - } - return stars; - } - const dispatch = createEventDispatcher(); const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone ?? 'UTC'; @@ -86,6 +76,8 @@ export let collection: Collection | null = null; export let readOnly: boolean = false; export let itineraryItem: CollectionItineraryItem | null = null; + export let compact: boolean = false; + export let showImage: boolean = true; const toMiles = (km: any) => (Number(km) * 0.621371).toFixed(1); @@ -173,62 +165,77 @@ {/if}
- -
- {#if routeGeojson} - - {:else} - - {/if} + {#if showImage} + +
+ {#if routeGeojson} + + {:else} + + {/if} - -
-
+ +
+ + + {#if transportation.type} +
+
+ {$t(`transportation.modes.${transportation.type}`)} + {getTransportationIcon(transportation.type)} +
+
+ {/if}
+ {/if} - - {#if transportation.type} -
-
- {$t(`transportation.modes.${transportation.type}`)} - {getTransportationIcon(transportation.type)} -
-
- {/if} -
- -
+
{transportation.name} @@ -343,6 +350,33 @@
+ {#if !showImage} +
+
+ +
+ {#if transportation.type} +
+ {$t(`transportation.modes.${transportation.type}`)} + {getTransportationIcon(transportation.type)} +
+ {/if} +
+ {/if} + {#if routeFromLabel || routeToLabel}
@@ -466,7 +500,7 @@
{/if} - +
{#if transportationPriceLabel} 💰 {transportationPriceLabel} @@ -483,20 +517,6 @@ ⏱️ {travelDurationLabel} {/if} - {#if transportation.rating} -
-
- {#each renderStars(transportation.rating) as filled} - {#if filled} - - {:else} - - {/if} - {/each} -
- ({transportation.rating}/5) -
- {/if}
diff --git a/frontend/src/lib/components/collections/CollectionItineraryPlanner.svelte b/frontend/src/lib/components/collections/CollectionItineraryPlanner.svelte index 7427af1c..87c42539 100644 --- a/frontend/src/lib/components/collections/CollectionItineraryPlanner.svelte +++ b/frontend/src/lib/components/collections/CollectionItineraryPlanner.svelte @@ -408,17 +408,6 @@ return '🚗'; } - function formatTransportationDuration(minutes: number | null | undefined): string | null { - if (minutes === null || minutes === undefined || Number.isNaN(minutes)) return null; - const safeMinutes = Math.max(0, Math.floor(minutes)); - const hours = Math.floor(safeMinutes / 60); - const mins = safeMinutes % 60; - const parts = [] as string[]; - if (hours) parts.push(`${hours}h`); - parts.push(`${mins}m`); - return parts.join(' '); - } - function formatTransportationDistance(distanceKm: number | null | undefined): string | null { if (distanceKm === null || distanceKm === undefined || Number.isNaN(distanceKm)) return null; if (distanceKm < 10) return `${distanceKm.toFixed(1)} km`; @@ -509,7 +498,8 @@ }; }; - type ConnectableItemType = 'location' | 'lodging'; + type ConnectableItemType = 'location' | 'lodging' | 'transportation'; + type TransportationCoordinateRole = 'origin' | 'destination'; type RouteMetricResult = { distance_label?: string; @@ -523,17 +513,37 @@ let activeConnectorFetchVersion = 0; function isConnectableItemType(type: string): type is ConnectableItemType { - return type === 'location' || type === 'lodging'; + return type === 'location' || type === 'lodging' || type === 'transportation'; } function getCoordinatesFromItineraryItem( - item: ResolvedItineraryItem | null + item: ResolvedItineraryItem | null, + transportationRole: TransportationCoordinateRole = 'origin' ): { latitude: number; longitude: number } | null { if (!item) return null; const itemType = item.item?.type || ''; if (!isConnectableItemType(itemType)) return null; + if (itemType === 'transportation') { + const transportation = item.resolvedObject as Transportation | null; + if (!transportation) return null; + + const latitude = normalizeCoordinate( + transportationRole === 'origin' + ? transportation.origin_latitude + : transportation.destination_latitude + ); + const longitude = normalizeCoordinate( + transportationRole === 'origin' + ? transportation.origin_longitude + : transportation.destination_longitude + ); + if (latitude === null || longitude === null) return null; + + return { latitude, longitude }; + } + const resolvedObj = item.resolvedObject as Location | Lodging | null; if (!resolvedObj) return null; @@ -544,20 +554,20 @@ return { latitude, longitude }; } - function getFirstLocationItem(items: ResolvedItineraryItem[]): ResolvedItineraryItem | null { + function getFirstConnectableItem(items: ResolvedItineraryItem[]): ResolvedItineraryItem | null { for (const item of items) { if (item?.[SHADOW_ITEM_MARKER_PROPERTY_NAME]) continue; - if ((item.item?.type || '') === 'location') return item; + if (isConnectableItemType(item.item?.type || '')) return item; } return null; } - function getLastLocationItem(items: ResolvedItineraryItem[]): ResolvedItineraryItem | null { + function getLastConnectableItem(items: ResolvedItineraryItem[]): ResolvedItineraryItem | null { for (let index = items.length - 1; index >= 0; index -= 1) { const item = items[index]; if (item?.[SHADOW_ITEM_MARKER_PROPERTY_NAME]) continue; - if ((item.item?.type || '') === 'location') return item; + if (isConnectableItemType(item.item?.type || '')) return item; } return null; @@ -691,8 +701,14 @@ const nextType = nextItem.item?.type || ''; if (!isConnectableItemType(currentType) || !isConnectableItemType(nextType)) return null; - const fromCoordinates = getCoordinatesFromItineraryItem(currentItem); - const toCoordinates = getCoordinatesFromItineraryItem(nextItem); + const fromCoordinates = getCoordinatesFromItineraryItem( + currentItem, + currentType === 'transportation' ? 'destination' : 'origin' + ); + const toCoordinates = getCoordinatesFromItineraryItem( + nextItem, + 'origin' + ); if (!fromCoordinates || !toCoordinates) return null; const key = getLocationConnectorKey(currentItem, nextItem); @@ -705,7 +721,7 @@ }; } - function findNextLocationItem( + function findNextConnectableItem( items: ResolvedItineraryItem[], currentIndex: number ): ResolvedItineraryItem | null { @@ -714,7 +730,7 @@ if (candidate?.[SHADOW_ITEM_MARKER_PROPERTY_NAME]) { continue; } - if ((candidate?.item?.type || '') === 'location') { + if (isConnectableItemType(candidate?.item?.type || '')) { return candidate; } } @@ -734,11 +750,11 @@ for (const dayGroup of dayGroups) { const dayTimelineItems = getDayTimelineItems(dayGroup); - const firstLocationItem = getFirstLocationItem(dayGroup.items); - const lastLocationItem = getLastLocationItem(dayGroup.items); + const firstConnectableItem = getFirstConnectableItem(dayGroup.items); + const lastConnectableItem = getLastConnectableItem(dayGroup.items); - if (dayGroup.preTimelineLodging && firstLocationItem) { - pushPair(getConnectorPair(dayGroup.preTimelineLodging, firstLocationItem)); + if (dayGroup.preTimelineLodging && firstConnectableItem) { + pushPair(getConnectorPair(dayGroup.preTimelineLodging, firstConnectableItem)); } for (let index = 0; index < dayTimelineItems.length - 1; index += 1) { @@ -746,12 +762,12 @@ if (currentItem?.[SHADOW_ITEM_MARKER_PROPERTY_NAME]) { continue; } - const nextLocationItem = findNextLocationItem(dayTimelineItems, index); - pushPair(getConnectorPair(currentItem, nextLocationItem)); + const nextConnectableItem = findNextConnectableItem(dayTimelineItems, index); + pushPair(getConnectorPair(currentItem, nextConnectableItem)); } - if (dayGroup.postTimelineLodging && lastLocationItem) { - pushPair(getConnectorPair(lastLocationItem, dayGroup.postTimelineLodging)); + if (dayGroup.postTimelineLodging && lastConnectableItem) { + pushPair(getConnectorPair(lastConnectableItem, dayGroup.postTimelineLodging)); } } @@ -885,11 +901,20 @@ unavailable: true }; - const currentLocation = currentItem.resolvedObject as Location | Lodging | null; - const nextLocation = nextItem.resolvedObject as Location | Lodging | null; - if (!currentLocation || !nextLocation) return unavailableConnector; + const fromCoordinates = getCoordinatesFromItineraryItem( + currentItem, + currentType === 'transportation' ? 'destination' : 'origin' + ); + const toCoordinates = getCoordinatesFromItineraryItem( + nextItem, + 'origin' + ); + if (!fromCoordinates || !toCoordinates) return unavailableConnector; - const distanceKm = haversineDistanceKm(currentLocation, nextLocation); + const distanceKm = haversineDistanceKm( + { latitude: fromCoordinates.latitude, longitude: fromCoordinates.longitude } as Location, + { latitude: toCoordinates.latitude, longitude: toCoordinates.longitude } as Location + ); if (distanceKm === null) return unavailableConnector; const walkingMinutes = (distanceKm / WALKING_SPEED_KMH) * 60; @@ -926,14 +951,20 @@ const nextType = nextItem.item?.type || ''; if (!isConnectableItemType(currentType) || !isConnectableItemType(nextType)) return null; - const currentLocation = currentItem.resolvedObject as Location | Lodging | null; - const nextLocation = nextItem.resolvedObject as Location | Lodging | null; - if (!currentLocation || !nextLocation) return null; + const fromCoordinates = getCoordinatesFromItineraryItem( + currentItem, + currentType === 'transportation' ? 'destination' : 'origin' + ); + const toCoordinates = getCoordinatesFromItineraryItem( + nextItem, + 'origin' + ); + if (!fromCoordinates || !toCoordinates) return null; - const fromLatitude = normalizeCoordinate(currentLocation.latitude); - const fromLongitude = normalizeCoordinate(currentLocation.longitude); - const toLatitude = normalizeCoordinate(nextLocation.latitude); - const toLongitude = normalizeCoordinate(nextLocation.longitude); + const fromLatitude = fromCoordinates.latitude; + const fromLongitude = fromCoordinates.longitude; + const toLatitude = toCoordinates.latitude; + const toLongitude = toCoordinates.longitude; if ( fromLatitude === null || @@ -955,50 +986,6 @@ return translated && translated !== key ? translated : fallback; } - function editTransportationInline(transportation: Transportation) { - handleEditTransportation({ detail: transportation } as CustomEvent); - } - - async function removeItineraryEntry(item: CollectionItineraryItem) { - if (!item?.id) return; - try { - const res = await fetch(`/api/itineraries/${item.id}`, { - method: 'DELETE' - }); - if (!res.ok) throw new Error('Failed to remove itinerary item'); - handleRemoveItineraryItem(new CustomEvent('removeFromItinerary', { detail: item }) as any); - addToast('info', $t('itinerary.item_remove_success')); - } catch (error) { - console.error('Error removing itinerary item:', error); - addToast('error', $t('itinerary.item_remove_error')); - } - } - - async function deleteTransportationFromItinerary( - item: CollectionItineraryItem, - transportation: Transportation - ) { - const confirmed = window.confirm($t('adventures.transportation_delete_confirm')); - if (!confirmed) return; - - try { - const res = await fetch(`/api/transportations/${transportation.id}`, { - method: 'DELETE', - headers: { - 'Content-Type': 'application/json' - } - }); - - if (!res.ok) throw new Error('Failed to delete transportation'); - - addToast('info', $t('transportation.transportation_deleted')); - handleItemDelete(new CustomEvent('delete', { detail: transportation.id }) as any); - } catch (error) { - console.error('Failed to delete transportation:', error); - addToast('error', $t('transportation.transportation_delete_error')); - } - } - function upsertNote(note: Note) { const notes = collection.notes ? [...collection.notes] : []; const idx = notes.findIndex((n) => n.id === note.id); @@ -2399,6 +2386,9 @@ transportation={resolvedObj} {user} {collection} + readOnly={!canModify} + compact={true} + showImage={false} on:delete={handleItemDelete} itineraryItem={item} on:removeFromItinerary={handleRemoveItineraryItem} @@ -2463,34 +2453,34 @@ {@const preTimelineLodging = day.preTimelineLodging} {@const postTimelineLodging = day.postTimelineLodging} {@const dayTimelineItems = getDayTimelineItems(day)} - {@const firstLocationItem = getFirstLocationItem(day.items)} - {@const lastLocationItem = getLastLocationItem(day.items)} - {@const noLocationsInDay = !firstLocationItem && !lastLocationItem} + {@const firstConnectableItem = getFirstConnectableItem(day.items)} + {@const lastConnectableItem = getLastConnectableItem(day.items)} + {@const noLocationsInDay = !firstConnectableItem && !lastConnectableItem} {@const shouldCollapseBoundaryLodging = noLocationsInDay && preTimelineLodging?.id && postTimelineLodging?.id && preTimelineLodging.id === postTimelineLodging.id} {@const startBoundaryConnector = - preTimelineLodging && firstLocationItem - ? getLocationConnector(preTimelineLodging, firstLocationItem) + preTimelineLodging && firstConnectableItem + ? getLocationConnector(preTimelineLodging, firstConnectableItem) : null} {@const startBoundaryDirectionsUrl = - preTimelineLodging && firstLocationItem + preTimelineLodging && firstConnectableItem ? buildDirectionsUrl( preTimelineLodging, - firstLocationItem, + firstConnectableItem, startBoundaryConnector?.mode || 'walking' ) : null} {@const endBoundaryConnector = - postTimelineLodging && lastLocationItem - ? getLocationConnector(lastLocationItem, postTimelineLodging) + postTimelineLodging && lastConnectableItem + ? getLocationConnector(lastConnectableItem, postTimelineLodging) : null} {@const endBoundaryDirectionsUrl = - postTimelineLodging && lastLocationItem + postTimelineLodging && lastConnectableItem ? buildDirectionsUrl( - lastLocationItem, + lastConnectableItem, postTimelineLodging, endBoundaryConnector?.mode || 'walking' ) @@ -2737,11 +2727,11 @@ {@const objectType = item.item?.type || ''} {@const resolvedObj = item.resolvedObject} {@const multiDay = isMultiDay(item)} - {@const nextLocationItem = findNextLocationItem(dayTimelineItems, index)} - {@const locationConnector = getLocationConnector(item, nextLocationItem)} + {@const nextConnectableItem = findNextConnectableItem(dayTimelineItems, index)} + {@const locationConnector = getLocationConnector(item, nextConnectableItem)} {@const directionsUrl = buildDirectionsUrl( item, - nextLocationItem, + nextConnectableItem, locationConnector?.mode || 'walking' )} {@const isDraggingShadow = item[SHADOW_ITEM_MARKER_PROPERTY_NAME]} @@ -2797,84 +2787,25 @@ {/if} {#if objectType === 'transportation'} -
-
-
- {getTransportationIcon(resolvedObj.type)} -

{resolvedObj.name}

- - {$t(`transportation.modes.${resolvedObj.type}`) || - resolvedObj.type} - -
-
- {#if formatTransportationDuration(resolvedObj.travel_duration_minutes)} - {formatTransportationDuration( - resolvedObj.travel_duration_minutes - )} - {/if} - {#if formatTransportationDistance(resolvedObj.distance)} - {formatTransportationDistance(resolvedObj.distance)} - {/if} -
-
-
- {resolvedObj.from_location || '—'} → {resolvedObj.to_location || - '—'} -
- {#if canModify} -
- - - - - -
- {/if} -
+ moveItemToGlobal(e.detail.type, e.detail.id)} + on:changeDay={(e) => + handleOpenDayPickerForItem( + e.detail.type, + e.detail.item, + e.detail.forcePicker, + day.date + )} + /> {:else} {#if multiDay && objectType === 'lodging'}
@@ -3443,6 +3374,9 @@ transportation={item} {user} {collection} + readOnly={!canModify} + compact={true} + showImage={false} on:delete={handleItemDelete} on:edit={handleEditTransportation} /> diff --git a/frontend/src/lib/components/collections/CollectionStats.svelte b/frontend/src/lib/components/collections/CollectionStats.svelte index 951dd998..1c9b44f5 100644 --- a/frontend/src/lib/components/collections/CollectionStats.svelte +++ b/frontend/src/lib/components/collections/CollectionStats.svelte @@ -355,12 +355,6 @@ return Array.from(types.values()).sort((a, b) => b.distance - a.distance); })(); - $: averageLocationRating = (() => { - const rated = visitedLocations.filter((loc) => loc.rating !== null && loc.rating !== undefined); - if (rated.length === 0) return 0; - return rated.reduce((sum, loc) => sum + (loc.rating || 0), 0) / rated.length; - })(); - $: checklistStats = (() => { let totalItems = 0; let checkedItems = 0; @@ -743,18 +737,9 @@
- {#if averageLocationRating > 0 || checklistStats.total > 0 || lodgingTypeBreakdown.length > 0} + {#if checklistStats.total > 0 || lodgingTypeBreakdown.length > 0}
{$t('adventures.more_details')}
- {#if averageLocationRating > 0} -
-
-
{$t('adventures.avg_rating')}
-
{averageLocationRating.toFixed(1)}
-
{$t('adventures.of_locations')}
-
- {/if} - {#if checklistStats.total > 0}
diff --git a/frontend/src/lib/components/locations/LocationDetails.svelte b/frontend/src/lib/components/locations/LocationDetails.svelte index bb1d5895..9a0b052e 100755 --- a/frontend/src/lib/components/locations/LocationDetails.svelte +++ b/frontend/src/lib/components/locations/LocationDetails.svelte @@ -15,7 +15,6 @@ import GenerateIcon from '~icons/mdi/lightning-bolt'; import ArrowLeftIcon from '~icons/mdi/arrow-left'; import SaveIcon from '~icons/mdi/content-save'; - import ClearIcon from '~icons/mdi/close-circle'; const dispatch = createEventDispatcher(); @@ -34,7 +33,6 @@ let location: { name: string; category: Category | null; - rating: number; price: number | null; price_currency: string | null; is_public: boolean; @@ -48,7 +46,6 @@ } = { name: '', category: null, - rating: NaN, price: null, price_currency: DEFAULT_CURRENCY, is_public: false, @@ -239,7 +236,6 @@ if (!location.name) location.name = initialLocation.name || ''; if (!location.link) location.link = initialLocation.link || ''; if (!location.description) location.description = initialLocation.description || ''; - if (Number.isNaN(location.rating)) location.rating = initialLocation.rating || NaN; if (location.price === null || location.price === undefined) { const money = toMoneyValue( initialLocation.price, @@ -359,44 +355,6 @@ }} /> - -
- -
-
- - {#each [1, 2, 3, 4, 5] as star} - (location.rating = star)} - checked={location.rating === star} - /> - {/each} -
- {#if !Number.isNaN(location.rating)} - - {/if} -
-
diff --git a/frontend/src/lib/components/locations/LocationModal.svelte b/frontend/src/lib/components/locations/LocationModal.svelte index 23d67642..7089af04 100644 --- a/frontend/src/lib/components/locations/LocationModal.svelte +++ b/frontend/src/lib/components/locations/LocationModal.svelte @@ -53,7 +53,6 @@ link: null, description: null, tags: [], - rating: NaN, price: null, price_currency: null, is_public: false, @@ -81,7 +80,6 @@ link: locationToEdit?.link || null, description: locationToEdit?.description || null, tags: locationToEdit?.tags || [], - rating: locationToEdit?.rating || NaN, price: locationToEdit?.price ?? null, price_currency: locationToEdit?.price_currency ?? null, is_public: locationToEdit?.is_public || false, @@ -295,7 +293,6 @@ on:save={(e) => { location.name = e.detail.name; location.category = e.detail.category; - location.rating = e.detail.rating; location.is_public = e.detail.is_public; location.link = e.detail.link; location.description = e.detail.description; diff --git a/frontend/src/lib/components/lodging/LodgingDetails.svelte b/frontend/src/lib/components/lodging/LodgingDetails.svelte index aab01b68..7c39c6de 100644 --- a/frontend/src/lib/components/lodging/LodgingDetails.svelte +++ b/frontend/src/lib/components/lodging/LodgingDetails.svelte @@ -7,7 +7,6 @@ // Icons import MapIcon from '~icons/mdi/map'; - import ClearIcon from '~icons/mdi/close'; import InfoIcon from '~icons/mdi/information'; import GenerateIcon from '~icons/mdi/lightning-bolt'; import ArrowLeftIcon from '~icons/mdi/arrow-left'; @@ -49,7 +48,6 @@ name: string; type: string; description: string; - rating: number; link: string; check_in: string | null; check_out: string | null; @@ -67,7 +65,6 @@ name: '', type: '', description: '', - rating: NaN, link: '', check_in: null, check_out: null, @@ -442,7 +439,6 @@ lodging.type = initialLodging.type || ''; lodging.link = initialLodging.link || ''; lodging.description = initialLodging.description || ''; - lodging.rating = initialLodging.rating ?? NaN; lodging.is_public = initialLodging.is_public ?? true; lodging.reservation_number = initialLodging.reservation_number || null; const money = toMoneyValue( @@ -565,45 +561,6 @@
- -
- -
-
- - {#each [1, 2, 3, 4, 5] as star} - (lodging.rating = star)} - checked={lodging.rating === star} - /> - {/each} -
- {#if !Number.isNaN(lodging.rating)} - - {/if} -
-
-
{/if} - -
- -
-
- - {#each [1, 2, 3, 4, 5] as star} - (transportation.rating = star)} - checked={transportation.rating === star} - /> - {/each} -
- {#if !Number.isNaN(transportation.rating)} - - {/if} -
-
diff --git a/frontend/src/lib/components/transportation/TransportationModal.svelte b/frontend/src/lib/components/transportation/TransportationModal.svelte index 89dc0f24..c86f96f4 100644 --- a/frontend/src/lib/components/transportation/TransportationModal.svelte +++ b/frontend/src/lib/components/transportation/TransportationModal.svelte @@ -41,7 +41,6 @@ name: '', type: '', description: null, - rating: null, link: null, date: null, end_date: null, @@ -91,7 +90,6 @@ name: transportationToEdit.name || '', type: transportationToEdit.type || '', description: transportationToEdit.description || null, - rating: transportationToEdit.rating || null, link: transportationToEdit.link || null, date: transportationToEdit.date || null, end_date: transportationToEdit.end_date || null, diff --git a/frontend/src/lib/types.ts b/frontend/src/lib/types.ts index 94f459ac..2ab116c9 100644 --- a/frontend/src/lib/types.ts +++ b/frontend/src/lib/types.ts @@ -45,7 +45,6 @@ export type Location = { location?: string | null; tags?: string[] | null; description?: string | null; - rating?: number | null; price?: number | null; price_currency?: string | null; link?: string | null; @@ -202,7 +201,6 @@ export type Transportation = { type: string; name: string; description: string | null; - rating: number | null; price: number | null; price_currency: string | null; link: string | null; @@ -341,7 +339,6 @@ export type Lodging = { name: string; type: string; description: string | null; - rating: number | null; link: string | null; check_in: string | null; // ISO 8601 date string check_out: string | null; // ISO 8601 date string diff --git a/frontend/src/routes/locations/+page.svelte b/frontend/src/routes/locations/+page.svelte index ed5be53d..147f4abd 100644 --- a/frontend/src/routes/locations/+page.svelte +++ b/frontend/src/routes/locations/+page.svelte @@ -405,11 +405,11 @@ - {$t('adventures.rating')} + {$t('adventures.price')}
diff --git a/frontend/src/routes/locations/[id]/+page.svelte b/frontend/src/routes/locations/[id]/+page.svelte index fb35754f..3bd0f8d4 100644 --- a/frontend/src/routes/locations/[id]/+page.svelte +++ b/frontend/src/routes/locations/[id]/+page.svelte @@ -285,23 +285,6 @@

{adventure.name}

- - {#if adventure.rating !== undefined && adventure.rating !== null} -
-
- {#each Array.from({ length: 5 }, (_, i) => i + 1) as star} - - {/each} -
-
- {/if} - - - {#if lodging.rating !== undefined && lodging.rating !== null} -
-
- {#each Array.from({ length: 5 }, (_, i) => i + 1) as star} - - {/each} -
-
- {/if} -
{#if lodging.type} @@ -389,32 +362,20 @@ zoom={13} > - -
-
{lodging.name}
-

- {$t(`lodging.${lodging.type}`)} - {getLodgingIcon(lodging.type)} -

- {#if lodging.rating} -
- {#each renderStars(lodging.rating) as filled} - {#if filled} - - {:else} - - {/if} - {/each} - ({lodging.rating}/5) -
- {/if} - {#if lodging.location} -
- 📍 {lodging.location} -
- {/if} -
-
+ +
+
{lodging.name}
+

+ {$t(`lodging.${lodging.type}`)} + {getLodgingIcon(lodging.type)} +

+ {#if lodging.location} +
+ 📍 {lodging.location} +
+ {/if} +
+
diff --git a/frontend/src/routes/map/+page.svelte b/frontend/src/routes/map/+page.svelte index 148ee114..7fc086d9 100644 --- a/frontend/src/routes/map/+page.svelte +++ b/frontend/src/routes/map/+page.svelte @@ -746,25 +746,20 @@
{/if} -
- {#if hoveredLocation.rating !== null && hoveredLocation.rating !== undefined} -
- ★ {hoveredLocation.rating} -
- {/if} -
- Visits: {hoveredLocation.visits?.length ?? 0} -
-
- Media: {hoveredLocation.images?.length ?? 0} -
-
- Files: {hoveredLocation.attachments?.length ?? 0} -
-
- Trails: {hoveredLocation.trails?.length ?? 0} -
-
+
+
+ Visits: {hoveredLocation.visits?.length ?? 0} +
+
+ Media: {hoveredLocation.images?.length ?? 0} +
+
+ Files: {hoveredLocation.attachments?.length ?? 0} +
+
+ Trails: {hoveredLocation.trails?.length ?? 0} +
+
{#if hoveredLocation.visits && hoveredLocation.visits.length > 0}
diff --git a/frontend/src/routes/transportations/[id]/+page.svelte b/frontend/src/routes/transportations/[id]/+page.svelte index dad0560c..6c35e931 100644 --- a/frontend/src/routes/transportations/[id]/+page.svelte +++ b/frontend/src/routes/transportations/[id]/+page.svelte @@ -15,8 +15,6 @@ import ImageDisplayModal from '$lib/components/ImageDisplayModal.svelte'; import AttachmentCard from '$lib/components/cards/AttachmentCard.svelte'; import { getBasemapUrl, isAllDay, TRANSPORTATION_TYPES_ICONS } from '$lib'; - import Star from '~icons/mdi/star'; - import StarOutline from '~icons/mdi/star-outline'; import MapMarker from '~icons/mdi/map-marker'; import CalendarRange from '~icons/mdi/calendar-range'; import OpenInNew from '~icons/mdi/open-in-new'; @@ -67,14 +65,6 @@ return '🚗'; } - function renderStars(rating: number) { - const stars = []; - for (let i = 1; i <= 5; i++) { - stars.push(i <= rating); - } - return stars; - } - onMount(async () => { if (data.props.transportation) { transportation = data.props.transportation; @@ -395,23 +385,6 @@

{transportation.name}

- - {#if transportation.rating !== undefined && transportation.rating !== null} -
-
- {#each Array.from({ length: 5 }, (_, i) => i + 1) as star} - - {/each} -
-
- {/if} -
{#if transportation.type} @@ -553,20 +526,6 @@ {$t('transportation.from_location')} {getTransportationIcon(transportation.type)}

- {#if transportation.rating} -
- {#each renderStars(transportation.rating) as filled} - {#if filled} - - {:else} - - {/if} - {/each} - - ({transportation.rating}/5) - -
- {/if} {#if transportation.from_location}
📍 {transportation.from_location} @@ -591,20 +550,6 @@ {$t('transportation.to_location')} {getTransportationIcon(transportation.type)}

- {#if transportation.rating} -
- {#each renderStars(transportation.rating) as filled} - {#if filled} - - {:else} - - {/if} - {/each} - - ({transportation.rating}/5) - -
- {/if} {#if transportation.to_location}
📍 {transportation.to_location}