34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import "@/src/styles/globals.css";
|
|
import "prism-themes/themes/prism-dracula.css";
|
|
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,
|
|
);
|
|
|
|
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>
|
|
);
|
|
}
|