fix: ssr issues

This commit is contained in:
Xyphyn committed 2023-10-10 17:15:08 -07:00
1 parent e3c7aca8ee
commit 16154bbc23
9 files changed
+146 -146

No files matched your search

+52 -55
View File
@@ -39,63 +39,60 @@
</script>
<slot {vote} {score}>
<Popover openOnHover placement="bottom">
<div
class=" flex items-center text-sm gap-1 rounded-md border border-slate-200
<!-- <Popover openOnHover placement="bottom"> -->
<div
class=" flex items-center text-sm gap-1 rounded-md border border-slate-200
dark:border-zinc-800 bg-white dark:bg-zinc-900 px-1 h-8 cursor-pointer"
slot="target"
>
<Button
aria-label="Upvote"
class={vote == 1
? voteColor(vote)
: 'hover:dark:text-blue-600 hover:text-blue-500'}
on:click={async () => castVote(vote == 1 ? 0 : 1)}
size="square-sm"
color="tertiary"
alignment="center"
>
<Button
aria-label="Upvote"
class={vote == 1
? voteColor(vote)
: 'hover:dark:text-blue-600 hover:text-blue-500'}
on:click={async () => castVote(vote == 1 ? 0 : 1)}
size="square-sm"
color="tertiary"
alignment="center"
>
<Icon src={ChevronUp} mini size="18" />
</Button>
<span
class="font-medium transition-colors duration-200 grid {voteColor(
vote
)}"
class:hidden={$profile?.user?.local_user_view.local_user.show_scores ==
false}
>
{#key score}
<span
in:fly={{ y: score > oldScore ? 4 : -4, duration: 200 }}
out:fly={{ y: score > oldScore ? -4 : 4, duration: 200 }}
style="grid-column: 1; grid-row: 1;"
>
<FormattedNumber number={score} />
</span>
{/key}
</span>
<Button
aria-label="Downvote"
class="{vote == -1 ? voteColor(vote) : ''} {$site?.site_view.local_site
.enable_downvotes
? 'hover:dark:text-red-600 hover:text-red-500'
: 'pointer-events-none opacity-50'}"
on:click={async () => castVote(vote == -1 ? 0 : -1)}
size="square-sm"
color="tertiary"
>
<Icon src={ChevronDown} mini size="18" />
</Button>
<Icon src={ChevronUp} mini size="18" />
</Button>
<span
class="font-medium transition-colors duration-200 grid {voteColor(vote)}"
class:hidden={$profile?.user?.local_user_view.local_user.show_scores ==
false}
>
{#key score}
<span
in:fly={{ y: score > oldScore ? 4 : -4, duration: 200 }}
out:fly={{ y: score > oldScore ? -4 : 4, duration: 200 }}
style="grid-column: 1; grid-row: 1;"
>
<FormattedNumber number={score} />
</span>
{/key}
</span>
<Button
aria-label="Downvote"
class="{vote == -1 ? voteColor(vote) : ''} {$site?.site_view.local_site
.enable_downvotes
? 'hover:dark:text-red-600 hover:text-red-500'
: 'pointer-events-none opacity-50'}"
on:click={async () => castVote(vote == -1 ? 0 : -1)}
size="square-sm"
color="tertiary"
>
<Icon src={ChevronDown} mini size="18" />
</Button>
</div>
<!-- <div class="flex items-center gap-2">
<div class="flex items-center font-medium text-blue-500 gap-0.5">
<Icon src={ArrowUp} mini size="18" title="Upvotes" />
{upvotes}
</div>
<div class="flex items-center gap-2">
<div class="flex items-center font-medium text-blue-500 gap-0.5">
<Icon src={ArrowUp} mini size="18" title="Upvotes" />
{upvotes}
</div>
<div class="flex items-center font-medium text-red-500 gap-0.5">
<Icon src={ArrowDown} mini size="18" title="Downvotes" />
{downvotes}
</div>
<div class="flex items-center font-medium text-red-500 gap-0.5">
<Icon src={ArrowDown} mini size="18" title="Downvotes" />
{downvotes}
</div>
</Popover>
</div> -->
<!-- </Popover> -->
</slot>