nusmodifications / nusmods

🏫 Official course planning platform for National University of Singapore.
https://nusmods.com
MIT License
557 stars 270 forks source link

Autoscroll Course Planner to current year card #3640

Open jacobkwan opened 8 months ago

jacobkwan commented 8 months ago

Context

3639: Autoscroll Course Planner to current year on first render

Implementation

  1. Add currentYearCardRef state variable
  2. Only pass currentYearCardRef to the PlannerYear card for the current year of enrolment
  3. Define componentDidMount method in PlannerYear
    • Uses currentYearCardRef to get parent container and calculate offsets for child and parent
    • scrolls the desired amount (with smooth effect)

Before

https://github.com/nusmodifications/nusmods/assets/77665182/73a54f87-4da6-43ed-9bac-267ef656a392

After

https://github.com/nusmodifications/nusmods/assets/77665182/2fa24e4a-0337-4eea-8d34-39bcde10d12f

Other Information

vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nusmods-export ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 8, 2024 1:06pm
nusmods-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 8, 2024 1:06pm
vercel[bot] commented 8 months ago

@jacobkwan is attempting to deploy a commit to a Personal Account owned by @nusmodifications on Vercel.

@nusmodifications first needs to authorize it.

codecov[bot] commented 8 months ago

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 53.63%. Comparing base (d99218b) to head (904ba66).

Files Patch % Lines
website/src/views/planner/PlannerYear.tsx 0.00% 9 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3640 +/- ## ========================================== - Coverage 53.73% 53.63% -0.10% ========================================== Files 272 272 Lines 5959 5968 +9 Branches 1418 1421 +3 ========================================== - Hits 3202 3201 -1 - Misses 2757 2767 +10 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.