feat: add #157
This commit is contained in:
1 parent
1214b35b29
commit
51b6fe1b4d
3 files changed
+15
-2
No files matched your search
@@ -70,6 +70,7 @@ interface Settings {
|
||||
hidePhoton: boolean
|
||||
|
||||
newWidth: boolean
|
||||
markPostsAsRead: boolean
|
||||
}
|
||||
|
||||
export const defaultSettings: Settings = {
|
||||
@@ -116,6 +117,7 @@ export const defaultSettings: Settings = {
|
||||
leftAlign: false,
|
||||
hidePhoton: toBool(env.PUBLIC_REMOVE_CREDIT) ?? false,
|
||||
newWidth: true,
|
||||
markPostsAsRead: true,
|
||||
}
|
||||
|
||||
export const userSettings = writable(defaultSettings)
|
||||
|
||||
@@ -30,16 +30,20 @@
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
|
||||
export let data
|
||||
|
||||
let post = data.post
|
||||
|
||||
onMount(async () => {
|
||||
if (!post.post_view.read && $profile?.jwt) {
|
||||
if (
|
||||
!(post.post_view.read && $userSettings.markPostsAsRead) &&
|
||||
$profile?.jwt
|
||||
) {
|
||||
getClient().markPostAsRead({
|
||||
auth: $profile.jwt,
|
||||
read: true,
|
||||
read: $userSettings.markPostsAsRead,
|
||||
post_id: post.post_view.post.id,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -143,6 +143,13 @@
|
||||
</Setting>
|
||||
|
||||
<SectionTitle class="mt-4" id="posts">Posts</SectionTitle>
|
||||
<Setting>
|
||||
<span slot="title">Mark read posts</span>
|
||||
<span slot="description">Mark a post as read when you click on it.</span>
|
||||
<Checkbox bind:checked={$userSettings.markPostsAsRead}>
|
||||
{$userSettings.markPostsAsRead ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Fade read posts</span>
|
||||
<span slot="description">
|
||||
|
||||
Reference in new issue
Block a user