From 0b92ccd58d3c5d69b9e16a960faa42374440509d Mon Sep 17 00:00:00 2001 From: tijl Date: Thu, 28 Mar 2024 12:58:31 +0100 Subject: [PATCH] make it work --- src/components/Recipe/Recipe.svelte | 11 ++++++----- src/components/Recipe/TotalComments.svelte | 8 +++++--- src/components/Recipe/TotalLikes.svelte | 6 ++++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/components/Recipe/Recipe.svelte b/src/components/Recipe/Recipe.svelte index 630be63..e956e8f 100644 --- a/src/components/Recipe/Recipe.svelte +++ b/src/components/Recipe/Recipe.svelte @@ -128,10 +128,9 @@ else toggleLists.add(id); } - - const firstTag = recipeTags.find( + /*const firstTag = recipeTags.find( (e) => e.title.toLowerCase().replaceAll(' ', '-') == event.getMatchingTags("t").filter((t) => t[1].slice(13)[0])[0][1].slice(13) - ); + );*/ (zapModal = false)} /> @@ -224,7 +223,7 @@ on:click_outside={() => (dropdownActive = false)} class="flex flex-col right-0 gap-4 absolute z-20 bg-white rounded-3xl drop-shadow px-5 py-6 my-6" > - {#if event.author.pubkey === $userPublickey} + {#if event.author?.pubkey === $userPublickey} Edit @@ -275,12 +274,14 @@

Enjoy this recipe?

- +
+ {:else} diff --git a/src/components/Recipe/TotalComments.svelte b/src/components/Recipe/TotalComments.svelte index 686f6a2..5d76970 100644 --- a/src/components/Recipe/TotalComments.svelte +++ b/src/components/Recipe/TotalComments.svelte @@ -11,10 +11,12 @@ (async () => { const evs = await $ndk.fetchEvents({ kinds: [1], - '#a': [`${event.kind}:${event.author.hexpubkey}:${event.tags.find((e) => e[0] == 'd')?.[1]}`] + '#a': [ + `${event.kind}:${event.author.hexpubkey}:${event.tags.find((e) => e[0] == 'd')?.[1]}` + ] }); - totalCommentAmount = evs.size // normal way - })() + totalCommentAmount = evs.size; // normal way + })(); } loading = false; diff --git a/src/components/Recipe/TotalLikes.svelte b/src/components/Recipe/TotalLikes.svelte index 7719f86..0ff104a 100644 --- a/src/components/Recipe/TotalLikes.svelte +++ b/src/components/Recipe/TotalLikes.svelte @@ -12,11 +12,13 @@ (async () => { const evs = await $ndk.fetchEvents({ kinds: [7], - '#a': [`${event.kind}:${event.author.hexpubkey}:${event.tags.find((e) => e[0] == 'd')?.[1]}`] + '#a': [ + `${event.kind}:${event.author.hexpubkey}:${event.tags.find((e) => e[0] == 'd')?.[1]}` + ] }); if (Array.from(evs).find((e) => e.pubkey == $userPublickey)) liked = true; totalLikeAmount = evs.size; - })() + })(); } loading = false; async function likePost() {