Skip to content

Conversation

@Japleen-Kaur2409
Copy link
Contributor

Proposed Changes

  • Refactor GraphDropdown component from being a child of Graph to being a child of NavBar
  • Removed the current logic for controlling this using direct DOM manipulation, and refactored the code so that it is controlled entirely through React props/state.

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue)
🎨 User interface change (change to user interface; provide screenshots)
♻️ Refactoring (internal change to codebase, without changing functionality) X
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

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:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.
  • I have updated the project Changelog (this is required for all changes).

After opening your pull request:

  • I have verified that the CircleCI checks have passed.
  • I have requested a review from a project maintainer.

import { CourseModal } from "../common/react_modal.js.jsx"
import { ExportModal } from "../common/export.js.jsx"
import { getProgram } from "../common/utils.js"
import { getPost } from "../common/utils.js"
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is unrelated to this PR

setDropdownTimeouts(dropdownTimeouts.concat(timeout))
}

React.useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation at this line is incorrect

}

React.useEffect(() => {
const navGraph = document.querySelector("#nav-graph")
Copy link
Contributor

Choose a reason for hiding this comment

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

Part of your task is to remove DOM manipulation. This includes accessing DOM elements direction and manually adding callbacks (addEventListener, below). Instead, these callbacks should be managed by the React components themselves. Make sure you understand the existing behaviour (on master) so that you can replicate it with your changes.

this.state.infoboxTimeouts.forEach(timeout => clearTimeout(timeout))
this.setState({ infoboxTimeouts: [] })
break
case TIMEOUT_NAMES_ENUM.DROPDOWN:
Copy link
Contributor

Choose a reason for hiding this comment

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

It's now possible that TIMEOUT_NAMES_ENUM.DROPDOWN is no longer used anywhere. Check this, and if so please delete the DROPDOWN value from the enum.

data-testid={"test-graph-dropdown"}
style={{ left: graphTabLeft }}
style={{ left: graphTabLeft, top: "50px", zIndex: 1000
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Put the }} on the same line as the {{.

Also, in this file there is still direct DOM manipulation, which you should remove by handling the logic in the parent NavBar component.

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