fix: vendor options display by locales

This commit is contained in:
jialin
2026-06-03 18:28:31 +08:00
committed by jialin
parent 2bb04a419d
commit dc04529f5b
8 changed files with 81 additions and 26 deletions
@@ -41,16 +41,6 @@ const imageLogoMap = {
ubuntu: ubuntuLogo
} as const;
const manufacturerLabelMap: Record<string, string> = Object.values(
GPUsConfigs
).reduce(
(acc, item) => {
if (item.gpuVendor) acc[item.gpuVendor] = item.label;
return acc;
},
{ cpu: 'CPU' } as Record<string, string>
);
const matchImageLogo = (
image: string | undefined
): { logo: string; type: string } | null => {
@@ -145,6 +135,19 @@ interface TemplateCardProps {
const TemplateCardItem: React.FC<TemplateCardProps> = ({ data, onSelect }) => {
const intl = useIntl();
const manufacturerLabelMap: Record<string, string> = Object.values(
GPUsConfigs
).reduce(
(acc, item) => {
if (item.gpuVendor)
acc[item.gpuVendor] = item.locales.locale
? intl.formatMessage({ id: item.locales.label })
: item.locales.label;
return acc;
},
{ cpu: 'CPU' } as Record<string, string>
);
const handleOnSelect = (item: any) => {
onSelect?.({ action: item.key, data });
};