Skip to content

Commit

Permalink
cleanup(ts/components/nav): remove unused allowViews prop
Browse files Browse the repository at this point in the history
  • Loading branch information
firestack committed Nov 16, 2023
1 parent 5a7ba3a commit 3361bb6
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 118 deletions.
2 changes: 1 addition & 1 deletion assets/src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const AppRoutes = () => {
</div>
<VehiclesByRouteIdProvider vehiclesByRouteId={vehiclesByRouteId}>
<div className="l-app__main">
<Nav allowViews>
<Nav>
<Routes>
<Route
element={
Expand Down
6 changes: 1 addition & 5 deletions assets/src/components/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import { StateDispatchContext } from "../contexts/stateDispatchContext"

interface Props {
children?: React.ReactNode
allowViews: boolean
}

const Nav: React.FC<Props> = ({ children, allowViews }) => {
const Nav: React.FC<Props> = ({ children }) => {
const [, dispatch] = useContext(StateDispatchContext)
const deviceType = useScreenSize()

Expand All @@ -34,7 +33,6 @@ const Nav: React.FC<Props> = ({ children, allowViews }) => {
defaultToCollapsed={true}
dispatcherFlag={readDispatcherFlag()}
closePickerOnViewOpen={true}
allowViews={allowViews}
/>
</div>
</div>
Expand All @@ -48,7 +46,6 @@ const Nav: React.FC<Props> = ({ children, allowViews }) => {
toggleMobileMenu={() => dispatch(toggleMobileMenu())}
defaultToCollapsed={true}
dispatcherFlag={readDispatcherFlag()}
allowViews={allowViews}
/>
</div>
</div>
Expand All @@ -64,7 +61,6 @@ const Nav: React.FC<Props> = ({ children, allowViews }) => {
<LeftNav
defaultToCollapsed={false}
dispatcherFlag={readDispatcherFlag()}
allowViews={allowViews}
/>
</div>
</div>
Expand Down
5 changes: 0 additions & 5 deletions assets/src/components/nav/leftNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ interface Props {
toggleMobileMenu?: () => void
defaultToCollapsed: boolean
dispatcherFlag: boolean
allowViews: boolean
closePickerOnViewOpen?: boolean
}

const LeftNav = ({
toggleMobileMenu,
defaultToCollapsed,
dispatcherFlag,
allowViews,
closePickerOnViewOpen,
}: Props): JSX.Element => {
const [{ mobileMenuIsOpen, pickerContainerIsVisible }, dispatch] =
Expand Down Expand Up @@ -148,7 +146,6 @@ const LeftNav = ({
}
}}
collapsed={collapsed}
disabled={!allowViews}
/>
</li>
) : null}
Expand All @@ -173,7 +170,6 @@ const LeftNav = ({
}
}}
collapsed={collapsed}
disabled={!allowViews}
/>
</li>
<li>
Expand All @@ -191,7 +187,6 @@ const LeftNav = ({
}}
name="Notifications"
collapsed={collapsed}
disabled={!allowViews}
/>
</li>
</ul>
Expand Down
2 changes: 0 additions & 2 deletions assets/tests/components/__snapshots__/app.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ exports[`App renders 1`] = `
</li>
<li>
<button
aria-disabled="false"
class="c-left-nav__link c-left-nav__view"
title="Swings View"
>
Expand All @@ -238,7 +237,6 @@ exports[`App renders 1`] = `
</li>
<li>
<button
aria-disabled="false"
class="c-left-nav__link c-left-nav__view"
title="Notifications"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ exports[`renders 1`] = `
</li>
<li>
<button
aria-disabled="false"
class="c-left-nav__link c-left-nav__view"
title="Swings View"
>
Expand All @@ -270,7 +269,6 @@ exports[`renders 1`] = `
</li>
<li>
<button
aria-disabled="false"
class="c-left-nav__link c-left-nav__view"
title="Notifications"
>
Expand Down
10 changes: 5 additions & 5 deletions assets/tests/components/nav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("Nav", () => {

const result = render(
<BrowserRouter>
<Nav allowViews={true}>Hello, world!</Nav>
<Nav>Hello, world!</Nav>
</BrowserRouter>
)

Expand All @@ -44,7 +44,7 @@ describe("Nav", () => {

const result = render(
<BrowserRouter>
<Nav allowViews={true}>Hello, world!</Nav>
<Nav>Hello, world!</Nav>
</BrowserRouter>
)

Expand All @@ -57,7 +57,7 @@ describe("Nav", () => {

const result = render(
<BrowserRouter>
<Nav allowViews={true}>Hello, world!</Nav>
<Nav>Hello, world!</Nav>
</BrowserRouter>
)

Expand All @@ -70,7 +70,7 @@ describe("Nav", () => {

render(
<BrowserRouter>
<Nav allowViews={true}>Hello, world!</Nav>
<Nav>Hello, world!</Nav>
</BrowserRouter>
)

Expand All @@ -81,7 +81,7 @@ describe("Nav", () => {
test("renders desktop nav content", () => {
const result = render(
<BrowserRouter>
<Nav allowViews={true}>Hello, world!</Nav>
<Nav>Hello, world!</Nav>
</BrowserRouter>
)

Expand Down
Loading

0 comments on commit 3361bb6

Please sign in to comment.