This reverts commit e9fe8d90ef.
This commit is contained in:
@@ -102,77 +102,12 @@ let PostDropdownBtn = ({
|
|||||||
timestamp: string
|
timestamp: string
|
||||||
threadgateRecord?: AppBskyFeedThreadgate.Record
|
threadgateRecord?: AppBskyFeedThreadgate.Record
|
||||||
}): React.ReactNode => {
|
}): React.ReactNode => {
|
||||||
|
const {hasSession, currentAccount} = useSession()
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
const alf = useAlf()
|
const alf = useAlf()
|
||||||
const {_} = useLingui()
|
|
||||||
const defaultCtrlColor = theme.palette.default.postCtrl
|
|
||||||
return (
|
|
||||||
<EventStopper onKeyDown={false}>
|
|
||||||
<Menu.Root>
|
|
||||||
<Menu.Trigger label={_(msg`Open post options menu`)}>
|
|
||||||
{({props, state}) => {
|
|
||||||
return (
|
|
||||||
<Pressable
|
|
||||||
{...props}
|
|
||||||
hitSlop={hitSlop}
|
|
||||||
testID={testID}
|
|
||||||
style={[
|
|
||||||
style,
|
|
||||||
a.rounded_full,
|
|
||||||
(state.hovered || state.pressed) && [
|
|
||||||
alf.atoms.bg_contrast_25,
|
|
||||||
],
|
|
||||||
]}>
|
|
||||||
<DotsHorizontal
|
|
||||||
fill={defaultCtrlColor}
|
|
||||||
style={{pointerEvents: 'none'}}
|
|
||||||
size={size}
|
|
||||||
/>
|
|
||||||
</Pressable>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</Menu.Trigger>
|
|
||||||
<Menu.Outer>
|
|
||||||
<PostDropdownMenuItems
|
|
||||||
testID={testID}
|
|
||||||
post={post}
|
|
||||||
postFeedContext={postFeedContext}
|
|
||||||
record={record}
|
|
||||||
richText={richText}
|
|
||||||
timestamp={timestamp}
|
|
||||||
threadgateRecord={threadgateRecord}
|
|
||||||
/>
|
|
||||||
</Menu.Outer>
|
|
||||||
</Menu.Root>
|
|
||||||
</EventStopper>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
PostDropdownBtn = memo(PostDropdownBtn)
|
|
||||||
export {PostDropdownBtn}
|
|
||||||
|
|
||||||
let PostDropdownMenuItems = ({
|
|
||||||
post,
|
|
||||||
postFeedContext,
|
|
||||||
record,
|
|
||||||
richText,
|
|
||||||
timestamp,
|
|
||||||
threadgateRecord,
|
|
||||||
}: {
|
|
||||||
testID: string
|
|
||||||
post: Shadow<AppBskyFeedDefs.PostView>
|
|
||||||
postFeedContext: string | undefined
|
|
||||||
record: AppBskyFeedPost.Record
|
|
||||||
richText: RichTextAPI
|
|
||||||
style?: StyleProp<ViewStyle>
|
|
||||||
hitSlop?: PressableProps['hitSlop']
|
|
||||||
size?: 'lg' | 'md' | 'sm'
|
|
||||||
timestamp: string
|
|
||||||
threadgateRecord?: AppBskyFeedThreadgate.Record
|
|
||||||
}): React.ReactNode => {
|
|
||||||
const {hasSession, currentAccount} = useSession()
|
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
const defaultCtrlColor = theme.palette.default.postCtrl
|
||||||
const langPrefs = useLanguagePrefs()
|
const langPrefs = useLanguagePrefs()
|
||||||
const {mutateAsync: deletePostMutate} = usePostDeleteMutation()
|
const {mutateAsync: deletePostMutate} = usePostDeleteMutation()
|
||||||
const {mutateAsync: pinPostMutate, isPending: isPinPending} =
|
const {mutateAsync: pinPostMutate, isPending: isPinPending} =
|
||||||
@@ -425,7 +360,33 @@ let PostDropdownMenuItems = ({
|
|||||||
}, [isPinned, pinPostMutate, postCid, postUri])
|
}, [isPinned, pinPostMutate, postCid, postUri])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<EventStopper onKeyDown={false}>
|
||||||
|
<Menu.Root>
|
||||||
|
<Menu.Trigger label={_(msg`Open post options menu`)}>
|
||||||
|
{({props, state}) => {
|
||||||
|
return (
|
||||||
|
<Pressable
|
||||||
|
{...props}
|
||||||
|
hitSlop={hitSlop}
|
||||||
|
testID={testID}
|
||||||
|
style={[
|
||||||
|
style,
|
||||||
|
a.rounded_full,
|
||||||
|
(state.hovered || state.pressed) && [
|
||||||
|
alf.atoms.bg_contrast_25,
|
||||||
|
],
|
||||||
|
]}>
|
||||||
|
<DotsHorizontal
|
||||||
|
fill={defaultCtrlColor}
|
||||||
|
style={{pointerEvents: 'none'}}
|
||||||
|
size={size}
|
||||||
|
/>
|
||||||
|
</Pressable>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</Menu.Trigger>
|
||||||
|
|
||||||
|
<Menu.Outer>
|
||||||
{isAuthor && (
|
{isAuthor && (
|
||||||
<>
|
<>
|
||||||
<Menu.Group>
|
<Menu.Group>
|
||||||
@@ -547,7 +508,9 @@ let PostDropdownMenuItems = ({
|
|||||||
}
|
}
|
||||||
onPress={onToggleThreadMute}>
|
onPress={onToggleThreadMute}>
|
||||||
<Menu.ItemText>
|
<Menu.ItemText>
|
||||||
{isThreadMuted ? _(msg`Unmute thread`) : _(msg`Mute thread`)}
|
{isThreadMuted
|
||||||
|
? _(msg`Unmute thread`)
|
||||||
|
: _(msg`Mute thread`)}
|
||||||
</Menu.ItemText>
|
</Menu.ItemText>
|
||||||
<Menu.ItemIcon
|
<Menu.ItemIcon
|
||||||
icon={isThreadMuted ? Unmute : Mute}
|
icon={isThreadMuted ? Unmute : Mute}
|
||||||
@@ -667,7 +630,9 @@ let PostDropdownMenuItems = ({
|
|||||||
<Menu.Item
|
<Menu.Item
|
||||||
testID="postDropdownEditPostInteractions"
|
testID="postDropdownEditPostInteractions"
|
||||||
label={_(msg`Edit interaction settings`)}
|
label={_(msg`Edit interaction settings`)}
|
||||||
onPress={() => postInteractionSettingsDialogControl.open()}
|
onPress={() =>
|
||||||
|
postInteractionSettingsDialogControl.open()
|
||||||
|
}
|
||||||
{...(isAuthor
|
{...(isAuthor
|
||||||
? Platform.select({
|
? Platform.select({
|
||||||
web: {
|
web: {
|
||||||
@@ -695,6 +660,8 @@ let PostDropdownMenuItems = ({
|
|||||||
</Menu.Group>
|
</Menu.Group>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
</Menu.Outer>
|
||||||
|
</Menu.Root>
|
||||||
|
|
||||||
<Prompt.Basic
|
<Prompt.Basic
|
||||||
control={deletePromptControl}
|
control={deletePromptControl}
|
||||||
@@ -778,7 +745,9 @@ let PostDropdownMenuItems = ({
|
|||||||
onConfirm={onToggleReplyVisibility}
|
onConfirm={onToggleReplyVisibility}
|
||||||
confirmButtonCta={_(msg`Yes, hide`)}
|
confirmButtonCta={_(msg`Yes, hide`)}
|
||||||
/>
|
/>
|
||||||
</>
|
</EventStopper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
PostDropdownMenuItems = memo(PostDropdownMenuItems)
|
|
||||||
|
PostDropdownBtn = memo(PostDropdownBtn)
|
||||||
|
export {PostDropdownBtn}
|
||||||
|
|||||||
Reference in New Issue
Block a user