Merge pull request #955 from SuanmoSuanyangTechnology/fix/v0.3.1_zy
fix(web): package support unlimited
This commit is contained in:
@@ -2,11 +2,11 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-04-14 12:28:23
|
* @Date: 2026-04-14 12:28:23
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-04-16 17:34:02
|
* @Last Modified time: 2026-04-21 15:46:35
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useState, forwardRef, useImperativeHandle } from 'react';
|
import { useState, forwardRef, useImperativeHandle } from 'react';
|
||||||
import { Flex, Tooltip, Divider } from 'antd';
|
import { Flex, Divider } from 'antd';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
|
||||||
@@ -82,8 +82,7 @@ const SubscriptionDetailModal = forwardRef<SubscriptionDetailModalRef>((_props,
|
|||||||
{/* Features */}
|
{/* Features */}
|
||||||
<Flex gap={12} vertical className="rb:space-y-3 rb:mb-4 rb:h-[calc(100vh-341px)]! rb:overflow-y-auto">
|
<Flex gap={12} vertical className="rb:space-y-3 rb:mb-4 rb:h-[calc(100vh-341px)]! rb:overflow-y-auto">
|
||||||
{billingUnits.map(({ key, unit, icon }) => {
|
{billingUnits.map(({ key, unit, icon }) => {
|
||||||
const value = detail?.quotas[key as keyof Subscription['quotas']];
|
const value = detail?.quotas?.[key as keyof Subscription['quotas']];
|
||||||
if (value === undefined || value === null) return null;
|
|
||||||
return (
|
return (
|
||||||
<UnitWrapper
|
<UnitWrapper
|
||||||
key={key}
|
key={key}
|
||||||
@@ -95,7 +94,7 @@ const SubscriptionDetailModal = forwardRef<SubscriptionDetailModalRef>((_props,
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
{detail?.package_plan?.tech_support && (
|
{detail?.package_plan?.tech_support && detail?.package_plan?.[getKeyWithLanguage('tech_support')] && (
|
||||||
<UnitWrapper
|
<UnitWrapper
|
||||||
titleKey="tech_support"
|
titleKey="tech_support"
|
||||||
value={String(detail?.package_plan?.[getKeyWithLanguage('tech_support')] ?? '')}
|
value={String(detail?.package_plan?.[getKeyWithLanguage('tech_support')] ?? '')}
|
||||||
@@ -103,7 +102,7 @@ const SubscriptionDetailModal = forwardRef<SubscriptionDetailModalRef>((_props,
|
|||||||
theme_color={detail?.package_plan?.theme_color}
|
theme_color={detail?.package_plan?.theme_color}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{detail?.package_plan?.sla_compliance && (
|
{detail?.package_plan?.sla_compliance && detail?.package_plan?.[getKeyWithLanguage('sla_compliance')] && (
|
||||||
<UnitWrapper
|
<UnitWrapper
|
||||||
titleKey="sla"
|
titleKey="sla"
|
||||||
value={String(detail?.package_plan?.[getKeyWithLanguage('sla_compliance')] ?? '')}
|
value={String(detail?.package_plan?.[getKeyWithLanguage('sla_compliance')] ?? '')}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-02 15:25:31
|
* @Date: 2026-02-02 15:25:31
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-04-20 10:15:20
|
* @Last Modified time: 2026-04-21 15:46:03
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* SiderMenu Component
|
* SiderMenu Component
|
||||||
@@ -417,7 +417,7 @@ const Menu: FC<{
|
|||||||
<div className="rb:grid rb:grid-cols-4 rb:mt-4">
|
<div className="rb:grid rb:grid-cols-4 rb:mt-4">
|
||||||
{['workspace_quota', 'skill_quota', 'app_quota', 'model_quota'].map(key => (
|
{['workspace_quota', 'skill_quota', 'app_quota', 'model_quota'].map(key => (
|
||||||
<div key={key} className="rb:text-center">
|
<div key={key} className="rb:text-center">
|
||||||
<div className="rb:text-[13px] rb:font-[MiSans-Semibold] rb:font-semibold">{subscription.quotas?.[key as keyof typeof subscription.quotas]}</div>
|
<div className="rb:text-[13px] rb:font-[MiSans-Semibold] rb:font-semibold">{subscription.quotas?.[key as keyof typeof subscription.quotas] ?? t('package.noLimit')}</div>
|
||||||
<div className="rb:mt-1 rb:text-[#5B6167] rb:text-[10px] rb:leading-3.5">{t(`index.${key}`)}</div>
|
<div className="rb:mt-1 rb:text-[#5B6167] rb:text-[10px] rb:leading-3.5">{t(`index.${key}`)}</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -3093,6 +3093,7 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re
|
|||||||
editPackage: 'Edit Package',
|
editPackage: 'Edit Package',
|
||||||
|
|
||||||
viewDetail: 'View full package details',
|
viewDetail: 'View full package details',
|
||||||
|
noLimit: 'Unlimited',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3057,6 +3057,7 @@ export const zh = {
|
|||||||
editPackage: '编辑套餐',
|
editPackage: '编辑套餐',
|
||||||
|
|
||||||
viewDetail: '查看完整套餐详情',
|
viewDetail: '查看完整套餐详情',
|
||||||
|
noLimit: '不限制',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-04-14 11:43:57
|
* @Date: 2026-04-14 11:43:57
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-04-14 11:44:40
|
* @Last Modified time: 2026-04-21 15:44:13
|
||||||
*/
|
*/
|
||||||
export const billingUnits = [
|
export const billingUnits = [
|
||||||
{
|
{
|
||||||
@@ -42,7 +42,7 @@ export const billingUnits = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'model_quota',
|
key: 'model_quota',
|
||||||
unit: 'ops', placeholder: 'numberPlaceholder',
|
unit: 'pcs', placeholder: 'numberPlaceholder',
|
||||||
icon: 'model',
|
icon: 'model',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-04-14 11:34:42
|
* @Date: 2026-04-14 11:34:42
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-04-16 17:23:49
|
* @Last Modified time: 2026-04-21 15:45:30
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Package Component
|
* Package Component
|
||||||
@@ -60,7 +60,7 @@ const btnClassNames = {
|
|||||||
default: 'rb:h-10! rb:rounded-[8px]! rb:bg-[#212332]! rb:text-white! rb:border-0! rb:hover:border-0! rb:hover:opacity-[0.8]',
|
default: 'rb:h-10! rb:rounded-[8px]! rb:bg-[#212332]! rb:text-white! rb:border-0! rb:hover:border-0! rb:hover:opacity-[0.8]',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const UnitWrapper = ({ titleKey, value, icon, unit, theme_color = '#171719' }: { titleKey: string; value: number | string; icon: string; unit?: string; theme_color?: string; }) => {
|
export const UnitWrapper = ({ titleKey, value, icon, unit, theme_color = '#171719' }: { titleKey: string; value?: number | string | null; icon: string; unit?: string; theme_color?: string; }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const renderFeatureIcon = (iconKey: string, color: string) => {
|
const renderFeatureIcon = (iconKey: string, color: string) => {
|
||||||
@@ -78,7 +78,7 @@ export const UnitWrapper = ({ titleKey, value, icon, unit, theme_color = '#17171
|
|||||||
>{renderFeatureIcon(icon, theme_color)}</Flex>
|
>{renderFeatureIcon(icon, theme_color)}</Flex>
|
||||||
<div className="rb:text-[13px] rb:leading-4.5">
|
<div className="rb:text-[13px] rb:leading-4.5">
|
||||||
<div className="rb:text-[#5F6266]">{t(`package.${titleKey}`)}</div>
|
<div className="rb:text-[#5F6266]">{t(`package.${titleKey}`)}</div>
|
||||||
<div>{value} {unit ? t(`package.${unit}`) : ''}</div>
|
{value ? <div>{value} {unit ? t(`package.${unit}`) : ''}</div> : <div>{t('package.noLimit')}</div>}
|
||||||
</div>
|
</div>
|
||||||
</Flex>
|
</Flex>
|
||||||
)
|
)
|
||||||
@@ -252,7 +252,6 @@ const Package: FC = () => {
|
|||||||
>
|
>
|
||||||
{billingUnits.map(({ key, unit, icon }) => {
|
{billingUnits.map(({ key, unit, icon }) => {
|
||||||
const value = pkg?.quotas?.[key as keyof Package['quotas']];
|
const value = pkg?.quotas?.[key as keyof Package['quotas']];
|
||||||
if (value === undefined || value === null) return null;
|
|
||||||
return (
|
return (
|
||||||
<UnitWrapper
|
<UnitWrapper
|
||||||
key={key}
|
key={key}
|
||||||
@@ -264,7 +263,7 @@ const Package: FC = () => {
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
{pkg.tech_support && (
|
{pkg.tech_support && pkg[getKeyWithLanguage('tech_support')] && (
|
||||||
<UnitWrapper
|
<UnitWrapper
|
||||||
titleKey="tech_support"
|
titleKey="tech_support"
|
||||||
value={String(pkg[getKeyWithLanguage('tech_support')] ?? '')}
|
value={String(pkg[getKeyWithLanguage('tech_support')] ?? '')}
|
||||||
@@ -272,7 +271,7 @@ const Package: FC = () => {
|
|||||||
theme_color={pkg.theme_color}
|
theme_color={pkg.theme_color}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{pkg.sla_compliance && (
|
{pkg.sla_compliance && pkg[getKeyWithLanguage('sla_compliance')] && (
|
||||||
<UnitWrapper
|
<UnitWrapper
|
||||||
titleKey="sla"
|
titleKey="sla"
|
||||||
value={String(pkg[getKeyWithLanguage('sla_compliance')] ?? '')}
|
value={String(pkg[getKeyWithLanguage('sla_compliance')] ?? '')}
|
||||||
|
|||||||
Reference in New Issue
Block a user