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.6 KB
Raw Blame
'use client'

import type { ReactNode } from 'react'
import { cn } from '@langgenius/dify-ui/cn'
import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@langgenius/dify-ui/dialog'
import styles from './style.module.css'

type UpgradeModalClassNames = {
  content?: string
  heroOverlay?: string
  body?: string
  icon?: string
  copy?: string
  title?: string
  description?: string
  footer?: string
}

type UpgradeModalProps = {
  open: boolean
  onOpenChange?: (open: boolean) => void
  iconClassName?: string
  title: ReactNode
  description: ReactNode
  extraInfo?: ReactNode
  footer: ReactNode
  classNames?: UpgradeModalClassNames
}

export function UpgradeModal({
  open,
  onOpenChange,
  iconClassName,
  title,
  description,
  extraInfo,
  footer,
  classNames,
}: UpgradeModalProps) {
  return (
    <Dialog open={open} onOpenChange={onOpenChange}>
      <DialogContent className={cn(styles.surface, 'w-120 overflow-hidden', classNames?.content)}>
        <div className="relative">
          <div
            aria-hidden
            className={cn(
              styles.heroOverlay,
              'pointer-events-none absolute inset-0',
              classNames?.heroOverlay,
            )}
          />
          <div className={cn('px-8 pt-8', classNames?.body)}>
            {iconClassName && (
              <div
                className={cn(
                  styles.icon,
                  'flex size-12 items-center justify-center rounded-xl shadow-lg backdrop-blur-[5px]',
                  classNames?.icon,
                )}
              >
                <span
                  aria-hidden
                  className={cn(iconClassName, 'size-6 text-text-primary-on-surface')}
                />
              </div>
            )}
            <div className={cn('mt-6 space-y-2', classNames?.copy)}>
              <DialogTitle
                // oxlint-disable-next-line shadcn/no-restyle -- Upgrade hero keeps its marketing title type.
                className={cn(styles.highlight, 'title-3xl-semi-bold', classNames?.title)}
              >
                {title}
              </DialogTitle>
              <DialogDescription
                // oxlint-disable-next-line shadcn/no-restyle -- Upgrade hero keeps its marketing body type.
                className={cn('text-sm/5 text-text-tertiary', classNames?.description)}
              >
                {description}
              </DialogDescription>
            </div>
            {extraInfo}
          </div>
        </div>

        <div className={cn('mt-10 mb-8 flex justify-end space-x-2 px-8', classNames?.footer)}>
          {footer}
        </div>
      </DialogContent>
    </Dialog>
  )
}