feat: Add pagination to inbox page

This commit is contained in:
Xyphyn committed 2023-07-27 12:30:09 -07:00
1 parent c0aaf08a9f
commit 81270b72d3
4 files changed
+31 -24

No files matched your search

+14 -3
View File
@@ -5,9 +5,9 @@ import type {
PostView,
} from 'lemmy-js-client'
export function getItemPublished(
item: PostView | CommentView | PersonView | CommunityView
) {
type Result = PostView | CommentView | PersonView | CommunityView
export function getItemPublished(item: Result) {
if ('comment' in item) {
return item.comment.published
} else if ('post' in item) {
@@ -24,3 +24,14 @@ export function getItemPublished(
return ''
}
export const isPost = (item: Result): item is PostView =>
'post' in item && !('comment' in item)
export const isComment = (item: Result): item is CommentView =>
'comment' in item
export const isCommunity = (item: Result): item is CommunityView =>
'community' in item
export const isUser = (item: Result): item is PersonView => 'person' in item