"use client"; // ============================================================================ // Workspace Settings Page // ============================================================================ import { useState } from "react"; import { useParams, useRouter } from "next/navigation"; import { Loader2, Settings, Pencil, Trash2 } from "lucide-react"; import { DashboardHeader } from "@/components/layout/dashboard-header"; import { useWorkspace } from "@/components/providers/workspace-provider"; import { workspacesApi } from "@/lib/api"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; export default function SettingsPage() { const params = useParams(); const router = useRouter(); const workspaceId = params?.workspaceId as string; const { currentWorkspace, refreshWorkspaces } = useWorkspace(); const [name, setName] = useState(currentWorkspace?.name || ""); const [isUpdating, setIsUpdating] = useState(false); const [isDeleting, setIsDeleting] = useState(false); const handleUpdate = async () => { if (!name.trim() || name === currentWorkspace?.name) return; try { setIsUpdating(true); await workspacesApi.update(workspaceId, { name: name.trim() }); await refreshWorkspaces(); } catch (err) { console.error("Failed to update workspace:", err); } finally { setIsUpdating(false); } }; const handleDelete = async () => { try { setIsDeleting(true); await workspacesApi.delete(workspaceId); router.replace("/"); } catch (err) { console.error("Failed to delete workspace:", err); } finally { setIsDeleting(false); } }; if (!currentWorkspace) { return ( <>
); } return ( <>

Настройки воркспейса

Управление настройками воркспейса

{/* General Settings */} Основные настройки Название и основные параметры воркспейса
setName(e.target.value)} placeholder="Название воркспейса" />
{/* Team Management Links */} Команда Управление участниками и приглашениями {/* Danger Zone */} Опасная зона Необратимые действия с воркспейсом Удалить воркспейс? Это действие необратимо. Все данные воркспейса будут удалены, включая проекты, креативы, размещения и аналитику. Отмена {isDeleting ? ( ) : null} Удалить
); }