dify/web/app/(commonLayout)/plugins/test/card/page.tsx

81 lines
2.7 KiB
TypeScript
Raw Normal View History

2024-10-10 17:47:04 +08:00
import { handleDelete } from './actions'
2024-10-11 18:05:36 +08:00
import TestClientPlugin from './test-client-plugin'
2024-10-09 11:35:07 +08:00
import Card from '@/app/components/plugins/card'
2024-10-10 10:40:26 +08:00
import { extensionDallE, modelGPT4, toolNotion } from '@/app/components/plugins/card/card-mock'
2024-10-09 18:36:15 +08:00
import PluginItem from '@/app/components/plugins/plugin-item'
2024-10-10 17:47:04 +08:00
import CardMoreInfo from '@/app/components/plugins/card/card-more-info'
import InstallModelItem from '@/app/components/plugins/install-model-item'
2024-10-11 18:05:36 +08:00
import { getLocaleOnServer, useTranslation as translate } from '@/i18n/server'
2024-10-09 11:35:07 +08:00
const PluginList = async () => {
2024-10-11 14:24:43 +08:00
const locale = getLocaleOnServer()
2024-10-10 17:49:23 +08:00
const pluginList = [toolNotion, extensionDallE, modelGPT4]
2024-10-11 18:05:36 +08:00
const { t: pluginI8n } = await translate(locale, 'plugin')
2024-10-09 11:35:07 +08:00
return (
2024-10-09 18:12:14 +08:00
<div className='pb-3 bg-white'>
<div className='mx-3 '>
<h2 className='my-3'>Dify Plugin list</h2>
2024-10-09 18:36:15 +08:00
<div className='grid grid-cols-2 gap-3'>
2024-10-10 17:47:04 +08:00
{pluginList.map((plugin, index) => (
2024-10-11 18:05:36 +08:00
<PluginItem
key={index}
payload={plugin as any}
onDelete={handleDelete}
pluginI8n={pluginI8n}
locale={locale}
/>
2024-10-10 17:47:04 +08:00
))}
2024-10-09 18:12:14 +08:00
</div>
2024-10-11 18:05:36 +08:00
<h2>Client plugin item</h2>
<TestClientPlugin />
2024-10-09 18:12:14 +08:00
<h2 className='my-3'>Install Plugin / Package under bundle</h2>
<div className='w-[512px] rounded-2xl bg-background-section-burn p-2'>
<Card
payload={toolNotion as any}
2024-10-11 14:24:43 +08:00
locale={locale}
2024-10-09 18:12:14 +08:00
descriptionLineRows={1}
showVersion
2024-10-09 18:12:14 +08:00
/>
</div>
<h3 className='my-1'>Installed</h3>
<div className='w-[512px] rounded-2xl bg-background-section-burn p-2'>
<Card
payload={toolNotion as any}
2024-10-11 14:24:43 +08:00
locale={locale}
2024-10-09 18:12:14 +08:00
descriptionLineRows={1}
installed
/>
</div>
2024-10-09 18:36:15 +08:00
2024-10-10 17:47:04 +08:00
<h3 className='my-1'>Install model provide</h3>
<div className='grid grid-cols-2 gap-3'>
{pluginList.map((plugin, index) => (
2024-10-11 16:21:03 +08:00
<InstallModelItem key={index} locale={locale} payload={plugin as any} />
2024-10-10 17:47:04 +08:00
))}
</div>
2024-10-09 18:36:15 +08:00
<div className='my-3 h-[px] bg-gray-50'></div>
<h2 className='my-3'>Marketplace Plugin list</h2>
<div className='grid grid-cols-4 gap-3'>
2024-10-10 17:47:04 +08:00
{pluginList.map((plugin, index) => (
<Card
key={index}
payload={plugin as any}
2024-10-11 14:24:43 +08:00
locale={locale}
2024-10-10 17:47:04 +08:00
footer={
<CardMoreInfo downloadCount={index % 2 === 0 ? 1234 : 6} tags={index % 2 === 0 ? ['Search', 'Productivity'] : []} />
}
/>
))}
2024-10-09 18:36:15 +08:00
</div>
2024-10-09 17:50:23 +08:00
</div>
2024-10-09 18:12:14 +08:00
</div>
2024-10-09 11:35:07 +08:00
)
}
export const metadata = {
title: 'Plugins - Card',
}
export default PluginList