Fix serialization reactions tooltip

This commit is contained in:
Sebastian Martinez
2024-03-19 10:59:22 +01:00
committed by Rūdolfs Ošiņš
parent 8ba5d4e731
commit 1d2503348c
+22 -16
View File
@@ -10,6 +10,10 @@
reaction: string,
) => Promise<void>)
| undefined;
function authorsToTooltip(authors: Comment["reactions"][0]["authors"]) {
return authors.map(a => a.alias ?? a.id).join("\n");
}
</script>
<style>
@@ -28,23 +32,25 @@
<div class="reactions">
{#each reactions as { emoji, authors }}
{#if handleReaction}
<IconButton
on:click={async () => {
if (handleReaction) {
await handleReaction(authors, emoji);
}
}}>
<div class="reaction txt-tiny">
<div title={authorsToTooltip(authors)}>
{#if handleReaction}
<IconButton
on:click={async () => {
if (handleReaction) {
await handleReaction(authors, emoji);
}
}}>
<div class="reaction txt-tiny">
<span>{emoji}</span>
<span>{authors.length}</span>
</div>
</IconButton>
{:else}
<div class="reaction txt-tiny" style="padding: 2px 4px;">
<span>{emoji}</span>
<span title={authors.join("\n")}>{authors.length}</span>
<span>{authors.length}</span>
</div>
</IconButton>
{:else}
<div class="reaction txt-tiny" style="padding: 2px 4px;">
<span>{emoji}</span>
<span title={authors.join("\n")}>{authors.length}</span>
</div>
{/if}
{/if}
</div>
{/each}
</div>