From d42a2808ba53a049fc38f559feeddaa5a335f93f Mon Sep 17 00:00:00 2001 From: "xan.lol" Date: Sat, 25 Apr 2026 03:30:35 -0700 Subject: [PATCH] feat: toggle to hide follow button on posts and scrolled profile header --- .../components/ThreadItemAnchor.tsx | 6 +- .../Profile/Header/ProfileHeaderStandard.tsx | 59 +++++++++--------- .../RunesSettings/UsabilitySettings.tsx | 23 +++++++ src/state/persisted/schema.ts | 2 + .../preferences/hide-scary-follow-buttons.tsx | 54 ++++++++++++++++ src/state/preferences/index.tsx | 61 +++++++++++-------- 6 files changed, 149 insertions(+), 56 deletions(-) create mode 100644 src/state/preferences/hide-scary-follow-buttons.tsx diff --git a/src/screens/PostThread/components/ThreadItemAnchor.tsx b/src/screens/PostThread/components/ThreadItemAnchor.tsx index 21e389404..f568e7e08 100644 --- a/src/screens/PostThread/components/ThreadItemAnchor.tsx +++ b/src/screens/PostThread/components/ThreadItemAnchor.tsx @@ -27,6 +27,7 @@ import {useDisableQuotesMetrics} from '#/state/preferences/disable-quotes-metric import {useDisableRepostsMetrics} from '#/state/preferences/disable-reposts-metrics' import {useDisableSavesMetrics} from '#/state/preferences/disable-saves-metrics' import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons' +import {useHideScaryFollowButtons} from '#/state/preferences/hide-scary-follow-buttons' import {useShowViaClient} from '#/state/preferences/show-via-client' import {type ThreadItem} from '#/state/queries/usePostThread/types' import {useSession} from '#/state/session' @@ -245,8 +246,11 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ const onlyFollowersCanReply = !!threadgateRecord?.allow?.find( rule => rule.$type === 'app.bsky.feed.threadgate#followerRule', ) + const hideScaryFollowButtons = useHideScaryFollowButtons() const showFollowButton = - currentAccount?.did !== post.author.did && !onlyFollowersCanReply + currentAccount?.did !== post.author.did && + !onlyFollowersCanReply && + !hideScaryFollowButtons const viaRepost = useMemo(() => { const reason = postSource?.post.reason diff --git a/src/screens/Profile/Header/ProfileHeaderStandard.tsx b/src/screens/Profile/Header/ProfileHeaderStandard.tsx index 838180e20..9cf15eb49 100644 --- a/src/screens/Profile/Header/ProfileHeaderStandard.tsx +++ b/src/screens/Profile/Header/ProfileHeaderStandard.tsx @@ -22,6 +22,7 @@ import { import {logger} from '#/logger' import {type Shadow, useProfileShadow} from '#/state/cache/profile-shadow' import {useDisableFollowedByMetrics} from '#/state/preferences/disable-followed-by-metrics' +import {useHideScaryFollowButtons} from '#/state/preferences/hide-scary-follow-buttons' import { useProfileBlockMutationQueue, useProfileFollowMutationQueue, @@ -327,6 +328,7 @@ export function HeaderStandardButtons({ const [, queueUnblock] = useProfileBlockMutationQueue(profile) const editProfileControl = useDialogControl() const unblockPromptControl = Prompt.usePromptControl() + const hideScaryFollowButtons = useHideScaryFollowButtons() const isMe = currentAccount?.did === profile.did @@ -458,35 +460,36 @@ export function HeaderStandardButtons({ )} - {(!minimal || !profile.viewer?.following) && ( - - )} + Follow + )} + + + )} ) : null} diff --git a/src/screens/Settings/RunesSettings/UsabilitySettings.tsx b/src/screens/Settings/RunesSettings/UsabilitySettings.tsx index 630aff249..d13ceb022 100644 --- a/src/screens/Settings/RunesSettings/UsabilitySettings.tsx +++ b/src/screens/Settings/RunesSettings/UsabilitySettings.tsx @@ -17,6 +17,10 @@ import { useHideFeedsPromoTab, useSetHideFeedsPromoTab, } from '#/state/preferences/hide-feeds-promo-tab' +import { + useHideScaryFollowButtons, + useSetHideScaryFollowButtons, +} from '#/state/preferences/hide-scary-follow-buttons' import { useHideSimilarAccountsRecomm, useSetHideSimilarAccountsRecomm, @@ -40,6 +44,7 @@ import {Eye_Stroke2_Corner2_Rounded as EyeIcon} from '#/components/icons/Eye' import {EyeSlash_Stroke2_Corner0_Rounded as EyeSlashIcon} from '#/components/icons/EyeSlash' import {PencilLine_Stroke2_Corner2_Rounded as PencilIcon} from '#/components/icons/Pencil' import {PersonGroup_Stroke2_Corner2_Rounded as PersonGroupIcon} from '#/components/icons/Person' +import {PlusLarge_Stroke2_Corner0_Rounded as PlusIcon} from '#/components/icons/Plus' import {Reply as ReplyIcon} from '#/components/icons/Reply' import {RunesScreenLayout} from './components/RunesScreenLayout' @@ -61,6 +66,9 @@ export function RunesUsabilitySettingsScreen() { const hideUnreplyablePosts = useHideUnreplyablePosts() const setHideUnreplyablePosts = useSetHideUnreplyablePosts() + const hideScaryFollowButtons = useHideScaryFollowButtons() + const setHideScaryFollowButtons = useSetHideScaryFollowButtons() + const disableComposerPrompt = useDisableComposerPrompt() const setDisableComposerPrompt = useSetDisableComposerPrompt() @@ -150,6 +158,21 @@ export function RunesUsabilitySettingsScreen() { + setHideScaryFollowButtons(value)}> + + + + + Hide follow button on posts and scrolled profile header + + + + + void + +const stateContext = createContext( + persisted.defaults.hideScaryFollowButtons, +) +const setContext = createContext( + (_: persisted.Schema['hideScaryFollowButtons']) => {}, +) + +export function Provider({children}: PropsWithChildren<{}>) { + const [state, setState] = useState(persisted.get('hideScaryFollowButtons')) + + const setStateWrapped = useCallback( + (hideScaryFollowButtons: persisted.Schema['hideScaryFollowButtons']) => { + setState(hideScaryFollowButtons) + persisted.write('hideScaryFollowButtons', hideScaryFollowButtons) + }, + [setState], + ) + + useEffect(() => { + return persisted.onUpdate('hideScaryFollowButtons', nextValue => { + setState(nextValue) + }) + }, [setStateWrapped]) + + return ( + + + {children} + + + ) +} + +export function useHideScaryFollowButtons() { + return useContext(stateContext) ?? persisted.defaults.hideScaryFollowButtons +} + +export function useSetHideScaryFollowButtons() { + return useContext(setContext) +} diff --git a/src/state/preferences/index.tsx b/src/state/preferences/index.tsx index 690778c91..08d25514d 100644 --- a/src/state/preferences/index.tsx +++ b/src/state/preferences/index.tsx @@ -30,6 +30,7 @@ import {Provider as FaviconServiceProvider} from './favicon-service' import {Provider as GoLinksProvider} from './go-links-enabled' import {Provider as HiddenPostsProvider} from './hidden-posts' import {Provider as HideFeedsPromoTabProvider} from './hide-feeds-promo-tab' +import {Provider as HideScaryFollowButtonsProvider} from './hide-scary-follow-buttons.tsx' import {Provider as HideSimilarAccountsRecommProvider} from './hide-similar-accounts-recommendations' import {Provider as HideUnreplyablePostsProvider} from './hide-unreplyable-posts' import {Provider as HighQualityImagesProvider} from './high-quality-images' @@ -85,6 +86,10 @@ export { useHideFeedsPromoTab, useSetHideFeedsPromoTab, } from './hide-feeds-promo-tab' +export { + useHideScaryFollowButtons, + useSetHideScaryFollowButtons, +} from './hide-scary-follow-buttons' export {useImageCdnHost, useSetImageCdnHost} from './image-cdn-host' export {useLabelDefinitions} from './label-defs' export {useLanguagePrefs, useLanguagePrefsApi} from './languages' @@ -152,33 +157,35 @@ export function Provider({children}: PropsWithChildren<{}>) { - - - - - - - - - - - - - { - children - } - - - - - - - - - - - - + + + + + + + + + + + + + + { + children + } + + + + + + + + + + + + + -- 2.51.2