diff --git a/packages/frontend/src/app/settings/organization/page.tsx b/packages/frontend/src/app/settings/organization/page.tsx index c217258d..1f8bd799 100644 --- a/packages/frontend/src/app/settings/organization/page.tsx +++ b/packages/frontend/src/app/settings/organization/page.tsx @@ -14,7 +14,6 @@ export default function OrganizationSettingsPage() { const [message, setMessage] = useState(''); // Create new org - const [showCreateForm, setShowCreateForm] = useState(false); const [newOrgName, setNewOrgName] = useState(''); const [creating, setCreating] = useState(false); const [createMessage, setCreateMessage] = useState(''); @@ -82,7 +81,6 @@ export default function OrganizationSettingsPage() { const newOrg = await organizations.create(newOrgName.trim(), token); setCreateMessage('Organization created! Switching...'); setNewOrgName(''); - setShowCreateForm(false); await switchOrg(newOrg.id); } catch (err: any) { setCreateMessage(err.message || 'Failed to create organization'); @@ -163,64 +161,6 @@ export default function OrganizationSettingsPage() { )} - {/* Create new organization — available to ALL users */} -
-
-
-

Create New Organization

-

- Create a separate workspace with its own connectors, MCP servers, and team. You will be the admin. -

-
- {!showCreateForm && ( - - )} -
- - {showCreateForm && ( -
-
- - setNewOrgName(e.target.value)} - className="w-full px-3 py-2 bg-[var(--background)] border border-[var(--border)] rounded-lg text-sm focus:ring-2 focus:ring-[var(--brand)] focus:border-transparent outline-none" - placeholder="My New Workspace" - autoFocus - onKeyDown={(e) => { if (e.key === 'Enter') handleCreateOrg(); }} - /> -
-
- - -
-
- )} - - {createMessage && ( -

- {createMessage} -

- )} -
- {/* Danger Zone — ADMIN only */} {isAdmin && (
@@ -282,41 +222,71 @@ export default function OrganizationSettingsPage() { - {/* My organizations list — available to ALL users */} - {orgs && orgs.length > 1 && ( -
-

My Organizations

-
- {orgs.map((org) => { + {/* My organizations list + create new — available to ALL users */} +
+

My Organizations

+ {orgs && orgs.length > 0 && ( +
+ {orgs.map((org, index) => { const isActive = org.id === user?.organizationId; return ( -
-
-

- {org.name} -

-

- {org.role} · Joined {new Date(org.joinedAt).toLocaleDateString()} -

-
- {isActive ? ( - - Active - - ) : ( - +
+ {index > 0 && ( +
)} +
+
+

+ {org.name} +

+

+ {org.role} · Joined {new Date(org.joinedAt).toLocaleDateString()} +

+
+ {isActive ? ( + + Active + + ) : ( + + )} +
); })}
+ )} +
+

Create New Organization

+
+ setNewOrgName(e.target.value)} + className="flex-1 px-3 py-2 bg-[var(--background)] border border-[var(--border)] rounded-lg text-sm focus:ring-2 focus:ring-[var(--brand)] focus:border-transparent outline-none" + placeholder="New organization name" + onKeyDown={(e) => { if (e.key === 'Enter') handleCreateOrg(); }} + /> + +
+ {createMessage && ( +

+ {createMessage} +

+ )}
- )} +
); }