fix: not owner can not pay (#1772)

This commit is contained in:
Joel 2023-12-18 16:54:47 +08:00 • committed by GitHub
commit 354d033e60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 8 deletions

View file

@ -16,6 +16,7 @@ type Props = {
currentPlan: Plan
plan: Plan
planRange: PlanRange
canPay: boolean
}
const KeyValue = ({ label, value, tooltip }: { label: string; value: string | number | JSX.Element; tooltip?: string }) => {
@ -65,6 +66,7 @@ const PlanItem: FC<Props> = ({
plan,
currentPlan,
planRange,
canPay,
}) => {
const { t } = useTranslation()
const [loading, setLoading] = React.useState(false)
@ -75,10 +77,13 @@ const PlanItem: FC<Props> = ({
const planInfo = ALL_PLANS[plan]
const isYear = planRange === PlanRange.yearly
const isCurrent = plan === currentPlan
const isPlanDisabled = planInfo.level <= ALL_PLANS[currentPlan].level
const isPlanDisabled = planInfo.level <= ALL_PLANS[currentPlan].level || (!canPay && plan !== Plan.enterprise)
const { isCurrentWorkspaceManager } = useAppContext()
const btnText = (() => {
if (!canPay && plan !== Plan.enterprise)
return t('billing.plansCommon.contractOwner')
if (isCurrent)
return t('billing.plansCommon.currentPlan')