adds zod API validation
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
export let fullWidth: boolean = false;
|
||||
|
||||
$: thumbnail = trail.photos.length
|
||||
? getFileURL(trail, trail.photos[trail.thumbnail])
|
||||
? getFileURL(trail, trail.photos[trail.thumbnail ?? 0])
|
||||
: "/imgs/default_thumbnail.webp";
|
||||
|
||||
$: trailIsShared = (trail.expand?.trail_share_via_trail?.length ?? 0) > 0;
|
||||
@@ -66,7 +66,7 @@
|
||||
})}
|
||||
</p>
|
||||
{/if}
|
||||
{#if trail.expand.author}
|
||||
{#if trail.expand?.author}
|
||||
<p class="text-xs text-gray-500 mb-3">
|
||||
{$_("by")}
|
||||
<img
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
const allowEdit =
|
||||
trail.author == $currentUser?.id ||
|
||||
trail.expand.trail_share_via_trail?.some((s) => s.permission == "edit");
|
||||
trail.expand?.trail_share_via_trail?.some((s) => s.permission == "edit");
|
||||
|
||||
const dropdownItems: DropdownItem[] = [
|
||||
mode == "overview"
|
||||
@@ -142,7 +142,7 @@
|
||||
}
|
||||
if (exportSettings.summitLog) {
|
||||
let summitLogString = "";
|
||||
for (const summitLog of trail.expand.summit_logs) {
|
||||
for (const summitLog of trail.expand?.summit_logs ?? []) {
|
||||
summitLogString += `${summitLog.date},${summitLog.text}\n`;
|
||||
}
|
||||
zip.file(
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
(trail.expand?.trail_share_via_trail?.length ?? 0) > 0;
|
||||
|
||||
let thumbnail = trail.photos.length
|
||||
? getFileURL(trail, trail.photos[trail.thumbnail])
|
||||
? getFileURL(trail, trail.photos[trail.thumbnail ?? 0])
|
||||
: "/imgs/default_thumbnail.webp";
|
||||
|
||||
let openGallery: (idx?: number) => void;
|
||||
@@ -99,7 +99,7 @@
|
||||
comments_create(newComment).then((c) => {
|
||||
newComment.text = "";
|
||||
c.expand = {
|
||||
author: $currentUser!,
|
||||
author: { ...$currentUser!, private: false },
|
||||
};
|
||||
|
||||
const newCommentList = [c, ...$comments];
|
||||
@@ -182,7 +182,7 @@
|
||||
)}
|
||||
</h5>
|
||||
{/if}
|
||||
{#if trail.expand.author}
|
||||
{#if trail.expand?.author}
|
||||
<p class="my-3">
|
||||
{$_("by")}
|
||||
<img
|
||||
@@ -218,7 +218,7 @@
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
{#if ($currentUser && $currentUser.id == trail.author) || trail.expand.trail_share_via_trail?.length || trail.public}
|
||||
{#if ($currentUser && $currentUser.id == trail.author) || trail.expand?.trail_share_via_trail?.length || trail.public}
|
||||
<TrailDropdown {trail} {mode}></TrailDropdown>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -251,7 +251,7 @@
|
||||
>{formatElevation(trail.elevation_loss)}</span
|
||||
>
|
||||
</div>
|
||||
{#if trail.expand.category}
|
||||
{#if trail.expand?.category}
|
||||
<div class="flex flex-col items-center">
|
||||
<span>{$_("category")}</span>
|
||||
<span class="font-semibold text-lg"
|
||||
@@ -286,7 +286,7 @@
|
||||
{/if}
|
||||
{#if activeTab == 1}
|
||||
<ul>
|
||||
{#each trail.expand.waypoints ?? [] as waypoint, i}
|
||||
{#each trail.expand?.waypoints ?? [] as waypoint, i}
|
||||
<li
|
||||
on:mouseenter={() => openMarkerPopup(i)}
|
||||
on:mouseleave={() => closeMarkerPopup(i)}
|
||||
@@ -322,7 +322,7 @@
|
||||
{#if activeTab == 3}
|
||||
<div class="overflow-x-auto">
|
||||
<SummitLogTable
|
||||
summitLogs={trail.expand.summit_logs}
|
||||
summitLogs={trail.expand?.summit_logs}
|
||||
showAuthor
|
||||
showRoute
|
||||
showPhotos
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
export let showDescription: boolean = true;
|
||||
|
||||
$: thumbnail = trail.photos.length
|
||||
? getFileURL(trail, trail.photos[trail.thumbnail])
|
||||
? getFileURL(trail, trail.photos[trail.thumbnail ?? 0])
|
||||
: "/imgs/default_thumbnail.webp";
|
||||
</script>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
})}
|
||||
</p>
|
||||
{/if}
|
||||
{#if trail.expand.author}
|
||||
{#if trail.expand?.author}
|
||||
<p class="text-xs text-gray-500 mb-3">
|
||||
{$_("by")}
|
||||
<img
|
||||
|
||||
Reference in New Issue
Block a user