Files
scrap/webui/src/utils/storeLogos.ts
Gilles Soulier cf7c415e22 before claude
2026-01-17 13:40:26 +01:00

27 lines
732 B
TypeScript

import amazonLogo from "@/assets/stores/amazon.svg";
import cdiscountLogo from "@/assets/stores/cdiscount.svg";
import aliexpressLogo from "@/assets/stores/aliexpress.svg";
import backmarketLogo from "@/assets/stores/backmarket.svg";
const LOGOS: Record<string, string> = {
amazon: amazonLogo,
cdiscount: cdiscountLogo,
aliexpress: aliexpressLogo,
backmarket: backmarketLogo,
};
const normalize = (value: string | undefined): string => {
if (!value) {
return "";
}
return value
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "");
};
export const getStoreLogo = (storeName: string | undefined): string | null => {
const key = normalize(storeName);
return LOGOS[key] || null;
};