WikiEducationFoundation / WikiEduDashboard

Wiki Education Foundation's Wikipedia course dashboard system
https://dashboard.wikiedu.org
MIT License
385 stars 600 forks source link

Refactor: Migrated timeline.jsx from Class Based Components to Functional Components. #5835

Open Yash121l opened 2 weeks ago

Yash121l commented 2 weeks ago

What this PR does

This pull request refactors the Timeline component from a class-based component to a functional component using React hooks. The key issues it addresses are:

  1. Modernizing the Code: Updates the component to use modern React practices, improving readability and maintainability.
  2. Performance Improvement: Implements useCallback with throttling for the scroll event handler to enhance performance.
  3. State Management: Simplifies state management by using useState.

These changes result in cleaner, more efficient, and easier-to-maintain code, while aligning with current React standards.

Open questions and concerns

This is my first time contributing to the Wiki Education Foundation. Refactoring has improved my understanding of code organization. If you find any errors or poor coding practices, please let me know and provide feedback.

ragesoss commented 2 weeks ago

This is too complex of a file for me to feel comfortable with directly converting it to a functional component, and probably also larger than what you should attempt for a first PR. For this file in particular, I think we need to do some refactoring first to extract small components.