From 2f54640bea61d8ec8138793c14b922c68b53af0b Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 10 Nov 2024 22:06:17 -0600 Subject: [PATCH] Fix cryptocurrency icons --- src/features/crypto-donate/components/crypto-icon.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/features/crypto-donate/components/crypto-icon.tsx b/src/features/crypto-donate/components/crypto-icon.tsx index 45b78e040..2ec7626e5 100644 --- a/src/features/crypto-donate/components/crypto-icon.tsx +++ b/src/features/crypto-donate/components/crypto-icon.tsx @@ -1,16 +1,11 @@ import genericIcon from 'soapbox/assets/cryptocurrency/generic.svg'; -const icons = import.meta.glob('../../../assets/cryptocurrency/*.svg', { eager: true }); +const icons: Record = import.meta.glob('../../../assets/cryptocurrency/*.svg', { eager: true }); /** Get crypto icon URL by ticker symbol, or fall back to generic icon */ function getIcon(ticker: string): string { const iconPath = `../../../assets/cryptocurrency/${ticker}.svg`; - - if (icons[iconPath]) { - return new URL(iconPath, import.meta.url).href; - } else { - return genericIcon; - } + return icons[iconPath]?.default || genericIcon; } interface ICryptoIcon {