"use client"; import type { ReactElement } from "react"; import { useState } from "react"; import { WorkspaceCard } from "@/components/workspace/WorkspaceCard"; import { ComingSoon } from "@/components/ui/ComingSoon"; import { WorkspaceMemberRole } from "@mosaic/shared"; import Link from "next/link"; // Check if we're in development mode const isDevelopment = process.env.NODE_ENV === "development"; // Mock data - TODO: Replace with real API calls (development only) const mockWorkspaces = [ { id: "ws-1", name: "Personal Workspace", ownerId: "user-1", settings: {}, createdAt: new Date("2024-01-15"), updatedAt: new Date("2024-01-15"), }, { id: "ws-2", name: "Team Alpha", ownerId: "user-2", settings: {}, createdAt: new Date("2024-01-20"), updatedAt: new Date("2024-01-20"), }, ]; const mockMemberships = [ { workspaceId: "ws-1", role: WorkspaceMemberRole.OWNER, memberCount: 1 }, { workspaceId: "ws-2", role: WorkspaceMemberRole.MEMBER, memberCount: 5 }, ]; /** * Workspaces Page Content - Development Only * Shows mock workspace data for development purposes */ function WorkspacesPageContent(): ReactElement { const [isCreating, setIsCreating] = useState(false); const [newWorkspaceName, setNewWorkspaceName] = useState(""); // TODO: Replace with real API call const workspacesWithRoles = mockWorkspaces.map((workspace) => { const membership = mockMemberships.find((m) => m.workspaceId === workspace.id); return { ...workspace, userRole: membership?.role ?? WorkspaceMemberRole.GUEST, memberCount: membership?.memberCount ?? 0, }; }); const handleCreateWorkspace = async (e: React.SyntheticEvent): Promise => { e.preventDefault(); if (!newWorkspaceName.trim()) return; setIsCreating(true); try { // TODO: Replace with real API call console.log("Creating workspace:", newWorkspaceName); await new Promise((resolve) => setTimeout(resolve, 1000)); // Simulate API call alert(`Workspace "${newWorkspaceName}" created successfully!`); setNewWorkspaceName(""); } catch (_error) { console.error("Failed to create workspace:", _error); alert("Failed to create workspace"); } finally { setIsCreating(false); } }; return (

Workspaces

← Back to Settings

Manage your workspaces and collaborate with your team

{/* Create New Workspace */}

Create New Workspace

{ setNewWorkspaceName(e.target.value); }} placeholder="Enter workspace name..." disabled={isCreating} className="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:bg-gray-100" />
{/* Workspace List */}

Your Workspaces ({workspacesWithRoles.length})

{workspacesWithRoles.length === 0 ? (

No workspaces yet

Create your first workspace to get started

) : (
{workspacesWithRoles.map((workspace) => ( ))}
)}
); } /** * Workspaces Page Entry Point * Shows development content or Coming Soon based on environment */ export default function WorkspacesPage(): ReactElement { // In production, show Coming Soon placeholder if (!isDevelopment) { return ( Back to Settings ); } // In development, show the full page with mock data return ; }