disable native dropdowns for now, remove ios-context-menu

This commit is contained in:
Hailey
2024-06-23 02:35:34 -07:00
parent 9054de701c
commit cd7f438f1a
6 changed files with 434 additions and 473 deletions
+101 -116
View File
@@ -1,21 +1,10 @@
import React from 'react'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useNavigation} from '@react-navigation/native'
import {isInvalidHandle} from '#/lib/strings/handles'
import {EventStopper} from '#/view/com/util/EventStopper'
import {NativeDropdown} from '#/view/com/util/forms/NativeDropdown'
import {NavigationProp} from '#/lib/routes/types'
import {
usePreferencesQuery,
useUpsertMutedWordsMutation,
useRemoveMutedWordMutation,
} from '#/state/queries/preferences'
import {enforceLen} from '#/lib/strings/helpers'
import {web} from '#/alf'
import * as Dialog from '#/components/Dialog'
// @TODO Fabric
export function useTagMenuControl(): Dialog.DialogControlProps {
return {
id: '',
@@ -30,11 +19,7 @@ export function useTagMenuControl(): Dialog.DialogControlProps {
}
}
export function TagMenu({
children,
tag,
authorHandle,
}: React.PropsWithChildren<{
export function TagMenu({}: React.PropsWithChildren<{
/**
* This should be the sanitized tag value from the facet itself, not the
* "display" value with a leading `#`.
@@ -42,108 +27,108 @@ export function TagMenu({
tag: string
authorHandle?: string
}>) {
const {_} = useLingui()
const navigation = useNavigation<NavigationProp>()
const {data: preferences} = usePreferencesQuery()
const {mutateAsync: upsertMutedWord, variables: optimisticUpsert} =
useUpsertMutedWordsMutation()
const {mutateAsync: removeMutedWord, variables: optimisticRemove} =
useRemoveMutedWordMutation()
const isMuted = Boolean(
(preferences?.moderationPrefs.mutedWords?.find(
m => m.value === tag && m.targets.includes('tag'),
) ??
optimisticUpsert?.find(
m => m.value === tag && m.targets.includes('tag'),
)) &&
!(optimisticRemove?.value === tag),
)
const truncatedTag = '#' + enforceLen(tag, 15, true, 'middle')
// const {_} = useLingui()
// const navigation = useNavigation<NavigationProp>()
// const {data: preferences} = usePreferencesQuery()
// const {mutateAsync: upsertMutedWord, variables: optimisticUpsert} =
// useUpsertMutedWordsMutation()
// const {mutateAsync: removeMutedWord, variables: optimisticRemove} =
// useRemoveMutedWordMutation()
// const isMuted = Boolean(
// (preferences?.moderationPrefs.mutedWords?.find(
// m => m.value === tag && m.targets.includes('tag'),
// ) ??
// optimisticUpsert?.find(
// m => m.value === tag && m.targets.includes('tag'),
// )) &&
// !(optimisticRemove?.value === tag),
// )
// const truncatedTag = '#' + enforceLen(tag, 15, true, 'middle')
const dropdownItems = React.useMemo(() => {
return [
{
label: _(msg`See ${truncatedTag} posts`),
onPress() {
navigation.push('Hashtag', {
tag: encodeURIComponent(tag),
})
},
testID: 'tagMenuSearch',
icon: {
ios: {
name: 'magnifyingglass',
},
android: '',
web: 'magnifying-glass',
},
},
authorHandle &&
!isInvalidHandle(authorHandle) && {
label: _(msg`See ${truncatedTag} posts by user`),
onPress() {
navigation.push('Hashtag', {
tag: encodeURIComponent(tag),
author: authorHandle,
})
},
testID: 'tagMenuSearchByUser',
icon: {
ios: {
name: 'magnifyingglass',
},
android: '',
web: ['far', 'user'],
},
},
preferences && {
label: 'separator',
},
preferences && {
label: isMuted
? _(msg`Unmute ${truncatedTag}`)
: _(msg`Mute ${truncatedTag}`),
onPress() {
if (isMuted) {
removeMutedWord({value: tag, targets: ['tag']})
} else {
upsertMutedWord([{value: tag, targets: ['tag']}])
}
},
testID: 'tagMenuMute',
icon: {
ios: {
name: 'speaker.slash',
},
android: 'ic_menu_sort_alphabetically',
web: isMuted ? 'eye' : ['far', 'eye-slash'],
},
},
].filter(Boolean)
}, [
_,
authorHandle,
isMuted,
navigation,
preferences,
tag,
truncatedTag,
upsertMutedWord,
removeMutedWord,
])
// const dropdownItems = React.useMemo(() => {
// return [
// {
// label: _(msg`See ${truncatedTag} posts`),
// onPress() {
// navigation.push('Hashtag', {
// tag: encodeURIComponent(tag),
// })
// },
// testID: 'tagMenuSearch',
// icon: {
// ios: {
// name: 'magnifyingglass',
// },
// android: '',
// web: 'magnifying-glass',
// },
// },
// authorHandle &&
// !isInvalidHandle(authorHandle) && {
// label: _(msg`See ${truncatedTag} posts by user`),
// onPress() {
// navigation.push('Hashtag', {
// tag: encodeURIComponent(tag),
// author: authorHandle,
// })
// },
// testID: 'tagMenuSearchByUser',
// icon: {
// ios: {
// name: 'magnifyingglass',
// },
// android: '',
// web: ['far', 'user'],
// },
// },
// preferences && {
// label: 'separator',
// },
// preferences && {
// label: isMuted
// ? _(msg`Unmute ${truncatedTag}`)
// : _(msg`Mute ${truncatedTag}`),
// onPress() {
// if (isMuted) {
// removeMutedWord({value: tag, targets: ['tag']})
// } else {
// upsertMutedWord([{value: tag, targets: ['tag']}])
// }
// },
// testID: 'tagMenuMute',
// icon: {
// ios: {
// name: 'speaker.slash',
// },
// android: 'ic_menu_sort_alphabetically',
// web: isMuted ? 'eye' : ['far', 'eye-slash'],
// },
// },
// ].filter(Boolean)
// }, [
// _,
// authorHandle,
// isMuted,
// navigation,
// preferences,
// tag,
// truncatedTag,
// upsertMutedWord,
// removeMutedWord,
// ])
return (
<EventStopper>
<NativeDropdown
accessibilityLabel={_(msg`Click here to open tag menu for ${tag}`)}
accessibilityHint=""
// @ts-ignore
items={dropdownItems}
triggerStyle={web({
textAlign: 'left',
})}>
{children}
</NativeDropdown>
{/*<NativeDropdown*/}
{/* accessibilityLabel={_(msg`Click here to open tag menu for ${tag}`)}*/}
{/* accessibilityHint=""*/}
{/* // @ts-ignore*/}
{/* items={dropdownItems}*/}
{/* triggerStyle={web({*/}
{/* textAlign: 'left',*/}
{/* })}>*/}
{/* {children}*/}
{/*</NativeDropdown>*/}
</EventStopper>
)
}
+49 -55
View File
@@ -3,24 +3,18 @@ import {View} from 'react-native'
import {AppBskyActorDefs, ModerationDecision} from '@atproto/api'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useNavigation} from '@react-navigation/native'
import {createHitslop} from '#/lib/constants'
import {NavigationProp} from '#/lib/routes/types'
import {useGate} from '#/lib/statsig/statsig'
import {sanitizeDisplayName} from '#/lib/strings/display-names'
import {useProfileShadow} from '#/state/cache/profile-shadow'
import {useSession} from '#/state/session'
import {
DropdownItem,
NativeDropdown,
} from '#/view/com/util/forms/NativeDropdown'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, select, useTheme} from '#/alf'
import {Button} from '#/components/Button'
import {useFollowMethods} from '#/components/hooks/useFollowMethods'
import {PlusSmall_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
// @TODO Fabric
export function AviFollowButton({
author,
moderation,
@@ -33,13 +27,13 @@ export function AviFollowButton({
const {_} = useLingui()
const t = useTheme()
const profile = useProfileShadow(author)
const {follow} = useFollowMethods({
profile: profile,
logContext: 'AvatarButton',
})
// const {follow} = useFollowMethods({
// profile: profile,
// logContext: 'AvatarButton',
// })
const gate = useGate()
const {currentAccount, hasSession} = useSession()
const navigation = useNavigation<NavigationProp>()
// const navigation = useNavigation<NavigationProp>()
const name = sanitizeDisplayName(
profile.displayName || profile.handle,
@@ -48,37 +42,37 @@ export function AviFollowButton({
const isFollowing =
profile.viewer?.following || profile.did === currentAccount?.did
function onPress() {
follow()
Toast.show(_(msg`Following ${name}`))
}
// function onPress() {
// follow()
// Toast.show(_(msg`Following ${name}`))
// }
const items: DropdownItem[] = [
{
label: _(msg`View profile`),
onPress: () => {
navigation.navigate('Profile', {name: profile.did})
},
icon: {
ios: {
name: 'arrow.up.right.square',
},
android: '',
web: ['far', 'arrow-up-right-from-square'],
},
},
{
label: _(msg`Follow ${name}`),
onPress: onPress,
icon: {
ios: {
name: 'person.badge.plus',
},
android: '',
web: ['far', 'user-plus'],
},
},
]
// const items: DropdownItem[] = [
// {
// label: _(msg`View profile`),
// onPress: () => {
// navigation.navigate('Profile', {name: profile.did})
// },
// icon: {
// ios: {
// name: 'arrow.up.right.square',
// },
// android: '',
// web: ['far', 'arrow-up-right-from-square'],
// },
// },
// {
// label: _(msg`Follow ${name}`),
// onPress: onPress,
// icon: {
// ios: {
// name: 'person.badge.plus',
// },
// android: '',
// web: ['far', 'user-plus'],
// },
// },
// ]
return hasSession && gate('show_avi_follow_button') ? (
<View style={a.relative}>
@@ -103,18 +97,18 @@ export function AviFollowButton({
borderColor: t.atoms.bg.backgroundColor,
},
]}>
<NativeDropdown items={items}>
<Plus
size="sm"
fill={
select(t.name, {
light: t.atoms.bg_contrast_600,
dim: t.atoms.bg_contrast_500,
dark: t.atoms.bg_contrast_600,
}).backgroundColor
}
/>
</NativeDropdown>
{/*<NativeDropdown items={items}>*/}
<Plus
size="sm"
fill={
select(t.name, {
light: t.atoms.bg_contrast_600,
dim: t.atoms.bg_contrast_500,
dark: t.atoms.bg_contrast_600,
}).backgroundColor
}
/>
{/*</NativeDropdown>*/}
</Button>
)}
</View>
+37 -40
View File
@@ -1,50 +1,47 @@
import React from 'react'
import {Pressable} from 'react-native'
import {
FontAwesomeIcon,
FontAwesomeIconStyle,
} from '@fortawesome/react-native-fontawesome'
import {SessionAccount} from '#/state/session'
import {s} from 'lib/styles'
import {usePalette} from 'lib/hooks/usePalette'
import {DropdownItem, NativeDropdown} from './forms/NativeDropdown'
import * as Toast from '../../com/util/Toast'
import {useSessionApi, SessionAccount} from '#/state/session'
import {useLingui} from '@lingui/react'
import {msg} from '@lingui/macro'
export function AccountDropdownBtn({account}: {account: SessionAccount}) {
const pal = usePalette('default')
const {removeAccount} = useSessionApi()
const {_} = useLingui()
// @TODO Fabric
export function AccountDropdownBtn({
account: _account,
}: {
account: SessionAccount
}) {
// const pal = usePalette('default')
// const {removeAccount} = useSessionApi()
// const {_} = useLingui()
const items: DropdownItem[] = [
{
label: _(msg`Remove account`),
onPress: () => {
removeAccount(account)
Toast.show(_(msg`Account removed from quick access`))
},
icon: {
ios: {
name: 'trash',
},
android: 'ic_delete',
web: ['far', 'trash-can'],
},
},
]
// const items: DropdownItem[] = [
// {
// label: _(msg`Remove account`),
// onPress: () => {
// removeAccount(account)
// Toast.show(_(msg`Account removed from quick access`))
// },
// icon: {
// ios: {
// name: 'trash',
// },
// android: 'ic_delete',
// web: ['far', 'trash-can'],
// },
// },
// ]
return (
<Pressable accessibilityRole="button" style={s.pl10}>
<NativeDropdown
testID="accountSettingsDropdownBtn"
items={items}
accessibilityLabel={_(msg`Account options`)}
accessibilityHint="">
<FontAwesomeIcon
icon="ellipsis-h"
style={pal.textLight as FontAwesomeIconStyle}
/>
</NativeDropdown>
{/*<NativeDropdown*/}
{/* testID="accountSettingsDropdownBtn"*/}
{/* items={items}*/}
{/* accessibilityLabel={_(msg`Account options`)}*/}
{/* accessibilityHint="">*/}
{/* <FontAwesomeIcon*/}
{/* icon="ellipsis-h"*/}
{/* style={pal.textLight as FontAwesomeIconStyle}*/}
{/* />*/}
{/*</NativeDropdown>*/}
</Pressable>
)
}
+237 -239
View File
@@ -11,7 +11,7 @@ import {useQueryClient} from '@tanstack/react-query'
import {useAnalytics} from '#/lib/analytics/analytics'
import {cleanError} from '#/lib/strings/errors'
import {logger} from '#/logger'
import {isNative, isWeb} from '#/platform/detection'
import {isNative} from '#/platform/detection'
import {listenSoftReset} from '#/state/events'
import {useModalControls} from '#/state/modals'
import {
@@ -41,9 +41,7 @@ import {ComposeIcon2} from 'lib/icons'
import {makeListLink, makeProfileLink} from 'lib/routes/links'
import {CommonNavigatorParams, NativeStackScreenProps} from 'lib/routes/types'
import {NavigationProp} from 'lib/routes/types'
import {shareUrl} from 'lib/sharing'
import {sanitizeHandle} from 'lib/strings/handles'
import {toShareUrl} from 'lib/strings/url-helpers'
import {s} from 'lib/styles'
import {ListMembers} from '#/view/com/lists/ListMembers'
import {PagerWithHeader} from 'view/com/pager/PagerWithHeader'
@@ -52,7 +50,6 @@ import {ProfileSubpageHeader} from 'view/com/profile/ProfileSubpageHeader'
import {EmptyState} from 'view/com/util/EmptyState'
import {FAB} from 'view/com/util/fab/FAB'
import {Button} from 'view/com/util/forms/Button'
import {DropdownItem, NativeDropdown} from 'view/com/util/forms/NativeDropdown'
import {TextLink} from 'view/com/util/Link'
import {ListRef} from 'view/com/util/List'
import {LoadLatestBtn} from 'view/com/util/load-latest/LoadLatestBtn'
@@ -74,6 +71,8 @@ interface SectionRef {
scrollToTop: () => void
}
// @TODO Fabric
type Props = NativeStackScreenProps<CommonNavigatorParams, 'ProfileList'>
export function ProfileListScreen(props: Props) {
const {_} = useLingui()
@@ -234,13 +233,13 @@ function ProfileListScreenLoaded({
}
function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) {
const pal = usePalette('default')
const palInverted = usePalette('inverted')
// const pal = usePalette('default')
// const palInverted = usePalette('inverted')
const {_} = useLingui()
const navigation = useNavigation<NavigationProp>()
const {currentAccount} = useSession()
const reportDialogControl = useReportDialogControl()
const {openModal} = useModalControls()
// const {openModal} = useModalControls()
const listMuteMutation = useListMuteMutation()
const listBlockMutation = useListBlockMutation()
const listDeleteMutation = useListDeleteMutation()
@@ -248,7 +247,7 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) {
const isModList = list.purpose === 'app.bsky.graph.defs#modlist'
const isBlocking = !!list.viewer?.blocked
const isMuting = !!list.viewer?.muted
const isOwner = list.creator.did === currentAccount?.did
// const isOwner = list.creator.did === currentAccount?.did
const {data: preferences} = usePreferencesQuery()
const {track} = useAnalytics()
const playHaptic = useHaptics()
@@ -312,17 +311,17 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) {
savedFeedConfig,
])
const onRemoveFromSavedFeeds = React.useCallback(async () => {
playHaptic()
if (!savedFeedConfig) return
try {
await removeSavedFeed(savedFeedConfig)
Toast.show(_(msg`Removed from your feeds`))
} catch (e) {
Toast.show(_(msg`There was an issue contacting the server`))
logger.error('Failed to remove pinned list', {message: e})
}
}, [playHaptic, removeSavedFeed, _, savedFeedConfig])
// const onRemoveFromSavedFeeds = React.useCallback(async () => {
// playHaptic()
// if (!savedFeedConfig) return
// try {
// await removeSavedFeed(savedFeedConfig)
// Toast.show(_(msg`Removed from your feeds`))
// } catch (e) {
// Toast.show(_(msg`There was an issue contacting the server`))
// logger.error('Failed to remove pinned list', {message: e})
// }
// }, [playHaptic, removeSavedFeed, _, savedFeedConfig])
const onSubscribeMute = useCallback(async () => {
try {
@@ -380,12 +379,12 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) {
}
}, [list, listBlockMutation, track, _])
const onPressEdit = useCallback(() => {
openModal({
name: 'create-or-edit-list',
list,
})
}, [openModal, list])
// const onPressEdit = useCallback(() => {
// openModal({
// name: 'create-or-edit-list',
// list,
// })
// }, [openModal, list])
const onPressDelete = useCallback(async () => {
await listDeleteMutation.mutateAsync({uri: list.uri})
@@ -411,188 +410,188 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) {
savedFeedConfig,
])
const onPressReport = useCallback(() => {
reportDialogControl.open()
}, [reportDialogControl])
// const onPressReport = useCallback(() => {
// reportDialogControl.open()
// }, [reportDialogControl])
//
// const onPressShare = useCallback(() => {
// const url = toShareUrl(`/profile/${list.creator.did}/lists/${rkey}`)
// shareUrl(url)
// track('Lists:Share')
// }, [list, rkey, track])
const onPressShare = useCallback(() => {
const url = toShareUrl(`/profile/${list.creator.did}/lists/${rkey}`)
shareUrl(url)
track('Lists:Share')
}, [list, rkey, track])
// const dropdownItems: DropdownItem[] = useMemo(() => {
// let items: DropdownItem[] = [
// {
// testID: 'listHeaderDropdownShareBtn',
// label: isWeb ? _(msg`Copy link to list`) : _(msg`Share`),
// onPress: onPressShare,
// icon: {
// ios: {
// name: 'square.and.arrow.up',
// },
// android: '',
// web: 'share',
// },
// },
// ]
//
// if (savedFeedConfig) {
// items.push({
// testID: 'listHeaderDropdownRemoveFromFeedsBtn',
// label: _(msg`Remove from my feeds`),
// onPress: onRemoveFromSavedFeeds,
// icon: {
// ios: {
// name: 'trash',
// },
// android: '',
// web: ['far', 'trash-can'],
// },
// })
// }
//
// if (isOwner) {
// items.push({label: 'separator'})
// items.push({
// testID: 'listHeaderDropdownEditBtn',
// label: _(msg`Edit list details`),
// onPress: onPressEdit,
// icon: {
// ios: {
// name: 'pencil',
// },
// android: '',
// web: 'pen',
// },
// })
// items.push({
// testID: 'listHeaderDropdownDeleteBtn',
// label: _(msg`Delete List`),
// onPress: deleteListPromptControl.open,
// icon: {
// ios: {
// name: 'trash',
// },
// android: '',
// web: ['far', 'trash-can'],
// },
// })
// } else {
// items.push({label: 'separator'})
// items.push({
// testID: 'listHeaderDropdownReportBtn',
// label: _(msg`Report List`),
// onPress: onPressReport,
// icon: {
// ios: {
// name: 'exclamationmark.triangle',
// },
// android: '',
// web: 'circle-exclamation',
// },
// })
// }
// if (isModList && isPinned) {
// items.push({label: 'separator'})
// items.push({
// testID: 'listHeaderDropdownUnpinBtn',
// label: _(msg`Unpin moderation list`),
// onPress:
// isPending || !savedFeedConfig
// ? undefined
// : () => removeSavedFeed(savedFeedConfig),
// icon: {
// ios: {
// name: 'pin',
// },
// android: '',
// web: 'thumbtack',
// },
// })
// }
// if (isCurateList && (isBlocking || isMuting)) {
// items.push({label: 'separator'})
//
// if (isMuting) {
// items.push({
// testID: 'listHeaderDropdownMuteBtn',
// label: _(msg`Un-mute list`),
// onPress: onUnsubscribeMute,
// icon: {
// ios: {
// name: 'eye',
// },
// android: '',
// web: 'eye',
// },
// })
// }
//
// if (isBlocking) {
// items.push({
// testID: 'listHeaderDropdownBlockBtn',
// label: _(msg`Un-block list`),
// onPress: onUnsubscribeBlock,
// icon: {
// ios: {
// name: 'person.fill.xmark',
// },
// android: '',
// web: 'user-slash',
// },
// })
// }
// }
// return items
// }, [
// _,
// onPressShare,
// isOwner,
// isModList,
// isPinned,
// isCurateList,
// onPressEdit,
// deleteListPromptControl.open,
// onPressReport,
// isPending,
// isBlocking,
// isMuting,
// onUnsubscribeMute,
// onUnsubscribeBlock,
// removeSavedFeed,
// savedFeedConfig,
// onRemoveFromSavedFeeds,
// ])
const dropdownItems: DropdownItem[] = useMemo(() => {
let items: DropdownItem[] = [
{
testID: 'listHeaderDropdownShareBtn',
label: isWeb ? _(msg`Copy link to list`) : _(msg`Share`),
onPress: onPressShare,
icon: {
ios: {
name: 'square.and.arrow.up',
},
android: '',
web: 'share',
},
},
]
if (savedFeedConfig) {
items.push({
testID: 'listHeaderDropdownRemoveFromFeedsBtn',
label: _(msg`Remove from my feeds`),
onPress: onRemoveFromSavedFeeds,
icon: {
ios: {
name: 'trash',
},
android: '',
web: ['far', 'trash-can'],
},
})
}
if (isOwner) {
items.push({label: 'separator'})
items.push({
testID: 'listHeaderDropdownEditBtn',
label: _(msg`Edit list details`),
onPress: onPressEdit,
icon: {
ios: {
name: 'pencil',
},
android: '',
web: 'pen',
},
})
items.push({
testID: 'listHeaderDropdownDeleteBtn',
label: _(msg`Delete List`),
onPress: deleteListPromptControl.open,
icon: {
ios: {
name: 'trash',
},
android: '',
web: ['far', 'trash-can'],
},
})
} else {
items.push({label: 'separator'})
items.push({
testID: 'listHeaderDropdownReportBtn',
label: _(msg`Report List`),
onPress: onPressReport,
icon: {
ios: {
name: 'exclamationmark.triangle',
},
android: '',
web: 'circle-exclamation',
},
})
}
if (isModList && isPinned) {
items.push({label: 'separator'})
items.push({
testID: 'listHeaderDropdownUnpinBtn',
label: _(msg`Unpin moderation list`),
onPress:
isPending || !savedFeedConfig
? undefined
: () => removeSavedFeed(savedFeedConfig),
icon: {
ios: {
name: 'pin',
},
android: '',
web: 'thumbtack',
},
})
}
if (isCurateList && (isBlocking || isMuting)) {
items.push({label: 'separator'})
if (isMuting) {
items.push({
testID: 'listHeaderDropdownMuteBtn',
label: _(msg`Un-mute list`),
onPress: onUnsubscribeMute,
icon: {
ios: {
name: 'eye',
},
android: '',
web: 'eye',
},
})
}
if (isBlocking) {
items.push({
testID: 'listHeaderDropdownBlockBtn',
label: _(msg`Un-block list`),
onPress: onUnsubscribeBlock,
icon: {
ios: {
name: 'person.fill.xmark',
},
android: '',
web: 'user-slash',
},
})
}
}
return items
}, [
_,
onPressShare,
isOwner,
isModList,
isPinned,
isCurateList,
onPressEdit,
deleteListPromptControl.open,
onPressReport,
isPending,
isBlocking,
isMuting,
onUnsubscribeMute,
onUnsubscribeBlock,
removeSavedFeed,
savedFeedConfig,
onRemoveFromSavedFeeds,
])
const subscribeDropdownItems: DropdownItem[] = useMemo(() => {
return [
{
testID: 'subscribeDropdownMuteBtn',
label: _(msg`Mute accounts`),
onPress: subscribeMutePromptControl.open,
icon: {
ios: {
name: 'speaker.slash',
},
android: '',
web: 'user-slash',
},
},
{
testID: 'subscribeDropdownBlockBtn',
label: _(msg`Block accounts`),
onPress: subscribeBlockPromptControl.open,
icon: {
ios: {
name: 'person.fill.xmark',
},
android: '',
web: 'ban',
},
},
]
}, [_, subscribeMutePromptControl.open, subscribeBlockPromptControl.open])
// const subscribeDropdownItems: DropdownItem[] = useMemo(() => {
// return [
// {
// testID: 'subscribeDropdownMuteBtn',
// label: _(msg`Mute accounts`),
// onPress: subscribeMutePromptControl.open,
// icon: {
// ios: {
// name: 'speaker.slash',
// },
// android: '',
// web: 'user-slash',
// },
// },
// {
// testID: 'subscribeDropdownBlockBtn',
// label: _(msg`Block accounts`),
// onPress: subscribeBlockPromptControl.open,
// icon: {
// ios: {
// name: 'person.fill.xmark',
// },
// android: '',
// web: 'ban',
// },
// },
// ]
// }, [_, subscribeMutePromptControl.open, subscribeBlockPromptControl.open])
return (
<ProfileSubpageHeader
@@ -633,29 +632,28 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) {
label={_(msg`Unmute`)}
onPress={onUnsubscribeMute}
/>
) : (
<NativeDropdown
testID="subscribeBtn"
items={subscribeDropdownItems}
accessibilityLabel={_(msg`Subscribe to this list`)}
accessibilityHint="">
<View style={[palInverted.view, styles.btn]}>
<Text style={palInverted.text}>
<Trans>Subscribe</Trans>
</Text>
</View>
</NativeDropdown>
)
) : null}
<NativeDropdown
testID="headerDropdownBtn"
items={dropdownItems}
accessibilityLabel={_(msg`More options`)}
accessibilityHint="">
<View style={[pal.viewLight, styles.btn]}>
<FontAwesomeIcon icon="ellipsis" size={20} color={pal.colors.text} />
</View>
</NativeDropdown>
) : null
) : // <NativeDropdown
// testID="subscribeBtn"
// items={subscribeDropdownItems}
// accessibilityLabel={_(msg`Subscribe to this list`)}
// accessibilityHint="">
// <View style={[palInverted.view, styles.btn]}>
// <Text style={palInverted.text}>
// <Trans>Subscribe</Trans>
// </Text>
// </View>
// </NativeDropdown>
null}
{/*<NativeDropdown*/}
{/* testID="headerDropdownBtn"*/}
{/* items={dropdownItems}*/}
{/* accessibilityLabel={_(msg`More options`)}*/}
{/* accessibilityHint="">*/}
{/* <View style={[pal.viewLight, styles.btn]}>*/}
{/* <FontAwesomeIcon icon="ellipsis" size={20} color={pal.colors.text} />*/}
{/* </View>*/}
{/*</NativeDropdown>*/}
<Prompt.Basic
control={deleteListPromptControl}
@@ -980,14 +978,14 @@ function ErrorScreen({error}: {error: string}) {
)
}
const styles = StyleSheet.create({
btn: {
flexDirection: 'row',
alignItems: 'center',
gap: 6,
paddingVertical: 7,
paddingHorizontal: 14,
borderRadius: 50,
marginLeft: 6,
},
})
// const styles = StyleSheet.create({
// btn: {
// flexDirection: 'row',
// alignItems: 'center',
// gap: 6,
// paddingVertical: 7,
// paddingHorizontal: 14,
// borderRadius: 50,
// marginLeft: 6,
// },
// })