feat: hide scores if 'show scores' is disabled in profile

This commit is contained in:
Xylight committed 2024-09-05 17:43:44 -07:00
1 parent 683523d32c
commit f562c54efa
3 files changed
+32 -28

No files matched your search

@@ -126,6 +126,8 @@
bind:score={post.counts.score}
bind:upvotes={post.counts.upvotes}
bind:downvotes={post.counts.downvotes}
showCounts={$profile?.user?.local_user_view?.local_user?.show_scores ??
true}
/>
<Button
+30 -24
View File
@@ -35,6 +35,8 @@
export let upvotes: number = 0
export let downvotes: number = 0
export let showCounts: boolean = true
let loading = false
let oldScore = score
@@ -77,18 +79,20 @@
aria-label={$t('post.actions.vote.upvote')}
>
<Icon src={ChevronUp} size="20" micro />
<span class="grid text-sm">
{#key upvotes}
<span
style="grid-column: 1; grid-row: 1;"
in:fly={{ duration: 400, y: -10, easing: backOut }}
out:fly={{ duration: 400, y: 10, easing: backOut }}
aria-label={$t('aria.vote.upvotes', { default: upvotes })}
>
<FormattedNumber number={upvotes} />
</span>
{/key}
</span>
{#if showCounts}
<span class="grid text-sm">
{#key upvotes}
<span
style="grid-column: 1; grid-row: 1;"
in:fly={{ duration: 400, y: -10, easing: backOut }}
out:fly={{ duration: 400, y: 10, easing: backOut }}
aria-label={$t('aria.vote.upvotes', { default: upvotes })}
>
<FormattedNumber number={upvotes} />
</span>
{/key}
</span>
{/if}
</button>
{#if $site?.site_view.local_site.enable_downvotes ?? true}
<button
@@ -101,18 +105,20 @@
aria-label={$t('post.actions.vote.downvote')}
>
<Icon src={ChevronDown} size="20" micro />
<span class="grid text-sm">
{#key downvotes}
<span
style="grid-column: 1; grid-row: 1;"
in:fly={{ duration: 400, y: -10, easing: backOut }}
out:fly={{ duration: 400, y: 10, easing: backOut }}
aria-label={$t('aria.vote.downvotes', { default: downvotes })}
>
<FormattedNumber number={downvotes} />
</span>
{/key}
</span>
{#if showCounts}
<span class="grid text-sm">
{#key downvotes}
<span
style="grid-column: 1; grid-row: 1;"
in:fly={{ duration: 400, y: -10, easing: backOut }}
out:fly={{ duration: 400, y: 10, easing: backOut }}
aria-label={$t('aria.vote.downvotes', { default: downvotes })}
>
<FormattedNumber number={downvotes} />
</span>
{/key}
</span>
{/if}
</button>
{/if}
</div>
-4
View File
@@ -1,9 +1,5 @@
import { profile } from '$lib/auth.js'
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
import { getClient } from '$lib/lemmy.js'
import { userSettings } from '$lib/settings.js'
import type { ListingType, SortType } from 'lemmy-js-client'
import { get } from 'svelte/store'
export async function load(req: any) {
const community = await getClient(undefined, req.fetch).getCommunity({