Skip to content

Commit

Permalink
Disable liquidity option in the graph section
Browse files Browse the repository at this point in the history
  • Loading branch information
af-afk committed Dec 5, 2024
1 parent 39c7366 commit 54ada6d
Showing 1 changed file with 3 additions and 32 deletions.
35 changes: 3 additions & 32 deletions web/src/components/SwapPro/SwapProGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export const Graph = ({
pool?: SwapProPoolFragmentFragment;
currentPrice: string;
}) => {
const [activeGraphType, setActiveGraphType] = useState<
"price" | "volume" | "liquidity"
>("volume");
const [activeGraphType, setActiveGraphType] = useState<"price" | "volume">(
"volume",
);

const [duration, setDuration] = useState<"7D" | "1M" | "6M" | "1Y" | "ALL">(
"7D",
Expand Down Expand Up @@ -108,30 +108,6 @@ export const Graph = ({
];
}

if (activeGraphType === "liquidity") {
// return the data for the duration
let slicedData = pool?.liquidityOverTime[durationKey];

if (duration !== "ALL") {
slicedData = slicedData?.slice(0, durationToDays[duration]);
}
slicedData = slicedData?.reverse();

const last = slicedData?.at(-1);
// TODO - should liquidity include token1 value as well?
const header = usdFormat(parseFloat(last?.fusdc.valueUsd ?? "0"));

return [
slicedData
// reformat pool data to match expected graph data
?.map((d) => ({
date: new Date(d.timestamp * 1000),
value: parseFloat(d.fusdc.valueUsd),
})),
header,
];
}

// should never reach here
return [];
}, [
Expand Down Expand Up @@ -159,11 +135,6 @@ export const Graph = ({
value: "volume",
ref: useRef(),
},
{
label: "Liquidity",
value: "liquidity",
ref: useRef(),
},
]}
/>
</div>
Expand Down

0 comments on commit 54ada6d

Please sign in to comment.