From 25337776a170879152df28758b7118fd6c28bf48 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 7 Jun 2024 20:40:05 +0000 Subject: [PATCH 1/3] Fix search filter UI --- src/routes/search/+page.svelte | 135 ++++++++++++++++++++++----------- 1 file changed, 89 insertions(+), 46 deletions(-) diff --git a/src/routes/search/+page.svelte b/src/routes/search/+page.svelte index f3601d3..9d0261b 100644 --- a/src/routes/search/+page.svelte +++ b/src/routes/search/+page.svelte @@ -5,8 +5,29 @@ import type { SubmitFunction } from "@sveltejs/kit"; import type { PageData } from "./$types"; - // let visitedValue = "all"; - // let typeValue = ""; + let typeValue: string = ""; + let visitedValue: string = "all"; + + async function filterResults() { + console.log(typeValue); + console.log(visitedValue); + + if (!typeValue) { + typeValue = ""; + } + const value = new URLSearchParams(location.search).get("value"); + console.log(value); + console.log( + `/api/search?value=${value}&type=${typeValue}&visited=${visitedValue}` + ); + let data = await fetch( + `/api/search?value=${value}&type=${typeValue}&visited=${visitedValue}` + ); + console.log(data); + adventureArray = []; + let res = await data.json(); + adventureArray = res.adventures as Adventure[]; + } export let data: PageData; let adventureArray: Adventure[] = data.props?.adventures as Adventure[]; @@ -34,51 +55,73 @@
-
- - All - - Not Visited - - Visited +

Filtering Options

+
+
+ + + +

- - All - - Activity - - Location - - Name - - - +
+ + + + +
+ +
+

Search Results

{#if adventureArray.length > 0}
Date: Fri, 7 Jun 2024 21:37:38 +0000 Subject: [PATCH 2/3] Add images to cards --- src/lib/components/AdventureCard.svelte | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/components/AdventureCard.svelte b/src/lib/components/AdventureCard.svelte index 7ae6205..ad69701 100644 --- a/src/lib/components/AdventureCard.svelte +++ b/src/lib/components/AdventureCard.svelte @@ -40,6 +40,15 @@
+ {#if adventure.imageUrl && adventure.imageUrl.length > 0} +
+ Shoes +
+ {/if}

{adventure.name}

{#if adventure.location && adventure.location !== ""} From c58c679d5ffeca9036dd695750b1e3f9b4548083 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 7 Jun 2024 21:49:58 +0000 Subject: [PATCH 3/3] Image fixes --- src/lib/components/AdventureCard.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/components/AdventureCard.svelte b/src/lib/components/AdventureCard.svelte index ad69701..a2026f4 100644 --- a/src/lib/components/AdventureCard.svelte +++ b/src/lib/components/AdventureCard.svelte @@ -42,9 +42,10 @@ > {#if adventure.imageUrl && adventure.imageUrl.length > 0}
+ Shoes
@@ -74,7 +75,7 @@ {/each} {/if} -
+
{#if type == "mylog"}