Handle read more cases in tree view
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
type AppBskyFeedDefs,
|
||||
type AppBskyFeedPost,
|
||||
type AppBskyUnspeccedGetPostThreadV2,
|
||||
AtUri,
|
||||
moderatePost,
|
||||
type ModerationOpts,
|
||||
} from '@atproto/api'
|
||||
@@ -99,6 +100,23 @@ export function threadPost({
|
||||
}
|
||||
}
|
||||
|
||||
export function readMore({
|
||||
item,
|
||||
parent,
|
||||
}: {
|
||||
item: Extract<Slice, {type: 'threadPost'}>
|
||||
parent: Extract<Slice, {type: 'threadPost'}>
|
||||
}) {
|
||||
return {
|
||||
type: 'readMore' as const,
|
||||
key: `readMore:${parent.uri}`,
|
||||
indent: parent.depth + (item.depth < parent.depth ? -1 : 0),
|
||||
replyCount: parent.value.moreReplies,
|
||||
nextAnchor: parent,
|
||||
nextAnchorUri: new AtUri(parent.uri),
|
||||
}
|
||||
}
|
||||
|
||||
export function postViewToThreadPlaceholder(
|
||||
post: AppBskyFeedDefs.PostView,
|
||||
): $Typed<
|
||||
|
||||
Reference in New Issue
Block a user