2024-10-10 17:47:04 +08:00
|
|
|
'use client'
|
|
|
|
import type { FC } from 'react'
|
|
|
|
import React from 'react'
|
|
|
|
import { useRouter } from 'next/navigation'
|
|
|
|
import { RiDeleteBinLine, RiInformation2Line, RiLoopLeftLine } from '@remixicon/react'
|
2024-10-16 11:30:04 +08:00
|
|
|
import { useBoolean } from 'ahooks'
|
|
|
|
import PluginInfo from '../plugin-page/plugin-info'
|
|
|
|
import ActionButton from '../../base/action-button'
|
2024-10-10 17:47:04 +08:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
pluginId: string
|
|
|
|
isShowFetchNewVersion: boolean
|
|
|
|
isShowInfo: boolean
|
|
|
|
isShowDelete: boolean
|
|
|
|
onDelete: () => void
|
|
|
|
}
|
|
|
|
|
|
|
|
const Action: FC<Props> = ({
|
|
|
|
isShowFetchNewVersion,
|
|
|
|
isShowInfo,
|
|
|
|
isShowDelete,
|
|
|
|
onDelete,
|
|
|
|
}) => {
|
|
|
|
const router = useRouter()
|
2024-10-16 11:30:04 +08:00
|
|
|
const [isShowPluginInfo, {
|
|
|
|
setTrue: showPluginInfo,
|
|
|
|
setFalse: hidePluginInfo,
|
|
|
|
}] = useBoolean(false)
|
2024-10-10 17:47:04 +08:00
|
|
|
|
|
|
|
const handleFetchNewVersion = () => { }
|
2024-10-16 11:30:04 +08:00
|
|
|
|
2024-10-10 17:47:04 +08:00
|
|
|
// const handleDelete = () => { }
|
|
|
|
return (
|
|
|
|
<div className='flex space-x-1'>
|
|
|
|
{isShowFetchNewVersion
|
2024-10-16 11:45:25 +08:00
|
|
|
&& <ActionButton onClick={handleFetchNewVersion}>
|
|
|
|
<RiLoopLeftLine className='w-4 h-4 text-text-tertiary' />
|
|
|
|
</ActionButton>
|
2024-10-10 17:47:04 +08:00
|
|
|
}
|
|
|
|
{
|
|
|
|
isShowInfo
|
2024-10-16 11:30:04 +08:00
|
|
|
&& <ActionButton onClick={showPluginInfo}>
|
2024-10-16 11:45:25 +08:00
|
|
|
<RiInformation2Line className='w-4 h-4 text-text-tertiary' />
|
2024-10-16 11:30:04 +08:00
|
|
|
</ActionButton>
|
2024-10-10 17:47:04 +08:00
|
|
|
}
|
|
|
|
{
|
|
|
|
isShowDelete
|
2024-10-16 11:45:25 +08:00
|
|
|
&& <ActionButton className='hover:bg-state-destructive-hover text-text-tertiary hover:text-text-destructive' onClick={onDelete}>
|
|
|
|
<RiDeleteBinLine className='w-4 h-4' />
|
|
|
|
</ActionButton>
|
2024-10-10 17:47:04 +08:00
|
|
|
}
|
2024-10-16 11:30:04 +08:00
|
|
|
|
|
|
|
{isShowPluginInfo && (
|
|
|
|
<PluginInfo
|
|
|
|
repository='https://github.com/langgenius/dify-github-plugin'
|
|
|
|
release='1.2.5'
|
|
|
|
packageName='notion-sync.difypkg'
|
|
|
|
onHide={hidePluginInfo}
|
|
|
|
/>
|
|
|
|
)}
|
2024-10-10 17:47:04 +08:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
export default React.memo(Action)
|