Skip to content

Commit 9d0647a

Browse files
authored
Merge pull request #2996 from pyth-network/cprussin/add-economic-data-feed-icon
feat(insights): add eco feed icons
2 parents 61d7e0a + 6e546ed commit 9d0647a

File tree

4 files changed

+31
-13
lines changed

4 files changed

+31
-13
lines changed
Lines changed: 4 additions & 0 deletions
Loading

apps/insights/src/components/PriceFeedIcon/index.module.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,9 @@
4242
background: theme.pallette-color("emerald", 300);
4343
fill: theme.pallette-color("stone", 700);
4444
}
45+
46+
&[data-asset-class="ECO"] {
47+
background: theme.pallette-color("sky", 200);
48+
fill: theme.pallette-color("sky", 800);
49+
}
4550
}

apps/insights/src/components/PriceFeedIcon/index.tsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Commodities from "./commodities.svg";
44
import CryptoIndex from "./crypto-index.svg";
55
import CryptoRedemptionRate from "./crypto-redemption-rate.svg";
66
import Crypto from "./crypto.svg";
7+
import Eco from "./eco.svg";
78
import Equity from "./equity.svg";
89
import Fx from "./fx.svg";
910
import { icons } from "./icons";
@@ -19,19 +20,25 @@ type Props = Omit<SVGProps, keyof OwnProps | "width" | "height" | "viewBox"> &
1920
OwnProps;
2021

2122
export const PriceFeedIcon = ({ assetClass, symbol, ...props }: Props) => {
22-
if (assetClass === "Crypto") {
23-
const firstPart = symbol.split(".")[1]?.split("/")[0];
24-
const Icon = firstPart ? (icons as SVGRecord)[firstPart] : undefined;
25-
return Icon ? (
26-
<Icon width="100%" height="100%" viewBox="0 0 32 32" {...props} />
27-
) : (
28-
<GenericIcon assetClass="Crypto" {...props} />
29-
);
30-
} else {
31-
return assetClassHasIcon(assetClass) ? (
32-
<GenericIcon assetClass={assetClass} {...props} />
33-
) : // eslint-disable-next-line unicorn/no-null
34-
null;
23+
switch (assetClass) {
24+
case "Crypto": {
25+
const firstPart = symbol.split(".")[1]?.split("/")[0];
26+
const Icon = firstPart ? (icons as SVGRecord)[firstPart] : undefined;
27+
return Icon ? (
28+
<Icon width="100%" height="100%" viewBox="0 0 32 32" {...props} />
29+
) : (
30+
<GenericIcon assetClass="Crypto" {...props} />
31+
);
32+
}
33+
case "Crypto NAV": {
34+
return <GenericIcon assetClass="Crypto" {...props} />;
35+
}
36+
default: {
37+
return assetClassHasIcon(assetClass) ? (
38+
<GenericIcon assetClass={assetClass} {...props} />
39+
) : // eslint-disable-next-line unicorn/no-null
40+
null;
41+
}
3542
}
3643
};
3744

@@ -64,6 +71,7 @@ const ASSET_CLASS_TO_ICON = {
6471
"Crypto Index": CryptoIndex,
6572
"Crypto Redemption Rate": CryptoRedemptionRate,
6673
Crypto,
74+
ECO: Eco,
6775
Equity,
6876
FX: Fx,
6977
Metal,

apps/insights/src/static-data/price-feeds.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const priceFeeds = {
22
updateFrequency: "400ms",
33
featuredFeeds: [
4+
"ECO.US.GDP",
45
"Crypto.ARC/USD",
56
"Crypto.CDXUSD/USD",
67
"Equity.GB.CSPX/USD",

0 commit comments

Comments
 (0)