import { Segmented, SegmentedValue } from '@/components/ui/segmented'; import { Routes } from '@/routes'; import { Cpu, MessageSquare, Search } from 'lucide-react'; import { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'umi'; import { Agents } from './agent-list'; import { ApplicationCard, SeeAllAppCard } from './application-card'; import { ChatList } from './chat-list'; const applications = [ { id: 1, title: 'Jarvis chatbot', type: 'Chat app', update_time: '11/24/2024', avatar: , }, { id: 2, title: 'Search app 01', type: 'Search app', update_time: '11/24/2024', avatar: , }, { id: 3, title: 'Chatbot 01', type: 'Chat app', update_time: '11/24/2024', avatar: , }, { id: 4, title: 'Workflow 01', type: 'Agent', update_time: '11/24/2024', avatar: , }, ]; const All = 'all'; export function Applications() { const [val, setVal] = useState('all'); const { t } = useTranslation(); const navigate = useNavigate(); const handleNavigate = useCallback(() => { navigate(val); }, [navigate, val]); const options = useMemo( () => [ { label: 'All', value: All, }, { value: Routes.Chats, label: t('header.chat') }, { value: Routes.Searches, label: t('header.search') }, { value: Routes.Agents, label: t('header.flow') }, ], [t], ); const handleChange = (path: SegmentedValue) => { setVal(path as string); }; return (

Applications

{(val === All || val === Routes.Searches) && [...Array(12)].map((_, i) => { const app = applications[i % 4]; return ; })} {val === Routes.Agents && } {val === Routes.Chats && } {val === All || }
); }