Fix cryptocurrency icons

This commit is contained in:
Alex Gleason 2024-11-10 22:06:17 -06:00
parent 35187f0c67
commit 2f54640bea
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 2 additions and 7 deletions

View File

@ -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<string, { default: string }> = 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 {