mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 08:58:09 +08:00
Frontend: - Migrate deprecated imports: modal→dialog, toast→ui/toast, tooltip→tooltip-plus, portal-to-follow-elem→portal-to-follow-elem-plus, select→ui/select, confirm→alert-dialog - Replace next/* with @/next/* wrapper modules - Convert TypeScript enums to const objects (erasable-syntax-only) - Replace all `any` types with `unknown` or specific types in workflow types - Fix unused vars, react-hooks-extra, react-refresh/only-export-components - Extract InteractionMode to separate module, tool-block commands to commands.ts Backend: - Fix pyrefly errors: type narrowing, null guards, getattr patterns - Remove unused TYPE_CHECKING imports in LLM node - Add ignore_imports entries to .importlinter for dify_graph boundary violations Made-with: Cursor
70 lines
1.7 KiB
TypeScript
70 lines
1.7 KiB
TypeScript
'use client'
|
|
import type { FC } from 'react'
|
|
import * as React from 'react'
|
|
import { useCallback } from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import Button from '@/app/components/base/button'
|
|
import UpgradeModalBase from '@/app/components/base/upgrade-modal'
|
|
import UpgradeBtn from '@/app/components/billing/upgrade-btn'
|
|
import { useModalContext } from '@/context/modal-context'
|
|
import { SquareChecklist } from '../../base/icons/src/vender/other'
|
|
|
|
type Props = {
|
|
Icon?: React.ComponentType<React.SVGProps<SVGSVGElement>>
|
|
title: string
|
|
description: string
|
|
extraInfo?: React.ReactNode
|
|
show: boolean
|
|
onClose: () => void
|
|
onUpgrade?: () => void
|
|
}
|
|
|
|
const PlanUpgradeModal: FC<Props> = ({
|
|
Icon = SquareChecklist,
|
|
title,
|
|
description,
|
|
extraInfo,
|
|
show,
|
|
onClose,
|
|
onUpgrade,
|
|
}) => {
|
|
const { t } = useTranslation()
|
|
const { setShowPricingModal } = useModalContext()
|
|
|
|
const handleUpgrade = useCallback(() => {
|
|
onClose()
|
|
if (onUpgrade)
|
|
onUpgrade()
|
|
else
|
|
setShowPricingModal()
|
|
}, [onClose, onUpgrade, setShowPricingModal])
|
|
|
|
return (
|
|
<UpgradeModalBase
|
|
show={show}
|
|
// eslint-disable-next-line ts/no-explicit-any
|
|
Icon={Icon as any}
|
|
title={title}
|
|
description={description}
|
|
extraInfo={extraInfo}
|
|
footer={(
|
|
<>
|
|
<Button onClick={onClose}>
|
|
{t('triggerLimitModal.dismiss', { ns: 'billing' })}
|
|
</Button>
|
|
<UpgradeBtn
|
|
size="custom"
|
|
isShort
|
|
onClick={handleUpgrade}
|
|
className="!h-8 !rounded-lg px-2"
|
|
labelKey="triggerLimitModal.upgrade"
|
|
loc="trigger-events-limit-modal"
|
|
/>
|
|
</>
|
|
)}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default React.memo(PlanUpgradeModal)
|