Make NavBar React (Part 2) - #1576
Conversation
|
Hi @david-yz-liu, I've done some work here to move towards the goal of having the export modal be controlled using React state rather than direct DOM manipulation, however I'm running into some failures with the pre-existing tests for the graph dropdown, and I'm unsure how to proceed. Right now, the tests in After some digging, I found that the duplicate "Graph" elements are coming from two sources: one is part of the actual React NavBar, and the other is injected into the test DOM via This didn’t cause issues in my first NavBar PR because the NavBar was rendered at the root level and wasn't included within the Container component ( I'm looking for guidance on the best way to go about resolving this. Thanks in advance! |
|
Hi @akarki2005, thanks for your detailed comment! Honestly with the change that you're working on, I don't think pre-rendering the nav bar in |
Pull Request Test Coverage Report for Build 2bca8f6f-d54f-47fc-a183-b940959a2751Details
💛 - Coveralls |
david-yz-liu
left a comment
There was a problem hiding this comment.
@akarki2005 all of the code changes look great.
Now that we've added this component to under the graph/grid components, please add some tests for the export modal functionality.
(It doesn't seem like there were any tests for the export modal functionality before, so this is a great time to add some!)
david-yz-liu
left a comment
There was a problem hiding this comment.
@akarki2005 the tests you added were good, but please also add some functional tests for the graph/grid components to check that clicking the export button also causes the modal to appear.
009f19e to
db5fe3b
Compare
|
Hi @david-yz-liu, I've added tests for both the graph and grid pages to make verify the functionality of the export button. In doing this, I also had to move the DOM mounting code located at the bottom of Please let me know if any changes are required - thanks! |
david-yz-liu
left a comment
There was a problem hiding this comment.
@akarki2005 the changes are all good, except when moving the "main" code of the grid component into a separate file, you also need to make changes to the actual HTML of the front-end in order to load this file and get the Grid component to display!
…ether modal is open up to root level components; moved navbar inside containers for graph and grid rather than creating seperate root
f379529 to
aa6c843
Compare
david-yz-liu
left a comment
There was a problem hiding this comment.
Nice work, @akarki2005!
Proposed Changes
This change builds off of the previous PR that converted the navigation bar into a React component. With this PR, the codebase is refactored so that the display of the export modal relies entirely on React state, rather than direct DOM manipulation. To achieve this, state information about whether the modal is currently open was lifted up into root-level components for both the graph and grid pages (
Container.jsandGrid.js.jsxrespectively). Additionally, to help facilitate this change, the navigation bar was shifted inside these root-level components, so that clicking the export button on the NavBar can open up the export modal (update state) without the use of vanilla DOM manipulation.Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request: