fixed network selection (hex string) and icons
This commit is contained in:
@@ -7,17 +7,16 @@ export const imagesPath = import.meta.glob<string>("@/assets/*.{png,svg}", {
|
||||
});
|
||||
|
||||
export const getNetworkImage = (networkName: string): string => {
|
||||
const imageName = networkName
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]/g, '-');
|
||||
try {
|
||||
const path = Object.keys(imagesPath).find((key) =>
|
||||
key.endsWith(`${networkName.toLowerCase()}.svg`)
|
||||
key.endsWith(`${imageName}.svg`)
|
||||
);
|
||||
return path ? imagesPath[path] : "";
|
||||
} catch (error) {
|
||||
console.error("Error fetching network image");
|
||||
const path = Object.keys(imagesPath).find((key) =>
|
||||
key.endsWith(`invalidIcon.svg`)
|
||||
);
|
||||
return path ? imagesPath[path] : "";
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user