mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-03 13:42:12 +08:00
Feature: calendar widget (#2077)
* Implemented calendar Signed-off-by: Denis Papec <denis.papec@gmail.com> * Added lidarr events to calendar Signed-off-by: Denis Papec <denis.papec@gmail.com> * Added radarr events to calendar Signed-off-by: Denis Papec <denis.papec@gmail.com> * Added readarr events to calendar Signed-off-by: Denis Papec <denis.papec@gmail.com> * Added sonarr events to calendar Signed-off-by: Denis Papec <denis.papec@gmail.com> * fix sonarr series title * integrations * fix bad setstate call * handle user sets includeSeries: false for sonarr * Translate radarr release strings * Support all widths * readarr get author * Finished first day in week config Signed-off-by: Denis Papec <denis.papec@gmail.com> --------- Signed-off-by: Denis Papec <denis.papec@gmail.com> Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
28
src/utils/contexts/calendar.jsx
Normal file
28
src/utils/contexts/calendar.jsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { createContext, useState, useMemo } from "react";
|
||||
|
||||
export const EventContext = createContext();
|
||||
export const ShowDateContext = createContext();
|
||||
|
||||
export function EventProvider({ initialEvent, children }) {
|
||||
const [events, setEvents] = useState({});
|
||||
|
||||
if (initialEvent) {
|
||||
setEvents(initialEvent);
|
||||
}
|
||||
|
||||
const value = useMemo(() => ({ events, setEvents }), [events]);
|
||||
|
||||
return <EventContext.Provider value={value}>{children}</EventContext.Provider>;
|
||||
}
|
||||
|
||||
export function ShowDateProvider({ initialDate, children }) {
|
||||
const [showDate, setShowDate] = useState(null);
|
||||
|
||||
if (initialDate) {
|
||||
setShowDate(initialDate);
|
||||
}
|
||||
|
||||
const value = useMemo(() => ({ showDate, setShowDate }), [showDate]);
|
||||
|
||||
return <ShowDateContext.Provider value={value}>{children}</ShowDateContext.Provider>;
|
||||
}
|
||||
Reference in New Issue
Block a user