dify/web/app/components/custom/custom-page/index.tsx
Stephen Zhou a84c2d36a3
style: format with vp fmt (#38803)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-12 15:57:46 +00:00

57 lines
2.3 KiB
TypeScript

import { useTranslation } from 'react-i18next'
import { contactSalesUrl } from '@/app/components/billing/config'
import { Plan } from '@/app/components/billing/type'
import { IS_CLOUD_EDITION } from '@/config'
import { useModalContext } from '@/context/modal-context'
import { useProviderContext } from '@/context/provider-context'
import CustomWebAppBrand from '../custom-web-app-brand'
const CustomPage = () => {
const { t } = useTranslation()
const { plan, enableBilling } = useProviderContext()
const { setShowPricingModal } = useModalContext()
const showBillingTip = IS_CLOUD_EDITION && enableBilling && plan.type === Plan.sandbox
const showContact = enableBilling && (plan.type === Plan.professional || plan.type === Plan.team)
return (
<div className="flex flex-col">
{showBillingTip && (
<div className="mb-1 flex justify-between rounded-xl bg-linear-to-r from-components-input-border-active-prompt-1 to-components-input-border-active-prompt-2 p-4 pl-6 shadow-lg backdrop-blur-xs">
<div className="space-y-1 text-text-primary-on-surface">
<div className="title-xl-semi-bold">
{t(($) => $['upgradeTip.title'], { ns: 'custom' })}
</div>
<div className="system-sm-regular">
{t(($) => $['upgradeTip.des'], { ns: 'custom' })}
</div>
</div>
<button
type="button"
className="flex h-10 w-[120px] cursor-pointer items-center justify-center rounded-3xl border-none bg-white p-0 system-md-semibold text-text-accent shadow-xs hover:opacity-95"
onClick={() => setShowPricingModal()}
>
{t(($) => $['upgradeBtn.encourageShort'], { ns: 'billing' })}
</button>
</div>
)}
<CustomWebAppBrand />
{showContact && (
<div className="absolute bottom-0 h-[50px] text-xs leading-[50px] text-text-quaternary">
{t(($) => $['customize.prefix'], { ns: 'custom' })}
<a
className="text-text-accent"
href={contactSalesUrl}
target="_blank"
rel="noopener noreferrer"
>
{t(($) => $['customize.contactUs'], { ns: 'custom' })}
</a>
{t(($) => $['customize.suffix'], { ns: 'custom' })}
</div>
)}
</div>
)
}
export default CustomPage