'use client' import ActionButton from '@/app/components/base/action-button' import Loading from '@/app/components/base/loading' import { Markdown } from '@/app/components/base/markdown' import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks' import { usePluginReadme } from '@/service/use-plugins' import cn from '@/utils/classnames' import { RiBookReadLine, RiCloseLine } from '@remixicon/react' import type { FC } from 'react' import { createPortal } from 'react-dom' import { useTranslation } from 'react-i18next' import DetailHeader from '../plugin-detail-panel/detail-header' import { ReadmeShowType, useReadmePanelStore } from './store' const ReadmePanel: FC = () => { const { currentPluginDetail, setCurrentPluginDetail } = useReadmePanelStore() const { detail, showType } = currentPluginDetail || {} const { t } = useTranslation() const language = useLanguage() const pluginUniqueIdentifier = detail?.plugin_unique_identifier || '' const { data: readmeData, isLoading, error } = usePluginReadme( { plugin_unique_identifier: pluginUniqueIdentifier, language: language === 'zh-Hans' ? undefined : language }, ) const onClose = () => { setCurrentPluginDetail() } if (!detail) return null const children = (
{t('plugin.readmeInfo.failedToFetch')}
{t('plugin.readmeInfo.noReadmeAvailable')}