mirror of
https://github.com/gethomepage/homepage.git
synced 2026-10-04 01:41:16 -07:00
Or this
This commit is contained in:
@@ -30,10 +30,6 @@ export function ColorProvider({ initialTheme, children }) {
|
||||
lastColor = rawColor;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (initialTheme !== undefined) setColor(initialTheme ?? getInitialColor());
|
||||
}, [initialTheme]);
|
||||
|
||||
useEffect(() => {
|
||||
rawSetColor(color);
|
||||
}, [color]);
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -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,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 = {
|
||||
|
||||
Reference in New Issue
Block a user