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.2 KB
Raw Blame
import type { SiteInfo } from '@/models/share'
import { cn } from '@langgenius/dify-ui/cn'
import { Dialog, DialogClose, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import AppIcon from '@/app/components/base/app-icon'
import { appDefaultIconBackground } from '@/config'

type Props = Readonly<{
  data?: SiteInfo
  isShow: boolean
  onClose: () => void
}>

const InfoModal = ({ isShow, onClose, data }: Props) => {
  const { t } = useTranslation(['common'])
  const [currentYear] = React.useState(() => new Date().getFullYear())

  return (
    <Dialog
      open={isShow}
      onOpenChange={(open) => {
        if (!open) onClose()
      }}
    >
      <DialogContent className="w-100 overflow-hidden">
        <DialogClose
          render={
            <IconButton
              aria-label={t(($) => $['operation.close'], { ns: 'common' })}
              size="lg"
              className="absolute inset-e-6 top-6"
            >
              <span aria-hidden className="i-ri-close-line size-4" />
            </IconButton>
          }
        />

        <div className={cn('flex flex-col items-center gap-4 px-4 pt-10 pb-8')}>
          <AppIcon
            fallback={{ content: '🤖', background: appDefaultIconBackground }}
            size="xxl"
            icon={data}
          />
          <div className="w-full text-center">
            <DialogTitle>
              {data?.title || t(($) => $['userProfile.about'], { ns: 'common' })}
            </DialogTitle>
            <div className="mt-1 system-xl-medium text-text-tertiary">{data?.description}</div>
          </div>
          <div className="system-xs-regular text-text-tertiary">
            {/* copyright */}
            {data?.copyright && (
              <div>
                Copyright © {currentYear} {data?.copyright}. All Rights Reserved.
              </div>
            )}
            {data?.custom_disclaimer && <div className="mt-2">{data.custom_disclaimer}</div>}
          </div>
        </div>
      </DialogContent>
    </Dialog>
  )
}

export default InfoModal