This commit is contained in:
shamoon
2026-08-21 12:33:35 -07:00
parent 2eaff4d9f2
commit dd6a7efee3
4 changed files with 3 additions and 21 deletions
-4
View File
@@ -30,10 +30,6 @@ export function ColorProvider({ initialTheme, children }) {
lastColor = rawColor;
};
useEffect(() => {
if (initialTheme !== undefined) setColor(initialTheme ?? getInitialColor());
}, [initialTheme]);
useEffect(() => {
rawSetColor(color);
}, [color]);
+1 -5
View File
@@ -1,14 +1,10 @@
import { createContext, useEffect, useMemo, useState } from "react";
import { createContext, useMemo, useState } from "react";
export const TabContext = createContext();
export function TabProvider({ initialTab, children }) {
const [activeTab, setActiveTab] = useState(() => initialTab ?? false);
useEffect(() => {
if (initialTab !== undefined) setActiveTab(initialTab ?? false);
}, [initialTab]);
const value = useMemo(() => ({ activeTab, setActiveTab }), [activeTab]);
return <TabContext.Provider value={value}>{children}</TabContext.Provider>;
-4
View File
@@ -31,10 +31,6 @@ export function ThemeProvider({ initialTheme, children }) {
localStorage.setItem("theme-mode", rawTheme);
};
useEffect(() => {
if (initialTheme !== undefined) setTheme(initialTheme ?? getInitialTheme());
}, [initialTheme]);
useEffect(() => {
rawSetTheme(theme);
}, [theme]);
+2 -8
View File
@@ -2,7 +2,7 @@ import Container from "components/services/widget/container";
import { DateTime } from "luxon";
import { useTranslation } from "next-i18next/pages";
import dynamic from "next/dynamic";
import { useContext, useEffect, useMemo, useState } from "react";
import { useContext, useMemo, useState } from "react";
import { SettingsContext } from "utils/contexts/settings";
import Agenda from "./agenda";
@@ -38,18 +38,12 @@ const colorVariants = {
export default function Component({ service }) {
const { widget } = service;
const { i18n } = useTranslation();
const [showDate, setShowDate] = useState(null);
const [events, setEvents] = useState({});
const nowDate = DateTime.now().setLocale(i18n.language);
const currentDate = widget?.timezone ? nowDate.setZone(widget?.timezone).startOf("day") : nowDate;
const [showDate, setShowDate] = useState(currentDate);
const { settings } = useContext(SettingsContext);
useEffect(() => {
if (!showDate) {
setShowDate(currentDate);
}
}, [showDate, currentDate]);
// params for API fetch
const params = useMemo(() => {
const constructedParams = {