hackgvl / hackgreenville-com

HackGreenville's Website
https://hackgreenville.com
MIT License
16 stars 15 forks source link

Scroll calendar to current week on first load #276

Closed JSn1nj4 closed 2 weeks ago

JSn1nj4 commented 2 weeks ago

The basic requirements are listed here

  • Scroll to current on page load
  • Reset to top on next/previous
  • Only do this on the month view

Attempting to move to the current week happens from Full Calendar's loading hook, which seems to fire both when loading and after loading is completed.

It will only happen on first render using a local var. This is because this hook is fired on first load and every time someone navigates using the calendar's "Next"/"Previous" buttons.

Re-centering also doesn't happen if someone manually navigates back to the current month instead of reloading the page.

Resolves #253

allella commented 2 weeks ago

Thanks. Sounds like a good approach.

@zach2825 is doing a good deal of front-end these days, so perhaps he can give this one a review too as my JS was never that great and I'm rusty to boot.

JSn1nj4 commented 2 weeks ago

Ah ok, my bad. I'll tag Zach next time then instead for these frontend ones. Thanks!

bogdankharchenko commented 2 weeks ago

@JSn1nj4 I am not sure what is happening here - I pulled the branch down but not sure what the effect should be

JSn1nj4 commented 2 weeks ago

@bogdankharchenko it's just making the calendar view move down to the current week on initial render instead of sticking to the top of the month.

This does depend on the height of the calendar view and viewport though. The more of the month that shows vertically, or the closer to the top of the month the current week is, the less scroll there may be.

I'm going to check if there's an easy way to add a light scroll animation in a minute.

JSn1nj4 commented 2 weeks ago

Thanks @zach2825 for the smooth scroll suggestion. Didn't realize scrollTo() could do that natively. :slightly_smiling_face:

@bogdankharchenko how does this look?

bogdankharchenko commented 2 weeks ago

Thanks @zach2825 for the smooth scroll suggestion. Didn't realize scrollTo() could do that natively. 🙂

@bogdankharchenko how does this look?

Functionally, looks good but wasn't the one making this request.

👍