diff --git a/src/api/api.ts b/src/api/api.ts index 547ea56..435efe1 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -26,7 +26,7 @@ import { AIRequestsV2, Assistants, OpenAI, - SinglePayment + SinglePayment, } from './resources' const api = { diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index 7103ae9..32c2b4f 100755 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useMemo, useState } from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { Routes, Route, @@ -109,6 +109,7 @@ import AdvisorChatPage from "../pages/AdvisorChat"; import PaymentWithEmailPage from "../pages/PaymentWithEmailPage"; import SuccessPaymentPage from "../pages/PaymentWithEmailPage/ResultPayment/SuccessPaymentPage"; import FailPaymentPage from "../pages/PaymentWithEmailPage/ResultPayment/FailPaymentPage"; +import { useSchemeColorByElement } from "@/hooks/useSchemeColorByElement"; import GetInformationPartnerPage from "../pages/GetInformationPartner"; const isProduction = import.meta.env.MODE === "production"; @@ -228,6 +229,26 @@ function App(): JSX.Element { } }, [dispatch]); + // useEffect(() => { + // const motion = window.matchMedia("(prefers-reduced-motion: no-preference)"); + // if (motion.matches) { + // const scheme = document.querySelector('meta[name="theme-color"]'); + // console.log(document.querySelectorAll("section.page")[0]); + // let hue = 0; + // let color; + // const backgroundColor = + // window.getComputedStyle(document.querySelectorAll("section.page")[0]) + // .backgroundColor || "#ffffff"; + // scheme?.setAttribute("content", backgroundColor); + + // setInterval(() => { + // color = `hsl(${(hue += 5)} 50% 30%)`; + // document.body.style.background = color; + // scheme?.setAttribute("content", color); + // }, 50); + // } + // }, []); + return ( }> @@ -550,6 +571,19 @@ function Layout({ setIsSpecialOfferOpen }: LayoutProps): JSX.Element { const changeIsSpecialOfferOpen = () => setIsSpecialOfferOpen(true); const homeConfig = useSelector(selectors.selectHome); const showNavbarFooter = homeConfig.isShowNavbar; + const mainRef = useRef(null); + // console.log( + // mainRef.current?.querySelectorAll("section.page, .page, section") + // ); + useSchemeColorByElement(mainRef.current, "section.page, .page, section", [ + location, + ]); + // useEffect(() => { + // console.log( + // "###$", + // mainRef.current?.querySelectorAll("section.page, .page, section")[0] + // ); + // }, [location]); const birthdate = useSelector(selectors.selectBirthdate); const dataItems = useMemo(() => [birthdate], [birthdate]); @@ -644,7 +678,7 @@ function Layout({ setIsSpecialOfferOpen }: LayoutProps): JSX.Element { )} -
+
{showFooter ?