This commit is contained in:
2026-03-10 08:56:20 +00:00
parent f26227c7a8
commit 921375c53d
22 changed files with 614 additions and 30 deletions
+13
View File
@@ -3,6 +3,7 @@ import type { AppProps } from "next/app";
import { createContext } from "react";
import { PagePropsType, TurboCIAdminAppContextType } from "../types";
import useAppInit from "../hooks/use-app-init";
import Toast from "@/twui/components/elements/Toast";
export const AppContext = createContext<TurboCIAdminAppContextType>(
{} as TurboCIAdminAppContextType,
@@ -11,9 +12,21 @@ export const AppContext = createContext<TurboCIAdminAppContextType>(
export default function App({ Component, pageProps }: AppProps<PagePropsType>) {
const init = useAppInit(pageProps);
const { toast, setToast } = init;
return (
<AppContext.Provider value={{ ...init }}>
<Component {...pageProps} />
<Toast
open={toast.toastOpen}
closeDispatch={(open) => {
setToast((prev) => ({ ...prev, toastOpen: false }));
}}
color={toast.toastStyle}
closeDelay={toast.closeDelay}
>
{toast.toastMessage}
</Toast>
</AppContext.Provider>
);
}