feat: add sorts to user pages
This commit is contained in:
1 parent
d427d4b2fc
commit
c0aaf08a9f
12 files changed
+129
-69
No files matched your search
@@ -10,29 +10,12 @@
|
||||
import { authData, getClient, user } from '$lib/lemmy.js'
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { isRead } from '$lib/lemmy/inbox.js'
|
||||
|
||||
export let data: {
|
||||
data: PersonMentionView[] | CommentReplyView[] | PrivateMessageView[]
|
||||
}
|
||||
|
||||
function isRead(
|
||||
item: PersonMentionView | CommentReplyView | PrivateMessageView
|
||||
) {
|
||||
if ('person_mention' in item) {
|
||||
return (item as PersonMentionView).person_mention.read
|
||||
}
|
||||
|
||||
if ('comment_reply' in item) {
|
||||
return (item as CommentReplyView).comment_reply.read
|
||||
}
|
||||
|
||||
if ('private_message' in item) {
|
||||
return (item as PrivateMessageView).private_message.read
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
let markingAsRead = false
|
||||
|
||||
async function markAllAsRead() {
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
overflow-hidden flex flex-row items-center gap-1 {read ? 'opacity-80' : ''}"
|
||||
>
|
||||
<span class="font-bold">
|
||||
{#if item.creator.id == $user?.person.id}
|
||||
{#if item.creator.id == $user?.local_user_view.person.id}
|
||||
You
|
||||
{:else}
|
||||
<UserLink avatar user={item.creator} />
|
||||
@@ -109,7 +109,7 @@
|
||||
</span>
|
||||
<span>messaged</span>
|
||||
<span class="font-bold">
|
||||
{#if item.recipient.id == $user?.person.id}
|
||||
{#if item.recipient.id == $user?.local_user_view.person.id}
|
||||
You
|
||||
{:else}
|
||||
<UserLink avatar user={item.recipient} />
|
||||
@@ -120,7 +120,7 @@
|
||||
<p class="text-sm py-2">
|
||||
<Markdown source={item.private_message.content} />
|
||||
</p>
|
||||
{#if item.recipient.id == $user?.person.id}
|
||||
{#if item.recipient.id == $user?.local_user_view.person.id}
|
||||
<div class="flex flex-row gap-2">
|
||||
<Button color="ghost" on:click={() => (replying = !replying)}>
|
||||
<Icon mini src={ChatBubbleOvalLeft} width={16} />
|
||||
|
||||
Reference in new issue
Block a user