Update code to deal with new paths under src

This commit is contained in:
Alex Gleason
2023-09-18 16:37:15 -05:00
parent efdec35d98
commit dd97a46a03
21 changed files with 69 additions and 41 deletions

View File

@ -3,8 +3,8 @@ import React from 'react';
/** Get crypto icon URL by ticker symbol, or fall back to generic icon */
const getIcon = (ticker: string): string => {
const modules: Record<string, any> = import.meta.glob('../../../../../node_modules/cryptocurrency-icons/svg/color/*.svg', { eager: true });
const key = `../../../../../node_modules/cryptocurrency-icons/svg/color/${ticker}.svg`;
const modules: Record<string, any> = import.meta.glob('../../../../node_modules/cryptocurrency-icons/svg/color/*.svg', { eager: true });
const key = `../../../../node_modules/cryptocurrency-icons/svg/color/${ticker}.svg`;
return modules[key]?.default || genericIcon;
};