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

feat: Current elevator closure layout #2315

Merged
merged 18 commits into from
Dec 3, 2024
Merged

Conversation

cmaddox5
Copy link
Contributor

@cmaddox5 cmaddox5 commented Nov 25, 2024

This PR adds a new layout for elevator screens. When the current elevator is closed at all, we show this layout that helps riders get to an alternate elevator. Maps will be created by Betsy and added to S3. Coordinates for the map marker will also be provided by Betsy.

Config that can be used for testing:

{
  "ELE-101": {
    "disabled": false,
    "name": "",
    "app_id": "elevator_v2",
    "app_params": {
      "evergreen_content": [],
      "elevator_id": "842",
      "alternate_direction_text": "Alternate direction text goes here. This is the largest body text class. Use this for shorter sets of directions. Add up to 6 lines at this size",
      "accessible_path_image_url": "images/elevator/maps/forest-hills-map.png",
      "accessible_path_direction_arrow": "e",
      "accessible_path_image_here_coordinates": {
        "x": 151,
        "y": 182
      }
    },
    "device_id": "",
    "hidden_from_screenplay": false,
    "refresh_if_loaded_before": null,
    "tags": [],
    "vendor": "mimo"
  }
}

@cmaddox5 cmaddox5 force-pushed the cm/current-station-closure branch 4 times, most recently from 3d38319 to 3f58dc3 Compare November 25, 2024 19:55
@cmaddox5 cmaddox5 marked this pull request as ready for review November 25, 2024 20:07
@cmaddox5 cmaddox5 requested a review from a team as a code owner November 25, 2024 20:07
assets/css/v2/elevator/elevator_closures.scss Outdated Show resolved Hide resolved
assets/css/v2/elevator/elevator_closures.scss Outdated Show resolved Hide resolved
assets/css/v2/elevator/elevator_closures.scss Outdated Show resolved Hide resolved
assets/css/v2/elevator/elevator_closures.scss Outdated Show resolved Hide resolved
assets/css/v2/elevator/elevator_closures.scss Outdated Show resolved Hide resolved
assets/src/components/v2/elevator/elevator_closures.tsx Outdated Show resolved Hide resolved
assets/src/components/v2/elevator/elevator_closures.tsx Outdated Show resolved Hide resolved
lib/screens/v2/candidate_generator/elevator/closures.ex Outdated Show resolved Hide resolved
lib/screens/v2/widget_instance/blue_bikes.ex Show resolved Hide resolved
@cmaddox5 cmaddox5 force-pushed the cm/current-station-closure branch from 32b20af to eecb902 Compare December 2, 2024 20:18
@cmaddox5 cmaddox5 force-pushed the cm/current-station-closure branch from eecb902 to 5db01b9 Compare December 2, 2024 20:20
Copy link
Contributor

@digitalcora digitalcora left a comment

Choose a reason for hiding this comment

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

Approving with one suggestion, take it if you'd like — this is now over a week old (though I know holidays etc.) and seems in good shape, so I don't want to hold it up any further!

lastUpdate={lastUpdate}
onFinish={onFinish}
/>
{currentElevatorClosure ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

We might have already talked about this, but I think it could be worthwhile to move this conditional to the widget generation. This single "widget" is basically two widgets in a trenchcoat — we always send over all the fields for both, and then throw half of them away, depending on a condition the server itself could easily check. In other words, we could instead have a CurrentElevatorClosed widget and an OutsideClosures widget on the backend, each populated with only the fields needed for that "view".

I could be missing something about future plans for this widget that might require it to have access to both sets of information at the same time, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Big fan of that approach. That would likely be a pretty big diff though. You think it makes sense here or should I create a followup PR?

Copy link
Contributor

@digitalcora digitalcora Dec 3, 2024

Choose a reason for hiding this comment

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

I think within this PR is actually the best place for it, since this is where we're introducing the second widget. Else we'd have (in the final commits on main) one commit that adds the widget using this approach, and a second that completely changes the approach. That's a lot of extra, and ultimately pointless, information for anyone looking at history to sort through.

I'm happy to quickly re-review the change if you want one more look at it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be good to go if you want to take a look.

@cmaddox5 cmaddox5 force-pushed the cm/current-station-closure branch from f7ac378 to 627f758 Compare December 3, 2024 17:46
Copy link
Contributor

@digitalcora digitalcora left a comment

Choose a reason for hiding this comment

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

Looking good!

assets/src/components/v2/elevator/models/station.ts Outdated Show resolved Hide resolved
end

describe "serialize/1" do
test "returns map with id, closure, and alternate direction info", %{instance: instance} do
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if we really need all these "it does the thing" tests for functions whose implementation is extremely basic... ideally the code paths would be covered by some higher-level test, but we have no such category of tests at the moment. Guess I won't make any specific recommendation here, just noting that it's an unfortunate situation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have this thought every time I make tests for a new widget. Definitely a good idea to put end-to-end framework tests on some kind of radar. Not sure if that's big enough to be roadmap worthy or if a simple tech-debt task would be sufficient?

@cmaddox5 cmaddox5 merged commit 69f0bb7 into main Dec 3, 2024
11 checks passed
@cmaddox5 cmaddox5 deleted the cm/current-station-closure branch December 3, 2024 20:21
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.

2 participants