From 4abaaa5fb375a429c95469b726abb0655c7aad63 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Thu, 18 Jul 2024 22:12:47 -0400 Subject: [PATCH] new sidebar --- .../lib/components/ActivityComplete.svelte | 6 +- .../src/lib/components/AdventureCard.svelte | 31 ++- frontend/src/routes/adventures/+page.svelte | 195 +++++++----------- 3 files changed, 102 insertions(+), 130 deletions(-) diff --git a/frontend/src/lib/components/ActivityComplete.svelte b/frontend/src/lib/components/ActivityComplete.svelte index 6d76abf..773f771 100644 --- a/frontend/src/lib/components/ActivityComplete.svelte +++ b/frontend/src/lib/components/ActivityComplete.svelte @@ -81,7 +81,11 @@ {#each activities as activity}
  • {activity} -
  • diff --git a/frontend/src/lib/components/AdventureCard.svelte b/frontend/src/lib/components/AdventureCard.svelte index d8c1649..4afacb7 100644 --- a/frontend/src/lib/components/AdventureCard.svelte +++ b/frontend/src/lib/components/AdventureCard.svelte @@ -26,6 +26,19 @@ export let adventure: Adventure; + let activityTypes: string[] = []; + // makes it reactivty to changes so it updates automatically + $: { + if (adventure.activity_types) { + activityTypes = adventure.activity_types; + if (activityTypes.length > 3) { + activityTypes = activityTypes.slice(0, 3); + let remaining = adventure.activity_types.length - 3; + activityTypes.push('+' + remaining); + } + } + } + async function deleteAdventure() { let res = await fetch(`/adventures/${adventure.id}?/delete`, { method: 'POST', @@ -131,14 +144,14 @@

    {adventure.name}

    -
    - {#if adventure.type == 'visited' && user?.pk == adventure.user_id} -
    Visited
    - {:else if user?.pk == adventure.user_id} -
    Planned
    - {/if} -
    {adventure.is_public ? 'Public' : 'Private'}
    -
    + +
    + {#if adventure.type == 'visited' && user?.pk == adventure.user_id} +
    Visited
    + {:else if user?.pk == adventure.user_id} +
    Planned
    + {/if} +
    {adventure.is_public ? 'Public' : 'Private'}
    {#if adventure.location && adventure.location !== ''}
    @@ -154,7 +167,7 @@ {/if} {#if adventure.activity_types && adventure.activity_types.length > 0}