mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-07 07:43:39 +01:00
Better handle invalid coinmarketcap data
This commit is contained in:
parent
d75505acc8
commit
276edb2069
@ -51,6 +51,9 @@ export default function Component({ service }) {
|
|||||||
|
|
||||||
const { data } = statsData;
|
const { data } = statsData;
|
||||||
|
|
||||||
|
// Make sure API returned valid data for the symbol
|
||||||
|
const validSymbols = symbols.filter(symbol => data[symbol].quote[currencyCode][`percent_change_${dateRange}`] !== null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
<div className={classNames(service.description ? "-top-10" : "-top-8", "absolute right-1")}>
|
<div className={classNames(service.description ? "-top-10" : "-top-8", "absolute right-1")}>
|
||||||
@ -58,7 +61,7 @@ export default function Component({ service }) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col w-full">
|
<div className="flex flex-col w-full">
|
||||||
{symbols.map((symbol) => (
|
{validSymbols.map((symbol) => (
|
||||||
<div
|
<div
|
||||||
key={data[symbol].symbol}
|
key={data[symbol].symbol}
|
||||||
className="bg-theme-200/50 dark:bg-theme-900/20 rounded m-1 flex-1 flex flex-row items-center justify-between p-1 text-xs"
|
className="bg-theme-200/50 dark:bg-theme-900/20 rounded m-1 flex-1 flex flex-row items-center justify-between p-1 text-xs"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user