Management of layout through state #4
Replies: 5 comments 3 replies
-
@TangoYankee Thanks for putting this together. Some of this will probably be easiest to talk through with James but let me share some immediate reactions to what you have above.
Correct. We can use Chakra's modal for this, which in turn is using a portal. I have a draft issue to passthrough the modal component in Streetscape. I don't think the expectation is that the modal being opened or closed would be reflected in the URL.
I was thinking the commitments would just be loaded for the capital project route and the state for toggling the accordion would be handled locally, defaulting to closed, but we could get James' take on this. It's simple enough from a routing perspective and there is some value to "lazy loading" the commitments. |
Beta Was this translation helpful? Give feedback.
-
Route for viewing a project selected directly from the mapThere may be an argument for having a |
Beta Was this translation helpful? Give feedback.
-
Reading these back, I'm reminded that |
Beta Was this translation helpful? Give feedback.
-
@TangoYankee It seems like a lot of the complexity comes from how to best handle the geography filter menu with routing. I'm going to describe one potential solution here, feel free to poke holes. It may be easier to talk through it IRL so I'm happy to do that as well.
I'll take a swing at implementing this and see how far I get. If nothing else, it'll be a good chance for me to get some familiarity with Remix's router. |
Beta Was this translation helpful? Give feedback.
-
@TangoYankee The details here in combination with the Figma are looking good. I created a milestone to group together Issues related to front end implementation. While I'm out, try to work with folks as they are picked up to incorporate the routing requirements into the AC where relevant. |
Beta Was this translation helpful? Give feedback.
-
The Capital Planning map has components to manage information on the screen.
These components are broadly:
The behavior of these components differs between mobile and desktop. Desktop allows almost all of them to appear simultaneously. Mobile only shows one component at a time but offers the option to navigate back to a previous component. In the mobile scenario, the components need a way to "know" about each other and the previous states of the layout. In these scenarios, a higher-level state manager can hold this information in a central location and make it easier to reason about. In the case of Capital Planning map, we are using Remix which has a robust routing system that can hold the state of the system. Because it hooks into the browser's routing API, we also get access to the history API and a "free" state stack that we can navigate through. Although, not of all the components can be mapped directly to a route. The welcome panel can appear on any route with the desktop version. However, it can only appear on the base route of the mobile version. To reflect this, we will need a state management paradigm that is decoupled from the URL paths. This could be either in-memory or embedded in a query parameter. We can decide which works best with the overall architecture as we get more details. For now, it is referred to generically as "component layout sets"
Before we start writing components, we should design this state management system. The components can then more easily fit within the context of this system.
Visual representation
Figma Wireframes
URLs:
The URLs manage the "macro state" of the layout. Each URL corresponds to
Root
/
Community Districts
Geography Selection
/community-districts
Geography Selection: Borough Selected
/community-districts/{boroughId}
Geography Selection: Borough and Community District Selected
/community-districts/{boroughId}/{communityDistrictId}
Capital Projects Panel: Show list of projects
/community-districts/{boroughId}/{communityDistrictId/capital-projects
Capital Projects Panel: Show details of a specific project
/community-districts/{boroughId}/{communityDistrictId/capital-projects/{capitalProjectId}
Capital Projects Panel: Show commitment details for a project
/community-districts/{boroughId}/{communityDistrictId/capital-projects/{capitalProjectId}/commitments
City Council Districts
Geometry selection
/city-council-districts
Geometry Selection: CCD selected
/city-council-districts/{cityCouncilDistrictId}
Capital Projects Panel: Show list of projects
/city-council-districts/{cityCouncilDistrictId}/capital-projects
Capital Projects Panel: Show details of a specific project
/city-council-districts/{cityCouncilDistrictId}/capital-projects/{capitalProjectId}
Capital Projects Panel: Show commitment details for a project
/city-council-districts/{cityCouncilDistrictId}/capital-projects/{capitalProjectId}/commitments
Component Layout Sets
default
sparse
geographySelector
Component behavior
Welcome Panel
Mobile
Desktop
Geography Filter Button
Mobile
Desktop
Geography Selector Panel
Mobile
Desktop
Project Information Panels
Mobile and Desktop
User-driven state changes
Now that we have defined the states and their associated layouts, we can discuss how to move between different states.
On page load
Clicking the welcome Information Panel
Clicking the Geography Filter Button
Selecting a geography in the first dropdown of the Geography Selector Panel
community-districts
Selecting a specific geography in the Geography Selector Panel
community-districts/boroughId/communityDistrictId
Clicking "Go to Selected Geography"
Clicking on a specific project
Clicking on the commitments dropdown
Toggling the commitments closed
Clicking on the Mobile Project Information Back button
Clicking on the Desktop Project Information Close button
Beta Was this translation helpful? Give feedback.
All reactions