diff --git a/src/screens/PostThread/components/ReadMore.tsx b/src/screens/PostThread/components/ReadMore.tsx index 6171776d86..3e9688f779 100644 --- a/src/screens/PostThread/components/ReadMore.tsx +++ b/src/screens/PostThread/components/ReadMore.tsx @@ -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 + item: Extract view: PostThreadParams['view'] }) { const t = useTheme() diff --git a/src/screens/PostThread/components/ThreadAnchor.tsx b/src/screens/PostThread/components/ThreadAnchor.tsx index 2433e6897f..096c0d0dbe 100644 --- a/src/screens/PostThread/components/ThreadAnchor.tsx +++ b/src/screens/PostThread/components/ThreadAnchor.tsx @@ -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 + item: Extract onPostSuccess?: (data: OnPostSuccessData) => void threadgateRecord?: AppBskyFeedThreadgate.Record }) { @@ -109,7 +109,7 @@ let PostThreadItemLoaded = ({ onPostSuccess, threadgateRecord, }: { - item: Extract + item: Extract postShadow: Shadow onPostSuccess?: (data: OnPostSuccessData) => void threadgateRecord?: AppBskyFeedThreadgate.Record @@ -396,7 +396,7 @@ function ExpandedPostDetails({ post, isThreadAuthor, }: { - post: Extract['value']['post'] + post: Extract['value']['post'] isThreadAuthor: boolean }) { const t = useTheme() diff --git a/src/screens/PostThread/components/ThreadPost.tsx b/src/screens/PostThread/components/ThreadPost.tsx index 9f77a4f750..e43964bd69 100644 --- a/src/screens/PostThread/components/ThreadPost.tsx +++ b/src/screens/PostThread/components/ThreadPost.tsx @@ -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 + item: Extract overrides?: { moderation?: boolean topBorder?: boolean @@ -106,7 +106,7 @@ const ThreadPostInner = memo(function ThreadPostInner({ onPostSuccess, threadgateRecord, }: { - item: Extract + item: Extract postShadow: Shadow overrides?: { moderation?: boolean diff --git a/src/screens/PostThread/components/ThreadReply.tsx b/src/screens/PostThread/components/ThreadReply.tsx index 993282e868..27717ec1f5 100644 --- a/src/screens/PostThread/components/ThreadReply.tsx +++ b/src/screens/PostThread/components/ThreadReply.tsx @@ -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 + item: Extract overrides?: { moderation?: boolean topBorder?: boolean @@ -110,7 +110,7 @@ const ThreadReplyInner = memo(function ThreadReplyInner({ onPostSuccess, threadgateRecord, }: { - item: Extract + item: Extract postShadow: Shadow overrides?: { moderation?: boolean diff --git a/src/screens/PostThread/index.tsx b/src/screens/PostThread/index.tsx index b78e5e7387..20e40d7c57 100644 --- a/src/screens/PostThread/index.tsx +++ b/src/screens/PostThread/index.tsx @@ -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 } -const keyExtractor = (item: Slice) => { +const keyExtractor = (item: ThreadItem) => { return item.key } diff --git a/src/state/queries/usePostThread/traversal.ts b/src/state/queries/usePostThread/traversal.ts index 93adccae44..65895e0ba1 100644 --- a/src/state/queries/usePostThread/traversal.ts +++ b/src/state/queries/usePostThread/traversal.ts @@ -7,7 +7,7 @@ import { import { HiddenReplyKind, type PostThreadParams, - type Slice, + type ThreadItem, type TraversalMetadata, } from '#/state/queries/usePostThread/types' import { @@ -36,9 +36,9 @@ export function traverse( view: PostThreadParams['view'] }, ) { - const items: Slice[] = [] - const hidden: Slice[] = [] - const muted: Slice[] = [] + const items: ThreadItem[] = [] + const hidden: ThreadItem[] = [] + const muted: ThreadItem[] = [] const metadatas = new Map() traversal: for (let i = 0; i < thread.length; i++) { diff --git a/src/state/queries/usePostThread/types.ts b/src/state/queries/usePostThread/types.ts index b4ed439a96..59772432ba 100644 --- a/src/state/queries/usePostThread/types.ts +++ b/src/state/queries/usePostThread/types.ts @@ -32,7 +32,7 @@ export enum HiddenReplyKind { Muted = 'muted', } -export type Slice = +export type ThreadItem = | { type: 'threadPost' key: string diff --git a/src/state/queries/usePostThread/utils.ts b/src/state/queries/usePostThread/utils.ts index eaea6a5993..2a0884e2eb 100644 --- a/src/state/queries/usePostThread/utils.ts +++ b/src/state/queries/usePostThread/utils.ts @@ -7,7 +7,7 @@ import { } from '@atproto/api' import { - type Slice, + type ThreadItem, type TraversalMetadata, } from '#/state/queries/usePostThread/types' import * as bsky from '#/types/bsky' @@ -122,7 +122,7 @@ export function getThreadPostUI({ repliesSeenCount, repliesUnhydrated, precedesChildReadMore, -}: TraversalMetadata): Extract['ui'] { +}: TraversalMetadata): Extract['ui'] { // TODO might be able to simplify this const isReplyAndHasReplies = depth > 0 && diff --git a/src/state/queries/usePostThread/views.ts b/src/state/queries/usePostThread/views.ts index e10bd656b3..53734f0b0c 100644 --- a/src/state/queries/usePostThread/views.ts +++ b/src/state/queries/usePostThread/views.ts @@ -10,7 +10,7 @@ import { import {makeProfileLink} from '#/lib/routes/links' import { - type Slice, + type ThreadItem, type TraversalMetadata, } from '#/state/queries/usePostThread/types' @@ -19,7 +19,7 @@ export function threadPostNoUnauthenticated({ depth, value, }: AppBskyUnspeccedGetPostThreadV2.ThreadItem): Extract< - Slice, + ThreadItem, {type: 'threadPostNoUnauthenticated'} > { return { @@ -36,7 +36,7 @@ export function threadPostNotFound({ depth, value, }: AppBskyUnspeccedGetPostThreadV2.ThreadItem): Extract< - Slice, + ThreadItem, {type: 'threadPostNotFound'} > { return { @@ -53,7 +53,7 @@ export function threadPostBlocked({ depth, value, }: AppBskyUnspeccedGetPostThreadV2.ThreadItem): Extract< - Slice, + ThreadItem, {type: 'threadPostBlocked'} > { return { @@ -75,7 +75,7 @@ export function threadPost({ depth: number value: $Typed moderationOpts: ModerationOpts -}): Extract { +}): Extract { return { type: 'threadPost', key: uri, @@ -102,7 +102,7 @@ export function readMore({ repliesUnhydrated, skippedIndentIndices, postData, -}: TraversalMetadata): Extract { +}: TraversalMetadata): Extract { const urip = new AtUri(postData.uri) const href = makeProfileLink( {