before claude
This commit is contained in:
26
webui/src/utils/storeLogos.ts
Normal file
26
webui/src/utils/storeLogos.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user