Merge branch 'doge' into 'main'
Add missing dogecoin icon, fix display of unknown cryptocurrency icons See merge request soapbox-pub/soapbox!3238
This commit is contained in:
commit
35187f0c67
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><g fill="none" fill-rule="evenodd"><circle cx="16" cy="16" r="16" fill="#C3A634"/><path fill="#FFF" d="M13.248 14.61h4.314v2.286h-4.314v4.818h2.721c1.077 0 1.958-.145 2.644-.437.686-.291 1.224-.694 1.615-1.21a4.4 4.4 0 00.796-1.815 11.4 11.4 0 00.21-2.252 11.4 11.4 0 00-.21-2.252 4.396 4.396 0 00-.796-1.815c-.391-.516-.93-.919-1.615-1.21-.686-.292-1.567-.437-2.644-.437h-2.721v4.325zm-2.766 2.286H9v-2.285h1.482V8h6.549c1.21 0 2.257.21 3.142.627.885.419 1.607.99 2.168 1.715.56.724.977 1.572 1.25 2.543.273.971.409 2.01.409 3.115a11.47 11.47 0 01-.41 3.115c-.272.97-.689 1.819-1.25 2.543-.56.725-1.282 1.296-2.167 1.715-.885.418-1.933.627-3.142.627h-6.549v-7.104z"/></g></svg>
|
After Width: | Height: | Size: 738 B |
|
@ -1,10 +1,14 @@
|
||||||
import genericIcon from 'soapbox/assets/cryptocurrency/generic.svg';
|
import genericIcon from 'soapbox/assets/cryptocurrency/generic.svg';
|
||||||
|
|
||||||
|
const icons = import.meta.glob('../../../assets/cryptocurrency/*.svg', { eager: true });
|
||||||
|
|
||||||
/** Get crypto icon URL by ticker symbol, or fall back to generic icon */
|
/** Get crypto icon URL by ticker symbol, or fall back to generic icon */
|
||||||
function getIcon(ticker: string): string {
|
function getIcon(ticker: string): string {
|
||||||
try {
|
const iconPath = `../../../assets/cryptocurrency/${ticker}.svg`;
|
||||||
return new URL(`../../../assets/cryptocurrency/${ticker}.svg`, import.meta.url).href;
|
|
||||||
} catch {
|
if (icons[iconPath]) {
|
||||||
|
return new URL(iconPath, import.meta.url).href;
|
||||||
|
} else {
|
||||||
return genericIcon;
|
return genericIcon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue