Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(ui): align organization navigation and errors

Maxc1a5f04383c1
diff --git a/ui/src/App.tsx b/ui/src/App.tsx
index a41eb38c9..c85f0ea23 100644
--- a/ui/src/App.tsx
+++ b/ui/src/App.tsx
@@ -114,6 +114,7 @@ import {
InstanceProjectsPage,
} from './features/organization/pages/OrganizationInstancePages';
import { OrganizationResourcesPage } from './features/organization/pages/OrganizationResourcesPage';
+import { OrganizationShell } from './features/organization/OrganizationShell';
const RemoteLoginGate = ({ target }: { target: string }) => {
const { t } = useTranslation();
@@ -613,15 +614,17 @@ const router = createBrowserRouter(
{/* Control Panel mode — existing pages moved under /admin/* */}
<Route path="/admin" element={<Navigate to="/admin/dashboard" replace />} />
<Route path="/admin/dashboard" element={<Dashboard />} />
- <Route path="/admin/organization" element={<Navigate to="/admin/organization/overview" replace />} />
- <Route path="/admin/organization/overview" element={<OrganizationOverviewPage />} />
- <Route path="/admin/organization/members" element={<OrganizationMembersPage />} />
- <Route path="/admin/organization/groups" element={<OrganizationGroupsPage />} />
- <Route path="/admin/organization/groups/:groupId" element={<OrganizationGroupDetailPage />} />
- <Route path="/admin/organization/instances" element={<OrganizationInstancesPage />} />
- <Route path="/admin/organization/instances/:instanceId/access" element={<InstanceAccessPage />} />
- <Route path="/admin/organization/instances/:instanceId/projects" element={<InstanceProjectsPage />} />
- <Route path="/admin/organization/resources" element={<OrganizationResourcesPage />} />
+ <Route path="/admin/organization" element={<OrganizationShell />}>
+ <Route index element={<Navigate to="/admin/organization/overview" replace />} />
+ <Route path="overview" element={<OrganizationOverviewPage />} />
+ <Route path="members" element={<OrganizationMembersPage />} />
+ <Route path="groups" element={<OrganizationGroupsPage />} />
+ <Route path="groups/:groupId" element={<OrganizationGroupDetailPage />} />
+ <Route path="instances" element={<OrganizationInstancesPage />} />
+ <Route path="instances/:instanceId/access" element={<InstanceAccessPage />} />
+ <Route path="instances/:instanceId/projects" element={<InstanceProjectsPage />} />
+ <Route path="resources" element={<OrganizationResourcesPage />} />
+ </Route>
<Route path="/admin/remote-access" element={<RemoteAccessPage />} />
<Route path="/admin/groups" element={<ChannelList isPage />} />
<Route path="/admin/users" element={<UserList />} />
diff --git a/ui/src/components/AppShell.tsx b/ui/src/components/AppShell.tsx
index 14f34910b..4e44c39dd 100644
--- a/ui/src/components/AppShell.tsx
+++ b/ui/src/components/AppShell.tsx
@@ -35,7 +35,6 @@ import { InstallHint } from './InstallHint';
import logoImg from '../assets/logo.png';
import { getEnabledPlatforms, platformSupportsChannels } from '../lib/platforms';
import { useViewportHeightVar } from '../lib/useViewportHeightVar';
-import { OrganizationShell } from '../features/organization/OrganizationShell';
import {
adminLandingPath,
filterLocalSystemNavItems,
@@ -63,9 +62,9 @@ type ShellNavItem = {
variant?: 'workbench';
};
-// Keep the Organization routes available for direct access while the product
-// entry points remain hidden. Re-enable every shell surface from one switch.
-const ORGANIZATION_NAV_ENABLED = false;
+// Organization is exposed from the admin control panel only. The workbench
+// keeps its compact navigation focused on agent work.
+const ORGANIZATION_NAV_ENABLED = true;
const isItemActive = (item: ShellNavItem, pathname: string): boolean =>
item.match
@@ -340,12 +339,6 @@ export const AppShell: React.FC = () => {
window.history.replaceState(window.history.state, '', `${url.pathname}${url.search}${url.hash}`);
}, [chromeless, location.pathname, location.search]);
- // Organization takes over the whole shell, so it returns after every hook above
- // has run — an early return before them would make those hooks conditional.
- if (location.pathname.startsWith('/admin/organization')) {
- return <OrganizationShell />;
- }
-
if (
location.pathname === '/setup' &&
remote &&
@@ -633,16 +626,6 @@ export const AppShell: React.FC = () => {
Control Panel → Back to Workbench, the mint counterpart. */}
<div className="flex items-stretch gap-2">
{canUseApps && <AppsLauncher />}
- {shellMode === 'workbench' && ORGANIZATION_NAV_ENABLED && (
- <Link
- to="/admin/organization/overview"
- title={t('nav.organization')}
- aria-label={t('nav.organization')}
- className="group flex w-11 shrink-0 items-center justify-center rounded-lg border border-border-strong text-foreground transition-colors hover:bg-foreground/[0.04]"
- >
- <Building2 className="size-[18px] text-muted group-hover:text-foreground" />
- </Link>
- )}
{shellMode === 'workbench' && (capabilities.can_manage_instance || canUseRuntimeSurfaces) && (
<Link
to={adminLandingPath(capabilities.can_use_system, canUseRuntimeSurfaces)}
@@ -726,16 +709,6 @@ export const AppShell: React.FC = () => {
when not yet installed; null everywhere else). Version / language /
theme / account live in the More tab. */}
<div className="flex items-center gap-1.5">
- {ORGANIZATION_NAV_ENABLED && (
- <Link
- to="/admin/organization/overview"
- title={t('nav.organization')}
- aria-label={t('nav.organization')}
- className="grid size-9 place-items-center rounded-lg text-muted transition-colors hover:bg-foreground/[0.05] hover:text-foreground"
- >
- <Building2 className="size-[18px]" />
- </Link>
- )}
<InstallHint />
</div>
</header>
@@ -756,7 +729,14 @@ export const AppShell: React.FC = () => {
(location.pathname.startsWith('/admin/settings') ? 'page-glow-settings' : 'page-glow-console')
)}
>
- <div className={clsx('w-full', chromeless ? 'h-full' : 'mx-auto px-4 py-5 md:px-10 md:py-8')}>
+ <div className={clsx(
+ 'w-full',
+ chromeless
+ ? 'h-full'
+ : location.pathname.startsWith('/admin/organization')
+ ? 'mx-auto'
+ : 'mx-auto px-4 py-5 md:px-10 md:py-8',
+ )}>
{/* A crashing page only replaces the content area — the sidebar + chrome stay usable, and
navigating elsewhere clears the error without a manual retry. Key on location.key (not
just pathname) so a query-only navigation (e.g. /search?q=…) also resets. */}
diff --git a/ui/src/features/organization/OrganizationShell.tsx b/ui/src/features/organization/OrganizationShell.tsx
index 7319c1aea..d7fe6575b 100644
--- a/ui/src/features/organization/OrganizationShell.tsx
+++ b/ui/src/features/organization/OrganizationShell.tsx
@@ -1,4 +1,3 @@
-import { useState } from 'react';
import {
ArrowLeft,
Boxes,
@@ -8,12 +7,10 @@ import {
Grid2x2,
LoaderCircle,
LogOut,
- Menu,
Server,
ShieldAlert,
Users,
WifiOff,
- X,
} from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Link, NavLink, Outlet, useLocation, useNavigate } from 'react-router-dom';
@@ -129,11 +126,10 @@ function GateState() {
);
}
-function OrganizationSidebar({ mobile = false, onNavigate }: { mobile?: boolean; onNavigate?: () => void }) {
+function OrganizationNavbar() {
const { t } = useTranslation();
const location = useLocation();
const navigate = useNavigate();
- const backToControlPanelPath = useBackToControlPanelPath();
const {
organizations,
selectedOrganizationId,
@@ -142,79 +138,52 @@ function OrganizationSidebar({ mobile = false, onNavigate }: { mobile?: boolean;
session,
signOut,
} = useOrganization();
+ const backToControlPanelPath = useBackToControlPanelPath();
const switchOrganization = async (organizationId: string) => {
const destination = organizationSwitchDestination(location.pathname);
if (destination) navigate(destination, { replace: true });
await selectOrganization(organizationId);
- onNavigate?.();
};
return (
- <div className="flex h-full flex-col bg-surface px-4 py-5">
- <Link to={backToControlPanelPath} className="flex items-center gap-2 text-[13px] text-muted hover:text-foreground" onClick={onNavigate}>
- <ArrowLeft className="size-4" />
- {t('organization.actions.backToControlPanel')}
- </Link>
- <div className="mt-6 rounded-lg border border-border bg-card p-3">
- <div className="flex items-center gap-3">
+ <header className="border-b border-border bg-background/95 px-4 pt-5 backdrop-blur md:px-10 md:pt-8">
+ <div className="flex flex-wrap items-start justify-between gap-4">
+ <div className="flex min-w-0 items-start gap-3">
<InitialsAvatar value={detail?.organization.name ?? ''} tone="violet" />
- <div className="min-w-0 flex-1">
- <div className="truncate text-sm font-semibold">{detail?.organization.name}</div>
- <div className="mt-0.5 text-[11px] text-muted">
+ <div className="min-w-0">
+ <h1 className="truncate text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">
+ {detail?.organization.name}
+ </h1>
+ <p className="mt-1 text-[14px] leading-[1.55] text-muted">
{t(`organization.roles.${detail?.membership.role ?? 'member'}`)}
{organizations.length > 1 ? ` · ${t('organization.sidebar.organizationCount', { count: organizations.length })}` : ''}
- </div>
+ </p>
</div>
</div>
- {organizations.length > 1 ? (
- <Select
- className="mt-3"
- value={selectedOrganizationId ?? ''}
- aria-label={t('organization.sidebar.switchOrganization')}
- onChange={(event) => void switchOrganization(event.target.value)}
- >
- {organizations.map((organization) => (
- <option key={organization.id} value={organization.id}>{organization.name}</option>
- ))}
- </Select>
- ) : null}
- </div>
- <div className="mt-5 px-1 font-mono text-[10px] font-bold uppercase text-muted">
- {t('organization.sidebar.section')}
- </div>
- <nav className="mt-3 flex flex-col gap-1">
- {NAV.map((item) => {
- const Icon = item.icon;
- return (
- <NavLink
- key={item.path}
- to={item.path}
- onClick={onNavigate}
- className={({ isActive }) => clsx(
- 'flex items-center gap-3 rounded-lg border px-3 py-2.5 text-[13px] font-medium transition-colors',
- isActive
- ? 'border-mint/30 bg-mint/10 text-foreground'
- : 'border-transparent text-muted hover:bg-foreground/[0.04] hover:text-foreground',
- )}
+ <div className="flex shrink-0 items-center gap-2">
+ {organizations.length > 1 ? (
+ <Select
+ className="w-auto min-w-[150px]"
+ value={selectedOrganizationId ?? ''}
+ aria-label={t('organization.sidebar.switchOrganization')}
+ onChange={(event) => void switchOrganization(event.target.value)}
>
- <Icon className="size-4" />
- {t(`organization.nav.${item.key}`)}
- </NavLink>
- );
- })}
- </nav>
- <div className="mt-auto pt-6">
- <div className="rounded-lg border border-mint/30 bg-mint/10 p-3">
- <div className="flex items-center gap-2 text-[12px] font-semibold">
- <span className="size-2 rounded-full bg-mint shadow-[0_0_8px_rgba(91,255,160,0.8)]" />
- {t('organization.sidebar.cloudConnected')}
- </div>
- <div className="mt-1 font-mono text-[10px] text-muted">
- {t('organization.sidebar.sessionRemaining', { minutes: Math.max(1, Math.ceil((session?.expires_in ?? 0) / 60)) })}
+ {organizations.map((organization) => (
+ <option key={organization.id} value={organization.id}>{organization.name}</option>
+ ))}
+ </Select>
+ ) : null}
+ <div className="hidden items-center gap-2 sm:flex">
+ <div className="rounded-lg border border-mint/30 bg-mint/10 px-3 py-2">
+ <div className="flex items-center gap-2 text-[12px] font-semibold">
+ <span className="size-2 rounded-full bg-mint shadow-[0_0_8px_rgba(91,255,160,0.8)]" />
+ {t('organization.sidebar.cloudConnected')}
+ </div>
+ <div className="mt-1 font-mono text-[10px] text-muted">
+ {t('organization.sidebar.sessionRemaining', { minutes: Math.max(1, Math.ceil((session?.expires_in ?? 0) / 60)) })}
+ </div>
+ </div>
+ <InitialsAvatar value={session?.user.email ?? ''} className="size-8 rounded-full" />
</div>
- </div>
- <div className="mt-3 flex items-center gap-2">
- <InitialsAvatar value={session?.user.email ?? ''} className="size-8 rounded-full" />
- <div className="min-w-0 flex-1 truncate text-[11px] text-muted">{session?.user.email}</div>
<Button
variant="ghost"
size="icon"
@@ -223,10 +192,29 @@ function OrganizationSidebar({ mobile = false, onNavigate }: { mobile?: boolean;
>
<LogOut className="size-4" />
</Button>
+ <Link to={backToControlPanelPath} className="inline-flex items-center gap-2 text-[13px] text-muted hover:text-foreground">
+ <ArrowLeft className="size-4" />
+ <span className="hidden sm:inline">{t('organization.actions.backToControlPanel')}</span>
+ </Link>
</div>
</div>
- {mobile ? <div className="h-[env(safe-area-inset-bottom)]" /> : null}
- </div>
+ <nav className="mt-6 -mb-px overflow-x-auto" aria-label={t('organization.sidebar.section')}>
+ <div className="flex min-w-max gap-1">
+ {NAV.map((item) => {
+ const Icon = item.icon;
+ return (
+ <NavLink key={item.path} to={item.path} className={({ isActive }) => clsx(
+ 'inline-flex h-11 shrink-0 items-center gap-2 border-b-2 px-4 text-[13px] transition-colors',
+ isActive ? 'border-mint font-semibold text-foreground' : 'border-transparent font-medium text-muted hover:border-border-strong hover:text-foreground',
+ )}>
+ <Icon className="size-4" />
+ {t(`organization.nav.${item.key}`)}
+ </NavLink>
+ );
+ })}
+ </div>
+ </nav>
+ </header>
);
}
@@ -234,7 +222,6 @@ function ConnectedShell() {
const { t } = useTranslation();
const location = useLocation();
const { organizations, detail } = useOrganization();
- const [drawerOpen, setDrawerOpen] = useState(false);
if (organizations.length === 0 || !detail) {
return (
<div className="min-h-[100dvh] bg-background p-6">
@@ -243,33 +230,11 @@ function ConnectedShell() {
);
}
return (
- <div className="h-[100dvh] overflow-y-auto bg-background text-foreground md:grid md:grid-cols-[260px_minmax(0,1fr)] md:overflow-hidden">
- <aside className="sticky top-0 hidden h-[100dvh] border-r border-border md:block">
- <OrganizationSidebar />
- </aside>
- <div className="min-w-0 md:h-[100dvh] md:overflow-y-auto">
- <header className="sticky top-0 z-30 flex h-14 items-center justify-between border-b border-border bg-background/95 px-4 backdrop-blur md:hidden">
- <Button variant="ghost" size="icon" aria-label={t('organization.sidebar.openMenu')} onClick={() => setDrawerOpen(true)}>
- <Menu className="size-5" />
- </Button>
- <div className="truncate text-[13px] font-semibold">{detail.organization.name}</div>
- <div className="size-9" />
- </header>
- <main key={location.pathname} className="mx-auto w-full max-w-[1560px] px-4 py-5 md:px-8 md:py-7">
- <Outlet />
- </main>
- </div>
- {drawerOpen ? (
- <div className="fixed inset-0 z-50 md:hidden" role="dialog" aria-modal="true">
- <button className="absolute inset-0 bg-background/70 backdrop-blur-sm" aria-label={t('common.close')} onClick={() => setDrawerOpen(false)} />
- <aside className="absolute inset-y-0 left-0 w-[min(86vw,300px)] border-r border-border shadow-2xl">
- <Button variant="ghost" size="icon" className="absolute right-3 top-3 z-10" aria-label={t('common.close')} onClick={() => setDrawerOpen(false)}>
- <X className="size-4" />
- </Button>
- <OrganizationSidebar mobile onNavigate={() => setDrawerOpen(false)} />
- </aside>
- </div>
- ) : null}
+ <div className="min-h-[100dvh] bg-background text-foreground">
+ <OrganizationNavbar />
+ <main key={location.pathname} className="mx-auto w-full max-w-[1560px] px-4 py-5 md:px-8 md:py-7">
+ <Outlet />
+ </main>
</div>
);
}
diff --git a/ui/src/features/organization/components.tsx b/ui/src/features/organization/components.tsx
index 9b83f8f42..bb7b26549 100644
--- a/ui/src/features/organization/components.tsx
+++ b/ui/src/features/organization/components.tsx
@@ -210,6 +210,10 @@ export function ErrorBanner({ code, onRetry }: { code?: string; onRetry?: () =>
'resource_not_found',
'member_email_taken',
'group_name_taken',
+ 'organization_member_not_active_in_organization',
+ 'invalid_organization_group_name',
+ 'invalid_organization_group_color',
+ 'invalid_request',
'too_many_entries',
'invalid_project_access_intent',
'invalid_project_access_principal',
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index df4153685..d1d922dc9 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -4068,6 +4068,10 @@
"resource_not_found": "This resource is unavailable.",
"member_email_taken": "That email already belongs to this Organization.",
"group_name_taken": "A group with that name already exists.",
+ "organization_member_not_active_in_organization": "One of the selected initial members is no longer active in this Organization. Refresh the member list and try again.",
+ "invalid_organization_group_name": "The group name is invalid. Use 1-120 characters.",
+ "invalid_organization_group_color": "The group color is invalid. Choose a color from the list.",
+ "invalid_request": "The request parameters are invalid. Check the form and try again.",
"too_many_entries": "This policy has too many entries.",
"invalid_project_access_intent": "Choose a valid Project access rule.",
"invalid_project_access_principal": "One Project access principal is invalid.",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 1c37adec0..d35e36f07 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -4068,6 +4068,10 @@
"resource_not_found": "无法访问此资源。",
"member_email_taken": "该邮箱已属于此组织。",
"group_name_taken": "已存在同名群组。",
+ "organization_member_not_active_in_organization": "所选初始成员已不是该组织的活跃成员,请刷新成员列表后重试。",
+ "invalid_organization_group_name": "群组名称无效,请使用 1-120 个字符。",
+ "invalid_organization_group_color": "群组颜色无效,请选择列表中的颜色。",
+ "invalid_request": "请求参数无效,请检查填写内容后重试。",
"too_many_entries": "此策略包含过多条目。",
"invalid_project_access_intent": "请选择有效的 Project 访问规则。",
"invalid_project_access_principal": "某个 Project 访问主体无效。",