cohorta/src/pages/NotFound.tsx
2025-12-19 19:26:16 +00:00

66 lines
2.1 KiB
TypeScript
Executable file

import { useLocation, useNavigate } from "react-router-dom";
import { useEffect } from "react";
import { Button } from "@/components/ui/button";
const NotFound = () => {
const location = useLocation();
const navigate = useNavigate();
useEffect(() => {
console.error(
"404 Error: User attempted to access non-existent route:",
location.pathname
);
}, [location.pathname]);
// Check if this is a persona not found path
const isPersonaPath = location.pathname.startsWith("/synthetic-users/");
// Check if user came from review page
const searchParams = new URLSearchParams(location.search);
const fromReview = searchParams.get('fromReview') === 'true';
return (
<div className="min-h-screen flex items-center justify-center bg-gray-100">
<div className="text-center p-8 max-w-md bg-white rounded-lg shadow-md">
<h1 className="text-4xl font-bold mb-4">404</h1>
{isPersonaPath ? (
<>
<p className="text-xl text-gray-600 mb-4">Persona Not Found</p>
<p className="text-gray-500 mb-6">
The persona you're looking for may have been removed or doesn't exist.
</p>
{fromReview ? (
<Button onClick={() => navigate("/synthetic-users?mode=create&tab=ai&step=review")} className="mb-2 w-full">
Return to Review Page
</Button>
) : (
<Button onClick={() => navigate("/synthetic-users")} className="mb-2 w-full">
View All Personas
</Button>
)}
</>
) : (
<>
<p className="text-xl text-gray-600 mb-4">Oops! Page not found</p>
<p className="text-gray-500 mb-6">
The page you're looking for doesn't exist or has been moved.
</p>
</>
)}
<Button
variant="outline"
onClick={() => navigate("/")}
className="w-full"
>
Return to Home
</Button>
</div>
</div>
);
};
export default NotFound;