mirror of
https://github.com/langgenius/dify.git
synced 2026-07-16 01:48:40 +08:00
34 lines
934 B
TypeScript
34 lines
934 B
TypeScript
import type { ReactNode } from 'react'
|
|
import { Button } from '@langgenius/dify-ui/button'
|
|
import { RiAddLine } from '@remixicon/react'
|
|
import { memo } from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
type PluginAuthInDataSourceNodeProps = {
|
|
children?: ReactNode
|
|
isAuthorized?: boolean
|
|
onJumpToDataSourcePage: () => void
|
|
}
|
|
const PluginAuthInDataSourceNode = ({
|
|
children,
|
|
isAuthorized,
|
|
onJumpToDataSourcePage,
|
|
}: PluginAuthInDataSourceNodeProps) => {
|
|
const { t } = useTranslation()
|
|
return (
|
|
<>
|
|
{!isAuthorized && (
|
|
<div className="px-4 pb-2">
|
|
<Button className="w-full" variant="primary" onClick={onJumpToDataSourcePage}>
|
|
<RiAddLine className="mr-1 size-4" />
|
|
{t(($) => $['integrations.connect'], { ns: 'common' })}
|
|
</Button>
|
|
</div>
|
|
)}
|
|
{isAuthorized && children}
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default memo(PluginAuthInDataSourceNode)
|