Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion release-calendar/src/client/components/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export class Calendar extends React.Component<CalendarProps, CalendarState> {
this.apiService = new ApiService();
}

calendarReference = React.createRef<FullCalendar>();

async componentDidMount(): Promise<void> {
const promotions = await this.apiService.getPromotions();
this.setState({allEvents: getAllEvents(promotions)});
Expand All @@ -61,6 +63,7 @@ export class Calendar extends React.Component<CalendarProps, CalendarState> {
const promotionsOfSingleRelease = await this.apiService.getSinglePromotions(
this.props.singleRelease,
);
this.gotoDate(promotionsOfSingleRelease[0].date);
this.setState((prevState: CalendarState) => ({
singleEvents: getSingleReleaseEvents(
promotionsOfSingleRelease,
Expand All @@ -73,6 +76,11 @@ export class Calendar extends React.Component<CalendarProps, CalendarState> {
}
}

gotoDate(date: Date): void {
const calendarApi = this.calendarReference.current.getApi();
calendarApi.gotoDate(date);
}

render(): JSX.Element {
let displayEvents: ReleaseEventInput[] = [];
if (this.props.singleRelease) {
Expand All @@ -89,10 +97,11 @@ export class Calendar extends React.Component<CalendarProps, CalendarState> {
<FullCalendar
defaultView='dayGridMonth'
header={{
left: 'prev,next',
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,listWeek',
}}
ref={this.calendarReference}
plugins={[dayGridPlugin, timeGridPlugin]}
eventSources={[{events: displayEvents, textColor: 'white'}]}
contentHeight={CALENDAR_CONTENT_HEIGHT}
Expand Down
1 change: 1 addition & 0 deletions release-calendar/src/client/components/ChannelTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class ChannelTable extends React.Component<
};
this.apiService = new ApiService();
this.handleChannelClick = this.handleChannelClick.bind(this);
this.handleReleaseClick = this.handleReleaseClick.bind(this);
}

async componentDidMount(): Promise<void> {
Expand Down
4 changes: 4 additions & 0 deletions release-calendar/src/client/stylesheets/calendar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
@include off;
}

.fc-button-primary:disabled {
@include off;
}

.fc-unthemed td.fc-today {
background-color: base.$amp-yellow;
}
Expand Down