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

import { Breadcrumb, Icon, Text } from '@lobehub/ui';
import { ChevronRight } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';

import { styles } from '@/features/AgentTasks/shared/style';
import WorkspaceLink from '@/features/Workspace/WorkspaceLink';

interface GoalWorkspaceBreadcrumbProps {
  title: string;
}

/**
 * The bare `/goal/:goalId` page's way back: the cross-agent goal list, the way
 * a bare task detail leads back to `/tasks`.
 */
const GoalWorkspaceBreadcrumb = memo<GoalWorkspaceBreadcrumbProps>(({ title }) => {
  const { t } = useTranslation('chat');

  const titleCrumb = {
    key: 'goal',
    title: (
      // Viewport-capped so the crumb fits beside the back button on a phone.
      <Text ellipsis color={'inherit'} style={{ maxWidth: 'min(320px, 45vw)' }} weight={500}>
        {title}
      </Text>
    ),
  };

  return (
    <Breadcrumb
      className={styles.breadcrumb}
      separator={<Icon icon={ChevronRight} />}
      items={[
        {
          key: 'goals',
          title: (
            <WorkspaceLink to={'/goals'}>
              <Text color={'inherit'} style={{ whiteSpace: 'nowrap' }} weight={500}>
                {t('goalList.title')}
              </Text>
            </WorkspaceLink>
          ),
        },
        titleCrumb,
      ]}
    />
  );
});

GoalWorkspaceBreadcrumb.displayName = 'GoalWorkspaceBreadcrumb';

export default GoalWorkspaceBreadcrumb;