mirror of
https://github.com/toeverything/AFFiNE.git
synced 2025-01-03 06:45:12 +03:00
fix(core): wrong pricing state in billing ai card (#6583)
This commit is contained in:
parent
f6fcbd8ea9
commit
c222cf7b96
@ -97,6 +97,7 @@ const SubscriptionSettings = () => {
|
||||
const [subscription, mutateSubscription] = useUserSubscription();
|
||||
const [openCancelModal, setOpenCancelModal] = useState(false);
|
||||
const {
|
||||
isFree: isFreeAI,
|
||||
actionType: aiActionType,
|
||||
Action: AIAction,
|
||||
billingTip,
|
||||
@ -187,7 +188,11 @@ const SubscriptionSettings = () => {
|
||||
<SettingRow
|
||||
spreadCol={false}
|
||||
name={t['com.affine.payment.billing-setting.ai-plan']()}
|
||||
desc={billingTip}
|
||||
desc={
|
||||
isFreeAI
|
||||
? t['com.affine.payment.billing-setting.ai.free-desc']()
|
||||
: billingTip
|
||||
}
|
||||
/>
|
||||
{aiPrice?.yearlyAmount ? (
|
||||
<AIAction
|
||||
@ -196,12 +201,14 @@ const SubscriptionSettings = () => {
|
||||
recurring={SubscriptionRecurring.Yearly}
|
||||
onSubscriptionUpdate={mutateSubscription}
|
||||
>
|
||||
{aiActionType === 'subscribe' ? 'Purchase' : null}
|
||||
{aiActionType === 'subscribe'
|
||||
? t['com.affine.payment.billing-setting.ai.purchase']()
|
||||
: null}
|
||||
</AIAction>
|
||||
) : null}
|
||||
</div>
|
||||
<p className={styles.planPrice}>
|
||||
{aiPriceReadable}
|
||||
{isFreeAI ? '$0' : aiPriceReadable}
|
||||
<span className={styles.billingFrequency}>/{aiPriceFrequency}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -32,6 +32,8 @@ export const useAffineAISubscription = () => {
|
||||
cancel: AICancel,
|
||||
}[actionType];
|
||||
|
||||
const isFree = !subscription;
|
||||
|
||||
const billingTip = subscription?.nextBillAt
|
||||
? t['com.affine.payment.ai.billing-tip.next-bill-at']({
|
||||
due: timestampToLocalDate(subscription.nextBillAt),
|
||||
@ -42,5 +44,5 @@ export const useAffineAISubscription = () => {
|
||||
})
|
||||
: null;
|
||||
|
||||
return { actionType, Action, billingTip };
|
||||
return { actionType, Action, billingTip, isFree };
|
||||
};
|
||||
|
@ -909,6 +909,8 @@
|
||||
"com.affine.payment.billing-setting.upgrade": "Upgrade",
|
||||
"com.affine.payment.billing-setting.view-invoice": "View Invoice",
|
||||
"com.affine.payment.billing-setting.year": "year",
|
||||
"com.affine.payment.billing-setting.ai.free-desc": "Yue are current on the Free plan.",
|
||||
"com.affine.payment.billing-setting.ai.purchase": "Purchase",
|
||||
"com.affine.payment.blob-limit.description.local": "The maximum file upload size for local workspaces is {{quota}}.",
|
||||
"com.affine.payment.blob-limit.description.member": "The maximum file upload size for this joined workspace is {{quota}}. You can contact the owner of this workspace.",
|
||||
"com.affine.payment.blob-limit.description.owner.free": "{{planName}} users can upload files with a maximum size of {{currentQuota}}. You can upgrade your account to unlock a maximum file size of {{upgradeQuota}}.",
|
||||
|
Loading…
Reference in New Issue
Block a user