2025-01-17 19:01:09 +08:00
|
|
|
import { Segmented, SegmentedValue } from '@/components/ui/segmented';
|
2025-04-29 09:50:54 +08:00
|
|
|
import { Routes } from '@/routes';
|
|
|
|
|
import { Cpu, MessageSquare, Search } from 'lucide-react';
|
2024-11-22 15:11:38 +08:00
|
|
|
import { useMemo, useState } from 'react';
|
2025-04-29 09:50:54 +08:00
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
import { Agents } from './agent-list';
|
|
|
|
|
import { ApplicationCard } from './application-card';
|
2024-11-20 11:14:21 +08:00
|
|
|
|
|
|
|
|
const applications = [
|
|
|
|
|
{
|
|
|
|
|
id: 1,
|
|
|
|
|
title: 'Jarvis chatbot',
|
|
|
|
|
type: 'Chat app',
|
2025-04-29 09:50:54 +08:00
|
|
|
update_time: '11/24/2024',
|
|
|
|
|
avatar: <MessageSquare className="h-6 w-6" />,
|
2024-11-20 11:14:21 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 2,
|
|
|
|
|
title: 'Search app 01',
|
|
|
|
|
type: 'Search app',
|
2025-04-29 09:50:54 +08:00
|
|
|
update_time: '11/24/2024',
|
|
|
|
|
avatar: <Search className="h-6 w-6" />,
|
2024-11-20 11:14:21 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 3,
|
|
|
|
|
title: 'Chatbot 01',
|
|
|
|
|
type: 'Chat app',
|
2025-04-29 09:50:54 +08:00
|
|
|
update_time: '11/24/2024',
|
|
|
|
|
avatar: <MessageSquare className="h-6 w-6" />,
|
2024-11-20 11:14:21 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 4,
|
|
|
|
|
title: 'Workflow 01',
|
|
|
|
|
type: 'Agent',
|
2025-04-29 09:50:54 +08:00
|
|
|
update_time: '11/24/2024',
|
|
|
|
|
avatar: <Cpu className="h-6 w-6" />,
|
2024-11-20 11:14:21 +08:00
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export function Applications() {
|
2024-11-22 15:11:38 +08:00
|
|
|
const [val, setVal] = useState('all');
|
2025-04-29 09:50:54 +08:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
|
|
const options = useMemo(
|
|
|
|
|
() => [
|
2024-11-22 15:11:38 +08:00
|
|
|
{
|
|
|
|
|
label: 'All',
|
|
|
|
|
value: 'all',
|
|
|
|
|
},
|
2025-04-29 09:50:54 +08:00
|
|
|
{ value: Routes.Chats, label: t('header.chat') },
|
|
|
|
|
{ value: Routes.Searches, label: t('header.search') },
|
|
|
|
|
{ value: Routes.Agents, label: t('header.flow') },
|
|
|
|
|
],
|
|
|
|
|
[t],
|
|
|
|
|
);
|
2024-11-22 15:11:38 +08:00
|
|
|
|
|
|
|
|
const handleChange = (path: SegmentedValue) => {
|
|
|
|
|
setVal(path as string);
|
|
|
|
|
};
|
|
|
|
|
|
2024-11-20 11:14:21 +08:00
|
|
|
return (
|
|
|
|
|
<section className="mt-12">
|
|
|
|
|
<div className="flex justify-between items-center mb-6">
|
2024-12-03 18:59:11 +08:00
|
|
|
<h2 className="text-2xl font-bold ">Applications</h2>
|
2024-11-22 15:11:38 +08:00
|
|
|
<Segmented
|
|
|
|
|
options={options}
|
|
|
|
|
value={val}
|
|
|
|
|
onChange={handleChange}
|
2024-12-03 18:59:11 +08:00
|
|
|
className="bg-colors-background-inverse-standard text-colors-text-neutral-standard"
|
2024-11-22 15:11:38 +08:00
|
|
|
></Segmented>
|
2024-11-20 11:14:21 +08:00
|
|
|
</div>
|
2025-04-29 09:50:54 +08:00
|
|
|
<div className="flex flex-wrap gap-4">
|
|
|
|
|
{val === Routes.Agents ||
|
|
|
|
|
[...Array(12)].map((_, i) => {
|
|
|
|
|
const app = applications[i % 4];
|
|
|
|
|
return <ApplicationCard key={i} app={app}></ApplicationCard>;
|
|
|
|
|
})}
|
|
|
|
|
{val === Routes.Agents && <Agents></Agents>}
|
2024-11-20 11:14:21 +08:00
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
}
|