feat: add option to revert post vote design

This commit is contained in:
Xyphyn committed 2023-08-15 16:05:39 -07:00
1 parent c09460bd9b
commit 466b33a583
3 files changed
+63 -26

No files matched your search

+54 -25
View File
@@ -84,31 +84,60 @@
</script> </script>
<slot {upvote} {downvote} {vote} {score}> <slot {upvote} {downvote} {vote} {score}>
<div {#if $userSettings.newVote}
class="flex items-center text-sm gap-1 rounded-md border border-slate-200 <div class="flex items-center text-sm gap-1 rounded-md border-zinc-700">
<Button
aria-label="Upvote"
class={vote == 1 ? voteColor(vote) : ''}
on:click={upvote}
size="square-md"
color="tertiary"
alignment="center"
>
<Icon src={ArrowUpCircle} mini={vote == 1} size="20" />
</Button>
<span class="font-medium {voteColor(vote)}">
<FormattedNumber number={score} />
</span>
<Button
aria-label="Downvote"
class={vote == -1 ? voteColor(vote) : ''}
on:click={downvote}
size="square-md"
color="tertiary"
>
<Icon src={ArrowDownCircle} mini={vote == -1} size="20" />
</Button>
</div>
{:else}
<div
class="flex items-center text-sm gap-1 rounded-md border border-slate-200
dark:border-zinc-700 px-1 h-full duration-200" dark:border-zinc-700 px-1 h-full duration-200"
>
<Button
aria-label="Upvote"
class={vote == 1 ? voteColor(vote) : ''}
on:click={upvote}
size="square-sm"
color="tertiary"
alignment="center"
> >
<Icon src={ChevronUp} mini size="18" /> <Button
</Button> aria-label="Upvote"
<span class="font-medium transition-colors duration-200 {voteColor(vote)}"> class={vote == 1 ? voteColor(vote) : ''}
<FormattedNumber number={score} /> on:click={upvote}
</span> size="square-sm"
<Button color="tertiary"
aria-label="Downvote" alignment="center"
class={vote == -1 ? voteColor(vote) : ''} >
on:click={downvote} <Icon src={ChevronUp} mini size="18" />
size="square-sm" </Button>
color="tertiary" <span
> class="font-medium transition-colors duration-200 {voteColor(vote)}"
<Icon src={ChevronDown} mini size="18" /> >
</Button> <FormattedNumber number={score} />
</div> </span>
<Button
aria-label="Downvote"
class={vote == -1 ? voteColor(vote) : ''}
on:click={downvote}
size="square-sm"
color="tertiary"
>
<Icon src={ChevronDown} mini size="18" />
</Button>
</div>
{/if}
</slot> </slot>
+2
View File
@@ -35,6 +35,7 @@ interface Settings {
moderation: { moderation: {
removalReasonPreset: string removalReasonPreset: string
} }
newVote: boolean
} }
export const defaultSettings: Settings = { export const defaultSettings: Settings = {
@@ -69,6 +70,7 @@ export const defaultSettings: Settings = {
moderation: { moderation: {
removalReasonPreset: `Your submission in *"{{post}}"* was removed for {{reason}}.`, removalReasonPreset: `Your submission in *"{{post}}"* was removed for {{reason}}.`,
}, },
newVote: false,
} }
export const userSettings = writable(defaultSettings) export const userSettings = writable(defaultSettings)
+7 -1
View File
@@ -95,8 +95,8 @@
Show a user's display name instead of their account username. Show a user's display name instead of their account username.
</span> </span>
</Setting> </Setting>
<SectionTitle class="mt-4">UI</SectionTitle>
<SectionTitle class="mt-4">UI</SectionTitle>
<Setting> <Setting>
<Checkbox bind:checked={$userSettings.markReadPosts} slot="title"> <Checkbox bind:checked={$userSettings.markReadPosts} slot="title">
Mark read posts Mark read posts
@@ -125,6 +125,12 @@
</Checkbox> </Checkbox>
<span slot="description">Blur images of NSFW content.</span> <span slot="description">Blur images of NSFW content.</span>
</Setting> </Setting>
<Setting>
<Checkbox bind:checked={$userSettings.newVote} slot="title">
New vote design
</Checkbox>
<span slot="description">Alternate vote design</span>
</Setting>
<SectionTitle class="mt-4">Instances</SectionTitle> <SectionTitle class="mt-4">Instances</SectionTitle>
<Setting> <Setting>