feat: Add option to revert vote colors
This commit is contained in:
1 parent
adc3df0d8f
commit
75671f3fad
7 files changed
+50
-10
No files matched your search
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { authData, getClient } from '$lib/lemmy'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { Color } from '$lib/ui/colors.js'
|
||||
import type { Post } from 'lemmy-js-client'
|
||||
import { ChevronDown, ChevronUp, Icon } from 'svelte-hero-icons'
|
||||
@@ -71,7 +72,8 @@
|
||||
>
|
||||
<button
|
||||
aria-label="Upvote"
|
||||
class:text-orange-500={vote == 1}
|
||||
class:text-orange-500={vote == 1 && $userSettings.revertColors}
|
||||
class:text-blue-500={vote == 1 && !$userSettings.revertColors}
|
||||
class="p-0.5 px-1"
|
||||
on:click={upvote}
|
||||
>
|
||||
@@ -80,7 +82,8 @@
|
||||
<FormattedNumber number={score} />
|
||||
<button
|
||||
aria-label="Downvote"
|
||||
class:text-blue-500={vote == -1}
|
||||
class:text-blue-500={vote == -1 && $userSettings.revertColors}
|
||||
class:text-red-500={vote == -1 && !$userSettings.revertColors}
|
||||
class="p-0.5 px-1"
|
||||
on:click={downvote}
|
||||
>
|
||||
|
||||
@@ -65,7 +65,11 @@
|
||||
>
|
||||
<button
|
||||
on:click={upvote}
|
||||
class="px-1.5 {vote == 1 ? 'text-orange-500' : ''}"
|
||||
class="px-1.5 {vote == 1
|
||||
? $userSettings.revertColors
|
||||
? 'text-orange-500'
|
||||
: 'dark:text-blue-500 text-blue-600'
|
||||
: ''}"
|
||||
aria-label="Upvote"
|
||||
>
|
||||
<Icon src={ChevronUp} width={19} mini />
|
||||
@@ -75,7 +79,11 @@
|
||||
</span>
|
||||
<button
|
||||
on:click={downvote}
|
||||
class="px-1.5 {vote == -1 ? 'text-blue-500' : ''}"
|
||||
class="px-1.5 {vote == -1
|
||||
? $userSettings.revertColors
|
||||
? 'dark:text-blue-500 text-blue-600'
|
||||
: 'text-red-400'
|
||||
: ''}"
|
||||
aria-label="Downvote"
|
||||
>
|
||||
<Icon src={ChevronDown} width={19} mini />
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div
|
||||
class="bg-white border border-slate-200
|
||||
dark:border-zinc-800 dark:bg-zinc-900 break-words
|
||||
flex-col p-1 rounded-lg {clazz}"
|
||||
p-1 rounded-lg {clazz}"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
+2
-1
@@ -1,4 +1,3 @@
|
||||
import { DEFAULT_INSTANCE_URL } from '$lib/lemmy.js'
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
interface Settings {
|
||||
@@ -6,12 +5,14 @@ interface Settings {
|
||||
expandableImages: boolean
|
||||
markReadPosts: boolean
|
||||
instance?: string
|
||||
revertColors: boolean
|
||||
}
|
||||
|
||||
const defaultSettings: Settings = {
|
||||
newComments: true,
|
||||
expandableImages: true,
|
||||
markReadPosts: true,
|
||||
revertColors: false,
|
||||
}
|
||||
|
||||
export const userSettings = writable(defaultSettings)
|
||||
|
||||
@@ -124,3 +124,20 @@
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
<div class="mt-2 w-full">
|
||||
<Button
|
||||
on:click={() => {
|
||||
$page.url.searchParams.set(
|
||||
'page',
|
||||
((Number($page.url.searchParams.get('page')) || 1) + 1).toString()
|
||||
)
|
||||
|
||||
goto($page.url.toString(), {
|
||||
invalidateAll: true,
|
||||
})
|
||||
}}
|
||||
>
|
||||
Next
|
||||
</Button>
|
||||
</div>
|
||||
@@ -3,7 +3,7 @@ import type { ListingType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export function load({ url }) {
|
||||
const type = url.searchParams.get('listingType') as ListingType
|
||||
const type = url.searchParams.get('type') as ListingType
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
const query = url.searchParams.get('q')
|
||||
|
||||
|
||||
@@ -43,9 +43,10 @@
|
||||
<title>Settings</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="flex flex-col">
|
||||
<h1 class="text-3xl font-bold">Settings</h1>
|
||||
<Card class="flex flex-col gap-3 p-6 text-sm">
|
||||
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">General</h2>
|
||||
<Card class="flex flex-col gap-3 p-6 text-sm my-2">
|
||||
<h1 class="font-bold">Instance</h1>
|
||||
<p>Changing this will log you out.</p>
|
||||
<div class="flex gap-2">
|
||||
@@ -67,9 +68,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<Card class="flex flex-col gap-3 p-6 text-sm">
|
||||
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">UI</h2>
|
||||
<Card class="flex flex-col gap-3 p-6 text-sm my-2">
|
||||
<h1 class="font-bold">Mark read posts</h1>
|
||||
<p>Fade the title of posts you've already read.</p>
|
||||
<Switch bind:enabled={$userSettings.markReadPosts} />
|
||||
</Card>
|
||||
<Card class="flex flex-col gap-3 p-6 text-sm my-2">
|
||||
<h1 class="font-bold">Revert vote colors</h1>
|
||||
<p>Make upvotes orange and downvotes blue, like Reddit used to do.</p>
|
||||
<Switch bind:enabled={$userSettings.revertColors} />
|
||||
</Card>
|
||||
<Card class="flex flex-col gap-3 p-6 text-sm my-2">
|
||||
<h1 class="font-bold">New comment design</h1>
|
||||
<Switch bind:enabled={$userSettings.newComments} />
|
||||
</Card>
|
||||
</div>
|
||||
Reference in new issue
Block a user