-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix: Avoid collapsing green line and Mattapan line rows unless needed #2415
Conversation
deab2ed
to
abdb8f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The before and after is soooo good!
I almost feel like there might be a meta-programming-ish thing one could implement around the three collapse functions, since they all work so similarly. But I didn't leave a blocking comment on it, since this implementation is probably clearer anyway, despite the repetition.
Requesting changes for adjusting the "active now" part of your test code.
test/dotcom_web/components/system_status/subway_status_test.exs
Outdated
Show resolved
Hide resolved
c18768d
to
dd36096
Compare
@@ -131,7 +131,7 @@ defmodule DotcomWeb.Components.SystemStatus.SubwayStatus do | |||
@route_ids | |||
|> Enum.map(&{&1, subway_status |> Map.get(&1)}) | |||
|> Enum.flat_map(&rows_for_route/1) | |||
|> maybe_collapse_rows() | |||
|> collapse_rows_if_needed() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I could name this back to maybe_collapse_rows()
. I can't remember now why I changed it.
…hod to use Also simplify names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
This PR fixes a few edge cases in the homepage subway status component where it was unnecessarily collapsing green line rows together, or collapsing Mattapan alerts into Red line (which we decided it should never do).
Two Green line rows when other data would cause a collapse (Green line shouldn't be collapsed, but other rows should be)
Before
After
Green line and Mattapan both have extra rows (Green should be collapsed / Mattapan should remain visible)
Before
After
Asana Tickets
Blocked by: