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

Add a new settings option for shuttle vehicle labels #192

Merged
merged 6 commits into from
Sep 12, 2019

Conversation

arkadyan
Copy link
Contributor

@arkadyan arkadyan force-pushed the mss-map-vehicle-label-setting branch 2 times, most recently from c2cf6be to ebf07ad Compare September 11, 2019 19:28
@codecov
Copy link

codecov bot commented Sep 11, 2019

Codecov Report

Merging #192 into master will increase coverage by <.01%.
The diff coverage is 97.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #192      +/-   ##
==========================================
+ Coverage   95.75%   95.76%   +<.01%     
==========================================
  Files         116      116              
  Lines        2452     2481      +29     
  Branches      255      266      +11     
==========================================
+ Hits         2348     2376      +28     
- Misses        102      103       +1     
  Partials        2        2
Impacted Files Coverage Δ
assets/src/components/headwayDiagram.tsx 100% <ø> (ø) ⬆️
assets/src/components/vehiclePropertiesPanel.tsx 95.37% <ø> (ø) ⬆️
assets/src/components/layoverBox.tsx 96.29% <ø> (ø) ⬆️
assets/src/components/incomingBox.tsx 100% <ø> (ø) ⬆️
assets/src/components/ladder.tsx 98.88% <ø> (ø) ⬆️
assets/src/helpers/icon.tsx 100% <100%> (ø) ⬆️
assets/src/state.ts 92.1% <100%> (+1.19%) ⬆️
assets/src/components/tabBar.tsx 100% <100%> (ø) ⬆️
assets/src/helpers/vehicleLabel.ts 100% <100%> (ø) ⬆️
assets/src/components/map.tsx 98.5% <100%> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac91de9...0119004. Read the comment docs.

@arkadyan arkadyan force-pushed the mss-map-vehicle-label-setting branch from ebf07ad to 8c9a680 Compare September 11, 2019 20:09
// special handling code in usePersistedStateReducer. -- MSS 2019-09-11
vehicleLabel: VehicleLabelSetting | undefined
ladderVehicleLabel: VehicleLabelSetting
mapVehicleLabel: VehicleLabelSetting
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think shuttleVehicleLabel might be a better name? We don't have this field because we draw some vehicles on a map. We have this field because shuttle have non-unique runs.

@@ -20,6 +22,34 @@ export const collapseIcon = (): JSX.Element => renderSvg("", collapseIconSvg)

export const expandIcon = (): JSX.Element => renderSvg("", expandIconSvg)

export const ladderIcon = (className: string = ""): JSX.Element => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to set the .m-tab-bar__icon class on a parent element or to apply styles to a parent's CSS instead of needing to pass the class in, so that the icon can be a constant?

In the settings page, I think if the fill was put on .c-page__section-row-icon, then you wouldn't need to pass the .c-page__section-row-icon-path class in.

className={className}
d="m32.73 39.86v-12.08a4.37 4.37 0 0 1 0-7.56v-12.08a4.36 4.36 0 1 1 4.36 0v12.08a4.37 4.37 0 0 1 0 7.56v12.08a4.36 4.36 0 1 1 -4.36 0zm-17.46 0a4.36 4.36 0 1 1 -4.36 0v-12.08a4.37 4.37 0 0 1 0-7.56v-12.08a4.36 4.36 0 1 1 4.36 0v12.08a4.37 4.37 0 0 1 0 7.56z"
/>
</svg>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the svgs be moved to separate .svg files to match the other icons loaded by this file?

@@ -100,7 +101,7 @@ const Header = ({
<VehicleIcon
size={Size.Large}
orientation={Orientation.Up}
label={vehicleLabel(vehicle, settings.vehicleLabel)}
label={vehicleLabel(vehicle, vehicleLabelSetting(settings, vehicle))}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now the caller needs to make two calls, to vehicleLabelSettings and vehicleLabel. Could we get by with just one call to a vehicleLabel(vehicle, settings) that checks which setting to use?

Ideally, the setting to use would depend on the page you're on, not the vehicle you're looking at, but since you should only see a shuttle on the shuttle page and only see non-shuttles on the ladder, I think it'd be okay to always determine the label based on the vehicle?

@arkadyan arkadyan force-pushed the mss-map-vehicle-label-setting branch from e01f511 to 41831b1 Compare September 12, 2019 18:42
@arkadyan
Copy link
Contributor Author

@skyqrose Ready for another look, I think I've addressed everything.

Copy link
Member

@skyqrose skyqrose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

d="m32.73 39.86v-12.08a4.37 4.37 0 0 1 0-7.56v-12.08a4.36 4.36 0 1 1 4.36 0v12.08a4.37 4.37 0 0 1 0 7.56v12.08a4.36 4.36 0 1 1 -4.36 0zm-17.46 0a4.36 4.36 0 1 1 -4.36 0v-12.08a4.37 4.37 0 0 1 0-7.56v-12.08a4.36 4.36 0 1 1 4.36 0v12.08a4.37 4.37 0 0 1 0 7.56z"
/>
</svg>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whitespace is a little weird in this file. There's a trailing line, and all lines except the 1st line (in both .svg files) are indented one extra space.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah weird. Fixed thanks.

@arkadyan arkadyan force-pushed the mss-map-vehicle-label-setting branch from a3c53bc to 0119004 Compare September 12, 2019 19:35
@arkadyan
Copy link
Contributor Author

Got a thumbs up from Ingrid.

@arkadyan arkadyan merged commit f2d4b36 into master Sep 12, 2019
@arkadyan arkadyan deleted the mss-map-vehicle-label-setting branch September 12, 2019 19:56
skyqrose added a commit that referenced this pull request Nov 26, 2019
skyqrose added a commit that referenced this pull request Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants