feat(frontend): apply itinerary UI and docs refinements
This commit is contained in:
@@ -47,7 +47,7 @@ Voyage aims to be simple, beautiful, and open to everyone — inheriting Adventu
|
||||
<img src="./brand/screenshots/adventures.png" alt="Locations" />
|
||||
<p>Displays the locations you have visited and the ones you plan to embark on. You can also filter and sort the locations.</p>
|
||||
<img src="./brand/screenshots/details.png" alt="Location Details" />
|
||||
<p>Shows specific details about a location, including the name, date, location, description, and rating.</p>
|
||||
<p>Shows specific details about a location, including the name, date, location, and description.</p>
|
||||
<img src="./brand/screenshots/edit.png" alt="Edit Modal" />
|
||||
<img src="./brand/screenshots/map.png" alt="Location Details" />
|
||||
<p>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</p>
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
<img src="https://raw.githubusercontent.com/Alex-Wiesner/voyage/refs/heads/main/brand/screenshots/details.png" alt="Detailed Adventure Logs" style="max-width:100%; margin-top:10px;" />
|
||||
:::
|
||||
|
||||
|
||||
@@ -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 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Inline stats: location, rating, visits -->
|
||||
<!-- Inline stats: location and price -->
|
||||
<div
|
||||
class="flex flex-wrap items-center text-base-content/70 min-w-0"
|
||||
class:gap-2={compact}
|
||||
@@ -592,21 +580,6 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if adventure.rating}
|
||||
<div class="flex items-center gap-1">
|
||||
<div class="flex -ml-1">
|
||||
{#each renderStars(adventure.rating) as filled}
|
||||
{#if filled}
|
||||
<Star class="w-4 h-4 text-warning fill-current" />
|
||||
{:else}
|
||||
<StarOutline class="w-4 h-4 text-base-content/30" />
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
<span class="text-xs text-base-content/60">({adventure.rating}/5)</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if adventurePriceLabel}
|
||||
<span class="badge badge-ghost badge-sm whitespace-nowrap">💰 {adventurePriceLabel}</span>
|
||||
{/if}
|
||||
|
||||
@@ -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 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Rating & Info Badges -->
|
||||
<!-- Info Badges -->
|
||||
<div class="flex flex-wrap items-center gap-2 text-sm">
|
||||
{#if lodging.rating}
|
||||
<div class="flex items-center gap-1">
|
||||
<div class="flex -ml-1">
|
||||
{#each renderStars(lodging.rating) as filled}
|
||||
{#if filled}
|
||||
<Star class="w-4 h-4 text-warning fill-current" />
|
||||
{:else}
|
||||
<StarOutline class="w-4 h-4 text-base-content/30" />
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
<span class="text-xs text-base-content/60">({lodging.rating}/5)</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if lodging.user == user?.uuid || (collection && user && collection.shared_with?.includes(user.uuid))}
|
||||
{#if lodging.reservation_number}
|
||||
<span class="badge badge-primary badge-sm font-medium">
|
||||
|
||||
@@ -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}
|
||||
|
||||
<div
|
||||
class="card w-full max-w-md bg-base-300 shadow hover:shadow-md transition-all duration-200 border border-base-300 group"
|
||||
class="card w-full bg-base-300 shadow hover:shadow-md transition-all duration-200 border border-base-300 group"
|
||||
class:max-w-md={!compact}
|
||||
aria-label="transportation-card"
|
||||
>
|
||||
<!-- Image Section with Overlay -->
|
||||
<div class="relative overflow-hidden rounded-t-2xl">
|
||||
{#if routeGeojson}
|
||||
<TransportationRoutePreview
|
||||
geojson={routeGeojson}
|
||||
name={transportation.name}
|
||||
images={transportation.images}
|
||||
/>
|
||||
{:else}
|
||||
<CardCarousel
|
||||
images={transportation.images}
|
||||
icon={getTransportationIcon(transportation.type)}
|
||||
name={transportation.name}
|
||||
/>
|
||||
{/if}
|
||||
{#if showImage}
|
||||
<!-- Image Section with Overlay -->
|
||||
<div class="relative overflow-hidden rounded-t-2xl">
|
||||
{#if routeGeojson}
|
||||
<TransportationRoutePreview
|
||||
geojson={routeGeojson}
|
||||
name={transportation.name}
|
||||
images={transportation.images}
|
||||
/>
|
||||
{:else}
|
||||
<CardCarousel
|
||||
images={transportation.images}
|
||||
icon={getTransportationIcon(transportation.type)}
|
||||
name={transportation.name}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<!-- Privacy Indicator -->
|
||||
<div class="absolute top-2 right-4">
|
||||
<div
|
||||
class="tooltip tooltip-left"
|
||||
data-tip={transportation.is_public ? $t('adventures.public') : $t('adventures.private')}
|
||||
>
|
||||
<!-- Privacy Indicator -->
|
||||
<div class="absolute top-2 right-4">
|
||||
<div
|
||||
class="badge badge-sm p-1 rounded-full text-base-content shadow-sm"
|
||||
role="img"
|
||||
aria-label={transportation.is_public ? $t('adventures.public') : $t('adventures.private')}
|
||||
class="tooltip tooltip-left"
|
||||
data-tip={transportation.is_public ? $t('adventures.public') : $t('adventures.private')}
|
||||
>
|
||||
{#if transportation.is_public}
|
||||
<Eye class="w-4 h-4" />
|
||||
{:else}
|
||||
<EyeOff class="w-4 h-4" />
|
||||
{/if}
|
||||
<div
|
||||
class="badge badge-sm p-1 rounded-full text-base-content shadow-sm"
|
||||
role="img"
|
||||
aria-label={transportation.is_public
|
||||
? $t('adventures.public')
|
||||
: $t('adventures.private')}
|
||||
>
|
||||
{#if transportation.is_public}
|
||||
<Eye class="w-4 h-4" />
|
||||
{:else}
|
||||
<EyeOff class="w-4 h-4" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Category Badge -->
|
||||
{#if transportation.type}
|
||||
<div class="absolute bottom-4 left-4">
|
||||
<div class="badge badge-primary shadow-lg font-medium">
|
||||
{$t(`transportation.modes.${transportation.type}`)}
|
||||
{getTransportationIcon(transportation.type)}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Category Badge -->
|
||||
{#if transportation.type}
|
||||
<div class="absolute bottom-4 left-4">
|
||||
<div class="badge badge-primary shadow-lg font-medium">
|
||||
{$t(`transportation.modes.${transportation.type}`)}
|
||||
{getTransportationIcon(transportation.type)}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="card-body p-4 space-y-3 min-w-0">
|
||||
<div
|
||||
class="card-body min-w-0"
|
||||
class:p-3={compact}
|
||||
class:p-4={!compact}
|
||||
class:space-y-2={compact}
|
||||
class:space-y-3={!compact}
|
||||
>
|
||||
<!-- Header -->
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<a
|
||||
href="/transportations/{transportation.id}"
|
||||
class="hover:text-primary transition-colors duration-200 line-clamp-2 text-lg font-semibold"
|
||||
class="hover:text-primary transition-colors duration-200 line-clamp-2"
|
||||
class:text-base={compact}
|
||||
class:text-lg={!compact}
|
||||
class:font-medium={compact}
|
||||
class:font-semibold={!compact}
|
||||
>
|
||||
{transportation.name}
|
||||
</a>
|
||||
@@ -343,6 +350,33 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if !showImage}
|
||||
<div class="flex items-center gap-2 text-xs text-base-content/70 min-w-0">
|
||||
<div
|
||||
class="tooltip tooltip-left"
|
||||
data-tip={transportation.is_public ? $t('adventures.public') : $t('adventures.private')}
|
||||
>
|
||||
<div
|
||||
class="badge badge-sm p-1 rounded-full text-base-content shadow-sm"
|
||||
role="img"
|
||||
aria-label={transportation.is_public ? $t('adventures.public') : $t('adventures.private')}
|
||||
>
|
||||
{#if transportation.is_public}
|
||||
<Eye class="w-4 h-4" />
|
||||
{:else}
|
||||
<EyeOff class="w-4 h-4" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{#if transportation.type}
|
||||
<div class="badge badge-primary badge-sm font-medium">
|
||||
{$t(`transportation.modes.${transportation.type}`)}
|
||||
{getTransportationIcon(transportation.type)}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Route & Flight Info -->
|
||||
{#if routeFromLabel || routeToLabel}
|
||||
<div class="flex items-center gap-2 min-w-0">
|
||||
@@ -466,7 +500,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Stats & Rating -->
|
||||
<!-- Stats -->
|
||||
<div class="flex flex-wrap items-center gap-2 text-sm">
|
||||
{#if transportationPriceLabel}
|
||||
<span class="badge badge-ghost badge-sm">💰 {transportationPriceLabel}</span>
|
||||
@@ -483,20 +517,6 @@
|
||||
<span class="badge badge-ghost badge-sm">⏱️ {travelDurationLabel}</span>
|
||||
{/if}
|
||||
|
||||
{#if transportation.rating}
|
||||
<div class="flex items-center gap-1">
|
||||
<div class="flex -ml-1">
|
||||
{#each renderStars(transportation.rating) as filled}
|
||||
{#if filled}
|
||||
<Star class="w-4 h-4 text-warning fill-current" />
|
||||
{:else}
|
||||
<StarOutline class="w-4 h-4 text-base-content/30" />
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
<span class="text-xs text-base-content/60">({transportation.rating}/5)</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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<Transportation>);
|
||||
}
|
||||
|
||||
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'}
|
||||
<div class="rounded-xl border border-base-300 bg-base-100 px-4 py-3">
|
||||
<div class="flex items-center justify-between gap-3 mb-2">
|
||||
<div class="flex items-center gap-2 min-w-0">
|
||||
<span class="text-lg"
|
||||
>{getTransportationIcon(resolvedObj.type)}</span
|
||||
>
|
||||
<p class="font-semibold truncate">{resolvedObj.name}</p>
|
||||
<span class="badge badge-outline badge-sm truncate">
|
||||
{$t(`transportation.modes.${resolvedObj.type}`) ||
|
||||
resolvedObj.type}
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-xs opacity-70 flex items-center gap-2 shrink-0">
|
||||
{#if formatTransportationDuration(resolvedObj.travel_duration_minutes)}
|
||||
<span
|
||||
>{formatTransportationDuration(
|
||||
resolvedObj.travel_duration_minutes
|
||||
)}</span
|
||||
>
|
||||
{/if}
|
||||
{#if formatTransportationDistance(resolvedObj.distance)}
|
||||
<span>{formatTransportationDistance(resolvedObj.distance)}</span
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-sm opacity-80 truncate">
|
||||
{resolvedObj.from_location || '—'} → {resolvedObj.to_location ||
|
||||
'—'}
|
||||
</div>
|
||||
{#if canModify}
|
||||
<div class="mt-2 flex flex-wrap gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-xs btn-ghost"
|
||||
on:click={() => editTransportationInline(resolvedObj)}
|
||||
>
|
||||
{$t('transportation.edit')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-xs btn-ghost"
|
||||
on:click={() =>
|
||||
handleOpenDayPickerForItem(
|
||||
'transportation',
|
||||
resolvedObj,
|
||||
true,
|
||||
day.date
|
||||
)}
|
||||
>
|
||||
{$t('itinerary.change_day')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-xs btn-ghost"
|
||||
on:click={() =>
|
||||
moveItemToGlobal('transportation', resolvedObj.id)}
|
||||
>
|
||||
{$t('itinerary.move_to_trip_context') || 'Move to Trip Context'}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-xs btn-ghost"
|
||||
on:click={() => removeItineraryEntry(item)}
|
||||
>
|
||||
{$t('itinerary.remove_from_itinerary')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-xs btn-error btn-outline"
|
||||
on:click={() =>
|
||||
deleteTransportationFromItinerary(item, resolvedObj)}
|
||||
>
|
||||
{$t('adventures.delete')}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<TransportationCard
|
||||
transportation={resolvedObj}
|
||||
{user}
|
||||
{collection}
|
||||
itineraryItem={item}
|
||||
compact={true}
|
||||
showImage={false}
|
||||
on:delete={handleItemDelete}
|
||||
on:removeFromItinerary={handleRemoveItineraryItem}
|
||||
on:edit={handleEditTransportation}
|
||||
on:moveToGlobal={(e) => 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'}
|
||||
<div class="mb-2">
|
||||
@@ -3443,6 +3374,9 @@
|
||||
transportation={item}
|
||||
{user}
|
||||
{collection}
|
||||
readOnly={!canModify}
|
||||
compact={true}
|
||||
showImage={false}
|
||||
on:delete={handleItemDelete}
|
||||
on:edit={handleEditTransportation}
|
||||
/>
|
||||
|
||||
@@ -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 @@
|
||||
</div>
|
||||
|
||||
<!-- Additional Stats Row -->
|
||||
{#if averageLocationRating > 0 || checklistStats.total > 0 || lodgingTypeBreakdown.length > 0}
|
||||
{#if checklistStats.total > 0 || lodgingTypeBreakdown.length > 0}
|
||||
<div class="divider">{$t('adventures.more_details')}</div>
|
||||
<div class="grid grid-cols-2 sm:grid-cols-3 gap-3">
|
||||
{#if averageLocationRating > 0}
|
||||
<div class="stat bg-base-300 rounded-lg p-4">
|
||||
<div class="stat-figure text-2xl">⭐</div>
|
||||
<div class="stat-title text-xs">{$t('adventures.avg_rating')}</div>
|
||||
<div class="stat-value text-lg">{averageLocationRating.toFixed(1)}</div>
|
||||
<div class="stat-desc text-xs">{$t('adventures.of_locations')}</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if checklistStats.total > 0}
|
||||
<div class="stat bg-base-300 rounded-lg p-4">
|
||||
<div class="stat-figure text-2xl">✓</div>
|
||||
|
||||
@@ -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 @@
|
||||
}}
|
||||
/>
|
||||
|
||||
<!-- Rating Field -->
|
||||
<div class="form-control">
|
||||
<label class="label" for="rating">
|
||||
<span class="label-text font-medium">{$t('adventures.rating')}</span>
|
||||
</label>
|
||||
<div
|
||||
class="flex items-center gap-4 p-3 bg-base-100/80 border border-base-300 rounded-lg"
|
||||
>
|
||||
<div class="rating">
|
||||
<input
|
||||
type="radio"
|
||||
name="rating"
|
||||
id="rating"
|
||||
class="rating-hidden"
|
||||
checked={Number.isNaN(location.rating)}
|
||||
/>
|
||||
{#each [1, 2, 3, 4, 5] as star}
|
||||
<input
|
||||
type="radio"
|
||||
name="rating"
|
||||
class="mask mask-star-2 bg-warning"
|
||||
on:click={() => (location.rating = star)}
|
||||
checked={location.rating === star}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{#if !Number.isNaN(location.rating)}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm btn-error btn-outline gap-2"
|
||||
on:click={() => (location.rating = NaN)}
|
||||
>
|
||||
<ClearIcon class="w-4 h-4" />
|
||||
{$t('adventures.remove')}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right Column -->
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Rating Field -->
|
||||
<div class="form-control">
|
||||
<label class="label" for="rating">
|
||||
<span class="label-text font-medium">{$t('adventures.rating')}</span>
|
||||
</label>
|
||||
<div
|
||||
class="flex items-center gap-4 p-3 bg-base-100/80 border border-base-300 rounded-lg"
|
||||
>
|
||||
<div class="rating">
|
||||
<input
|
||||
type="radio"
|
||||
name="rating"
|
||||
id="rating"
|
||||
class="rating-hidden"
|
||||
checked={Number.isNaN(lodging.rating)}
|
||||
/>
|
||||
{#each [1, 2, 3, 4, 5] as star}
|
||||
<input
|
||||
type="radio"
|
||||
name="rating"
|
||||
class="mask mask-star-2 bg-warning"
|
||||
on:click={() => (lodging.rating = star)}
|
||||
checked={lodging.rating === star}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{#if !Number.isNaN(lodging.rating)}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm btn-error btn-outline gap-2"
|
||||
on:click={() => (lodging.rating = NaN)}
|
||||
>
|
||||
<ClearIcon class="w-4 h-4" />
|
||||
{$t('adventures.remove')}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Reservation Number -->
|
||||
<div class="form-control">
|
||||
<label class="label" for="reservation">
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
name: '',
|
||||
type: '',
|
||||
description: null,
|
||||
rating: null,
|
||||
link: null,
|
||||
check_in: null,
|
||||
check_out: null,
|
||||
@@ -84,7 +83,6 @@
|
||||
name: lodgingToEdit.name || '',
|
||||
type: lodgingToEdit.type || '',
|
||||
description: lodgingToEdit.description || null,
|
||||
rating: lodgingToEdit.rating || null,
|
||||
link: lodgingToEdit.link || null,
|
||||
check_in: lodgingToEdit.check_in || null,
|
||||
check_out: lodgingToEdit.check_out || null,
|
||||
|
||||
@@ -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';
|
||||
@@ -50,7 +49,6 @@
|
||||
name: '',
|
||||
type: '',
|
||||
description: '',
|
||||
rating: NaN,
|
||||
link: '',
|
||||
date: null,
|
||||
end_date: null,
|
||||
@@ -516,7 +514,6 @@
|
||||
transportation.type = initialTransportation.type || '';
|
||||
transportation.link = initialTransportation.link || '';
|
||||
transportation.description = initialTransportation.description || '';
|
||||
transportation.rating = initialTransportation.rating ?? NaN;
|
||||
transportation.is_public = initialTransportation.is_public ?? true;
|
||||
transportation.flight_number = initialTransportation.flight_number || null;
|
||||
transportation.start_code = initialTransportation.start_code || null;
|
||||
@@ -714,44 +711,6 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Rating Field -->
|
||||
<div class="form-control">
|
||||
<label class="label" for="rating">
|
||||
<span class="label-text font-medium">{$t('adventures.rating')}</span>
|
||||
</label>
|
||||
<div
|
||||
class="flex items-center gap-4 p-3 bg-base-100/80 border border-base-300 rounded-lg"
|
||||
>
|
||||
<div class="rating">
|
||||
<input
|
||||
type="radio"
|
||||
name="rating"
|
||||
id="rating"
|
||||
class="rating-hidden"
|
||||
checked={Number.isNaN(transportation.rating)}
|
||||
/>
|
||||
{#each [1, 2, 3, 4, 5] as star}
|
||||
<input
|
||||
type="radio"
|
||||
name="rating"
|
||||
class="mask mask-star-2 bg-warning"
|
||||
on:click={() => (transportation.rating = star)}
|
||||
checked={transportation.rating === star}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{#if !Number.isNaN(transportation.rating)}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm btn-error btn-outline gap-2"
|
||||
on:click={() => (transportation.rating = NaN)}
|
||||
>
|
||||
<ClearIcon class="w-4 h-4" />
|
||||
{$t('adventures.remove')}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right Column -->
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -405,11 +405,11 @@
|
||||
<input
|
||||
type="radio"
|
||||
name="order_by"
|
||||
value="rating"
|
||||
value="price"
|
||||
class="radio radio-primary radio-sm"
|
||||
checked={currentSort.order_by === 'rating'}
|
||||
checked={currentSort.order_by === 'price'}
|
||||
/>
|
||||
<span class="label-text text-sm">{$t('adventures.rating')}</span>
|
||||
<span class="label-text text-sm">{$t('adventures.price')}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -285,23 +285,6 @@
|
||||
<div class="max-w-4xl">
|
||||
<h1 class="text-6xl font-bold mb-4 drop-shadow-lg">{adventure.name}</h1>
|
||||
|
||||
<!-- Rating -->
|
||||
{#if adventure.rating !== undefined && adventure.rating !== null}
|
||||
<div class="flex justify-center mb-6">
|
||||
<div class="rating rating-lg">
|
||||
{#each Array.from({ length: 5 }, (_, i) => i + 1) as star}
|
||||
<input
|
||||
type="radio"
|
||||
name="rating-hero"
|
||||
class="mask mask-star-2 bg-warning"
|
||||
checked={star <= adventure.rating}
|
||||
disabled
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Quick Info Badges -->
|
||||
<div class="flex flex-wrap justify-center gap-4 mb-6">
|
||||
<a
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
import ImageDisplayModal from '$lib/components/ImageDisplayModal.svelte';
|
||||
import AttachmentCard from '$lib/components/cards/AttachmentCard.svelte';
|
||||
import { getBasemapUrl, isAllDay, LODGING_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 Eye from '~icons/mdi/eye';
|
||||
@@ -69,14 +67,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function renderStars(rating: number) {
|
||||
const stars = [];
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
stars.push(i <= rating);
|
||||
}
|
||||
return stars;
|
||||
}
|
||||
|
||||
const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone ?? 'UTC';
|
||||
const getTimezoneLabel = (zone?: string | null) => zone ?? localTimeZone;
|
||||
const getTimezoneTip = (zone?: string | null) => {
|
||||
@@ -258,23 +248,6 @@
|
||||
<h1 class="text-6xl font-bold drop-shadow-lg">{lodging.name}</h1>
|
||||
</div>
|
||||
|
||||
<!-- Rating -->
|
||||
{#if lodging.rating !== undefined && lodging.rating !== null}
|
||||
<div class="flex justify-center mb-6">
|
||||
<div class="rating rating-lg">
|
||||
{#each Array.from({ length: 5 }, (_, i) => i + 1) as star}
|
||||
<input
|
||||
type="radio"
|
||||
name="rating-hero"
|
||||
class="mask mask-star-2 bg-warning"
|
||||
checked={star <= lodging.rating}
|
||||
disabled
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Quick Info Badges -->
|
||||
<div class="flex flex-wrap justify-center gap-4 mb-6">
|
||||
{#if lodging.type}
|
||||
@@ -389,32 +362,20 @@
|
||||
zoom={13}
|
||||
>
|
||||
<DefaultMarker lngLat={[lodging.longitude, lodging.latitude]}>
|
||||
<Popup openOn="click" offset={[0, -10]}>
|
||||
<div class="p-2">
|
||||
<div class="text-lg font-bold text-black mb-1">{lodging.name}</div>
|
||||
<p class="font-semibold text-black text-sm mb-2">
|
||||
{$t(`lodging.${lodging.type}`)}
|
||||
{getLodgingIcon(lodging.type)}
|
||||
</p>
|
||||
{#if lodging.rating}
|
||||
<div class="flex items-center gap-1 mb-2">
|
||||
{#each renderStars(lodging.rating) as filled}
|
||||
{#if filled}
|
||||
<Star class="w-4 h-4 text-warning fill-current" />
|
||||
{:else}
|
||||
<StarOutline class="w-4 h-4 text-gray-400" />
|
||||
{/if}
|
||||
{/each}
|
||||
<span class="text-xs text-black ml-1">({lodging.rating}/5)</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if lodging.location}
|
||||
<div class="text-xs text-black">
|
||||
📍 {lodging.location}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</Popup>
|
||||
<Popup openOn="click" offset={[0, -10]}>
|
||||
<div class="p-2">
|
||||
<div class="text-lg font-bold text-black mb-1">{lodging.name}</div>
|
||||
<p class="font-semibold text-black text-sm mb-2">
|
||||
{$t(`lodging.${lodging.type}`)}
|
||||
{getLodgingIcon(lodging.type)}
|
||||
</p>
|
||||
{#if lodging.location}
|
||||
<div class="text-xs text-black">
|
||||
📍 {lodging.location}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</Popup>
|
||||
</DefaultMarker>
|
||||
</MapLibre>
|
||||
</div>
|
||||
|
||||
@@ -746,25 +746,20 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
{#if hoveredLocation.rating !== null && hoveredLocation.rating !== undefined}
|
||||
<div class="badge badge-neutral badge-sm">
|
||||
★ {hoveredLocation.rating}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="badge badge-ghost badge-sm">
|
||||
Visits: {hoveredLocation.visits?.length ?? 0}
|
||||
</div>
|
||||
<div class="badge badge-ghost badge-sm">
|
||||
Media: {hoveredLocation.images?.length ?? 0}
|
||||
</div>
|
||||
<div class="badge badge-ghost badge-sm">
|
||||
Files: {hoveredLocation.attachments?.length ?? 0}
|
||||
</div>
|
||||
<div class="badge badge-ghost badge-sm">
|
||||
Trails: {hoveredLocation.trails?.length ?? 0}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<div class="badge badge-ghost badge-sm">
|
||||
Visits: {hoveredLocation.visits?.length ?? 0}
|
||||
</div>
|
||||
<div class="badge badge-ghost badge-sm">
|
||||
Media: {hoveredLocation.images?.length ?? 0}
|
||||
</div>
|
||||
<div class="badge badge-ghost badge-sm">
|
||||
Files: {hoveredLocation.attachments?.length ?? 0}
|
||||
</div>
|
||||
<div class="badge badge-ghost badge-sm">
|
||||
Trails: {hoveredLocation.trails?.length ?? 0}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if hoveredLocation.visits && hoveredLocation.visits.length > 0}
|
||||
<div class="text-xs text-base-content/70">
|
||||
|
||||
@@ -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 @@
|
||||
<h1 class="text-6xl font-bold drop-shadow-lg">{transportation.name}</h1>
|
||||
</div>
|
||||
|
||||
<!-- Rating -->
|
||||
{#if transportation.rating !== undefined && transportation.rating !== null}
|
||||
<div class="flex justify-center mb-6">
|
||||
<div class="rating rating-lg">
|
||||
{#each Array.from({ length: 5 }, (_, i) => i + 1) as star}
|
||||
<input
|
||||
type="radio"
|
||||
name="rating-hero"
|
||||
class="mask mask-star-2 bg-warning"
|
||||
checked={star <= transportation.rating}
|
||||
disabled
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Quick Info Badges -->
|
||||
<div class="flex flex-wrap justify-center gap-4 mb-6">
|
||||
{#if transportation.type}
|
||||
@@ -553,20 +526,6 @@
|
||||
{$t('transportation.from_location')}
|
||||
{getTransportationIcon(transportation.type)}
|
||||
</p>
|
||||
{#if transportation.rating}
|
||||
<div class="flex items-center gap-1 mb-2">
|
||||
{#each renderStars(transportation.rating) as filled}
|
||||
{#if filled}
|
||||
<Star class="w-4 h-4 text-warning fill-current" />
|
||||
{:else}
|
||||
<StarOutline class="w-4 h-4 text-gray-400" />
|
||||
{/if}
|
||||
{/each}
|
||||
<span class="text-xs text-black ml-1">
|
||||
({transportation.rating}/5)
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if transportation.from_location}
|
||||
<div class="text-xs text-black">
|
||||
📍 {transportation.from_location}
|
||||
@@ -591,20 +550,6 @@
|
||||
{$t('transportation.to_location')}
|
||||
{getTransportationIcon(transportation.type)}
|
||||
</p>
|
||||
{#if transportation.rating}
|
||||
<div class="flex items-center gap-1 mb-2">
|
||||
{#each renderStars(transportation.rating) as filled}
|
||||
{#if filled}
|
||||
<Star class="w-4 h-4 text-warning fill-current" />
|
||||
{:else}
|
||||
<StarOutline class="w-4 h-4 text-gray-400" />
|
||||
{/if}
|
||||
{/each}
|
||||
<span class="text-xs text-black ml-1">
|
||||
({transportation.rating}/5)
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if transportation.to_location}
|
||||
<div class="text-xs text-black">
|
||||
📍 {transportation.to_location}
|
||||
|
||||
Reference in New Issue
Block a user