feat: global platform v2 update

This commit is contained in:
ivannoskov
2025-12-29 10:12:13 +03:00
parent 8e6a1fa83f
commit f64cf02100
84 changed files with 11023 additions and 11486 deletions

View File

@@ -5,8 +5,9 @@
// ============================================================================
import React, { useEffect } from "react";
import { useRouter } from "next/navigation";
import { useRouter, useParams } from "next/navigation";
import { useAuth } from "./auth-provider";
import { isDemoWorkspace } from "@/lib/demo";
interface ProtectedRouteProps {
children: React.ReactNode;
@@ -15,12 +16,25 @@ interface ProtectedRouteProps {
export const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ children }) => {
const { user, loading } = useAuth();
const router = useRouter();
const params = useParams();
// Check if this is demo mode
const workspaceId = params?.workspaceId as string | undefined;
const isDemo = isDemoWorkspace(workspaceId);
useEffect(() => {
// Skip auth check for demo mode
if (isDemo) return;
if (!loading && !user) {
router.push("/login");
}
}, [user, loading, router]);
}, [user, loading, router, isDemo]);
// Demo mode - skip auth entirely
if (isDemo) {
return <>{children}</>;
}
if (loading) {
return (