Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@vercel/speed-insights": "^1.0.1",
"alchemy-sdk": "^3.1.0",
"axios": "^1.2.2",
"chart.js": "^4.4.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"ethers": "^5.7.2",
Expand All @@ -36,6 +37,7 @@
"next-themes": "^0.2.1",
"rc-toastr": "^1.3.4",
"react": "18.2.0",
"react-chartjs-2": "^5.2.0",
"react-device-detect": "^2.2.3",
"react-dom": "18.2.0",
"react-router-dom": "^6.6.1",
Expand Down
41 changes: 41 additions & 0 deletions src/components/Charts/TVLChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import { Line } from 'react-chartjs-2';
import 'chart.js/auto';

const TVLChart = () => {
const data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June'],
datasets: [
{
label: 'TVL',
data: [65, 59, 80, 81, 56, 80, 40],
fill: false,
backgroundColor: 'rgb(75, 192, 192)',
borderColor: '#227BED',
pointRadius: 0,
tension: 0.1,
},
],
};

const options = {

scales: {
y: {
display: false,
},
x: {
display: false,
},
},
plugins: {
legend: {
display: false,
},
},
};

return <Line data={data} options={options} />;
};

export default TVLChart
83 changes: 83 additions & 0 deletions src/components/Modals/Range/Analytics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { Transition, Dialog } from "@headlessui/react";
import { Fragment, useEffect, useState } from "react";
import { XMarkIcon } from "@heroicons/react/20/solid";
import { LineChart } from "lucide-react";
import TVLChart from "../../Charts/TVLChart";

export default function Analytics({ isOpen, setIsOpen }) {
return (
<Transition appear show={isOpen} as={Fragment}>
<Dialog
as="div"
className="relative z-50"
onClose={() => setIsOpen(false)}
>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-50" />
</Transition.Child>

<div className="fixed inset-0 overflow-y-auto">
<div className="flex min-h-full items-center justify-center p-4 text-center">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<Dialog.Panel className="w-full max-w-4xl transform overflow-hidden rounded-[4px] bg-black text-white border border-grey text-left align-middle shadow-xl px-5 py-5 transition-all">
<div className="flex items-center justify-between px-2 mb-5">
<h1 className="flex items-center gap-x-2">
<svg width="17" height="17" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M18 9C18.5523 9 19 9.44772 19 10V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V10C17 9.44772 17.4477 9 18 9Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 13C6.55228 13 7 13.4477 7 14V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V14C5 13.4477 5.44772 13 6 13Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 3C12.5523 3 13 3.44772 13 4V20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20V4C11 3.44772 11.4477 3 12 3Z" fill="currentColor"/>
</svg>
Analytics <span className="text-grey1">- (All Chains)</span>
</h1>
<XMarkIcon
onClick={() => setIsOpen(false)}
className="w-7 cursor-pointer"
/>
</div>
<div className="flex justify-between items-start gap-4 h-full">
<div className="border border-grey p-4 w-full flex justify-between flex-col rounded-[4px]">
<div className="flex flex-col gap-y-1">
<span className="text-sm text-grey1">TVL</span>
<span className="text-3xl">$200.3k</span>
</div>
<TVLChart />
</div>
<div className="flex flex-col items-center justify-between w-[60%] gap-4 h-[341px]">
<div className="border bg-dark/80 border-grey h-full rounded-[4px] flex flex-col w-full items-center justify-center gap-y-3">
<span className="text-grey1 text-sm">VOLUME</span>
<span className="text-white text-2xl md:text-3xl">
$25k
</span>
</div>
<div className="border bg-dark/80 border-grey h-full rounded-[4px] flex flex-col w-full items-center justify-center gap-y-3">
<span className="text-grey1 text-sm">FEES</span>
<span className="text-white text-2xl md:text-3xl">
$2.5k
</span>
</div>
</div>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition>
);
}
137 changes: 137 additions & 0 deletions src/components/Modals/Range/PoolAnalytics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import { Transition, Dialog } from "@headlessui/react";
import { Fragment, useEffect, useState } from "react";
import { XMarkIcon } from "@heroicons/react/20/solid";
import { LineChart } from "lucide-react";
import TVLChart from "../../Charts/TVLChart";
import { logoMapKey } from "../../../utils/tokens";

export default function PoolAnalytics({
isOpen,
setIsOpen,
logoMap,
rangePoolData,
tokenIn,
tokenOut,
}) {
return (
<Transition appear show={isOpen} as={Fragment}>
<Dialog
as="div"
className="relative z-50"
onClose={() => setIsOpen(false)}
>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-50" />
</Transition.Child>

<div className="fixed inset-0 overflow-y-auto">
<div className="flex min-h-full items-center justify-center p-4 text-center">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<Dialog.Panel className="w-full max-w-4xl transform overflow-hidden rounded-[4px] bg-black text-white border border-grey text-left align-middle shadow-xl px-5 py-5 transition-all">
<div className="flex items-center justify-between px-2 mb-5">
<h1 className="flex items-center gap-x-8">
<span className="flex items-center gap-x-2">
<svg
width="17"
height="17"
viewBox="0 0 24 24"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M18 9C18.5523 9 19 9.44772 19 10V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V10C17 9.44772 17.4477 9 18 9Z"
fill="currentColor"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M6 13C6.55228 13 7 13.4477 7 14V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V14C5 13.4477 5.44772 13 6 13Z"
fill="currentColor"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M12 3C12.5523 3 13 3.44772 13 4V20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20V4C11 3.44772 11.4477 3 12 3Z"
fill="currentColor"
/>
</svg>
Analytics
</span>
<div className="flex items-center gap-x-2 border border-grey/60 py-2 px-5 rounded-[4px]">
<div className="flex items-center">
<img
className="md:w-6 w-6"
src={logoMap[logoMapKey(tokenIn)]}
/>
<img
className="md:w-6 w-6 -ml-2"
src={logoMap[logoMapKey(tokenOut)]}
/>
</div>
<span className="text-white text-xs">
{tokenIn.symbol} - {tokenOut.symbol}
</span>
<span className="bg-grey/50 rounded-[4px] text-grey1 text-xs px-3 py-0.5">
{(
(!isNaN(rangePoolData.feeTier?.feeAmount)
? rangePoolData.feeTier?.feeAmount
: 0) / 10000
).toFixed(2)}
%
</span>
</div>
</h1>
<XMarkIcon
onClick={() => setIsOpen(false)}
className="w-7 cursor-pointer"
/>
</div>
<div className="flex justify-between items-start gap-4 h-full">
<div className="border border-grey p-4 w-full flex justify-between flex-col rounded-[4px]">
<div className="flex flex-col gap-y-1">
<span className="text-sm text-grey1">TVL</span>
<span className="text-3xl">$200.3k</span>
</div>
<TVLChart />
</div>
<div className="flex flex-col items-center justify-between w-[60%] gap-4 h-[341px]">
<div className="border bg-dark/80 border-grey h-full rounded-[4px] flex flex-col w-full items-center justify-center gap-y-3">
<span className="text-grey1 text-sm">VOLUME</span>
<span className="text-white text-2xl md:text-3xl">
$25k
</span>
</div>
<div className="border bg-dark/80 border-grey h-full rounded-[4px] flex flex-col w-full items-center justify-center gap-y-3">
<span className="text-grey1 text-sm">FEES</span>
<span className="text-white text-2xl md:text-3xl">
$2.5k
</span>
</div>
</div>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition>
);
}
Loading