fix: enable toast in admin app. (#4545)

This commit is contained in:
Prateek Shourya 2024-05-22 12:34:57 +05:30 committed by GitHub
parent 6eca4a1f1f
commit 0c80cf3d54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,12 +1,14 @@
"use client"; "use client";
import { ReactNode } from "react"; import { ReactNode } from "react";
import { ThemeProvider } from "next-themes"; import { ThemeProvider, useTheme } from "next-themes";
import { SWRConfig } from "swr"; import { SWRConfig } from "swr";
// ui
import { Toast } from "@plane/ui";
// constants // constants
import { SWR_CONFIG } from "@/constants/swr-config"; import { SWR_CONFIG } from "@/constants/swr-config";
// helpers // helpers
import { ASSET_PREFIX } from "@/helpers/common.helper"; import { ASSET_PREFIX, resolveGeneralTheme } from "@/helpers/common.helper";
// lib // lib
import { InstanceProvider } from "@/lib/instance-provider"; import { InstanceProvider } from "@/lib/instance-provider";
import { StoreProvider } from "@/lib/store-provider"; import { StoreProvider } from "@/lib/store-provider";
@ -15,6 +17,9 @@ import { UserProvider } from "@/lib/user-provider";
import "./globals.css"; import "./globals.css";
function RootLayout({ children }: { children: ReactNode }) { function RootLayout({ children }: { children: ReactNode }) {
// themes
const { resolvedTheme } = useTheme();
return ( return (
<html lang="en"> <html lang="en">
<head> <head>
@ -26,6 +31,7 @@ function RootLayout({ children }: { children: ReactNode }) {
</head> </head>
<body className={`antialiased`}> <body className={`antialiased`}>
<ThemeProvider themes={["light", "dark"]} defaultTheme="system" enableSystem> <ThemeProvider themes={["light", "dark"]} defaultTheme="system" enableSystem>
<Toast theme={resolveGeneralTheme(resolvedTheme)} />
<SWRConfig value={SWR_CONFIG}> <SWRConfig value={SWR_CONFIG}>
<StoreProvider> <StoreProvider>
<InstanceProvider> <InstanceProvider>