update on the agents and registry side
This commit is contained in:
@@ -4,7 +4,7 @@ import { motion } from 'framer-motion';
|
||||
import {
|
||||
Activity, Bell, Bike, Bot, Car, ChevronDown, Coins, FileSpreadsheet,
|
||||
FileText, ListTodo, LogOut, Menu, Search, Settings, Shield,
|
||||
ShieldAlert, User, UserCheck, Warehouse,
|
||||
ShieldAlert, User, UserCheck, UserPlus, Warehouse,
|
||||
} from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { DOORMILE_MARK_URL } from '@/assets/brand';
|
||||
@@ -16,9 +16,11 @@ import {
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet';
|
||||
import { useAuth } from '@/lib/AuthContext';
|
||||
import { canOnboardClients } from '@/lib/clientOnboarding';
|
||||
import { useExceptions } from '@/lib/doormileHooks';
|
||||
import { formatDoormileTimestamp } from '@/lib/doormileTimestamp';
|
||||
import AIPanel from '@/components/assistant/DoormileAI/AIPanel';
|
||||
import { useSkillRegistrySync } from '@/lib/assistant/skills/useSkillRegistrySync';
|
||||
import AILauncher from '@/components/assistant/DoormileAI/AILauncher';
|
||||
|
||||
/**
|
||||
@@ -221,6 +223,10 @@ export default function AdminLayout() {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const { user, isClient, logout } = useAuth();
|
||||
// One sync for the whole console, so the Exceptions banner and the chat's
|
||||
// "what needs attention" briefing run on the same registry settings. Partner
|
||||
// logins cannot read the registry (403) and run on code defaults.
|
||||
useSkillRegistrySync(!isClient);
|
||||
const [menuOpen, setMenuOpen] = useState(false);
|
||||
const [assistantOpen, setAssistantOpen] = useState(() => {
|
||||
try {
|
||||
@@ -251,12 +257,21 @@ export default function AdminLayout() {
|
||||
return NAV;
|
||||
}, [isClient]);
|
||||
|
||||
const canOnboard = canOnboardClients(user, isClient);
|
||||
|
||||
const navGroups = useMemo(() => {
|
||||
if (isClient) {
|
||||
return NAV_GROUPS.filter((group) => group.label !== 'Fleet Ops');
|
||||
}
|
||||
return NAV_GROUPS;
|
||||
}, [isClient]);
|
||||
if (!canOnboard) return NAV_GROUPS;
|
||||
// Only the onboarding owner login sees this entry; the server refuses
|
||||
// everyone else regardless.
|
||||
return NAV_GROUPS.map((group) =>
|
||||
group.label === 'Fleet Ops'
|
||||
? { ...group, items: [...group.items, { label: 'Client Onboarding', path: '/doormile/clients/onboard', icon: UserPlus }] }
|
||||
: group
|
||||
);
|
||||
}, [isClient, canOnboard]);
|
||||
|
||||
const allDestinations = useMemo(() => {
|
||||
return [...navItems, ...navGroups.flatMap((group) => group.items)];
|
||||
|
||||
Reference in New Issue
Block a user