Handle read more cases in tree view

This commit is contained in:
Eric Bailey
2025-05-25 14:54:56 -05:00
parent 4c4274ada3
commit 2497099d81
3 changed files with 59 additions and 26 deletions
+18
View File
@@ -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<