Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup(ts/components/nav): remove unused allowViews prop #2276

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,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