diff --git a/vibn-frontend/app/[workspace]/projects/page.tsx b/vibn-frontend/app/[workspace]/projects/page.tsx index 56841b7..d524a26 100644 --- a/vibn-frontend/app/[workspace]/projects/page.tsx +++ b/vibn-frontend/app/[workspace]/projects/page.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from "react"; import { useSession } from "next-auth/react"; -import { useParams } from "next/navigation"; +import { useParams, useRouter } from "next/navigation"; import Link from "next/link"; import { ProjectCreationModal } from "@/components/project-creation-modal"; import { @@ -17,7 +17,6 @@ import { } from "@/components/ui/alert-dialog"; import { Loader2, Trash2 } from "lucide-react"; import { toast } from "sonner"; -import AgencyDashboard from "../agency/page"; interface ProjectWithStats { id: string; @@ -109,11 +108,11 @@ function StatusTag({ status }: { status?: string }) { export default function ProjectsPage() { const params = useParams(); + const router = useRouter(); const workspace = params.workspace as string; const { data: session, status } = useSession(); const [projects, setProjects] = useState([]); - const [isAgency, setIsAgency] = useState(null); const [loading, setLoading] = useState(true); const [loadError, setLoadError] = useState(null); const [showNew, setShowNew] = useState(false); @@ -134,10 +133,9 @@ export default function ProjectsPage() { }); if (wsRes.ok) { const wsData = await wsRes.json(); - setIsAgency(wsData.isAgency); if (wsData.isAgency) { - setLoading(false); - return; // Stop fetching projects if it's an agency, let AgencyDashboard handle its own data + router.replace(`/${workspace}/agency`); + return; } } @@ -209,10 +207,6 @@ export default function ProjectsPage() { return `${projects.length} total · ${parts.join(" · ")}`; }; - if (isAgency === true) { - return ; - } - return (