Rename Slice to ThreadItem
This commit is contained in:
@@ -2,7 +2,10 @@ import {View} from 'react-native'
|
||||
import {msg, Plural, Trans} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
|
||||
import {type PostThreadParams, type Slice} from '#/state/queries/usePostThread'
|
||||
import {
|
||||
type PostThreadParams,
|
||||
type ThreadItem,
|
||||
} from '#/state/queries/usePostThread'
|
||||
import {
|
||||
LINEAR_AVI_WIDTH,
|
||||
REPLY_LINE_WIDTH,
|
||||
@@ -18,7 +21,7 @@ export function ReadMore({
|
||||
item,
|
||||
view,
|
||||
}: {
|
||||
item: Extract<Slice, {type: 'readMore'}>
|
||||
item: Extract<ThreadItem, {type: 'readMore'}>
|
||||
view: PostThreadParams['view']
|
||||
}) {
|
||||
const t = useTheme()
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
} from '#/state/cache/post-shadow'
|
||||
import {useProfileShadow} from '#/state/cache/profile-shadow'
|
||||
import {useLanguagePrefs} from '#/state/preferences'
|
||||
import {type Slice} from '#/state/queries/usePostThread/types'
|
||||
import {type ThreadItem} from '#/state/queries/usePostThread/types'
|
||||
import {useSession} from '#/state/session'
|
||||
import {type OnPostSuccessData} from '#/state/shell/composer'
|
||||
import {useMergedThreadgateHiddenReplies} from '#/state/threadgate-hidden-replies'
|
||||
@@ -60,7 +60,7 @@ export function ThreadAnchor({
|
||||
onPostSuccess,
|
||||
threadgateRecord,
|
||||
}: {
|
||||
item: Extract<Slice, {type: 'threadPost'}>
|
||||
item: Extract<ThreadItem, {type: 'threadPost'}>
|
||||
onPostSuccess?: (data: OnPostSuccessData) => void
|
||||
threadgateRecord?: AppBskyFeedThreadgate.Record
|
||||
}) {
|
||||
@@ -109,7 +109,7 @@ let PostThreadItemLoaded = ({
|
||||
onPostSuccess,
|
||||
threadgateRecord,
|
||||
}: {
|
||||
item: Extract<Slice, {type: 'threadPost'}>
|
||||
item: Extract<ThreadItem, {type: 'threadPost'}>
|
||||
postShadow: Shadow<AppBskyFeedDefs.PostView>
|
||||
onPostSuccess?: (data: OnPostSuccessData) => void
|
||||
threadgateRecord?: AppBskyFeedThreadgate.Record
|
||||
@@ -396,7 +396,7 @@ function ExpandedPostDetails({
|
||||
post,
|
||||
isThreadAuthor,
|
||||
}: {
|
||||
post: Extract<Slice, {type: 'threadPost'}>['value']['post']
|
||||
post: Extract<ThreadItem, {type: 'threadPost'}>['value']['post']
|
||||
isThreadAuthor: boolean
|
||||
}) {
|
||||
const t = useTheme()
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
type Shadow,
|
||||
usePostShadow,
|
||||
} from '#/state/cache/post-shadow'
|
||||
import {type Slice} from '#/state/queries/usePostThread/types'
|
||||
import {type ThreadItem} from '#/state/queries/usePostThread/types'
|
||||
import {useSession} from '#/state/session'
|
||||
import {type OnPostSuccessData} from '#/state/shell/composer'
|
||||
import {useMergedThreadgateHiddenReplies} from '#/state/threadgate-hidden-replies'
|
||||
@@ -51,7 +51,7 @@ export function ThreadPost({
|
||||
onPostSuccess,
|
||||
threadgateRecord,
|
||||
}: {
|
||||
item: Extract<Slice, {type: 'threadPost'}>
|
||||
item: Extract<ThreadItem, {type: 'threadPost'}>
|
||||
overrides?: {
|
||||
moderation?: boolean
|
||||
topBorder?: boolean
|
||||
@@ -106,7 +106,7 @@ const ThreadPostInner = memo(function ThreadPostInner({
|
||||
onPostSuccess,
|
||||
threadgateRecord,
|
||||
}: {
|
||||
item: Extract<Slice, {type: 'threadPost'}>
|
||||
item: Extract<ThreadItem, {type: 'threadPost'}>
|
||||
postShadow: Shadow<AppBskyFeedDefs.PostView>
|
||||
overrides?: {
|
||||
moderation?: boolean
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
type Shadow,
|
||||
usePostShadow,
|
||||
} from '#/state/cache/post-shadow'
|
||||
import {type Slice} from '#/state/queries/usePostThread/types'
|
||||
import {type ThreadItem} from '#/state/queries/usePostThread/types'
|
||||
import {useSession} from '#/state/session'
|
||||
import {type OnPostSuccessData} from '#/state/shell/composer'
|
||||
import {useMergedThreadgateHiddenReplies} from '#/state/threadgate-hidden-replies'
|
||||
@@ -55,7 +55,7 @@ export function ThreadReply({
|
||||
onPostSuccess,
|
||||
threadgateRecord,
|
||||
}: {
|
||||
item: Extract<Slice, {type: 'threadPost'}>
|
||||
item: Extract<ThreadItem, {type: 'threadPost'}>
|
||||
overrides?: {
|
||||
moderation?: boolean
|
||||
topBorder?: boolean
|
||||
@@ -110,7 +110,7 @@ const ThreadReplyInner = memo(function ThreadReplyInner({
|
||||
onPostSuccess,
|
||||
threadgateRecord,
|
||||
}: {
|
||||
item: Extract<Slice, {type: 'threadPost'}>
|
||||
item: Extract<ThreadItem, {type: 'threadPost'}>
|
||||
postShadow: Shadow<AppBskyFeedDefs.PostView>
|
||||
overrides?: {
|
||||
moderation?: boolean
|
||||
|
||||
@@ -11,7 +11,7 @@ import {isNative} from '#/platform/detection'
|
||||
import {useThreadPreferences} from '#/state/queries/preferences/useThreadPreferences'
|
||||
import {
|
||||
HiddenReplyKind,
|
||||
type Slice,
|
||||
type ThreadItem,
|
||||
usePostThread,
|
||||
} from '#/state/queries/usePostThread'
|
||||
import {type OnPostSuccessData} from '#/state/shell/composer'
|
||||
@@ -162,7 +162,7 @@ export function Inner({uri}: {uri: string | undefined}) {
|
||||
}
|
||||
|
||||
const items = useMemo(() => {
|
||||
const results: Slice[] = []
|
||||
const results: ThreadItem[] = []
|
||||
|
||||
if (!data?.items) return results
|
||||
|
||||
@@ -203,7 +203,7 @@ export function Inner({uri}: {uri: string | undefined}) {
|
||||
return results
|
||||
}, [data, deferParents, maxParentCount, maxRepliesCount])
|
||||
|
||||
const renderItem = ({item, index}: {item: Slice; index: number}) => {
|
||||
const renderItem = ({item, index}: {item: ThreadItem; index: number}) => {
|
||||
if (item.type === 'threadPost') {
|
||||
if (item.depth < 0) {
|
||||
if (deferParents) return null
|
||||
@@ -397,6 +397,6 @@ function PostThreadError({error}: {error: Error}) {
|
||||
return <View />
|
||||
}
|
||||
|
||||
const keyExtractor = (item: Slice) => {
|
||||
const keyExtractor = (item: ThreadItem) => {
|
||||
return item.key
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user