From f36c9565362b741c58672204fe0c155252affe28 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 24 Jan 2023 13:00:11 -0600 Subject: Resolve all remaining lint issues (#88) * Rework 'navIdx' variables from number arrays to strings to avoid equality-check failures in react hooks * Resolve all remaining lint issues * Fix tests * Use node v18 in gh action test --- src/view/shell/mobile/Menu.tsx | 288 ++++++++++++++++++++--------------------- 1 file changed, 141 insertions(+), 147 deletions(-) (limited to 'src/view/shell/mobile/Menu.tsx') diff --git a/src/view/shell/mobile/Menu.tsx b/src/view/shell/mobile/Menu.tsx index 26cb5b9bd..a7d3e2142 100644 --- a/src/view/shell/mobile/Menu.tsx +++ b/src/view/shell/mobile/Menu.tsx @@ -23,163 +23,157 @@ import {Text} from '../../com/util/text/Text' import {ToggleButton} from '../../com/util/forms/ToggleButton' import {usePalette} from '../../lib/hooks/usePalette' -export const Menu = observer( - ({visible, onClose}: {visible: boolean; onClose: () => void}) => { - const pal = usePalette('default') - const store = useStores() +export const Menu = observer(({onClose}: {onClose: () => void}) => { + const pal = usePalette('default') + const store = useStores() - // events - // = + // events + // = - const onNavigate = (url: string) => { - onClose() - if (url === '/notifications') { - store.nav.switchTo(1, true) - } else { - store.nav.switchTo(0, true) - if (url !== '/') { - store.nav.navigate(url) - } + const onNavigate = (url: string) => { + onClose() + if (url === '/notifications') { + store.nav.switchTo(1, true) + } else { + store.nav.switchTo(0, true) + if (url !== '/') { + store.nav.navigate(url) } } + } - // rendering - // = + // rendering + // = - const MenuItem = ({ - icon, - label, - count, - url, - bold, - onPress, - }: { - icon: JSX.Element - label: string - count?: number - url?: string - bold?: boolean - onPress?: () => void - }) => ( - onNavigate(url || '/')}> - - {icon} - {count ? ( - - {count} - - ) : undefined} - - - {label} - - - ) - - return ( - - onNavigate(`/profile/${store.me.handle}`)} - style={styles.profileCard}> - - - - {store.me.displayName || store.me.handle} - - - @{store.me.handle} - + const MenuItem = ({ + icon, + label, + count, + url, + bold, + onPress, + }: { + icon: JSX.Element + label: string + count?: number + url?: string + bold?: boolean + onPress?: () => void + }) => ( + onNavigate(url || '/')}> + + {icon} + {count ? ( + + {count} - - onNavigate('/search')}> - } - size={25} - /> - - Search + ) : undefined} + + + {label} + + + ) + + return ( + + onNavigate(`/profile/${store.me.handle}`)} + style={styles.profileCard}> + + + + {store.me.displayName || store.me.handle} - - - } size="26" /> - } - label="Home" - url="/" - /> - } size="28" /> - } - label="Notifications" - url="/notifications" - count={store.me.notificationCount} - /> - } - size="30" - strokeWidth={2} - /> - } - label="Profile" - url={`/profile/${store.me.handle}`} - /> - } - size="30" - strokeWidth={2} - /> - } - label="Settings" - url="/settings" - /> - - - store.shell.setDarkMode(!store.shell.darkMode)} - /> - - - - Build version {VersionNumber.appVersion} ( - {VersionNumber.buildVersion}) + + @{store.me.handle} - - - ) - }, -) + + onNavigate('/search')}> + } + size={25} + /> + + Search + + + + } size="26" />} + label="Home" + url="/" + /> + } size="28" />} + label="Notifications" + url="/notifications" + count={store.me.notificationCount} + /> + } + size="30" + strokeWidth={2} + /> + } + label="Profile" + url={`/profile/${store.me.handle}`} + /> + } + size="30" + strokeWidth={2} + /> + } + label="Settings" + url="/settings" + /> + + + store.shell.setDarkMode(!store.shell.darkMode)} + /> + + + + Build version {VersionNumber.appVersion} ({VersionNumber.buildVersion} + ) + + + + + ) +}) const styles = StyleSheet.create({ view: { -- cgit 1.4.1