import {memo} from 'react' import {View} from 'react-native' import {Plural, Trans, useLingui} from '@lingui/react/macro' import { type PostThreadParams, type ThreadItem, } from '#/state/queries/usePostThread' import {useContinueReaderThread} from '#/state/queries/usePostThread/useContinueReaderThread' import { LINEAR_AVI_WIDTH, READER_LINE_INDENT, READER_SEAM_HEIGHT, REPLY_LINE_WIDTH, TREE_AVI_WIDTH, TREE_INDENT, } from '#/screens/PostThread/const' import {atoms as a, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' import {CirclePlus_Stroke2_Corner0_Rounded as CirclePlus} from '#/components/icons/CirclePlus' import {Link} from '#/components/Link' import {Text} from '#/components/Typography' /** Align the continuation button with the reader content. */ const READER_BUTTON_INSET = 14 export const ThreadItemReadMore = memo(function ThreadItemReadMore({ item, view, }: { item: Extract view: PostThreadParams['view'] | 'reader' }) { const t = useTheme() const {t: l} = useLingui() const isTreeView = view === 'tree' const isReader = view === 'reader' const indent = Math.max(0, item.depth - 1) const spacers = isTreeView ? Array.from(Array(indent)).map((_, n: number) => { const isSkipped = item.skippedIndentIndices.has(n) return ( ) }) : null if (isReader) { return ( ) } return ( {spacers} {({hovered, pressed}) => { const interacted = hovered || pressed return ( <> Read{' '} ) }} ) }) /** Keeps long-thread continuation in the current reader instead of navigating. */ function ReaderContinueButton() { const {t: l} = useLingui() const continuation = useContinueReaderThread() if (continuation.isSuccess && !continuation.data) { return ( No more posts in this thread. Open replies to see other responses. ) } return ( ) }