-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added route ladders to new minimal ladders page (#2583)
* Added route ladders to new minimal ladders page * Removed unused `findSelectedVehicleOrGhost`
- Loading branch information
1 parent
2d0b9b6
commit 3de1f3f
Showing
9 changed files
with
557 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,36 @@ | ||
import React from "react" | ||
import React, { useContext } from "react" | ||
import RouteLadders from "./routeLadders" | ||
import { currentRouteTab } from "../models/routeTab" | ||
import { StateDispatchContext } from "../contexts/stateDispatchContext" | ||
import { | ||
deselectRouteInTab, | ||
flipLadderInTab, | ||
toggleLadderCrowdingInTab, | ||
} from "../state" | ||
|
||
export const MinimalLadderPage = () => { | ||
return <div>Placeholder for Minimal Route Ladders Page</div> | ||
const [{ routeTabs }, dispatch] = useContext(StateDispatchContext) | ||
|
||
const { selectedRouteIds, ladderDirections, ladderCrowdingToggles } = | ||
currentRouteTab(routeTabs) || { | ||
selectedRouteIds: [] as string[], | ||
ladderDirections: {}, | ||
ladderCrowdingToggles: {}, | ||
} | ||
|
||
return ( | ||
<div className="c-ladder-page__tab-bar-and-ladders"> | ||
<RouteLadders | ||
selectedRouteIds={selectedRouteIds} | ||
selectedVehicleId={undefined} | ||
deselectRoute={(routeId) => dispatch(deselectRouteInTab(routeId))} | ||
reverseLadder={(routeId) => dispatch(flipLadderInTab(routeId))} | ||
toggleCrowding={(routeId) => | ||
dispatch(toggleLadderCrowdingInTab(routeId)) | ||
} | ||
ladderDirections={ladderDirections} | ||
ladderCrowdingToggles={ladderCrowdingToggles} | ||
/> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
173 changes: 173 additions & 0 deletions
173
assets/tests/components/__snapshots__/minimalLadderPage.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`RouteLadders renders a route ladder 1`] = ` | ||
<DocumentFragment> | ||
<div | ||
class="c-ladder-page__tab-bar-and-ladders" | ||
> | ||
<div | ||
class="c-route-ladders" | ||
data-testid="route-ladders-div" | ||
> | ||
<div | ||
class="c-route-ladder__header" | ||
> | ||
<div | ||
class="c-route-ladder__close-button-container" | ||
> | ||
<button | ||
aria-label="Close" | ||
class="c-close-button c-close-button--large c-close-button--darker" | ||
> | ||
<span | ||
aria-hidden="true" | ||
aria-label="" | ||
role="img" | ||
> | ||
<svg /> | ||
</span> | ||
</button> | ||
</div> | ||
<div | ||
class="c-route-ladder__route-name" | ||
> | ||
1 | ||
</div> | ||
</div> | ||
<div | ||
class="c-route-ladder__controls" | ||
> | ||
<button | ||
class="c-route-ladder__reverse" | ||
> | ||
<span | ||
class="c-route-ladder__reverse-icon" | ||
> | ||
<svg /> | ||
</span> | ||
Reverse | ||
</button> | ||
</div> | ||
<div | ||
class="c-ladder" | ||
style="width: 184px;" | ||
> | ||
<svg | ||
class="c-ladder__svg" | ||
height="0" | ||
viewBox="-92 -55 184 0" | ||
width="184" | ||
> | ||
<line | ||
class="c-ladder__line" | ||
x1="-40" | ||
x2="-40" | ||
y1="0" | ||
y2="-110" | ||
/> | ||
<line | ||
class="c-ladder__line" | ||
x1="40" | ||
x2="40" | ||
y1="0" | ||
y2="-110" | ||
/> | ||
<circle | ||
class="c-ladder__stop-circle" | ||
cx="-40" | ||
cy="0" | ||
r="3" | ||
/> | ||
<circle | ||
class="c-ladder__stop-circle" | ||
cx="40" | ||
cy="0" | ||
r="3" | ||
/> | ||
</svg> | ||
<div | ||
class="mock-tippy" | ||
> | ||
<div | ||
class="mock-tippy-content" | ||
> | ||
WASMA Name | ||
</div> | ||
<text | ||
class="c-ladder__timepoint-name" | ||
dominant-baseline="middle" | ||
text-anchor="middle" | ||
x="0" | ||
y="0" | ||
> | ||
WASMA | ||
</text> | ||
</div> | ||
<circle | ||
class="c-ladder__stop-circle" | ||
cx="-40" | ||
cy="-55" | ||
r="3" | ||
/> | ||
<circle | ||
class="c-ladder__stop-circle" | ||
cx="40" | ||
cy="-55" | ||
r="3" | ||
/> | ||
<div | ||
class="mock-tippy" | ||
> | ||
<div | ||
class="mock-tippy-content" | ||
> | ||
MELWA Name | ||
</div> | ||
<text | ||
class="c-ladder__timepoint-name" | ||
dominant-baseline="middle" | ||
text-anchor="middle" | ||
x="0" | ||
y="-55" | ||
> | ||
MELWA | ||
</text> | ||
</div> | ||
<circle | ||
class="c-ladder__stop-circle" | ||
cx="-40" | ||
cy="-110" | ||
r="3" | ||
/> | ||
<circle | ||
class="c-ladder__stop-circle" | ||
cx="40" | ||
cy="-110" | ||
r="3" | ||
/> | ||
<div | ||
class="mock-tippy" | ||
> | ||
<div | ||
class="mock-tippy-content" | ||
> | ||
HHGAT Name | ||
</div> | ||
<text | ||
class="c-ladder__timepoint-name" | ||
dominant-baseline="middle" | ||
text-anchor="middle" | ||
x="0" | ||
y="-110" | ||
> | ||
HHGAT | ||
</text> | ||
</div> | ||
</div> | ||
<div | ||
class="c-incoming-box" | ||
/> | ||
</div> | ||
</div> | ||
</DocumentFragment> | ||
`; |
Oops, something went wrong.