Skip to content

Commit

Permalink
Remove logs and change linewidth
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoopmann committed May 24, 2024
1 parent b869865 commit e7cb0c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
16 changes: 15 additions & 1 deletion src/mainsite/api/market-caps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import useSWR from "swr";
import * as Duration from "../../duration";
import { fetchJsonSwr } from "./fetchers";
import { useFlippeningData } from "./flippening-data";

type MarketCaps = {
btcMarketCap: number;
Expand All @@ -14,6 +15,19 @@ export const useMarketCaps = (): MarketCaps | undefined => {
const { data } = useSWR<MarketCaps>("/api/fees/market-caps", fetchJsonSwr, {
refreshInterval: Duration.millisFromSeconds(30),
});
const flippeningData = useFlippeningData();
const lastFlippeningDatapoint = flippeningData?.[flippeningData.length - 1];

return data;
const marketCapData =
(data === undefined || lastFlippeningDatapoint === undefined)
? undefined
: {
btcMarketCap: lastFlippeningDatapoint.btcMarketcap,
ethMarketCap: lastFlippeningDatapoint.ethMarketcap,
goldMarketCap: data.goldMarketCap,
usdM3MarketCap: data.usdM3MarketCap,
timestamp: data.timestamp,
};

return marketCapData;
};
9 changes: 3 additions & 6 deletions src/mainsite/components/MarketCapRatioWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const MarketCapRatiosWidget: FC<Props> = ({
color: COLORS.SERIES[0],
threshold: barrier,
data: marketCapRatiosSeries,
lineWidth: 3,
lineWidth: 2,
states: {
hover: {
lineWidthPlus: 0,
Expand All @@ -244,7 +244,7 @@ const MarketCapRatiosWidget: FC<Props> = ({
showInLegend: true,
threshold: barrier,
data: exponentialGrowthCurveSeries,
lineWidth: 3,
lineWidth: 2,
states: {
hover: {
lineWidthPlus: 0,
Expand Down Expand Up @@ -299,10 +299,7 @@ const MarketCapRatiosWidget: FC<Props> = ({
);

if (!isProjected && firstPoint?.x !== undefined) {
console.log("First Point", firstPoint);
const marketCaps = marketCapsMap[firstPoint.x as number];
console.log("Market caps Map", marketCapsMap);
console.log("Market caps", marketCaps);
const marketCapRows = [
`<tr>
<td>
Expand Down Expand Up @@ -390,7 +387,7 @@ const MarketCapRatiosWidget: FC<Props> = ({
</LabelText>
</div>
) : (
<div ref={containerRef} className={styles.supplyChart}>
<div ref={containerRef} className={`${styles.supplyChart}`}>
<HighchartsReact highcharts={Highcharts} options={options} />
</div>
)}
Expand Down

0 comments on commit e7cb0c7

Please sign in to comment.