diff --git a/src/lib/components/AddPlaces.svelte b/src/lib/components/AddPlaces.svelte new file mode 100644 index 0000000..cb32fba --- /dev/null +++ b/src/lib/components/AddPlaces.svelte @@ -0,0 +1,191 @@ + + +
+
+
+ +
+
+ {#if showAddButton} + + {/if} +
+ + \ No newline at end of file diff --git a/src/lib/components/ItineraryDate.svelte b/src/lib/components/ItineraryDate.svelte index 06ddeb1..ce1dc34 100644 --- a/src/lib/components/ItineraryDate.svelte +++ b/src/lib/components/ItineraryDate.svelte @@ -1,18 +1,31 @@ -
@@ -28,14 +41,16 @@ class="date-content" transition:slide={{ duration: 400, easing: quintOut }} > - {#each places as place} - + {#each places as place, i} + handleDeletePlace(i)} /> {/each} - +
+ +
{/if} @@ -65,14 +80,14 @@ } .date-text h3 { - margin: 0; - font-size: 1.1rem; - font-weight: 500; + margin: 0; + font-size: 1.1rem; + font-weight: 500; } .arrow-icon { - transition: transform 0.3s ease; - transform-origin: center; + transition: transform 0.3s ease; + transform-origin: center; } .rotated { @@ -83,24 +98,7 @@ padding: 1rem 0 1rem 2rem; } - .add-place-btn { - width: 100%; - display: flex; - align-items: center; - justify-content: center; - gap: 0.5rem; - padding: 0.75rem; - background: white; - border: 2px solid var(--gray-100); - border-radius: 0.75rem; - color: var(--gray-600); - cursor: pointer; - margin: 1rem 0; - transition: all 0.2s ease; - } - - .add-place-btn:hover { - background: var(--gray-50); - border-color: var(--gray-50); + .add-places-container { + margin-top: 1rem; } \ No newline at end of file diff --git a/src/lib/components/Nav.svelte b/src/lib/components/Nav.svelte index e6b9b0c..b5194d9 100644 --- a/src/lib/components/Nav.svelte +++ b/src/lib/components/Nav.svelte @@ -1,5 +1,4 @@ - -
- -
-
{fullPlace.name}
- {#if fullPlace.desc} -

{fullPlace.desc}

- {/if} -
- + + +{#if variant === 'simple'} +
+ +
{fullPlace.name}
+
+ {#if showDelete} + + {/if} +
-
+{:else} +
+ +
+
+ +
+
{fullPlace.name}
+ {#if fullPlace.desc} +

{fullPlace.desc}

+ {/if} +
+ +
+
+
+{/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 @@
-
- - - -
-
+ {#if expandedSections.places_to_visit} +
+
+ {#each placesToVisit as place, i} + handleDeletePlace(i)} + /> + {/each} +
+ + +
+ {/if}
@@ -166,7 +194,6 @@ {/each}
@@ -316,6 +343,14 @@ .section-content { padding-left: 1.5rem; padding-top: 1rem; + display: flex; + flex-direction: column; + margin-bottom: 1rem; + gap: 0.5rem; + } + + .section-content.places{ + margin-left: 0.5rem; } .button-group { diff --git a/src/routes/memories/+page.svelte b/src/routes/memories/+page.svelte index e764fb7..a27e809 100644 --- a/src/routes/memories/+page.svelte +++ b/src/routes/memories/+page.svelte @@ -32,7 +32,7 @@
- +