feat: add option to hide read posts
This commit is contained in:
1 parent
8f58a9a181
commit
8a1fe35897
4 files changed
+25
-30
No files matched your search
@@ -1,14 +1,29 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import Button from '$lib/components/input/Button.svelte'
|
||||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||||
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import { userSettings } from '$lib/settings.js'
|
import { userSettings } from '$lib/settings.js'
|
||||||
import type { PostView } from 'lemmy-js-client'
|
import type { PostView } from 'lemmy-js-client'
|
||||||
|
import { ArchiveBox, Icon, Plus } from 'svelte-hero-icons'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
|
|
||||||
export let posts: PostView[]
|
export let posts: PostView[]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#each posts as post, index (post.post.id)}
|
{#if posts.length == 0}
|
||||||
{#if !($userSettings.hidePosts.deleted && post.post.deleted) && !($userSettings.hidePosts.removed && post.post.removed)}
|
<div class="h-full grid place-items-center">
|
||||||
|
<Placeholder>
|
||||||
|
<Icon src={ArchiveBox} size="32" solid slot="icon" />
|
||||||
|
<span slot="title">No posts</span>
|
||||||
|
<Button href="/communities" class="mt-4" slot="action">
|
||||||
|
<Icon src={Plus} size="16" mini slot="icon" />
|
||||||
|
<span>Follow some communities</span>
|
||||||
|
</Button>
|
||||||
|
</Placeholder>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
{#each posts as post, index (post.post.id)}
|
||||||
|
{#if !($userSettings.hidePosts.deleted && post.post.deleted) && !($userSettings.hidePosts.removed && post.post.removed) && !($userSettings.hidePosts.read && post.read)}
|
||||||
<div
|
<div
|
||||||
in:fly={{
|
in:fly={{
|
||||||
y: -8,
|
y: -8,
|
||||||
@@ -20,4 +35,5 @@
|
|||||||
<Post {post} />
|
<Post {post} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
{/if}
|
||||||
+2
-12
@@ -36,7 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<div class="flex flex-row gap-4 w-full">
|
<div class="flex flex-row gap-4 w-full h-full">
|
||||||
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
||||||
<header>
|
<header>
|
||||||
<h1 class="text-3xl font-bold">Frontpage</h1>
|
<h1 class="text-3xl font-bold">Frontpage</h1>
|
||||||
@@ -55,17 +55,7 @@
|
|||||||
/>
|
/>
|
||||||
<Sort selected={data.sort} />
|
<Sort selected={data.sort} />
|
||||||
</div>
|
</div>
|
||||||
<section class="flex flex-col gap-3 sm:gap-4">
|
<section class="flex flex-col gap-3 sm:gap-4 h-full">
|
||||||
{#if data.posts.posts.length == 0}
|
|
||||||
<Placeholder>
|
|
||||||
<Icon src={ArchiveBox} size="32" solid slot="icon" />
|
|
||||||
<span slot="title">No posts</span>
|
|
||||||
<Button href="/communities" class="mt-4" slot="action">
|
|
||||||
<Icon src={Plus} size="16" mini slot="icon" />
|
|
||||||
<span>Follow some communities</span>
|
|
||||||
</Button>
|
|
||||||
</Placeholder>
|
|
||||||
{/if}
|
|
||||||
<PostFeed posts={data.posts.posts} />
|
<PostFeed posts={data.posts.posts} />
|
||||||
</section>
|
</section>
|
||||||
<div class="mt-auto">
|
<div class="mt-auto">
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
import { fullCommunityName, searchParam } from '$lib/util.js'
|
import { fullCommunityName, searchParam } from '$lib/util.js'
|
||||||
import { onDestroy, onMount } from 'svelte'
|
import { onDestroy, onMount } from 'svelte'
|
||||||
import { setSessionStorage } from '$lib/session.js'
|
import { setSessionStorage } from '$lib/session.js'
|
||||||
|
import PostFeed from '$lib/components/lemmy/post/PostFeed.svelte'
|
||||||
|
|
||||||
export let data
|
export let data
|
||||||
|
|
||||||
@@ -77,13 +78,7 @@
|
|||||||
<div class="flex flex-col sm:flex-row gap-4 max-w-full w-full">
|
<div class="flex flex-col sm:flex-row gap-4 max-w-full w-full">
|
||||||
<Sort selected={data.sort} />
|
<Sort selected={data.sort} />
|
||||||
</div>
|
</div>
|
||||||
{#each data.posts.posts as post, index (post.post.id)}
|
<PostFeed posts={data.posts.posts} />
|
||||||
{#if !($userSettings.hidePosts.deleted && post.post.deleted) && !($userSettings.hidePosts.removed && post.post.removed)}
|
|
||||||
<div in:fly={{ y: -8, opacity: 0, delay: index < 4 ? index * 100 : 0 }}>
|
|
||||||
<Post hideCommunity={true} {post} />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/each}
|
|
||||||
<Pageination
|
<Pageination
|
||||||
page={data.page}
|
page={data.page}
|
||||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
import Subscribe from './Subscribe.svelte'
|
import Subscribe from './Subscribe.svelte'
|
||||||
import Button from '$lib/components/input/Button.svelte'
|
import Button from '$lib/components/input/Button.svelte'
|
||||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||||
|
import { searchParam } from '$lib/util.js'
|
||||||
|
|
||||||
export let data
|
export let data
|
||||||
|
|
||||||
@@ -28,14 +29,7 @@
|
|||||||
<MultiSelect
|
<MultiSelect
|
||||||
options={['Subscribed', 'Local', 'All']}
|
options={['Subscribed', 'Local', 'All']}
|
||||||
selected={$page.url.searchParams.get('type') ?? 'All'}
|
selected={$page.url.searchParams.get('type') ?? 'All'}
|
||||||
on:select={(e) => {
|
on:select={(e) => searchParam($page.url, 'type', e.detail, 'page')}
|
||||||
const url = $page.url
|
|
||||||
url.searchParams.set('type', e.detail)
|
|
||||||
url.searchParams.delete('page')
|
|
||||||
goto(url, {
|
|
||||||
invalidateAll: true,
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center">
|
<div class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center">
|
||||||
<TextInput
|
<TextInput
|
||||||
|
|||||||
Reference in new issue
Block a user