Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-calendar] Calendar view date #821

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ajwhatson
Copy link
Contributor

@ajwhatson ajwhatson commented May 1, 2020

This will navigate the calendar to a relevant date when a release is selected.

Undesirable behavior: Let's say a user went to select a release, but was viewing the calendar in a different month than one where the requested release had been promoted in. Then, when they select to view the release, the calendar could appear empty.

Fix: Change the calendar to display the month of the latest release promotion when a release is selected. Also, when a release is unselected, return the viewer to the current month.

Included:

  • reference to the calendar element, referenceCalendar, in order to access the FullCalendar method gotoDate(), https://fullcalendar.io/docs/Calendar-gotoDate.
  • creation of my own gotoDate(date: Date) which uses the referenceCalendar to change the calendar view date
  • use of gotoDate() when the Calendar component singleRelease state is changed
  • very unrelated to anything else, but the binding of handleReleaseClick() in ChannelTable that I should have done long ago
  • addition of a today button to take the user to the current month

@ajwhatson ajwhatson requested a review from estherkim May 1, 2020 17:51
} else {
this.setState({singleEvents: []});
this.gotoDate(new Date());
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious, does Full Calendar have a "go to Today" button option? Going back to the current date when you remove filters might be unexpected, so I'm not sure we should do this. But having a "go to Today" button would help!

} else {
this.setState({singleEvents: []});
}
}
}

gotoDate = (date: Date): void => {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why you use an anonymous function here and not a regular function syntax? (gotoDate(date: Date): void {)

Anonymous functions are more useful when you use them as, say, an argument to another function (e.g., arr.sort((firstEl, secondEl) => { ... }))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No there wasn't any reason. I just wasn't aware one was the "regular", and I've gotten used to the anonymous way since I use functions as arguments more often. I'll switch this one to the regular function syntax!

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants