* add basic profile page * apps/web: detect telegram/browser support browser (dev only) * apps/web: add dark mode * apps/web: support dark theme in tma * apps/web: add loading spinner remove dev info from page * apps\web\app\(auth)\page.tsx: remove useState * app/web: handle update profile name * move debounce functional to hook * add role checkbox
35 lines
734 B
TypeScript
35 lines
734 B
TypeScript
'use client';
|
|
import { ThemeProvider as NextThemesProvider } from 'next-themes';
|
|
import { type ComponentProps, useEffect, useState } from 'react';
|
|
|
|
/**
|
|
* mouted - fix for Next.js 15 Hydration Failed
|
|
*/
|
|
export function ThemeProvider({
|
|
children,
|
|
...props
|
|
}: Readonly<ComponentProps<typeof NextThemesProvider>>) {
|
|
const [mounted, setMounted] = useState(false);
|
|
|
|
useEffect(() => {
|
|
setMounted(true);
|
|
}, []);
|
|
|
|
if (!mounted) {
|
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
return <></>;
|
|
}
|
|
|
|
return (
|
|
<NextThemesProvider
|
|
{...props}
|
|
attribute="class"
|
|
defaultTheme="system"
|
|
disableTransitionOnChange
|
|
enableSystem
|
|
>
|
|
{children}
|
|
</NextThemesProvider>
|
|
);
|
|
}
|