import { IconFont } from '@/components/icon-font'; import { Segmented, SegmentedValue } from '@/components/ui/segmented'; import { Routes } from '@/routes'; import { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'umi'; import { Agents } from './agent-list'; import { SeeAllAppCard } from './application-card'; import { ChatList } from './chat-list'; const IconMap = { [Routes.Chats]: 'chat', [Routes.Searches]: 'search', [Routes.Agents]: 'agent', }; export function Applications() { const [val, setVal] = useState(Routes.Chats); const { t } = useTranslation(); const navigate = useNavigate(); const handleNavigate = useCallback(() => { navigate(val); }, [navigate, val]); const options = useMemo( () => [ { 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 (

{options.find((x) => x.value === val)?.label}

{val === Routes.Agents && } {val === Routes.Chats && } {}
); }