simplify logic determining if territory select is shown
This commit is contained in:
parent
2575a4a494
commit
6054afa10c
@ -33,25 +33,11 @@ export function Brand ({ className }) {
|
||||
)
|
||||
}
|
||||
|
||||
export function noNavSelect ({ path, pathname }) {
|
||||
export function hasNavSelect ({ path, pathname }) {
|
||||
return (
|
||||
path.startsWith('/items') ||
|
||||
path.endsWith('/post') ||
|
||||
path.endsWith('/edit') ||
|
||||
path.endsWith('/notifications') ||
|
||||
path.endsWith('/search') ||
|
||||
path.startsWith('/wallet') ||
|
||||
path.startsWith('/rewards') ||
|
||||
path.startsWith('/referrals') ||
|
||||
path.startsWith('/live') ||
|
||||
path.startsWith('/settings') ||
|
||||
path.startsWith('/invites') ||
|
||||
path.startsWith('/stackers') ||
|
||||
path.startsWith('/satistics') ||
|
||||
path.startsWith('/withdrawals') ||
|
||||
path.startsWith('/invoices') ||
|
||||
pathname.startsWith('/[name]') ||
|
||||
path.startsWith('/territory')
|
||||
pathname.startsWith('/~') &&
|
||||
!path.endsWith('/post') &&
|
||||
!path.endsWith('/edit')
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { Nav, Navbar } from 'react-bootstrap'
|
||||
import { NavSelect, PostItem, Sorts, noNavSelect } from '../common'
|
||||
import { NavSelect, PostItem, Sorts, hasNavSelect } from '../common'
|
||||
import styles from '../../header.module.css'
|
||||
|
||||
export default function SecondBar (props) {
|
||||
const { prefix, topNavKey, sub } = props
|
||||
if (noNavSelect(props)) return null
|
||||
if (!hasNavSelect(props)) return null
|
||||
return (
|
||||
<Navbar className='pt-0 pb-3'>
|
||||
<Nav
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { Nav, Navbar } from 'react-bootstrap'
|
||||
import { NavPrice, Sorts, noNavSelect } from '../common'
|
||||
import { NavPrice, Sorts, hasNavSelect } from '../common'
|
||||
import styles from '../../header.module.css'
|
||||
|
||||
export default function SecondBar (props) {
|
||||
const { topNavKey } = props
|
||||
if (noNavSelect(props)) return null
|
||||
if (!hasNavSelect(props)) return null
|
||||
return (
|
||||
<Navbar>
|
||||
<Nav
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Nav, Navbar } from 'react-bootstrap'
|
||||
import styles from '../../header.module.css'
|
||||
import { Back, NavPrice, NavSelect, NavWalletSummary, SignUpButton, noNavSelect } from '../common'
|
||||
import { Back, NavPrice, NavSelect, NavWalletSummary, SignUpButton, hasNavSelect } from '../common'
|
||||
import { useMe } from '@/components/me'
|
||||
|
||||
export default function TopBar ({ prefix, sub, path, pathname, topNavKey, dropNavKey }) {
|
||||
@ -12,13 +12,13 @@ export default function TopBar ({ prefix, sub, path, pathname, topNavKey, dropNa
|
||||
activeKey={topNavKey}
|
||||
>
|
||||
<Back className='d-flex d-md-none' />
|
||||
{noNavSelect({ path, pathname })
|
||||
? (
|
||||
{hasNavSelect({ path, pathname })
|
||||
? <NavSelect sub={sub} className='w-100' />
|
||||
: (
|
||||
<>
|
||||
<NavPrice className='flex-shrink-1' />
|
||||
{me ? <NavWalletSummary /> : <SignUpButton />}
|
||||
</>)
|
||||
: <NavSelect sub={sub} className='w-100' />}
|
||||
</>)}
|
||||
</Nav>
|
||||
</Navbar>
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user