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.2 KB
Raw Blame
'use client';

import { Flexbox } from '@lobehub/ui';
import { memo } from 'react';

import AgentTaskManager from '@/features/AgentTaskManager';
import MobilePortal from '@/features/Portal/Mobile';
import { useIsMobile } from '@/hooks/useIsMobile';

import { useCanonicalTaskSlug } from '../shared/useCanonicalTaskSlug';
import TaskDetailPage from './TaskDetailPage';

interface AgentScopedTaskDetailPageProps {
  agentId?: string;
  taskId: string;
}

const AgentScopedTaskDetailPage = memo<AgentScopedTaskDetailPageProps>(({ agentId, taskId }) => {
  const isMobile = useIsMobile();

  // This component is a route entry, so it owns the address bar and keeps the
  // readable slug tail in step with the title.
  useCanonicalTaskSlug(taskId);

  return (
    <Flexbox horizontal flex={1} height={'100%'} style={{ minHeight: 0 }} width={'100%'}>
      <Flexbox flex={1} style={{ minWidth: 0 }}>
        <TaskDetailPage showTaskAgentPanelToggle={!isMobile} taskId={taskId} />
      </Flexbox>
      {isMobile ? (
        <MobilePortal />
      ) : (
        <AgentTaskManager preferredAgentId={agentId} viewedTaskId={taskId} />
      )}
    </Flexbox>
  );
});

AgentScopedTaskDetailPage.displayName = 'AgentScopedTaskDetailPage';

export default AgentScopedTaskDetailPage;