simularium / simularium-website

Front end website for the Simularium project, includes the Simularium viewer
https://simularium.allencell.org
Apache License 2.0
6 stars 3 forks source link

Feature/information panel #532

Closed interim17 closed 3 weeks ago

interim17 commented 1 month ago

Time estimate or Size

medium: 10-15

Problem

Closes #411

Solution

New redux actions/type/constant/state for selectedAgent

ViewerPanel

Retrieve agent meta data via the new viewer callback onFollowObjectChanged and put into redux as AgentMetadata.

ModelPanel -> SidebarContents

Get metadata from state and pass it (and UIDisplayData) down to new Metadata Panel. Refactored both of these components from Classes into Functional Components, trivial because no lifecycle methods. Small tweaks to html structure and CSS

MetadataPanel

Hopefully it reads easily, is fairly self explanatory. Use helper functions and manage a few pieces of state/constants to track whether the panel is open and what it should display.

selectedAgentNotRendered is truthy only when the agent type is a positive number, greater than the number of agents in UIDisplayData. I don't know if there are any other ways to check for an agent that exists, but has "left the simulation" that don't collide with the null state where the id is -1.

Steps to Verify:

  1. Open and close the panel.
  2. Select/deselect agents, play the sim and verify that data updates

Screenshots (optional):

Screenshot 2024-06-12 at 4 40 08 PM Screenshot 2024-06-12 at 4 40 16 PM Screenshot 2024-06-12 at 4 40 35 PM Screenshot 2024-06-12 at 4 40 26 PM

Thanks for contributing!

github-actions[bot] commented 1 month ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
66.23% (-0.03% πŸ”»)
651/983
🟑 Branches 65.73% 94/143
πŸ”΄ Functions
34.8% (-0.3% πŸ”»)
87/250
🟑 Lines
64.56% (-0.09% πŸ”»)
581/900
Show files with reduced coverage πŸ”»
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------- | :------------------------------------------------------------- | :------- | :------------------------------------------------------------- | :------------------------------------------------------------- | | πŸ”΄ |
`...` / reducer.ts
|
20% (-1.74% πŸ”»)
| 100% | 0% |
20% (-1.74% πŸ”»)
| | πŸ”΄ |
`...` / actions.ts
|
52.38% (-0.25% πŸ”»)
| 100% | 0% |
52.38% (-0.25% πŸ”»)
| | 🟒 |
`...` / basic.ts
|
85.71% (-3.17% πŸ”»)
| 100% |
57.14% (-9.52% πŸ”»)
|
81.82% (-7.07% πŸ”»)
|

Test suite run success

111 tests passing in 7 suites.

Report generated by πŸ§ͺjest coverage report action from 91f93b8abc8d99332f26123e10dbd739769dc4f2