11'use client'
2- import type { FC } from 'react'
2+ import type { ComponentType , ReactNode } from 'react'
33import { Button } from '@langgenius/dify-ui/button'
4- import * as React from 'react'
54import { useCallback } from 'react'
65import { useTranslation } from 'react-i18next'
7- import Modal from '@/app/components/base/modal'
6+ import { UpgradeModal } from '@/app/components/base/upgrade- modal'
87import UpgradeBtn from '@/app/components/billing/upgrade-btn'
98import { useModalContext } from '@/context/modal-context'
109import { SquareChecklist } from '../../base/icons/src/vender/other'
11- import styles from './style.module.css'
1210
1311type Props = {
14- Icon ?: React . ComponentType < React . SVGProps < SVGSVGElement > >
12+ Icon ?: ComponentType < { className ?: string } >
1513 title : string
1614 description : string
17- extraInfo ?: React . ReactNode
15+ extraInfo ?: ReactNode
1816 show : boolean
1917 onClose : ( ) => void
2018 onUpgrade ?: ( ) => void
2119}
2220
23- const PlanUpgradeModal : FC < Props > = ( {
21+ export function PlanUpgradeModal ( {
2422 Icon = SquareChecklist ,
2523 title,
2624 description,
2725 extraInfo,
2826 show,
2927 onClose,
3028 onUpgrade,
31- } ) => {
29+ } : Props ) {
3230 const { t } = useTranslation ( )
3331 const { setShowPricingModal } = useModalContext ( )
3432
@@ -41,51 +39,30 @@ const PlanUpgradeModal: FC<Props> = ({
4139 } , [ onClose , onUpgrade , setShowPricingModal ] )
4240
4341 return (
44- < Modal
45- isShow = { show }
46- onClose = { onClose }
47- closable = { false }
48- clickOutsideNotClose
49- className = { `${ styles . surface } w-[580px] rounded-2xl p-0!` }
50- >
51- < div className = "relative" >
52- < div
53- aria-hidden
54- className = { `${ styles . heroOverlay } pointer-events-none absolute inset-0` }
55- />
56- < div className = "px-8 pt-8" >
57- < div className = { `${ styles . icon } flex size-12 items-center justify-center rounded-xl shadow-lg backdrop-blur-[5px]` } >
58- < Icon className = "size-6 text-text-primary-on-surface" />
59- </ div >
60- < div className = "mt-6 space-y-2" >
61- < div className = { `${ styles . highlight } title-3xl-semi-bold` } >
62- { title }
63- </ div >
64- < div className = "system-md-regular text-text-tertiary" >
65- { description }
66- </ div >
67- </ div >
68- { extraInfo }
69- </ div >
70- </ div >
71-
72- < div className = "mt-10 mb-8 flex justify-end space-x-2 px-8" >
73- < Button
74- onClick = { onClose }
75- >
76- { t ( 'triggerLimitModal.dismiss' , { ns : 'billing' } ) }
77- </ Button >
78- < UpgradeBtn
79- size = "custom"
80- isShort
81- onClick = { handleUpgrade }
82- className = "h-8! rounded-lg! px-2"
83- labelKey = "triggerLimitModal.upgrade"
84- loc = "trigger-events-limit-modal"
85- />
86- </ div >
87- </ Modal >
42+ < UpgradeModal
43+ open = { show }
44+ onOpenChange = { open => ! open && onClose ( ) }
45+ Icon = { Icon }
46+ title = { title }
47+ description = { description }
48+ extraInfo = { extraInfo }
49+ footer = { (
50+ < >
51+ < Button
52+ onClick = { onClose }
53+ >
54+ { t ( 'triggerLimitModal.dismiss' , { ns : 'billing' } ) }
55+ </ Button >
56+ < UpgradeBtn
57+ size = "custom"
58+ isShort
59+ onClick = { handleUpgrade }
60+ className = "h-8! rounded-lg! px-2"
61+ labelKey = "triggerLimitModal.upgrade"
62+ loc = "trigger-events-limit-modal"
63+ />
64+ </ >
65+ ) }
66+ />
8867 )
8968}
90-
91- export default React . memo ( PlanUpgradeModal )
0 commit comments