'use client' import { useState, useEffect } from 'react' import { Input, Button, toast } from '@ciphera-net/ui' import { Spinner } from '@ciphera-net/ui' import { useAuth } from '@/lib/auth/context' import { getOrganization, updateOrganization } from '@/lib/api/organization' import { getAuthErrorMessage } from '@ciphera-net/ui' export default function WorkspaceGeneralTab() { const { user } = useAuth() const [name, setName] = useState('') const [slug, setSlug] = useState('') const [loading, setLoading] = useState(true) const [saving, setSaving] = useState(false) useEffect(() => { if (!user?.org_id) return setLoading(true) getOrganization(user.org_id) .then(org => { setName(org.name || '') setSlug(org.slug || '') }) .catch(() => {}) .finally(() => setLoading(false)) }, [user?.org_id]) const handleSave = async () => { if (!user?.org_id) return setSaving(true) try { await updateOrganization(user.org_id, name, slug) toast.success('Organization updated') } catch (err) { toast.error(getAuthErrorMessage(err as Error) || 'Failed to update organization') } finally { setSaving(false) } } if (loading) { return (
) } return (

General Information

Basic details about your organization.

setName(e.target.value)} placeholder="Acme Corp" />
pulse.ciphera.net/ setSlug(e.target.value)} placeholder="acme-corp" />

Changing the slug will change your organization's URL.

{/* Danger Zone */}

Danger Zone

Delete Organization

Permanently delete this organization and all its data.

) }