refactor: chagne card to client component

This commit is contained in:
Joel
2024-10-17 15:06:06 +08:00
parent 18f5f9cc37
commit cac04c5f3c
12 changed files with 26 additions and 124 deletions

View File

@ -69,7 +69,6 @@ const InstallFromLocalPackage: React.FC<InstallFromLocalPackageProps> = ({ onClo
<div className='flex p-2 items-start content-start gap-1 self-stretch flex-wrap rounded-2xl bg-background-section-burn'>
<Card
className='w-full'
locale={locale}
payload={status === 'uploading' ? { name: 'notion-sync' } as any : toolNotion as any}
isLoading={status === 'uploading'}
loadingFileName='notion-sync.difypkg'
@ -85,7 +84,7 @@ const InstallFromLocalPackage: React.FC<InstallFromLocalPackageProps> = ({ onClo
: (
<>
<Button variant='secondary' className='min-w-[72px]' onClick={onClose}>
Cancel
Cancel
</Button>
<Button
variant='primary'

View File

@ -1,7 +1,6 @@
'use client'
import React, { useMemo, useState } from 'react'
import { useContext } from 'use-context-selector'
import { RiInformation2Line } from '@remixicon/react'
import Card from '../../card'
import { extensionDallE, modelGPT4, toolNotion } from '../../card/card-mock'
@ -9,14 +8,12 @@ import Modal from '@/app/components/base/modal'
import Button from '@/app/components/base/button'
import Checkbox from '@/app/components/base/checkbox'
import Badge, { BadgeState } from '@/app/components/base/badge/index'
import I18n from '@/context/i18n'
type InstallFromMarketplaceProps = {
onClose: () => void
}
const InstallFromMarketplace: React.FC<InstallFromMarketplaceProps> = ({ onClose }) => {
const { locale } = useContext(I18n)
const plugins = useMemo(() => [toolNotion, extensionDallE, modelGPT4], [])
const [selectedPlugins, setSelectedPlugins] = useState<Set<number>>(new Set())
const [isInstalling, setIsInstalling] = useState(false)
@ -40,7 +37,6 @@ const InstallFromMarketplace: React.FC<InstallFromMarketplaceProps> = ({ onClose
key={index}
installed={nextStep && !isInstalling}
payload={plugin}
locale={locale}
className='w-full'
titleLeft={
plugin.version === plugin.latest_version
@ -115,7 +111,7 @@ const InstallFromMarketplace: React.FC<InstallFromMarketplaceProps> = ({ onClose
: (
<>
<Button variant='secondary' className='min-w-[72px]' onClick={onClose}>
Cancel
Cancel
</Button>
<Button
variant='primary'
@ -126,7 +122,7 @@ const InstallFromMarketplace: React.FC<InstallFromMarketplaceProps> = ({ onClose
mockInstall()
}}
>
Install
Install
</Button>
</>
)}