import type { PluginDetail } from '../types' import type { ReadmePanelPresentation } from './store' import { cn } from '@langgenius/dify-ui/cn' import { useId } from 'react' import { useTranslation } from 'react-i18next' import { BUILTIN_TOOLS_ARRAY } from './constants' import { useReadmePanelStore } from './store' export const ReadmeEntrance = ({ pluginDetail, presentation = 'drawer', className, showShortTip = false, }: { pluginDetail: PluginDetail presentation?: ReadmePanelPresentation className?: string showShortTip?: boolean }) => { const { t } = useTranslation() const triggerId = useId() const openReadmePanel = useReadmePanelStore(s => s.openReadmePanel) const handleReadmeClick = () => { if (pluginDetail) { openReadmePanel({ detail: pluginDetail, presentation, triggerId, }) } } if (!pluginDetail || !pluginDetail?.plugin_unique_identifier || BUILTIN_TOOLS_ARRAY.includes(pluginDetail.id)) return null return (
{!showShortTip && (
)}
) }