Skip to content

Commit

Permalink
make it work
Browse files Browse the repository at this point in the history
  • Loading branch information
github-tijlxyz committed Mar 28, 2024
1 parent 1a94d3d commit 0b92ccd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/components/Recipe/Recipe.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
);*/
</script>

<ZapModal bind:open={zapModal} submit={zapEvt} cancel={() => (zapModal = false)} />
Expand Down Expand Up @@ -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}
<a class="flex gap-2 cursor-pointer" href="/fork/{naddr}">
<PencilIcon size={24} />
Edit
Expand Down Expand Up @@ -275,12 +274,14 @@
</div>
<div class="flex flex-col items-center gap-4 bg-input py-6 rounded-3xl">
<h2>Enjoy this recipe?</h2>
<Button on:click={() => zapModal = true}>Zap it</Button>
<Button on:click={() => (zapModal = true)}>Zap it</Button>
</div>
<!--
<div class="flex flex-col gap-4">
{firstTag}
<h2>More {firstTag[1].split("nostrcooking-")[1]}</h2>
</div>
-->
<Comments {event} />
</div>
{:else}
Expand Down
8 changes: 5 additions & 3 deletions src/components/Recipe/TotalComments.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
</script>
Expand Down
6 changes: 4 additions & 2 deletions src/components/Recipe/TotalLikes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 0b92ccd

Please sign in to comment.