From eb3c9c2b647e1fb3500c6e4aa677ab7e726e9a3a Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Tue, 5 Aug 2025 13:25:07 -0400 Subject: [PATCH] feat: add TrailCard component for displaying trail details with measurement system support --- frontend/src/lib/components/TrailCard.svelte | 155 ++++++++++++++++++ .../src/routes/locations/[id]/+page.svelte | 32 +--- 2 files changed, 160 insertions(+), 27 deletions(-) create mode 100644 frontend/src/lib/components/TrailCard.svelte diff --git a/frontend/src/lib/components/TrailCard.svelte b/frontend/src/lib/components/TrailCard.svelte new file mode 100644 index 0000000..5d585a7 --- /dev/null +++ b/frontend/src/lib/components/TrailCard.svelte @@ -0,0 +1,155 @@ + + +
+
+
+
+ +

{trail.name}

+ + +
+ {#if trail.provider} + {trail.provider} + {/if} + + Created: {formatDate(trail.created_at)} + +
+ + {#if trail.wanderer_data} +
+ +
+
+ + + {getDistance(trail.wanderer_data.distance)} + +
+ + {#if trail.wanderer_data.duration > 0} +
+ + + {getDuration(trail.wanderer_data.duration)} + +
+ {/if} + + {#if trail.wanderer_data.elevation_gain > 0} +
+ + + {getElevation(trail.wanderer_data.elevation_gain)} gain + +
+ {/if} + +
+ + + {formatDate(trail.wanderer_data.date)} + +
+
+ + + {#if trail.wanderer_data.difficulty} +
+ + {trail.wanderer_data.difficulty} + + + {#if trail.wanderer_data.like_count > 0} +
+ + {pluralize(trail.wanderer_data.like_count, 'like')} +
+ {/if} +
+ {/if} + + + {#if trail.wanderer_data.description} +
+ {@html trail.wanderer_data.description} +
+ {/if} + + + {#if trail.wanderer_data.location} +
+ + {trail.wanderer_data.location} +
+ {/if} + + + {#if trail.wanderer_data.photos?.length > 0} +
+ + {pluralize(trail.wanderer_data.photos.length, 'photo')} +
+ {/if} +
+ {/if} +
+ + {#if trail.link} + + 🔗 View Trail + + {/if} +
+
+
diff --git a/frontend/src/routes/locations/[id]/+page.svelte b/frontend/src/routes/locations/[id]/+page.svelte index 8e343e0..a750bc6 100644 --- a/frontend/src/routes/locations/[id]/+page.svelte +++ b/frontend/src/routes/locations/[id]/+page.svelte @@ -21,6 +21,7 @@ import AttachmentCard from '$lib/components/AttachmentCard.svelte'; import { getBasemapUrl, isAllDay } from '$lib'; import ActivityCard from '$lib/components/ActivityCard.svelte'; + import TrailCard from '$lib/components/TrailCard.svelte'; let geojson: any; @@ -504,33 +505,10 @@

🥾 {$t('adventures.trails')}

{#each adventure.trails as trail} -
-
-
-
-

{trail.name}

-
- {#if trail.provider} - {trail.provider} - {/if} - - Created: {new Date(trail.created_at).toLocaleDateString()} - -
-
- {#if trail.link} - - 🔗 View Trail - - {/if} -
-
-
+ {/each}