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.

2.8 KB
Raw Blame
'use client';

import { Button, FluentEmoji, Result, Text } from '@lobehub/ui';
import { CircleAlertIcon, FolderOpenIcon } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';

import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';

interface StatusPageProps {
  status: 'unpublished' | 'archived' | 'deprecated';
}

const StatusPage = memo<StatusPageProps>(({ status }) => {
  const navigate = useWorkspaceAwareNavigate();
  const { t } = useTranslation('discover');

  const handleBackToMarket = () => {
    navigate('/marketplace');
  };

  // Unpublished status
  if (status === 'unpublished') {
    return (
      <div
        style={{
          alignItems: 'center',
          display: 'flex',
          flex: 1,
          justifyContent: 'center',
          minHeight: '60vh',
          padding: '20px',
        }}
      >
        <Result
          icon={<FluentEmoji emoji={'⌛'} size={96} type={'anim'} />}
          extra={
            <Button size={'large'} type="primary" onClick={handleBackToMarket}>
              {t('assistants.status.backToMarket')}
            </Button>
          }
          subTitle={
            <Text fontSize={16} type={'secondary'}>
              {t('groupAgents.status.unpublished.subtitle', {
                defaultValue:
                  'This group agent is under review. Please contact [email protected] if you have questions.',
              })}
            </Text>
          }
          title={
            <Text fontSize={28} weight={'bold'}>
              {t('groupAgents.status.unpublished.title', { defaultValue: 'Under Review' })}
            </Text>
          }
        />
      </div>
    );
  }

  // Archived/Deprecated status
  const isArchived = status === 'archived';
  const statusKey = isArchived ? 'archived' : 'deprecated';
  const statusIcon = isArchived ? (
    <FolderOpenIcon color={'#8c8c8c'} />
  ) : (
    <CircleAlertIcon color={'#ff4d4f'} />
  );

  return (
    <div
      style={{
        alignItems: 'center',
        display: 'flex',
        flex: 1,
        justifyContent: 'center',
        minHeight: '60vh',
        padding: '20px',
      }}
    >
      <Result
        icon={statusIcon}
        extra={
          <Button type="primary" onClick={handleBackToMarket}>
            {t('assistants.status.backToMarket')}
          </Button>
        }
        subTitle={
          <div style={{ color: '#666', lineHeight: 1.6 }}>
            <p>
              {t(`groupAgents.status.${statusKey}.subtitle`, {
                defaultValue: `This group agent has been ${statusKey}.`,
              })}
            </p>
          </div>
        }
        title={t(`groupAgents.status.${statusKey}.title`, {
          defaultValue: isArchived ? 'Archived' : 'Deprecated',
        })}
      />
    </div>
  );
});

export default StatusPage;