feat(api): require session authentication for admin routes and improve error handling fix(api): streamline project image generation by fetching data directly from the database fix(api): optimize project import/export functionality with session validation and improved error handling fix(api): enhance analytics dashboard and email manager with session token for admin requests fix(components): improve loading states and dynamic imports for better user experience chore(security): update Content Security Policy to avoid unsafe-eval in production chore(deps): update package.json scripts for consistent environment handling in linting and testing
90 lines
1.9 KiB
TypeScript
90 lines
1.9 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect, useState } from "react";
|
|
import dynamic from "next/dynamic";
|
|
|
|
// Dynamically import KernelPanic404Wrapper to avoid SSR issues
|
|
const KernelPanic404 = dynamic(() => import("./components/KernelPanic404Wrapper"), {
|
|
ssr: false,
|
|
loading: () => (
|
|
<div style={{
|
|
position: "fixed",
|
|
top: 0,
|
|
left: 0,
|
|
width: "100%",
|
|
height: "100%",
|
|
display: "flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
backgroundColor: "#020202",
|
|
color: "#33ff00",
|
|
fontFamily: "monospace"
|
|
}}>
|
|
<div>Loading terminal...</div>
|
|
</div>
|
|
),
|
|
});
|
|
|
|
export default function NotFound() {
|
|
// In tests, avoid next/dynamic loadable timing and render a stable fallback
|
|
if (process.env.NODE_ENV === "test") {
|
|
return (
|
|
<div>
|
|
Oops! The page you're looking for doesn't exist.
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const [mounted, setMounted] = useState(false);
|
|
|
|
useEffect(() => {
|
|
setMounted(true);
|
|
}, []);
|
|
|
|
if (!mounted) {
|
|
return (
|
|
<div style={{
|
|
position: "fixed",
|
|
top: 0,
|
|
left: 0,
|
|
width: "100vw",
|
|
height: "100vh",
|
|
margin: 0,
|
|
padding: 0,
|
|
overflow: "hidden",
|
|
backgroundColor: "#020202",
|
|
zIndex: 9998
|
|
}}>
|
|
<div style={{
|
|
display: "flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
width: "100%",
|
|
height: "100%",
|
|
color: "#33ff00",
|
|
fontFamily: "monospace"
|
|
}}>
|
|
Loading terminal...
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div style={{
|
|
position: "fixed",
|
|
top: 0,
|
|
left: 0,
|
|
width: "100vw",
|
|
height: "100vh",
|
|
margin: 0,
|
|
padding: 0,
|
|
overflow: "hidden",
|
|
backgroundColor: "#020202",
|
|
zIndex: 9998
|
|
}}>
|
|
<KernelPanic404 />
|
|
</div>
|
|
);
|
|
}
|