diff --git a/src/components/PostControls/PostControlButton.tsx b/src/components/PostControls/PostControlButton.tsx index 200edaa563..1585d429d2 100644 --- a/src/components/PostControls/PostControlButton.tsx +++ b/src/components/PostControls/PostControlButton.tsx @@ -1,4 +1,4 @@ -import React, {useContext, useMemo} from 'react' +import {createContext, useContext, useMemo} from 'react' import {type GestureResponderEvent, type View} from 'react-native' import {POST_CTRL_HITSLOP} from '#/lib/constants' @@ -8,95 +8,96 @@ import {Button, type ButtonProps} from '#/components/Button' import {type Props as SVGIconProps} from '#/components/icons/common' import {Text, type TextProps} from '#/components/Typography' -const PostControlContext = React.createContext<{ +const PostControlContext = createContext<{ big?: boolean active?: boolean color?: {color: string} }>({}) // Base button style, which the the other ones extend -export const PostControlButton = React.forwardRef< - View, - ButtonProps & { - active?: boolean - big?: boolean - color?: string - activeColor?: string - } ->( - ( - {onPress, onLongPress, children, big, active, activeColor, ...props}, - ref, - ) => { - const t = useTheme() - const playHaptic = useHaptics() +export function PostControlButton({ + ref, + onPress, + onLongPress, + children, + big, + active, + activeColor, + ...props +}: ButtonProps & { + ref?: React.Ref + active?: boolean + big?: boolean + color?: string + activeColor?: string +}) { + const t = useTheme() + const playHaptic = useHaptics() - const ctx = React.useMemo( - () => ({ - big, - active, - color: { - color: activeColor && active ? activeColor : t.palette.contrast_500, - }, - }), - [big, active, activeColor, t.palette.contrast_500], - ) + const ctx = useMemo( + () => ({ + big, + active, + color: { + color: activeColor && active ? activeColor : t.palette.contrast_500, + }, + }), + [big, active, activeColor, t.palette.contrast_500], + ) - const style = useMemo( - () => [ - a.flex_row, - a.align_center, - a.gap_xs, - a.bg_transparent, - {padding: 5}, - ], - [], - ) + const style = useMemo( + () => [ + a.flex_row, + a.align_center, + a.gap_xs, + a.bg_transparent, + {padding: 5}, + ], + [], + ) - const handlePress = useMemo(() => { - if (!onPress) return - return (evt: GestureResponderEvent) => { - playHaptic('Light') - onPress(evt) - } - }, [onPress, playHaptic]) + const handlePress = useMemo(() => { + if (!onPress) return + return (evt: GestureResponderEvent) => { + playHaptic('Light') + onPress(evt) + } + }, [onPress, playHaptic]) - const handleLongPress = useMemo(() => { - if (!onLongPress) return - return (evt: GestureResponderEvent) => { - playHaptic('Heavy') - onLongPress(evt) - } - }, [onLongPress, playHaptic]) + const handleLongPress = useMemo(() => { + if (!onLongPress) return + return (evt: GestureResponderEvent) => { + playHaptic('Heavy') + onLongPress(evt) + } + }, [onLongPress, playHaptic]) - return ( - - ) - }, -) -PostControlButton.displayName = 'PostControlButton' + ) + ) : ( + + {children} + + )} + + ) +} export function PostControlButtonIcon({ icon: Comp, diff --git a/src/components/PostControls/PostMenu/PostMenuItems.tsx b/src/components/PostControls/PostMenu/PostMenuItems.tsx index 979d7a4a06..51991589fd 100644 --- a/src/components/PostControls/PostMenu/PostMenuItems.tsx +++ b/src/components/PostControls/PostMenu/PostMenuItems.tsx @@ -26,7 +26,6 @@ import { type CommonNavigatorParams, type NavigationProp, } from '#/lib/routes/types' -import {shareText} from '#/lib/sharing' import {logEvent} from '#/lib/statsig/statsig' import {richTextToString} from '#/lib/strings/rich-text-helpers' import {toShareUrl} from '#/lib/strings/url-helpers' @@ -58,7 +57,6 @@ import { PostInteractionSettingsDialog, usePrefetchPostInteractionSettings, } from '#/components/dialogs/PostInteractionSettingsDialog' -import {ArrowOutOfBox_Stroke2_Corner0_Rounded as Share} from '#/components/icons/ArrowOutOfBox' import {Atom_Stroke2_Corner0_Rounded as AtomIcon} from '#/components/icons/Atom' import {BubbleQuestion_Stroke2_Corner0_Rounded as Translate} from '#/components/icons/Bubble' import {Clipboard_Stroke2_Corner2_Rounded as ClipboardIcon} from '#/components/icons/Clipboard' @@ -85,7 +83,6 @@ import { useReportDialogControl, } from '#/components/moderation/ReportDialog' import * as Prompt from '#/components/Prompt' -import {useDevMode} from '#/storage/hooks/dev-mode' import * as bsky from '#/types/bsky' let PostMenuItems = ({ @@ -131,7 +128,6 @@ let PostMenuItems = ({ const hideReplyConfirmControl = useDialogControl() const {mutateAsync: toggleReplyVisibility} = useToggleReplyVisibilityMutation() - const [devModeEnabled] = useDevMode() const postUri = post.uri const postCid = post.cid @@ -390,14 +386,6 @@ let PostMenuItems = ({ } } - const onShareATURI = () => { - shareText(postUri) - } - - const onShareAuthorDID = () => { - shareText(postAuthor.did) - } - const onReportMisclassification = () => { const url = `https://docs.google.com/forms/d/e/1FAIpQLSd0QPqhNFksDQf1YyOos7r1ofCLvmrKAH1lU042TaS3GAZaWQ/viewform?entry.1756031717=${toShareUrl( href, @@ -485,11 +473,9 @@ let PostMenuItems = ({ DISCOVER_DEBUG_DIDS[currentAccount?.did ?? ''] && ( - - {_(msg`Assign topic - help train Discover!`)} - + {_(msg`Assign topic for algo`)} )} @@ -682,28 +668,6 @@ let PostMenuItems = ({ )} - - {devModeEnabled ? ( - <> - - - - {_(msg`Copy post at:// URI`)} - - - - {_(msg`Copy author DID`)} - - - - - ) : null} )}