diff --git a/src/components/PostControls/ShareMenu/ShareMenuItems.tsx b/src/components/PostControls/ShareMenu/ShareMenuItems.tsx index 3697ffb86..70a63f958 100644 --- a/src/components/PostControls/ShareMenu/ShareMenuItems.tsx +++ b/src/components/PostControls/ShareMenu/ShareMenuItems.tsx @@ -233,16 +233,6 @@ let ShareMenuItems = ({ - - { - copyLinksRef.current = value - }}> - Copy - - + + { + copyLinksRef.current = value + }}> + Copy + + diff --git a/src/components/RichText.tsx b/src/components/RichText.tsx index b4396d1cd..0d6e39261 100644 --- a/src/components/RichText.tsx +++ b/src/components/RichText.tsx @@ -1,4 +1,4 @@ -import {type ReactNode,useMemo} from 'react' +import {useMemo} from 'react' import {type StyleProp, type TextStyle} from 'react-native' import {AppBskyRichtextFacet, RichText as RichTextAPI} from '@atproto/api' @@ -40,13 +40,6 @@ export type RichTextProps = TextStyleProp & * Overrides any `paddingBottom`/`marginBottom` set via `style`. */ suffixOffset?: number - /** - * Rendered inline after the last text segment, so it flows with the final - * line and wraps with the text, e.g. the thread position indicator in the - * post thread's linear view. Must be text-compatible (a string or nested - * ). - */ - trailing?: ReactNode /** * DANGEROUS: Disable facet lexicon validation * @@ -77,7 +70,6 @@ export function RichText({ suffix, suffixOffset = 0, disableMentionFacetValidation, - trailing, }: RichTextProps) { const richText = useMemo(() => { if (value instanceof RichTextAPI) { @@ -114,7 +106,6 @@ export function RichText({ // @ts-ignore web only -prf dataSet={WORD_WRAP}> {text} - {trailing} {suffix ? ' ' : null} {suffix} @@ -132,7 +123,6 @@ export function RichText({ // @ts-ignore web only -prf dataSet={WORD_WRAP}> {text} - {trailing} {suffix ? ' ' : null} {suffix} @@ -221,7 +211,6 @@ export function RichText({ // @ts-ignore web only -prf dataSet={WORD_WRAP}> {els} - {trailing} {suffix ? ' ' : null} {suffix} diff --git a/src/components/forms/TextField.tsx b/src/components/forms/TextField.tsx index e9f671c22..7d1b70e4a 100644 --- a/src/components/forms/TextField.tsx +++ b/src/components/forms/TextField.tsx @@ -162,7 +162,7 @@ export function Root({children, isInvalid = false, style}: RootProps) { a.align_center, a.relative, a.w_full, - a.px_md, + !(hasMultiline && IS_WEB) && a.px_md, // Contain the input's z-index so it cannot paint over nearby overlays. {zIndex: 0}, style, diff --git a/src/screens/PostThread/__tests__/reader.test.ts b/src/screens/PostThread/__tests__/reader.test.ts index 97ad755c5..75c5f5c5a 100644 --- a/src/screens/PostThread/__tests__/reader.test.ts +++ b/src/screens/PostThread/__tests__/reader.test.ts @@ -1,7 +1,6 @@ import {type ThreadItem} from '#/state/queries/usePostThread/types' import { buildReaderThread, - computeSelfThreadPositions, type ReaderSegmentItem, type ThreadPostItem, } from '../reader' @@ -252,169 +251,3 @@ describe('buildReaderThread', () => { expect(items[1]).toBe(anchor) }) }) - -describe('computeSelfThreadPositions', () => { - it('numbers the OP chain from the root', () => { - const root = post({rkey: 'a', depth: 0}) - const one = post({rkey: 'b', depth: 1, opThread: true, isReply: true}) - const two = post({rkey: 'c', depth: 2, opThread: true, isReply: true}) - const positions = computeSelfThreadPositions([root, composer, one, two]) - - expect(positions?.get(root.uri)).toEqual({position: 1, postCount: 3}) - expect(positions?.get(one.uri)).toEqual({position: 2, postCount: 3}) - expect(positions?.get(two.uri)).toEqual({position: 3, postCount: 3}) - }) - - it('numbers across parents when anchored mid-chain', () => { - const root = post({rkey: 'a', depth: -2}) - const parent = post({rkey: 'b', depth: -1, opThread: true, isReply: true}) - const anchor = post({rkey: 'c', depth: 0, opThread: true, isReply: true}) - const below = post({rkey: 'd', depth: 1, opThread: true, isReply: true}) - const positions = computeSelfThreadPositions([root, parent, anchor, below]) - - expect(positions?.get(root.uri)).toEqual({position: 1, postCount: 4}) - expect(positions?.get(anchor.uri)).toEqual({position: 3, postCount: 4}) - expect(positions?.get(below.uri)).toEqual({position: 4, postCount: 4}) - }) - - it('returns undefined when there is no chain', () => { - const root = post({rkey: 'a', depth: 0}) - const reply = post({ - rkey: 'b', - depth: 1, - did: 'did:plc:other', - isReply: true, - }) - - expect(computeSelfThreadPositions([root, reply])).toBeUndefined() - }) - - it('numbers a reply chain by another author', () => { - const root = post({rkey: 'a', depth: 0}) - const replyA = post({ - rkey: 'b', - depth: 1, - did: 'did:plc:other', - isReply: true, - }) - const replyB = post({ - rkey: 'c', - depth: 2, - did: 'did:plc:other', - isReply: true, - }) - const positions = computeSelfThreadPositions([root, replyA, replyB]) - - expect(positions?.get(root.uri)).toBeUndefined() - expect(positions?.get(replyA.uri)).toEqual({position: 1, postCount: 2}) - expect(positions?.get(replyB.uri)).toEqual({position: 2, postCount: 2}) - }) - - it('finds the continuation among non-adjacent siblings of the anchor', () => { - const root = post({rkey: 'a', depth: 0}) - const other = post({ - rkey: 'b', - depth: 1, - did: 'did:plc:other', - isReply: true, - }) - const one = post({rkey: 'c', depth: 1, opThread: true, isReply: true}) - const two = post({rkey: 'd', depth: 2, opThread: true, isReply: true}) - const positions = computeSelfThreadPositions([root, other, one, two]) - - expect(positions?.get(root.uri)).toEqual({position: 1, postCount: 3}) - expect(positions?.get(one.uri)).toEqual({position: 2, postCount: 3}) - expect(positions?.get(two.uri)).toEqual({position: 3, postCount: 3}) - expect(positions?.get(other.uri)).toBeUndefined() - }) - - it('skips chains whose start has no hydrated parent', () => { - const notRoot = post({rkey: 'b', depth: 0, opThread: true, isReply: true}) - const below = post({rkey: 'c', depth: 1, opThread: true, isReply: true}) - - expect(computeSelfThreadPositions([notRoot, below])).toBeUndefined() - }) - - it('skips chains truncated above, without renumbering their tail', () => { - const truncated = post({ - rkey: 'a', - depth: -1, - opThread: true, - isReply: true, - moreParents: true, - }) - const anchor = post({rkey: 'b', depth: 0, opThread: true, isReply: true}) - const below = post({rkey: 'c', depth: 1, opThread: true, isReply: true}) - - expect( - computeSelfThreadPositions([truncated, anchor, below]), - ).toBeUndefined() - }) - - it('skips a non-OP chain cut off by the depth cap', () => { - const root = post({rkey: 'a', depth: 0}) - const replyA = post({ - rkey: 'b', - depth: 1, - did: 'did:plc:other', - isReply: true, - }) - const replyB = post({ - rkey: 'c', - depth: 2, - did: 'did:plc:other', - isReply: true, - moreReplies: 1, - }) - const readMore: ThreadItem = { - type: 'readMore', - key: `readMore:${replyB.uri}`, - depth: 3, - href: '/x', - moreReplies: 1, - skippedIndentIndices: new Set(), - } - const positions = computeSelfThreadPositions([ - root, - replyA, - replyB, - readMore, - ]) - - expect(positions).toBeUndefined() - }) - - it('numbers the OP chain even with a trailing read more', () => { - const root = post({rkey: 'a', depth: 0}) - const one = post({rkey: 'b', depth: 1, opThread: true, isReply: true}) - const two = post({rkey: 'c', depth: 2, opThread: true, isReply: true}) - const readMore: ThreadItem = { - type: 'readMore', - key: `readMore:${two.uri}`, - depth: 3, - href: '/x', - moreReplies: 2, - skippedIndentIndices: new Set(), - } - const positions = computeSelfThreadPositions([root, one, two, readMore]) - - expect(positions?.get(two.uri)).toEqual({position: 3, postCount: 3}) - }) - - it('ends the chain at an interloper and numbers only the prefix', () => { - const root = post({rkey: 'a', depth: 0}) - const one = post({rkey: 'b', depth: 1, opThread: true, isReply: true}) - const interloper = post({ - rkey: 'c', - depth: 2, - did: 'did:plc:other', - opThread: true, - isReply: true, - }) - const positions = computeSelfThreadPositions([root, one, interloper]) - - expect(positions?.get(root.uri)).toEqual({position: 1, postCount: 2}) - expect(positions?.get(one.uri)).toEqual({position: 2, postCount: 2}) - expect(positions?.get(interloper.uri)).toBeUndefined() - }) -}) diff --git a/src/screens/PostThread/components/ThreadItemAnchor.tsx b/src/screens/PostThread/components/ThreadItemAnchor.tsx index 4736e1137..bf22e6eb7 100644 --- a/src/screens/PostThread/components/ThreadItemAnchor.tsx +++ b/src/screens/PostThread/components/ThreadItemAnchor.tsx @@ -39,7 +39,6 @@ import { useRepostsMetricsDisplay, useSavesMetricsDisplay, } from '#/state/preferences/metrics-display-preference' -import {useShowThreadPostIndicators} from '#/state/preferences/show-thread-post-indicators' import {useShowViaClient} from '#/state/preferences/show-via-client' import {type ThreadItem} from '#/state/queries/usePostThread/types' import {useSession} from '#/state/session' @@ -55,7 +54,6 @@ import { ThreadItemPostNumber, useHasThreadItemPostNumber, } from '#/screens/PostThread/components/ThreadItemPostNumber' -import {ThreadPositionChip} from '#/screens/PostThread/components/ThreadPositionChip' import { LINEAR_AVI_WIDTH, OUTER_SPACE, @@ -63,10 +61,7 @@ import { READER_SEAM_HEIGHT, REPLY_LINE_WIDTH, } from '#/screens/PostThread/const' -import { - type ReaderSeam as ReaderSeamData, - type ThreadPostPosition, -} from '#/screens/PostThread/reader' +import {type ReaderSeam as ReaderSeamData} from '#/screens/PostThread/reader' import {atoms as a, tokens, useTheme} from '#/alf' import {Button} from '#/components/Button' import {DebugFieldDisplay} from '#/components/DebugFieldDisplay' @@ -101,7 +96,6 @@ export type ThreadItemAnchorReaderSeam = ReaderSeamData & { export function ThreadItemAnchor({ item, readerSeam, - threadPosition, onPostSuccess, threadgateRecord, postSource, @@ -112,11 +106,6 @@ export function ThreadItemAnchor({ * controls and replies into a seam below the post body. */ readerSeam?: ThreadItemAnchorReaderSeam - /** - * Set in linear view when the anchor is part of a self-thread: renders a - * "(x/n)" position chip at the end of the post text. - */ - threadPosition?: ThreadPostPosition onPostSuccess?: (data: OnPostSuccessData) => void threadgateRecord?: AppBskyFeedThreadgate.Record postSource?: PostSource @@ -135,7 +124,6 @@ export function ThreadItemAnchor({ item={item} isRoot={isRoot} readerSeam={readerSeam} - threadPosition={threadPosition} postShadow={postShadow} onPostSuccess={onPostSuccess} threadgateRecord={threadgateRecord} @@ -231,7 +219,6 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ item, isRoot, readerSeam, - threadPosition, postShadow, onPostSuccess, threadgateRecord, @@ -240,7 +227,6 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ item: Extract isRoot: boolean readerSeam?: ThreadItemAnchorReaderSeam - threadPosition?: ThreadPostPosition postShadow: Shadow onPostSuccess?: (data: OnPostSuccessData) => void threadgateRecord?: AppBskyFeedThreadgate.Record @@ -255,11 +241,6 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ const feedFeedback = useFeedFeedback(postSource?.feedSourceInfo, hasSession) const compactPosts = useCompactPosts() const isCompactPosts = !!compactPosts - const showThreadPostIndicators = useShowThreadPostIndicators() - const resolvedThreadPosition = - showThreadPostIndicators && threadPosition && threadPosition.postCount > 2 - ? threadPosition - : undefined const avatarSize = isCompactPosts ? 34 : 42 const sidePadding = isCompactPosts ? OUTER_SPACE - 2 : OUTER_SPACE @@ -541,13 +522,6 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ style={[a.flex_1, isCompactPosts ? a.text_md : a.text_lg]} authorHandle={post.author.handle} shouldProxyLinks={true} - trailing={ - resolvedThreadPosition ? ( - - ) : undefined - } suffixOffset={POST_NUMBER_INLINE_OFFSET} suffix={ showPostNumber ? ( @@ -555,19 +529,9 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ ) : undefined } /> - ) : resolvedThreadPosition || showPostNumber ? ( - - {resolvedThreadPosition && ( - - )} - - - ) : undefined} + ) : ( + + )} - /** - * Set in linear view when this post is part of a self-thread: renders a - * "(x/n)" position chip at the end of the post text. - */ - threadPosition?: ThreadPostPosition onPostSuccess?: (data: OnPostSuccessData) => void threadgateRecord?: AppBskyFeedThreadgate.Record } @@ -84,7 +76,6 @@ export function ThreadItemPost({ item, overrides, hoverStyle, - threadPosition, onPostSuccess, threadgateRecord, }: ThreadItemPostProps) { @@ -102,7 +93,6 @@ export function ThreadItemPost({ threadgateRecord={threadgateRecord} overrides={overrides} hoverStyle={hoverStyle} - threadPosition={threadPosition} onPostSuccess={onPostSuccess} /> @@ -224,7 +214,6 @@ const ThreadItemPostInner = memo(function ThreadItemPostInner({ postShadow, overrides, hoverStyle, - threadPosition, onPostSuccess, threadgateRecord, }: ThreadItemPostProps & { @@ -234,11 +223,6 @@ const ThreadItemPostInner = memo(function ThreadItemPostInner({ const {openComposer} = useOpenComposer() const {currentAccount} = useSession() const compactPosts = useCompactPosts() - const showThreadPostIndicators = useShowThreadPostIndicators() - const resolvedThreadPosition = - showThreadPostIndicators && threadPosition && threadPosition.postCount > 2 - ? threadPosition - : undefined const avatarSize = compactPosts ? 34 : LINEAR_AVI_WIDTH const post = item.value.post @@ -381,13 +365,6 @@ const ThreadItemPostInner = memo(function ThreadItemPostInner({ numberOfLines={limitLines ? MAX_POST_LINES : undefined} authorHandle={post.author.handle} shouldProxyLinks={true} - trailing={ - resolvedThreadPosition ? ( - - ) : undefined - } suffixOffset={POST_NUMBER_INLINE_OFFSET} suffix={ !limitLines && showPostNumber ? ( @@ -408,16 +385,9 @@ const ThreadItemPostInner = memo(function ThreadItemPostInner({ )} - ) : resolvedThreadPosition || showPostNumber ? ( - - {resolvedThreadPosition && ( - - )} - - - ) : undefined} + ) : ( + + )} {post.embed && ( - {` (${threadPosition.position}/${threadPosition.postCount})`} - - ) -} diff --git a/src/screens/PostThread/index.tsx b/src/screens/PostThread/index.tsx index 8e7eb86b5..2569fc4eb 100644 --- a/src/screens/PostThread/index.tsx +++ b/src/screens/PostThread/index.tsx @@ -64,11 +64,7 @@ import { ThreadItemTreePost, ThreadItemTreePostSkeleton, } from '#/screens/PostThread/components/ThreadItemTreePost' -import { - buildReaderThread, - computeSelfThreadPositions, - type ReaderItem, -} from '#/screens/PostThread/reader' +import {buildReaderThread, type ReaderItem} from '#/screens/PostThread/reader' import { atoms as a, native, @@ -579,16 +575,6 @@ export function PostThread({ }, [thread.state.view, thread.data.items, expandedSeamUri]) const sourceItems = reader?.items ?? thread.data.items - /* - * In linear view, self-thread posts - the OP thread and multi-part replies - * alike - get "(x/n)" position chips at the end of their text. - */ - const threadPositions = useMemo(() => { - return thread.state.view === 'linear' - ? computeSelfThreadPositions(thread.data.items) - : undefined - }, [thread.state.view, thread.data.items]) - /* * Show a floating collapse button when the open seam has replies, so the * user can close them without scrolling back up. @@ -691,7 +677,6 @@ export function PostThread({ overrides={{ topBorder: index === 0, }} - threadPosition={threadPositions?.get(item.uri)} onPostSuccess={optimisticOnPostReply} /> ) @@ -728,7 +713,6 @@ export function PostThread({ } : undefined } - threadPosition={threadPositions?.get(item.uri)} threadgateRecord={thread.data.threadgate?.record ?? undefined} onPostSuccess={optimisticOnPostReply} postSource={anchorPostSource} @@ -755,7 +739,6 @@ export function PostThread({ overrides={{ moderation: thread.state.otherItemsVisible && item.depth > 0, }} - threadPosition={threadPositions?.get(item.uri)} onPostSuccess={optimisticOnPostReply} /> ) @@ -818,7 +801,6 @@ export function PostThread({ [ thread, reader, - threadPositions, toggleSeam, optimisticOnPostReply, onReplyToAnchor, diff --git a/src/screens/PostThread/reader.ts b/src/screens/PostThread/reader.ts index 1497117ba..5f197f20a 100644 --- a/src/screens/PostThread/reader.ts +++ b/src/screens/PostThread/reader.ts @@ -184,142 +184,6 @@ export function buildReaderThread( return {items: result, anchorSeam, expandedSeam} } -export type ThreadPostPosition = { - /** 1-based position in the self-thread, where its first post is 1. */ - position: number - /** Number of posts in the self-thread. */ - postCount: number -} - -/** - * Maps each post of a self-thread - a run of consecutive replies by one - * author, i.e. the OP thread from the root or a multi-part reply - to its - * "(x/n)" position for the linear view's indicator chips. - * - * Chains are only numbered when the numbers can be trusted: - * - * - The start must be verifiably the chain's first post: the thread root, or - * a reply whose parent is hydrated and by another author. Same-author - * forks and posts with unhydrated parents are skipped since their true - * position is unknowable. - * - The OP chain is fetched exhaustively (see `extendSelfThreadChain`), so it is - * always complete. Other chains are cut off by the fetch depth cap, which - * surfaces as a "read more" after the last post - skip those rather than - * show a wrong total. - */ -export function computeSelfThreadPositions( - items: ThreadItem[], -): Map | undefined { - const positions = new Map() - const claimed = new Set() - - for (let i = 0; i < items.length; i++) { - const item = items[i] - if (item.type !== 'threadPost' || claimed.has(item.uri)) continue - if (!isValidChainStart(items, i)) continue - - const {chain, tipIndex} = collectChain(items, i) - for (const post of chain) claimed.add(post.uri) - if (chain.length < 2) continue - - const tip = chain[chain.length - 1] - if (!tip.value.opThread && isCutOffByDepthCap(items, tipIndex)) continue - - for (let k = 0; k < chain.length; k++) { - positions.set(chain[k].uri, { - position: k + 1, - postCount: chain.length, - }) - } - } - - return positions.size ? positions : undefined -} - -/** - * A chain start is trustworthy when it is the thread root, or a reply whose - * parent - the nearest preceding item one level up - is hydrated and by - * another author. A hydrated same-author parent means this post is a fork - * off a chain that was numbered (or skipped) already. - */ -function isValidChainStart(items: ThreadItem[], index: number): boolean { - const item = items[index] as ThreadPostItem - if (!item.value.post.record.reply) return true - const did = item.value.post.author.did - for (let j = index - 1; j >= 0; j--) { - const prev = items[j] - if (prev.type === 'replyComposer') continue - if (!('depth' in prev)) return false - if (prev.depth < item.depth) { - return ( - prev.depth === item.depth - 1 && - prev.type === 'threadPost' && - prev.value.post.author.did !== did - ) - } - } - return false -} - -/** - * Collects the self-thread starting at `startIndex`: repeatedly finds the - * next same-author child. Children are scanned across the parent's whole - * subtree, not just the adjacent item, since the anchor's direct replies are - * all hydrated and the continuation may sort after other replies. - */ -function collectChain( - items: ThreadItem[], - startIndex: number, -): {chain: ThreadPostItem[]; tipIndex: number} { - const start = items[startIndex] as ThreadPostItem - const did = start.value.post.author.did - const chain = [start] - let tipIndex = startIndex - - let next = findChainChild(items, tipIndex, did) - while (next !== -1) { - chain.push(items[next] as ThreadPostItem) - tipIndex = next - next = findChainChild(items, tipIndex, did) - } - return {chain, tipIndex} -} - -function findChainChild( - items: ThreadItem[], - parentIndex: number, - did: string, -): number { - const parent = items[parentIndex] as ThreadPostItem - for (let j = parentIndex + 1; j < items.length; j++) { - const item = items[j] - if (item.type === 'replyComposer') continue - if (!('depth' in item) || item.depth <= parent.depth) break - if ( - item.depth === parent.depth + 1 && - item.type === 'threadPost' && - item.value.post.author.did === did - ) { - return j - } - } - return -1 -} - -/** - * A "read more" immediately after a chain's last post means that post sits - * at the fetch depth cap with nothing of its subtree hydrated - the chain - * may well continue behind it. - */ -function isCutOffByDepthCap(items: ThreadItem[], tipIndex: number): boolean { - for (let j = tipIndex + 1; j < items.length; j++) { - const item = items[j] - if (item.type === 'replyComposer') continue - return item.type === 'readMore' - } - return false -} - function createSeam( post: ThreadPostItem, { diff --git a/src/screens/Settings/RunesSettings/DisplaySettings.tsx b/src/screens/Settings/RunesSettings/DisplaySettings.tsx index 6175ce9d3..a978c0dce 100644 --- a/src/screens/Settings/RunesSettings/DisplaySettings.tsx +++ b/src/screens/Settings/RunesSettings/DisplaySettings.tsx @@ -30,10 +30,6 @@ import { usePostReplacement, useSetPostReplacement, } from '#/state/preferences/post-name-replacement' -import { - useSetShowThreadPostIndicators, - useShowThreadPostIndicators, -} from '#/state/preferences/show-thread-post-indicators' import { useSetShowViaClient, useShowViaClient, @@ -52,7 +48,6 @@ import {Button, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as Toggle from '#/components/forms/Toggle' import {Celebrate_Stroke2_Corner0_Rounded as CelebrateIcon} from '#/components/icons/Celebrate' -import {Hashtag_Stroke2_Corner0_Rounded as HashtagIcon} from '#/components/icons/Hashtag' import {Heart2_Stroke2_Corner0_Rounded as HeartIcon} from '#/components/icons/Heart2' import {Image_Stroke2_Corner0_Rounded as ImageIcon} from '#/components/icons/Image' import {Pencil_Stroke2_Corner0_Rounded as PencilIcon} from '#/components/icons/Pencil' @@ -73,9 +68,6 @@ export function RunesDisplaySettingsScreen() { const showViaClient = useShowViaClient() const setShowViaClient = useSetShowViaClient() - const showThreadPostIndicators = useShowThreadPostIndicators() - const setShowThreadPostIndicators = useSetShowThreadPostIndicators() - const sixSevenCelebration = useSixSevenCelebration() const setSixSevenCelebration = useSetSixSevenCelebration() @@ -117,19 +109,6 @@ export function RunesDisplaySettingsScreen() { subtitleText={} /> - setShowThreadPostIndicators(value)}> - - - - Show thread position indicators - - - - ) { - - - - - - - - - - - - - - - - - - - - - - - - - - { - children - } - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + { + children + } + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/state/preferences/settings-sync.tsx b/src/state/preferences/settings-sync.tsx index f8adbe1d8..09f20ce9e 100644 --- a/src/state/preferences/settings-sync.tsx +++ b/src/state/preferences/settings-sync.tsx @@ -69,7 +69,6 @@ export const SYNCED_PREFS_KEYS = [ 'postsMetricsDisplay', 'showFollowsYouBadge', 'showFollowedByOnOwnProfile', - 'showThreadPostIndicators', 'hideSimilarAccountsRecomm', 'hideScaryFollowButtons', 'showGermDmButton', diff --git a/src/state/preferences/show-thread-post-indicators.tsx b/src/state/preferences/show-thread-post-indicators.tsx deleted file mode 100644 index f39c3c6c9..000000000 --- a/src/state/preferences/show-thread-post-indicators.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { - createContext, - type PropsWithChildren, - useCallback, - useContext, - useEffect, - useState, -} from 'react' - -import * as persisted from '#/state/persisted' - -type StateContext = boolean -type SetContext = (v: boolean) => void - -const stateContext = createContext( - persisted.defaults.showThreadPostIndicators ?? true, -) -const setContext = createContext((_: boolean) => {}) - -export function Provider({children}: PropsWithChildren<{}>) { - const [state, setState] = useState( - persisted.get('showThreadPostIndicators') ?? - persisted.defaults.showThreadPostIndicators ?? - true, - ) - - const setStateWrapped = useCallback((showThreadPostIndicators: boolean) => { - setState(showThreadPostIndicators) - void persisted.write('showThreadPostIndicators', showThreadPostIndicators) - }, []) - - useEffect(() => { - return persisted.onUpdate('showThreadPostIndicators', next => { - setState(next ?? persisted.defaults.showThreadPostIndicators ?? true) - }) - }, []) - - return ( - - - {children} - - - ) -} - -export function useShowThreadPostIndicators() { - return useContext(stateContext) -} - -export function useSetShowThreadPostIndicators() { - return useContext(setContext) -} diff --git a/src/view/com/profile/ProfileMenu.tsx b/src/view/com/profile/ProfileMenu.tsx index c28a9d99d..698393b8d 100644 --- a/src/view/com/profile/ProfileMenu.tsx +++ b/src/view/com/profile/ProfileMenu.tsx @@ -526,18 +526,6 @@ let ProfileMenu = ({ - {!IS_WEB && ( - - { - copyLinksRef.current = value - }}> - Copy - - - )} + {!IS_WEB && ( + + { + copyLinksRef.current = value + }}> + Copy + + + )}