mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-18 02:29:49 +00:00
Run pre-commit hooks over existing codebase
Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
parent
fa50bbad9c
commit
19c25713c4
387 changed files with 4785 additions and 4109 deletions
|
@ -7,9 +7,13 @@ import Error from "../../../components/services/widget/error";
|
|||
|
||||
export default function Integration({ config, params }) {
|
||||
const { setEvents } = useContext(EventContext);
|
||||
const { data: sonarrData, error: sonarrError } = useWidgetAPI(config, "calendar",
|
||||
{ ...params, includeSeries: 'true', includeEpisodeFile: 'false', includeEpisodeImages: 'false', ...config?.params ?? {} }
|
||||
);
|
||||
const { data: sonarrData, error: sonarrError } = useWidgetAPI(config, "calendar", {
|
||||
...params,
|
||||
includeSeries: "true",
|
||||
includeEpisodeFile: "false",
|
||||
includeEpisodeImages: "false",
|
||||
...(config?.params ?? {}),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!sonarrData || sonarrError) {
|
||||
|
@ -18,19 +22,19 @@ export default function Integration({ config, params }) {
|
|||
|
||||
const eventsToAdd = {};
|
||||
|
||||
sonarrData?.forEach(event => {
|
||||
sonarrData?.forEach((event) => {
|
||||
const title = `${event.series.title ?? event.title} - S${event.seasonNumber}E${event.episodeNumber}`;
|
||||
|
||||
eventsToAdd[title] = {
|
||||
title,
|
||||
date: DateTime.fromISO(event.airDateUtc),
|
||||
color: config?.color ?? 'teal'
|
||||
color: config?.color ?? "teal",
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
setEvents((prevEvents) => ({ ...prevEvents, ...eventsToAdd }));
|
||||
}, [sonarrData, sonarrError, config, setEvents]);
|
||||
|
||||
const error = sonarrError ?? sonarrData?.error;
|
||||
return error && <Error error={{ message: `${config.type}: ${error.message ?? error}`}} />
|
||||
return error && <Error error={{ message: `${config.type}: ${error.message ?? error}` }} />;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue