mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-06 13:35:48 +01:00
Add notifications for Calendar module
This commit is contained in:
@@ -3,6 +3,8 @@ import { Popover, Box, ScrollArea, Divider, Indicator } from '@mantine/core';
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Calendar } from '@mantine/dates';
|
import { Calendar } from '@mantine/dates';
|
||||||
import { CalendarIcon } from '@modulz/radix-icons';
|
import { CalendarIcon } from '@modulz/radix-icons';
|
||||||
|
import { showNotification } from '@mantine/notifications';
|
||||||
|
import { Check } from 'tabler-icons-react';
|
||||||
import { RadarrMediaDisplay, SonarrMediaDisplay } from './MediaDisplay';
|
import { RadarrMediaDisplay, SonarrMediaDisplay } from './MediaDisplay';
|
||||||
import { useConfig } from '../../../tools/state';
|
import { useConfig } from '../../../tools/state';
|
||||||
import { IModule } from '../modules';
|
import { IModule } from '../modules';
|
||||||
@@ -34,14 +36,36 @@ export default function CalendarComponent(props: any) {
|
|||||||
fetch(
|
fetch(
|
||||||
`${sonarrService?.url}api/calendar?apikey=${sonarrService?.apiKey}&end=${nextMonth}`
|
`${sonarrService?.url}api/calendar?apikey=${sonarrService?.apiKey}&end=${nextMonth}`
|
||||||
).then((response) => {
|
).then((response) => {
|
||||||
response.ok && response.json().then((data) => setSonarrMedias(data));
|
response.ok &&
|
||||||
|
response.json().then((data) => {
|
||||||
|
setSonarrMedias(data);
|
||||||
|
showNotification({
|
||||||
|
title: 'Sonarr',
|
||||||
|
icon: <Check />,
|
||||||
|
color: 'green',
|
||||||
|
autoClose: 1500,
|
||||||
|
radius: 'md',
|
||||||
|
message: `Loaded ${data.length} releases`,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (radarrService && radarrService.apiKey) {
|
if (radarrService && radarrService.apiKey) {
|
||||||
fetch(
|
fetch(
|
||||||
`${radarrService?.url}api/v3/calendar?apikey=${radarrService?.apiKey}&end=${nextMonth}`
|
`${radarrService?.url}api/v3/calendar?apikey=${radarrService?.apiKey}&end=${nextMonth}`
|
||||||
).then((response) => {
|
).then((response) => {
|
||||||
response.ok && response.json().then((data) => setRadarrMedias(data));
|
response.ok &&
|
||||||
|
response.json().then((data) => {
|
||||||
|
setRadarrMedias(data);
|
||||||
|
showNotification({
|
||||||
|
title: 'Radarr',
|
||||||
|
icon: <Check />,
|
||||||
|
color: 'green',
|
||||||
|
autoClose: 1500,
|
||||||
|
radius: 'md',
|
||||||
|
message: `Loaded ${data.length} releases`,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [config.services]);
|
}, [config.services]);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default function App(props: AppProps & { colorScheme: ColorScheme }) {
|
|||||||
withGlobalStyles
|
withGlobalStyles
|
||||||
withNormalizeCSS
|
withNormalizeCSS
|
||||||
>
|
>
|
||||||
<NotificationsProvider position="top-right">
|
<NotificationsProvider limit={2} position="top-right">
|
||||||
<ConfigProvider>
|
<ConfigProvider>
|
||||||
<Layout>
|
<Layout>
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
|
|||||||
Reference in New Issue
Block a user