-
{fullPlace.name}
- {#if fullPlace.desc}
-
{fullPlace.desc}
- {/if}
-
-
{fullPlace.time}
+
+
+{#if variant === 'simple'}
+
+
+
{fullPlace.name}
+
+ {#if showDelete}
+
+ Delete place
+
+
+ {/if}
+
+
+
-
+{:else}
+
+
+
+
+
+
+
+
+
{fullPlace.name}
+ {#if fullPlace.desc}
+
{fullPlace.desc}
+ {/if}
+
+ {fullPlace.time}
+
+
+
+{/if}
\ No newline at end of file
diff --git a/src/routes/itinerary/+page.svelte b/src/routes/itinerary/+page.svelte
index 1668edc..3b46826 100644
--- a/src/routes/itinerary/+page.svelte
+++ b/src/routes/itinerary/+page.svelte
@@ -6,12 +6,13 @@
import { page } from '$app/state';
import { onMount } from 'svelte';
import { Loader } from '@googlemaps/js-api-loader';
+ import { browser } from '$app/environment';
import ProfilePicture from '$lib/components/ProfilePicture.svelte';
import BottomBar from '$lib/components/BottomBar.svelte';
import Button from '$lib/components/Button.svelte';
import ItineraryDate from '$lib/components/ItineraryDate.svelte';
- import { browser } from '$app/environment';
-
+ import AddPlaces from '$lib/components/AddPlaces.svelte';
+ import PlaceCard from '$lib/components/PlaceCard.svelte';
// Placeholder data obtained from the popup
let destination = "Taiwan";
@@ -53,6 +54,7 @@
});
// Array of dates between startDate to endDate
+ // TODO: implement generateTripDates(startDate, endDate)
let tripDates = ["27/04/2025", "28/04/2025", "29/04/2025", "30/04/2025"];
let expandedSections = {
explore: true,
@@ -63,11 +65,21 @@
tripDates.forEach(date => expandedDates[date] = false);
let recommendedPlaces = [
- { name: "Place name", image: "" },
- { name: "Place name", image: "" },
- { name: "Place name", image: "" }
+ { name: "Place name" },
+ { name: "Place name" },
+ { name: "Place name" }
];
+ let placesToVisit = [
+ { name: "Place name"},
+ { name: "Place name"},
+ { name: "Place name"}
+ ];
+
+ function handleDeletePlace(index: number) {
+ placesToVisit = placesToVisit.filter((_, i) => i !== index);
+ }
+
function toggleSection(section: keyof typeof expandedSections) {
expandedSections[section] = !expandedSections[section];
}
@@ -84,8 +96,14 @@
}
}
- function handleAddPlace() {
- // TODO: Implement add place functionality
+ function handlePlaceSelected(place: google.maps.places.PlaceResult) {
+ const newPlace = {
+ name: place.name || 'Unknown Place',
+ desc: place.formatted_address || '',
+ img: place.photos ? place.photos[0].getUrl() : 'placeholder.jpeg'
+ };
+
+ placesToVisit = [...placesToVisit, newPlace];
}
function handlePastTrip() {
@@ -127,17 +145,6 @@
-
-
-
+