mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-13 20:52:45 +08:00
Run pre-commit hooks over existing codebase
Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
@@ -7,9 +7,11 @@ import Error from "../../../components/services/widget/error";
|
||||
|
||||
export default function Integration({ config, params }) {
|
||||
const { setEvents } = useContext(EventContext);
|
||||
const { data: lidarrData, error: lidarrError } = useWidgetAPI(config, "calendar",
|
||||
{ ...params, includeArtist: 'false', ...config?.params ?? {} }
|
||||
);
|
||||
const { data: lidarrData, error: lidarrError } = useWidgetAPI(config, "calendar", {
|
||||
...params,
|
||||
includeArtist: "false",
|
||||
...(config?.params ?? {}),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!lidarrData || lidarrError) {
|
||||
@@ -18,19 +20,19 @@ export default function Integration({ config, params }) {
|
||||
|
||||
const eventsToAdd = {};
|
||||
|
||||
lidarrData?.forEach(event => {
|
||||
lidarrData?.forEach((event) => {
|
||||
const title = `${event.artist.artistName} - ${event.title}`;
|
||||
|
||||
eventsToAdd[title] = {
|
||||
title,
|
||||
date: DateTime.fromISO(event.releaseDate),
|
||||
color: config?.color ?? 'green'
|
||||
color: config?.color ?? "green",
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
setEvents((prevEvents) => ({ ...prevEvents, ...eventsToAdd }));
|
||||
}, [lidarrData, lidarrError, config, setEvents]);
|
||||
|
||||
const error = lidarrError ?? lidarrData?.error;
|
||||
return error && <Error error={{ message: `${config.type}: ${error.message ?? error}`}} />
|
||||
return error && <Error error={{ message: `${config.type}: ${error.message ?? error}` }} />;
|
||||
}
|
||||
|
||||
@@ -9,9 +9,10 @@ import Error from "../../../components/services/widget/error";
|
||||
export default function Integration({ config, params }) {
|
||||
const { t } = useTranslation();
|
||||
const { setEvents } = useContext(EventContext);
|
||||
const { data: radarrData, error: radarrError } = useWidgetAPI(config, "calendar",
|
||||
{ ...params, ...config?.params ?? {} }
|
||||
);
|
||||
const { data: radarrData, error: radarrError } = useWidgetAPI(config, "calendar", {
|
||||
...params,
|
||||
...(config?.params ?? {}),
|
||||
});
|
||||
useEffect(() => {
|
||||
if (!radarrData || radarrError) {
|
||||
return;
|
||||
@@ -19,7 +20,7 @@ export default function Integration({ config, params }) {
|
||||
|
||||
const eventsToAdd = {};
|
||||
|
||||
radarrData?.forEach(event => {
|
||||
radarrData?.forEach((event) => {
|
||||
const cinemaTitle = `${event.title} - ${t("calendar.inCinemas")}`;
|
||||
const physicalTitle = `${event.title} - ${t("calendar.physicalRelease")}`;
|
||||
const digitalTitle = `${event.title} - ${t("calendar.digitalRelease")}`;
|
||||
@@ -27,23 +28,23 @@ export default function Integration({ config, params }) {
|
||||
eventsToAdd[cinemaTitle] = {
|
||||
title: cinemaTitle,
|
||||
date: DateTime.fromISO(event.inCinemas),
|
||||
color: config?.color ?? 'amber'
|
||||
color: config?.color ?? "amber",
|
||||
};
|
||||
eventsToAdd[physicalTitle] = {
|
||||
title: physicalTitle,
|
||||
date: DateTime.fromISO(event.physicalRelease),
|
||||
color: config?.color ?? 'cyan'
|
||||
color: config?.color ?? "cyan",
|
||||
};
|
||||
eventsToAdd[digitalTitle] = {
|
||||
title: digitalTitle,
|
||||
date: DateTime.fromISO(event.digitalRelease),
|
||||
color: config?.color ?? 'emerald'
|
||||
color: config?.color ?? "emerald",
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
setEvents((prevEvents) => ({ ...prevEvents, ...eventsToAdd }));
|
||||
}, [radarrData, radarrError, config, setEvents, t]);
|
||||
|
||||
const error = radarrError ?? radarrData?.error;
|
||||
return error && <Error error={{ message: `${config.type}: ${error.message ?? error}`}} />
|
||||
return error && <Error error={{ message: `${config.type}: ${error.message ?? error}` }} />;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,11 @@ import Error from "../../../components/services/widget/error";
|
||||
|
||||
export default function Integration({ config, params }) {
|
||||
const { setEvents } = useContext(EventContext);
|
||||
const { data: readarrData, error: readarrError } = useWidgetAPI(config, "calendar",
|
||||
{ ...params, includeAuthor: 'true', ...config?.params ?? {} },
|
||||
);
|
||||
const { data: readarrData, error: readarrError } = useWidgetAPI(config, "calendar", {
|
||||
...params,
|
||||
includeAuthor: "true",
|
||||
...(config?.params ?? {}),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!readarrData || readarrError) {
|
||||
@@ -18,20 +20,20 @@ export default function Integration({ config, params }) {
|
||||
|
||||
const eventsToAdd = {};
|
||||
|
||||
readarrData?.forEach(event => {
|
||||
const authorName = event.author?.authorName ?? event.authorTitle.replace(event.title, '');
|
||||
const title = `${authorName} - ${event.title} ${event?.seriesTitle ? `(${event.seriesTitle})` : ''} `;
|
||||
readarrData?.forEach((event) => {
|
||||
const authorName = event.author?.authorName ?? event.authorTitle.replace(event.title, "");
|
||||
const title = `${authorName} - ${event.title} ${event?.seriesTitle ? `(${event.seriesTitle})` : ""} `;
|
||||
|
||||
eventsToAdd[title] = {
|
||||
title,
|
||||
date: DateTime.fromISO(event.releaseDate),
|
||||
color: config?.color ?? 'rose'
|
||||
color: config?.color ?? "rose",
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
setEvents((prevEvents) => ({ ...prevEvents, ...eventsToAdd }));
|
||||
}, [readarrData, readarrError, config, setEvents]);
|
||||
|
||||
const error = readarrError ?? readarrData?.error;
|
||||
return error && <Error error={{ message: `${config.type}: ${error.message ?? error}`}} />
|
||||
return error && <Error error={{ message: `${config.type}: ${error.message ?? error}` }} />;
|
||||
}
|
||||
|
||||
@@ -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}` }} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user