diff --git a/frontend/src/Calendar/Day/CalendarDay.js b/frontend/src/Calendar/Day/CalendarDay.js
deleted file mode 100644
index b3da227dd..000000000
--- a/frontend/src/Calendar/Day/CalendarDay.js
+++ /dev/null
@@ -1,74 +0,0 @@
-import classNames from 'classnames';
-import moment from 'moment';
-import PropTypes from 'prop-types';
-import React from 'react';
-import * as calendarViews from 'Calendar/calendarViews';
-import CalendarEventConnector from 'Calendar/Events/CalendarEventConnector';
-import CalendarEventGroupConnector from 'Calendar/Events/CalendarEventGroupConnector';
-import styles from './CalendarDay.css';
-
-function CalendarDay(props) {
- const {
- date,
- time,
- isTodaysDate,
- events,
- view,
- onEventModalOpenToggle
- } = props;
-
- return (
-
- {
- view === calendarViews.MONTH &&
-
- {moment(date).date()}
-
- }
-
- {
- events.map((event) => {
- if (event.isGroup) {
- return (
-
- );
- }
-
- return (
-
- );
- })
- }
-
-
- );
-}
-
-CalendarDay.propTypes = {
- date: PropTypes.string.isRequired,
- time: PropTypes.string.isRequired,
- isTodaysDate: PropTypes.bool.isRequired,
- events: PropTypes.arrayOf(PropTypes.object).isRequired,
- view: PropTypes.string.isRequired,
- onEventModalOpenToggle: PropTypes.func.isRequired
-};
-
-export default CalendarDay;
diff --git a/frontend/src/Calendar/Day/CalendarDay.tsx b/frontend/src/Calendar/Day/CalendarDay.tsx
new file mode 100644
index 000000000..7538b0467
--- /dev/null
+++ b/frontend/src/Calendar/Day/CalendarDay.tsx
@@ -0,0 +1,80 @@
+import classNames from 'classnames';
+import moment from 'moment';
+import React from 'react';
+import * as calendarViews from 'Calendar/calendarViews';
+import CalendarEventConnector from 'Calendar/Events/CalendarEventConnector';
+import CalendarEventGroupConnector from 'Calendar/Events/CalendarEventGroupConnector';
+import Series from 'Series/Series';
+import CalendarEventGroup, { CalendarEvent } from 'typings/CalendarEventGroup';
+import styles from './CalendarDay.css';
+
+interface CalendarDayProps {
+ date: string;
+ time: string;
+ isTodaysDate: boolean;
+ events: (CalendarEvent | CalendarEventGroup)[];
+ view: string;
+ onEventModalOpenToggle(...args: unknown[]): unknown;
+}
+
+function CalendarDay(props: CalendarDayProps) {
+ const { date, time, isTodaysDate, events, view, onEventModalOpenToggle } =
+ props;
+
+ const ref = React.useRef(null);
+
+ React.useEffect(() => {
+ if (isTodaysDate && view === calendarViews.MONTH && ref.current) {
+ ref.current.scrollIntoView();
+ }
+ }, [time, isTodaysDate, view]);
+
+ return (
+
+ {view === calendarViews.MONTH && (
+
+ {moment(date).date()}
+
+ )}
+
+ {events.map((event) => {
+ if (event.isGroup) {
+ return (
+
+ );
+ }
+
+ return (
+
+ );
+ })}
+
+
+ );
+}
+
+export default CalendarDay;
diff --git a/frontend/src/Calendar/Events/CalendarEvent.js b/frontend/src/Calendar/Events/CalendarEvent.js
index 81d2beaf4..78d938e5c 100644
--- a/frontend/src/Calendar/Events/CalendarEvent.js
+++ b/frontend/src/Calendar/Events/CalendarEvent.js
@@ -236,6 +236,7 @@ class CalendarEvent extends Component {
CalendarEvent.propTypes = {
id: PropTypes.number.isRequired,
+ episodeId: PropTypes.number.isRequired,
series: PropTypes.object.isRequired,
episodeFile: PropTypes.object,
title: PropTypes.string.isRequired,
@@ -248,14 +249,15 @@ CalendarEvent.propTypes = {
hasFile: PropTypes.bool.isRequired,
grabbed: PropTypes.bool,
queueItem: PropTypes.object,
- showEpisodeInformation: PropTypes.bool.isRequired,
- showFinaleIcon: PropTypes.bool.isRequired,
- showSpecialIcon: PropTypes.bool.isRequired,
- showCutoffUnmetIcon: PropTypes.bool.isRequired,
- fullColorEvents: PropTypes.bool.isRequired,
- timeFormat: PropTypes.string.isRequired,
- colorImpairedMode: PropTypes.bool.isRequired,
- onEventModalOpenToggle: PropTypes.func.isRequired
+ // These props come from the connector, not marked as required to apease TS for now.
+ showEpisodeInformation: PropTypes.bool,
+ showFinaleIcon: PropTypes.bool,
+ showSpecialIcon: PropTypes.bool,
+ showCutoffUnmetIcon: PropTypes.bool,
+ fullColorEvents: PropTypes.bool,
+ timeFormat: PropTypes.string,
+ colorImpairedMode: PropTypes.bool,
+ onEventModalOpenToggle: PropTypes.func
};
export default CalendarEvent;
diff --git a/frontend/src/Calendar/Events/CalendarEventGroup.js b/frontend/src/Calendar/Events/CalendarEventGroup.js
index e62232e20..2527c09f7 100644
--- a/frontend/src/Calendar/Events/CalendarEventGroup.js
+++ b/frontend/src/Calendar/Events/CalendarEventGroup.js
@@ -235,14 +235,15 @@ class CalendarEventGroup extends Component {
}
CalendarEventGroup.propTypes = {
- series: PropTypes.object.isRequired,
+ // Most of these props come from the connector and are required, but TS is confused.
+ series: PropTypes.object,
events: PropTypes.arrayOf(PropTypes.object).isRequired,
- isDownloading: PropTypes.bool.isRequired,
- showEpisodeInformation: PropTypes.bool.isRequired,
- showFinaleIcon: PropTypes.bool.isRequired,
- fullColorEvents: PropTypes.bool.isRequired,
- timeFormat: PropTypes.string.isRequired,
- colorImpairedMode: PropTypes.bool.isRequired,
+ isDownloading: PropTypes.bool,
+ showEpisodeInformation: PropTypes.bool,
+ showFinaleIcon: PropTypes.bool,
+ fullColorEvents: PropTypes.bool,
+ timeFormat: PropTypes.string,
+ colorImpairedMode: PropTypes.bool,
onEventModalOpenToggle: PropTypes.func.isRequired
};
diff --git a/frontend/src/typings/CalendarEventGroup.ts b/frontend/src/typings/CalendarEventGroup.ts
new file mode 100644
index 000000000..2039f4615
--- /dev/null
+++ b/frontend/src/typings/CalendarEventGroup.ts
@@ -0,0 +1,15 @@
+import Episode from 'Episode/Episode';
+
+export interface CalendarEvent extends Episode {
+ isGroup: false;
+}
+
+interface CalendarEventGroup {
+ isGroup: true;
+ seriesId: number;
+ seasonNumber: number;
+ episodeIds: number[];
+ events: Episode[];
+}
+
+export default CalendarEventGroup;