dify/web/app/(commonLayout)/apps/NewAppCard.tsx

33 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-05-15 08:51:32 +08:00
'use client'
import { forwardRef, useState } from 'react'
2023-05-15 08:51:32 +08:00
import classNames from 'classnames'
import { useTranslation } from 'react-i18next'
import style from '../list.module.css'
import NewAppDialog from './NewAppDialog'
export type CreateAppCardProps = {
onSuccess?: () => void
}
const CreateAppCard = forwardRef<HTMLAnchorElement, CreateAppCardProps>(({ onSuccess }, ref) => {
2023-05-15 08:51:32 +08:00
const { t } = useTranslation()
const [showNewAppDialog, setShowNewAppDialog] = useState(false)
return (
<a ref={ref} className={classNames(style.listItem, style.newItemCard)} onClick={() => setShowNewAppDialog(true)}>
2023-05-15 08:51:32 +08:00
<div className={style.listItemTitle}>
<span className={style.newItemIcon}>
<span className={classNames(style.newItemIconImage, style.newItemIconAdd)} />
</span>
<div className={classNames(style.listItemHeading, style.newItemCardHeading)}>
{t('app.createApp')}
</div>
</div>
{/* <div className='text-xs text-gray-500'>{t('app.createFromConfigFile')}</div> */}
<NewAppDialog show={showNewAppDialog} onSuccess={onSuccess} onClose={() => setShowNewAppDialog(false)} />
2023-05-15 08:51:32 +08:00
</a>
)
})
2023-05-15 08:51:32 +08:00
export default CreateAppCard