Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1.1 KB
Raw Blame
'use client';

import { memo } from 'react';

import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
import { useHomeStore } from '@/store/home';

import AllAgentsDrawer from '../AllAgentsDrawer';
import AgentListContent from './AgentListContent';
import WorkspaceAgentListContent from './WorkspaceAgentListContent';

// The Home sidebar owns the all-agents drawer; other surfaces should import AgentListContent directly.
const AgentList = memo<{ onMoreClick?: () => void }>(({ onMoreClick }) => {
  const [allAgentsDrawerOpen, closeAllAgentsDrawer] = useHomeStore((s) => [
    s.allAgentsDrawerOpen,
    s.closeAllAgentsDrawer,
  ]);
  // A workspace merges shared and private rows into one Agents section with
  // the member's own pinned list; personal mode keeps the original layout.
  const activeWorkspaceId = useActiveWorkspaceId();

  return (
    <>
      {activeWorkspaceId ? (
        <WorkspaceAgentListContent />
      ) : (
        <AgentListContent onMoreClick={onMoreClick} />
      )}
      <AllAgentsDrawer open={allAgentsDrawerOpen} onClose={closeAllAgentsDrawer} />
    </>
  );
});

export default AgentList;