feat: enhance PricingTags and SelectableButtonGroup with new badge styles and color variants
This commit is contained in:
@@ -76,7 +76,6 @@ const PricingEndpointTypes = ({
|
||||
value: 'all',
|
||||
label: t('全部端点'),
|
||||
tagCount: getEndpointTypeCount('all'),
|
||||
disabled: models.length === 0,
|
||||
},
|
||||
...availableEndpointTypes.map((endpointType) => {
|
||||
const count = getEndpointTypeCount(endpointType);
|
||||
@@ -84,7 +83,6 @@ const PricingEndpointTypes = ({
|
||||
value: endpointType,
|
||||
label: getEndpointTypeLabel(endpointType),
|
||||
tagCount: count,
|
||||
disabled: count === 0,
|
||||
};
|
||||
}),
|
||||
];
|
||||
@@ -96,6 +94,7 @@ const PricingEndpointTypes = ({
|
||||
activeValue={filterEndpointType}
|
||||
onChange={setFilterEndpointType}
|
||||
loading={loading}
|
||||
variant='green'
|
||||
t={t}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -52,20 +52,19 @@ const PricingGroups = ({
|
||||
.length;
|
||||
let ratioDisplay = '';
|
||||
if (g === 'all') {
|
||||
ratioDisplay = t('全部');
|
||||
// ratioDisplay = t('全部');
|
||||
} else {
|
||||
const ratio = groupRatio[g];
|
||||
if (ratio !== undefined && ratio !== null) {
|
||||
ratioDisplay = `x${ratio}`;
|
||||
ratioDisplay = `${ratio}x`;
|
||||
} else {
|
||||
ratioDisplay = 'x1';
|
||||
ratioDisplay = '1x';
|
||||
}
|
||||
}
|
||||
return {
|
||||
value: g,
|
||||
label: g === 'all' ? t('全部分组') : g,
|
||||
tagCount: ratioDisplay,
|
||||
disabled: modelCount === 0,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -76,6 +75,7 @@ const PricingGroups = ({
|
||||
activeValue={filterGroup}
|
||||
onChange={setFilterGroup}
|
||||
loading={loading}
|
||||
variant='teal'
|
||||
t={t}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -52,6 +52,7 @@ const PricingQuotaTypes = ({
|
||||
activeValue={filterQuotaType}
|
||||
onChange={setFilterQuotaType}
|
||||
loading={loading}
|
||||
variant='amber'
|
||||
t={t}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -78,7 +78,6 @@ const PricingTags = ({
|
||||
value: 'all',
|
||||
label: t('全部标签'),
|
||||
tagCount: getTagCount('all'),
|
||||
disabled: models.length === 0,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -88,7 +87,6 @@ const PricingTags = ({
|
||||
value: tag,
|
||||
label: tag,
|
||||
tagCount: count,
|
||||
disabled: count === 0,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -102,6 +100,7 @@ const PricingTags = ({
|
||||
activeValue={filterTag}
|
||||
onChange={setFilterTag}
|
||||
loading={loading}
|
||||
variant='rose'
|
||||
t={t}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -83,7 +83,6 @@ const PricingVendors = ({
|
||||
value: 'all',
|
||||
label: t('全部供应商'),
|
||||
tagCount: getVendorCount('all'),
|
||||
disabled: models.length === 0,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -96,7 +95,6 @@ const PricingVendors = ({
|
||||
label: vendor,
|
||||
icon: icon ? getLobeHubIcon(icon, 16) : null,
|
||||
tagCount: count,
|
||||
disabled: count === 0,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -107,7 +105,6 @@ const PricingVendors = ({
|
||||
value: 'unknown',
|
||||
label: t('未知供应商'),
|
||||
tagCount: count,
|
||||
disabled: count === 0,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -121,6 +118,7 @@ const PricingVendors = ({
|
||||
activeValue={filterVendor}
|
||||
onChange={setFilterVendor}
|
||||
loading={loading}
|
||||
variant='violet'
|
||||
t={t}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -113,15 +113,6 @@ const PricingSidebar = ({
|
||||
t={t}
|
||||
/>
|
||||
|
||||
<PricingTags
|
||||
filterTag={filterTag}
|
||||
setFilterTag={setFilterTag}
|
||||
models={tagModels}
|
||||
allModels={categoryProps.models}
|
||||
loading={loading}
|
||||
t={t}
|
||||
/>
|
||||
|
||||
<PricingGroups
|
||||
filterGroup={filterGroup}
|
||||
setFilterGroup={handleGroupClick}
|
||||
@@ -140,6 +131,15 @@ const PricingSidebar = ({
|
||||
t={t}
|
||||
/>
|
||||
|
||||
<PricingTags
|
||||
filterTag={filterTag}
|
||||
setFilterTag={setFilterTag}
|
||||
models={tagModels}
|
||||
allModels={categoryProps.models}
|
||||
loading={loading}
|
||||
t={t}
|
||||
/>
|
||||
|
||||
<PricingEndpointTypes
|
||||
filterEndpointType={filterEndpointType}
|
||||
setFilterEndpointType={setFilterEndpointType}
|
||||
|
||||
@@ -96,15 +96,6 @@ const FilterModalContent = ({ sidebarProps, t }) => {
|
||||
t={t}
|
||||
/>
|
||||
|
||||
<PricingTags
|
||||
filterTag={filterTag}
|
||||
setFilterTag={setFilterTag}
|
||||
models={tagModels}
|
||||
allModels={categoryProps.models}
|
||||
loading={loading}
|
||||
t={t}
|
||||
/>
|
||||
|
||||
<PricingGroups
|
||||
filterGroup={filterGroup}
|
||||
setFilterGroup={setFilterGroup}
|
||||
@@ -123,6 +114,16 @@ const FilterModalContent = ({ sidebarProps, t }) => {
|
||||
t={t}
|
||||
/>
|
||||
|
||||
<PricingTags
|
||||
filterTag={filterTag}
|
||||
setFilterTag={setFilterTag}
|
||||
models={tagModels}
|
||||
allModels={categoryProps.models}
|
||||
loading={loading}
|
||||
t={t}
|
||||
/>
|
||||
|
||||
|
||||
<PricingEndpointTypes
|
||||
filterEndpointType={filterEndpointType}
|
||||
setFilterEndpointType={setFilterEndpointType}
|
||||
|
||||
Reference in New Issue
Block a user