Skip to content

Commit

Permalink
Hide navbar controls for guests (from #3704)
Browse files Browse the repository at this point in the history
  • Loading branch information
nl0 committed Jun 18, 2024
1 parent b4a3139 commit e49036d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions catalog/app/containers/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import * as React from 'react'
import { Link, useRouteMatch } from 'react-router-dom'
import * as redux from 'react-redux'
import { Link } from 'react-router-dom'

Check warning on line 3 in catalog/app/containers/NavBar/NavBar.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/NavBar/NavBar.tsx#L3

Added line #L3 was not covered by tests
import * as M from '@material-ui/core'

import Logo from 'components/Logo'
import cfg from 'constants/config'
import * as style from 'constants/style'
import * as URLS from 'constants/urls'
import * as authSelectors from 'containers/Auth/selectors'
import * as CatalogSettings from 'utils/CatalogSettings'
import * as NamedRoutes from 'utils/NamedRoutes'

Expand Down Expand Up @@ -212,21 +214,19 @@ const useNavBarStyles = M.makeStyles({
})

export function NavBar() {
const settings = CatalogSettings.use()
const { paths } = NamedRoutes.use()
const isSignIn = !!useRouteMatch({ path: paths.signIn, exact: true })
const classes = useNavBarStyles()
const t = M.useTheme()
const collapse = M.useMediaQuery(t.breakpoints.down('sm'))

Check warning on line 219 in catalog/app/containers/NavBar/NavBar.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/NavBar/NavBar.tsx#L218-L219

Added lines #L218 - L219 were not covered by tests

const settings = CatalogSettings.use()

Check warning on line 221 in catalog/app/containers/NavBar/NavBar.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/NavBar/NavBar.tsx#L221

Added line #L221 was not covered by tests
const sub = Subscription.useState()
const authenticated = redux.useSelector(authSelectors.authenticated)

Check warning on line 223 in catalog/app/containers/NavBar/NavBar.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/NavBar/NavBar.tsx#L223

Added line #L223 was not covered by tests

const hideControls = cfg.disableNavigator || (cfg.alwaysRequiresAuth && !authenticated)

return (
<Container>
{cfg.disableNavigator || (cfg.alwaysRequiresAuth && isSignIn) ? (
<div className={classes.spacer} />
) : (
<Controls />
)}
{hideControls ? <div className={classes.spacer} /> : <Controls />}

<Subscription.Display {...sub} />

Expand Down

0 comments on commit e49036d

Please sign in to comment.