mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-22 13:44:46 +08:00
feat: Add ThemeProviderWrapper for theme management
This commit is contained in:
29
web/src/app/_components/theme-provider-wrapper.tsx
Normal file
29
web/src/app/_components/theme-provider-wrapper.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
"use client";
|
||||
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
import { ThemeProvider } from "~/components/theme-provider";
|
||||
|
||||
export function ThemeProviderWrapper({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const pathname = usePathname();
|
||||
const isChatPage = pathname?.startsWith("/chat");
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme={"dark"}
|
||||
enableSystem={isChatPage}
|
||||
forcedTheme={isChatPage ? undefined : "dark"}
|
||||
disableTransitionOnChange
|
||||
>
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user