feat: add ability to mark single item as read
This commit is contained in:
1 parent
7e2561511d
commit
0f315bec01
6 files changed
+153
-93
No files matched your search
@@ -76,7 +76,7 @@
|
||||
<li
|
||||
class="py-2 {node.depth == 0
|
||||
? 'border-b border-slate-200 dark:border-zinc-800'
|
||||
: ''}"
|
||||
: ''} {$$props.class}"
|
||||
id="#{node.comment_view.comment.id.toString()}"
|
||||
>
|
||||
<details bind:open class="flex flex-col gap-1">
|
||||
|
||||
@@ -12,82 +12,93 @@
|
||||
LockClosed,
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import { getInstance } from '$lib/lemmy.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
|
||||
export let community: Community | undefined = undefined
|
||||
export let user: Person | undefined = undefined
|
||||
export let published: Date
|
||||
export let title: string | undefined = undefined
|
||||
export let id: number | undefined = undefined
|
||||
|
||||
// Score
|
||||
export let upvotes: number | undefined = undefined
|
||||
export let downvotes: number | undefined = undefined
|
||||
|
||||
// Badges
|
||||
export let nsfw: boolean
|
||||
export let saved: boolean
|
||||
export let featured: boolean
|
||||
export let deleted: boolean
|
||||
export let nsfw: boolean = false
|
||||
export let saved: boolean = false
|
||||
export let featured: boolean = false
|
||||
export let deleted: boolean = false
|
||||
export let removed: boolean = false
|
||||
export let locked: boolean = false
|
||||
</script>
|
||||
|
||||
<span class="flex flex-row gap-2 text-sm items-center">
|
||||
{#if community}
|
||||
<Avatar url={community.icon} width={24} alt={community.name} />
|
||||
{/if}
|
||||
<div class="flex flex-col text-xs">
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="flex flex-row gap-2 text-sm items-center">
|
||||
{#if community}
|
||||
<CommunityLink {community} />
|
||||
<Avatar url={community.icon} width={24} alt={community.name} />
|
||||
{/if}
|
||||
<span
|
||||
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-1 flex-wrap items-center"
|
||||
>
|
||||
{#if user}
|
||||
<div
|
||||
class="mr-0.5 flex items-center"
|
||||
class:text-slate-900={!community}
|
||||
class:dark:text-zinc-100={!community}
|
||||
>
|
||||
<UserLink avatarSize={20} {user} avatar={!community} />
|
||||
</div>
|
||||
<div class="flex flex-col text-xs">
|
||||
{#if community}
|
||||
<CommunityLink {community} />
|
||||
{/if}
|
||||
<RelativeDate date={published} />
|
||||
{#if upvotes != undefined && downvotes != undefined}
|
||||
<span>•</span>
|
||||
<span>
|
||||
{Math.floor((upvotes / (upvotes + downvotes || 1)) * 100)}%
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-1 flex-wrap items-center"
|
||||
>
|
||||
{#if user}
|
||||
<div
|
||||
class="mr-0.5 flex items-center"
|
||||
class:text-slate-900={!community}
|
||||
class:dark:text-zinc-100={!community}
|
||||
>
|
||||
<UserLink avatarSize={20} {user} avatar={!community} />
|
||||
</div>
|
||||
{/if}
|
||||
<RelativeDate date={published} />
|
||||
{#if upvotes != undefined && downvotes != undefined}
|
||||
<span>•</span>
|
||||
<span>
|
||||
{Math.floor((upvotes / (upvotes + downvotes || 1)) * 100)}%
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row ml-auto gap-2 flex-wrap">
|
||||
{#if nsfw}
|
||||
<Badge class="bg-red-600 text-white">NSFW</Badge>
|
||||
{/if}
|
||||
{#if saved}
|
||||
<Badge class="bg-yellow-500 text-white py-1" label="Saved">
|
||||
<Icon src={Bookmark} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if locked}
|
||||
<Badge class="bg-yellow-400 text-black py-1" label="Locked">
|
||||
<Icon src={LockClosed} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if removed}
|
||||
<Badge class="bg-green-600 text-white py-1" label="Removed">
|
||||
<Icon src={Trash} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if deleted}
|
||||
<Badge class="bg-red-600 text-white py-1" label="Deleted">
|
||||
<Icon src={Trash} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if featured}
|
||||
<Badge class="bg-green-500 text-white py-1" label="Pinned">
|
||||
<Icon src={InformationCircle} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
</div>
|
||||
</span>
|
||||
<div class="flex flex-row ml-auto gap-2 flex-wrap">
|
||||
{#if nsfw}
|
||||
<Badge class="bg-red-600 text-white">NSFW</Badge>
|
||||
{/if}
|
||||
{#if saved}
|
||||
<Badge class="bg-yellow-500 text-white py-1" label="Saved">
|
||||
<Icon src={Bookmark} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if locked}
|
||||
<Badge class="bg-yellow-400 text-black py-1" label="Locked">
|
||||
<Icon src={LockClosed} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if removed}
|
||||
<Badge class="bg-green-600 text-white py-1" label="Removed">
|
||||
<Icon src={Trash} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if deleted}
|
||||
<Badge class="bg-red-600 text-white py-1" label="Deleted">
|
||||
<Icon src={Trash} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if featured}
|
||||
<Badge class="bg-green-500 text-white py-1" label="Pinned">
|
||||
<Icon src={InformationCircle} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
</div>
|
||||
</span>
|
||||
{#if title && id}
|
||||
<a href="/post/{getInstance()}/{id}" class="font-medium">
|
||||
{title}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
Reference in new issue
Block a user