Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

2.1 KB
Raw Blame
'use client'

import type { ReadmePanelState } from './store'
import {
  Drawer,
  DrawerBackdrop,
  DrawerClose,
  DrawerContent,
  DrawerPopup,
  DrawerPortal,
  DrawerTitle,
  DrawerViewport,
} from '@langgenius/dify-ui/drawer'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useTranslation } from 'react-i18next'
import { ReadmePanelContent } from './content'

type ReadmeDrawerProps = {
  detail: ReadmePanelState['detail']
  open: boolean
  onOpenChange: (open: boolean) => void
  triggerId?: string
}

export function ReadmeDrawer({ detail, open, onOpenChange, triggerId }: ReadmeDrawerProps) {
  const { t } = useTranslation(['common', 'plugin'])

  return (
    <Drawer
      open={open}
      onOpenChange={onOpenChange}
      triggerId={triggerId}
      modal
      swipeDirection="left"
    >
      <DrawerPortal>
        <DrawerBackdrop className="bg-transparent" />
        <DrawerViewport>
          <DrawerPopup className="data-[swipe-direction=left]:top-16 data-[swipe-direction=left]:bottom-2 data-[swipe-direction=left]:left-2 data-[swipe-direction=left]:h-auto data-[swipe-direction=left]:w-150 data-[swipe-direction=left]:max-w-[calc(100vw-1rem)] data-[swipe-direction=left]:rounded-2xl">
            <DrawerContent>
              <ReadmePanelContent
                detail={detail}
                title={
                  <DrawerTitle className="truncate text-xs font-medium text-text-tertiary uppercase">
                    {t(($) => $['readmeInfo.title'], { ns: 'plugin' })}
                  </DrawerTitle>
                }
                closeButton={
                  <DrawerClose
                    render={
                      <IconButton
                        aria-label={t(($) => $['operation.close'], { ns: 'common' })}
                        size="lg"
                      >
                        <span aria-hidden="true" className="i-ri-close-line size-4" />
                      </IconButton>
                    }
                  />
                }
              />
            </DrawerContent>
          </DrawerPopup>
        </DrawerViewport>
      </DrawerPortal>
    </Drawer>
  )
}