diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-09-28 12:41:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-28 12:41:44 -0700 |
commit | 2e5f73ff6149f9ac2834b0417c84b76763ef5ee2 (patch) | |
tree | 2a30023dc0f6c81c33704235655f65e0f204629f /src/view/com/util/AccountDropdownBtn.tsx | |
parent | 3e340b336ef92feb25da042430b6b3719c772b77 (diff) | |
download | voidsky-2e5f73ff6149f9ac2834b0417c84b76763ef5ee2.tar.zst |
Account quick switch modal (#1567)
* quick switch menu * Some small tweaks and fixes to the account switch modal * Factor out the account switcher logic to a hook * Add haptic feedback on account switcher open * Fix bad merge --------- Co-authored-by: Samuel Newman <mozzius@protonmail.com>
Diffstat (limited to 'src/view/com/util/AccountDropdownBtn.tsx')
-rw-r--r-- | src/view/com/util/AccountDropdownBtn.tsx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/view/com/util/AccountDropdownBtn.tsx b/src/view/com/util/AccountDropdownBtn.tsx new file mode 100644 index 000000000..761fec216 --- /dev/null +++ b/src/view/com/util/AccountDropdownBtn.tsx @@ -0,0 +1,46 @@ +import React from 'react' +import {Pressable} from 'react-native' +import { + FontAwesomeIcon, + FontAwesomeIconStyle, +} from '@fortawesome/react-native-fontawesome' +import {s} from 'lib/styles' +import {useStores} from 'state/index' +import {usePalette} from 'lib/hooks/usePalette' +import {DropdownItem, NativeDropdown} from './forms/NativeDropdown' +import * as Toast from '../../com/util/Toast' + +export function AccountDropdownBtn({handle}: {handle: string}) { + const store = useStores() + const pal = usePalette('default') + const items: DropdownItem[] = [ + { + label: 'Remove account', + onPress: () => { + store.session.removeAccount(handle) + Toast.show('Account removed from quick access') + }, + icon: { + ios: { + name: 'trash', + }, + android: 'ic_delete', + web: 'trash', + }, + }, + ] + return ( + <Pressable accessibilityRole="button" style={s.pl10}> + <NativeDropdown + testID="accountSettingsDropdownBtn" + items={items} + accessibilityLabel="Account options" + accessibilityHint=""> + <FontAwesomeIcon + icon="ellipsis-h" + style={pal.textLight as FontAwesomeIconStyle} + /> + </NativeDropdown> + </Pressable> + ) +} |