🔒 (security) security improvement
This commit is contained in:
@ -1,32 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { HeroUIProvider, ToastProvider } from "@heroui/react";
|
||||
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
const HeroUIWrapper = ({
|
||||
children,
|
||||
}: Readonly<{ children: React.ReactNode }>) => {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<HeroUIProvider navigate={router.push}>
|
||||
<ToastProvider />
|
||||
{mounted ? (
|
||||
<NextThemesProvider attribute={"class"} defaultTheme="dark">
|
||||
<main>{children}</main>
|
||||
</NextThemesProvider>
|
||||
) : (
|
||||
<main className="dark text-foreground bg-background">{children}</main>
|
||||
)}
|
||||
</HeroUIProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export default HeroUIWrapper;
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { HeroUIProvider, ToastProvider } from "@heroui/react";
|
||||
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
const HeroUIWrapper = ({
|
||||
children,
|
||||
}: Readonly<{ children: React.ReactNode }>) => {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<HeroUIProvider navigate={router.push}>
|
||||
<ToastProvider />
|
||||
{mounted ? (
|
||||
<NextThemesProvider attribute={"class"} defaultTheme="dark">
|
||||
<main>{children}</main>
|
||||
</NextThemesProvider>
|
||||
) : (
|
||||
<main className="dark text-foreground bg-background">{children}</main>
|
||||
)}
|
||||
</HeroUIProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export default HeroUIWrapper;
|
||||
|
||||
@ -1,60 +1,60 @@
|
||||
import React from "react";
|
||||
import localFont from "next/font/local";
|
||||
|
||||
const Geist = localFont({
|
||||
src: [
|
||||
{
|
||||
path: "../../fonts/Geist-Black.ttf",
|
||||
weight: "900",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-ExtraBold.ttf",
|
||||
weight: "800",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-Bold.ttf",
|
||||
weight: "700",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-SemiBold.ttf",
|
||||
weight: "600",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-Medium.ttf",
|
||||
weight: "500",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-Regular.ttf",
|
||||
weight: "400",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-Light.ttf",
|
||||
weight: "300",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-ExtraLight.ttf",
|
||||
weight: "200",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-Thin.ttf",
|
||||
weight: "100",
|
||||
style: "normal",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const GeistFontProvider = ({
|
||||
children,
|
||||
}: Readonly<{ children: React.ReactNode }>) => {
|
||||
return <div className={`${Geist.className}`}>{children}</div>;
|
||||
};
|
||||
|
||||
export default GeistFontProvider;
|
||||
import React from "react";
|
||||
import localFont from "next/font/local";
|
||||
|
||||
const Geist = localFont({
|
||||
src: [
|
||||
{
|
||||
path: "../../fonts/Geist-Black.ttf",
|
||||
weight: "900",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-ExtraBold.ttf",
|
||||
weight: "800",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-Bold.ttf",
|
||||
weight: "700",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-SemiBold.ttf",
|
||||
weight: "600",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-Medium.ttf",
|
||||
weight: "500",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-Regular.ttf",
|
||||
weight: "400",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-Light.ttf",
|
||||
weight: "300",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-ExtraLight.ttf",
|
||||
weight: "200",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../../fonts/Geist-Thin.ttf",
|
||||
weight: "100",
|
||||
style: "normal",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const GeistFontProvider = ({
|
||||
children,
|
||||
}: Readonly<{ children: React.ReactNode }>) => {
|
||||
return <div className={`${Geist.className}`}>{children}</div>;
|
||||
};
|
||||
|
||||
export default GeistFontProvider;
|
||||
|
||||
Reference in New Issue
Block a user