From 62a4e9aed12480e3fe6743d53bc537cf27bad79e Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Fri, 2 Sep 2022 09:30:21 -0500 Subject: [PATCH] Add accounts menu to shell --- src/view/lib/styles.ts | 3 + src/view/screens/Home.tsx | 3 +- src/view/shell/mobile/accounts-menu.tsx | 89 +++++++++++++++++++++++++ src/view/shell/mobile/index.tsx | 6 +- src/view/shell/mobile/location-menu.tsx | 41 +++++------- 5 files changed, 116 insertions(+), 26 deletions(-) create mode 100644 src/view/shell/mobile/accounts-menu.tsx diff --git a/src/view/lib/styles.ts b/src/view/lib/styles.ts index 5d624b83..82fe4154 100644 --- a/src/view/lib/styles.ts +++ b/src/view/lib/styles.ts @@ -44,6 +44,9 @@ export const colors = { export const gradients = { primary: {start: '#db00ff', end: '#ff007a'}, + purple: {start: colors.pink3, end: colors.purple3}, + blue: {start: colors.purple3, end: colors.blue3}, + green: {start: colors.blue3, end: colors.green3}, } export const s = StyleSheet.create({ diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx index 9d0356fb..299e9cde 100644 --- a/src/view/screens/Home.tsx +++ b/src/view/screens/Home.tsx @@ -5,6 +5,7 @@ import {FAB} from '../com/util/FloatingActionButton' import {useStores} from '../../state' import {FeedViewModel} from '../../state/models/feed-view' import {ScreenParams} from '../routes' +import {s} from '../lib/styles' export function Home({visible}: ScreenParams) { const [hasSetup, setHasSetup] = useState(false) @@ -32,7 +33,7 @@ export function Home({visible}: ScreenParams) { } return ( - + {feedView && } diff --git a/src/view/shell/mobile/accounts-menu.tsx b/src/view/shell/mobile/accounts-menu.tsx new file mode 100644 index 00000000..e3b61ce4 --- /dev/null +++ b/src/view/shell/mobile/accounts-menu.tsx @@ -0,0 +1,89 @@ +import React from 'react' +import { + Image, + StyleSheet, + Text, + TouchableOpacity, + TouchableWithoutFeedback, + View, +} from 'react-native' +import RootSiblings from 'react-native-root-siblings' +import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import {AVIS} from '../../lib/assets' +import {s, colors} from '../../lib/styles' + +export function createAccountsMenu(): RootSiblings { + const onPressItem = (_index: number) => { + sibling.destroy() + } + const onOuterPress = () => sibling.destroy() + const sibling = new RootSiblings( + ( + <> + + + + + onPressItem(0)}> + + Alice + + onPressItem(0)}> + + New Account + + + + ), + ) + return sibling +} + +const styles = StyleSheet.create({ + bg: { + position: 'absolute', + top: 0, + right: 0, + bottom: 0, + left: 0, + backgroundColor: '#000', + opacity: 0.1, + }, + menu: { + position: 'absolute', + left: 4, + top: 70, + backgroundColor: '#fff', + borderRadius: 14, + opacity: 1, + paddingVertical: 2, + }, + menuItem: { + flexDirection: 'row', + alignItems: 'center', + paddingVertical: 8, + paddingLeft: 10, + paddingRight: 30, + }, + menuItemBorder: { + borderTopWidth: 1, + borderTopColor: colors.gray1, + }, + avi: { + width: 28, + height: 28, + marginRight: 8, + borderRadius: 14, + }, + icon: { + marginLeft: 6, + marginRight: 6, + }, + label: { + fontSize: 16, + }, +}) diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx index 68387883..3d35efa1 100644 --- a/src/view/shell/mobile/index.tsx +++ b/src/view/shell/mobile/index.tsx @@ -18,6 +18,7 @@ import {match, MatchResult} from '../../routes' import {TabsSelectorModal} from './tabs-selector' import {LocationMenu} from './location-menu' import {createBackMenu, createForwardMenu} from './history-menu' +import {createAccountsMenu} from './accounts-menu' import {colors} from '../../lib/styles' import {AVIS} from '../../lib/assets' @@ -96,6 +97,7 @@ export const MobileShell: React.FC = observer(() => { const [isLocationMenuActive, setLocationMenuActive] = useState(false) const screenRenderDesc = constructScreenRenderDesc(stores.nav) + const onPressAvi = () => createAccountsMenu() const onPressLocation = () => setLocationMenuActive(true) const onNavigateLocationMenu = (url: string) => { setLocationMenuActive(false) @@ -119,7 +121,9 @@ export const MobileShell: React.FC = observer(() => { return ( - + + + ( onNavigate(url)}> - + - + {label} ) @@ -84,25 +81,20 @@ export function LocationMenu({ - + - + @@ -142,13 +134,14 @@ const styles = StyleSheet.create({ }, menuItemsContainer: { paddingVertical: 30, + paddingHorizontal: 8, }, fatMenuItems: { flexDirection: 'row', marginBottom: 20, }, fatMenuItem: { - width: 90, + width: 86, alignItems: 'center', marginRight: 6, },