Remove PostThreadItem, migrate DebugMod to use new components
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -31,8 +31,11 @@ import {
|
|||||||
groupNotifications,
|
groupNotifications,
|
||||||
shouldFilterNotif,
|
shouldFilterNotif,
|
||||||
} from '#/state/queries/notifications/util'
|
} from '#/state/queries/notifications/util'
|
||||||
|
import {threadPost} from '#/state/queries/usePostThread/views'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {CenteredView, ScrollView} from '#/view/com/util/Views'
|
import {CenteredView, ScrollView} from '#/view/com/util/Views'
|
||||||
|
import {ThreadItemAnchor} from '#/screens/PostThread/components/ThreadItemAnchor'
|
||||||
|
import {ThreadItemPost} from '#/screens/PostThread/components/ThreadItemPost'
|
||||||
import {ProfileHeaderStandard} from '#/screens/Profile/Header/ProfileHeaderStandard'
|
import {ProfileHeaderStandard} from '#/screens/Profile/Header/ProfileHeaderStandard'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
@@ -49,7 +52,6 @@ import * as ProfileCard from '#/components/ProfileCard'
|
|||||||
import {H1, H3, P, Text} from '#/components/Typography'
|
import {H1, H3, P, Text} from '#/components/Typography'
|
||||||
import {ScreenHider} from '../../components/moderation/ScreenHider'
|
import {ScreenHider} from '../../components/moderation/ScreenHider'
|
||||||
import {NotificationFeedItem} from '../com/notifications/NotificationFeedItem'
|
import {NotificationFeedItem} from '../com/notifications/NotificationFeedItem'
|
||||||
import {PostThreadItem} from '../com/post-thread/PostThreadItem'
|
|
||||||
import {PostFeedItem} from '../com/posts/PostFeedItem'
|
import {PostFeedItem} from '../com/posts/PostFeedItem'
|
||||||
|
|
||||||
const LABEL_VALUES: (keyof typeof LABELS)[] = Object.keys(
|
const LABEL_VALUES: (keyof typeof LABELS)[] = Object.keys(
|
||||||
@@ -519,13 +521,13 @@ export const DebugModScreen = ({}: NativeStackScreenProps<
|
|||||||
<MockPostFeedItem post={post} moderation={postModeration} />
|
<MockPostFeedItem post={post} moderation={postModeration} />
|
||||||
|
|
||||||
<Heading title="Post" subtitle="viewed directly" />
|
<Heading title="Post" subtitle="viewed directly" />
|
||||||
<MockPostThreadItem post={post} moderation={postModeration} />
|
<MockPostThreadItemV2 post={post} moderationOpts={modOpts} />
|
||||||
|
|
||||||
<Heading title="Post" subtitle="reply in thread" />
|
<Heading title="Post" subtitle="reply in thread" />
|
||||||
<MockPostThreadItem
|
<MockPostThreadItemV2
|
||||||
post={post}
|
post={post}
|
||||||
moderation={postModeration}
|
moderationOpts={modOpts}
|
||||||
reply
|
isReply
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -835,30 +837,35 @@ function MockPostFeedItem({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function MockPostThreadItem({
|
function MockPostThreadItemV2({
|
||||||
post,
|
post,
|
||||||
moderation,
|
moderationOpts,
|
||||||
reply,
|
isReply,
|
||||||
}: {
|
}: {
|
||||||
post: AppBskyFeedDefs.PostView
|
post: AppBskyFeedDefs.PostView
|
||||||
moderation: ModerationDecision
|
moderationOpts: ModerationOpts
|
||||||
reply?: boolean
|
isReply?: boolean
|
||||||
}) {
|
}) {
|
||||||
return (
|
const thread = threadPost({
|
||||||
<PostThreadItem
|
uri: post.uri,
|
||||||
// @ts-ignore
|
depth: isReply ? 1 : 0,
|
||||||
post={post}
|
value: {
|
||||||
record={post.record as AppBskyFeedPost.Record}
|
$type: 'app.bsky.unspecced.defs#threadItemPost',
|
||||||
moderation={moderation}
|
post,
|
||||||
depth={reply ? 1 : 0}
|
moreParents: false,
|
||||||
isHighlightedPost={!reply}
|
moreReplies: 0,
|
||||||
treeView={false}
|
opThread: false,
|
||||||
prevPost={undefined}
|
hiddenByThreadgate: false,
|
||||||
nextPost={undefined}
|
mutedByViewer: false,
|
||||||
hasPrecedingItem={false}
|
},
|
||||||
overrideBlur={false}
|
moderationOpts,
|
||||||
onPostReply={() => {}}
|
threadgateHiddenReplies: new Set<string>(),
|
||||||
/>
|
})
|
||||||
|
|
||||||
|
return isReply ? (
|
||||||
|
<ThreadItemPost item={thread} />
|
||||||
|
) : (
|
||||||
|
<ThreadItemAnchor item={thread} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user