import { mdiEmail, mdiPhone, mdiDownload, mdiLink } from "@mdi/js"; import * as simpleIcons from "simple-icons"; export function getSimpleIconPath(network: string): string { try { const slug = network.toLowerCase().normalize("NFKD").replace(/[^\w]/g, ""); const iconKey = `si${slug.charAt(0).toUpperCase()}${slug.slice(1)}`; const icon = (simpleIcons as any)[iconKey]; return icon ? icon.path : ""; } catch (error) { console.warn(`Error finding icon for network: ${network}`, error); return ""; } } export function getMdiIconPath(iconName: string): string { const iconMap: { [key: string]: string } = { "mdi:email": mdiEmail, "mdi:phone": mdiPhone, "mdi:download": mdiDownload, "mdi:link": mdiLink, }; return iconMap[iconName] || ""; } export const fetchProfileIcons = (profiles: any[]) => { const profileIcons: { [key: string]: string } = {}; if (profiles) { for (const profile of profiles) { profileIcons[profile.network] = getSimpleIconPath(profile.network); } } return profileIcons; };