@@ -3,6 +3,7 @@ import { maxAgeForNext } from '~/api'
33import { IBarChartProps , IChartProps , IPieChartProps } from '~/components/ECharts/types'
44import { LazyChart } from '~/components/LazyChart'
55import { LocalLoader } from '~/components/Loaders'
6+ import { oldBlue } from '~/constants/colors'
67import { ProtocolOverviewLayout } from '~/containers/ProtocolOverview/Layout'
78import { getProtocol } from '~/containers/ProtocolOverview/queries'
89import { formatTvlsByChain , useFetchProtocolAddlChartsData } from '~/containers/ProtocolOverview/utils'
@@ -78,92 +79,90 @@ export default function Protocols(props) {
7879 tab = "assets"
7980 isCEX = { true }
8081 >
81- < div className = "grid grid-cols-2 rounded-md border border-(--cards-border) bg-(--cards-bg) pt-2" >
82- { isLoading ? (
83- < div className = "col-span-full flex min-h-[400px] items-center justify-center" >
84- < LocalLoader />
85- </ div >
86- ) : (
87- < >
88- { chainsSplit && chainsUnique ?. length > 1 && (
89- < LazyChart className = "relative col-span-full flex min-h-[400px] flex-col xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
82+ { isLoading ? (
83+ < div className = "flex flex-1 items-center justify-center rounded-md border border-(--cards-border) bg-(--cards-bg)" >
84+ < LocalLoader />
85+ </ div >
86+ ) : (
87+ < div className = "grid grid-cols-2 gap-2" >
88+ { chainsSplit && chainsUnique ?. length > 1 && (
89+ < LazyChart className = "relative col-span-full flex min-h-[408px] flex-col rounded-md border border-(--cards-border) bg-(--cards-bg) pt-2 xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
90+ < React . Suspense fallback = { < > </ > } >
91+ < AreaChart
92+ chartData = { chainsSplit }
93+ title = "Chains"
94+ customLegendName = "Chain"
95+ customLegendOptions = { chainsUnique }
96+ valueSymbol = "$"
97+ />
98+ </ React . Suspense >
99+ </ LazyChart >
100+ ) }
101+
102+ { tokenBreakdownUSD ?. length > 1 && tokensUnique ?. length > 0 && (
103+ < >
104+ < LazyChart className = "relative col-span-full flex min-h-[408px] flex-col rounded-md border border-(--cards-border) bg-(--cards-bg) pt-2 xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
90105 < React . Suspense fallback = { < > </ > } >
91106 < AreaChart
92- chartData = { chainsSplit }
93- title = "Chains "
94- customLegendName = "Chain "
95- customLegendOptions = { chainsUnique }
107+ chartData = { tokenBreakdownUSD }
108+ title = "Token Values (USD) "
109+ customLegendName = "Token "
110+ customLegendOptions = { tokensUnique }
96111 valueSymbol = "$"
97112 />
98113 </ React . Suspense >
99114 </ LazyChart >
100- ) }
115+ </ >
116+ ) }
101117
102- { tokenBreakdownUSD ?. length > 1 && tokensUnique ?. length > 0 && (
103- < >
104- < LazyChart className = "relative col-span-full flex min-h-[400px] flex-col xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
118+ { tokenBreakdownUSD ?. length > 1 && tokensUnique ?. length > 0 && (
119+ < >
120+ { tokenBreakdownPieChart ?. length > 0 && (
121+ < LazyChart className = "relative col-span-full flex min-h-[408px] flex-col rounded-md border border-(--cards-border) bg-(--cards-bg) pt-2 xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
105122 < React . Suspense fallback = { < > </ > } >
106- < AreaChart
107- chartData = { tokenBreakdownUSD }
108- title = "Token Values (USD)"
109- customLegendName = "Token"
110- customLegendOptions = { tokensUnique }
111- valueSymbol = "$"
112- />
123+ < PieChart title = "Tokens Breakdown" chartData = { tokenBreakdownPieChart } />
113124 </ React . Suspense >
114125 </ LazyChart >
115- </ >
116- ) }
117-
118- { tokenBreakdownUSD ?. length > 1 && tokensUnique ?. length > 0 && (
119- < >
120- { tokenBreakdownPieChart ?. length > 0 && (
121- < LazyChart className = "relative col-span-full flex min-h-[440px] flex-col pt-10 xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
122- < React . Suspense fallback = { < > </ > } >
123- < PieChart title = "Tokens Breakdown" chartData = { tokenBreakdownPieChart } />
124- </ React . Suspense >
125- </ LazyChart >
126- ) }
127- </ >
128- ) }
129-
130- { tokenBreakdown ?. length > 1 && tokensUnique ?. length > 0 && (
131- < LazyChart className = "relative col-span-full flex min-h-[400px] flex-col xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
132- < React . Suspense fallback = { < > </ > } >
133- < AreaChart
134- chartData = { tokenBreakdown }
135- title = "Token Balances (Raw Quantities)"
136- customLegendName = "Token"
137- customLegendOptions = { tokensUnique }
138- />
139- </ React . Suspense >
140- </ LazyChart >
141- ) }
142-
143- { usdInflows ?. length > 0 && (
144- < LazyChart className = "relative col-span-full flex min-h-[400px] flex-col xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
145- < React . Suspense fallback = { < > </ > } >
146- < BarChart chartData = { usdInflows } color = { props . backgroundColor } title = "USD Inflows" valueSymbol = "$" />
147- </ React . Suspense >
148- </ LazyChart >
149- ) }
150- { tokenInflows ?. length > 0 && tokensUnique ?. length > 0 && (
151- < LazyChart className = "relative col-span-full flex min-h-[400px] flex-col xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
152- < React . Suspense fallback = { < > </ > } >
153- < BarChart
154- chartData = { tokenInflows }
155- title = "Token Inflows"
156- customLegendName = "Token"
157- customLegendOptions = { tokensUnique }
158- hideDefaultLegend = { true }
159- valueSymbol = "$"
160- />
161- </ React . Suspense >
162- </ LazyChart >
163- ) }
164- </ >
165- ) }
166- </ div >
126+ ) }
127+ </ >
128+ ) }
129+
130+ { tokenBreakdown ?. length > 1 && tokensUnique ?. length > 0 && (
131+ < LazyChart className = "relative col-span-full flex min-h-[408px] flex-col rounded-md border border-(--cards-border) bg-(--cards-bg) pt-2 xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
132+ < React . Suspense fallback = { < > </ > } >
133+ < AreaChart
134+ chartData = { tokenBreakdown }
135+ title = "Token Balances (Raw Quantities)"
136+ customLegendName = "Token"
137+ customLegendOptions = { tokensUnique }
138+ />
139+ </ React . Suspense >
140+ </ LazyChart >
141+ ) }
142+
143+ { usdInflows ?. length > 0 && (
144+ < LazyChart className = "relative col-span-full flex min-h-[408px] flex-col rounded-md border border-(--cards-border) bg-(--cards-bg) pt-2 xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
145+ < React . Suspense fallback = { < > </ > } >
146+ < BarChart chartData = { usdInflows } color = { oldBlue } title = "USD Inflows" valueSymbol = "$" />
147+ </ React . Suspense >
148+ </ LazyChart >
149+ ) }
150+ { tokenInflows ?. length > 0 && tokensUnique ?. length > 0 && (
151+ < LazyChart className = "relative col-span-full flex min-h-[408px] flex-col rounded-md border border-(--cards-border) bg-(--cards-bg) pt-2 xl:col-span-1 xl:[&:last-child:nth-child(2n-1)]:col-span-full" >
152+ < React . Suspense fallback = { < > </ > } >
153+ < BarChart
154+ chartData = { tokenInflows }
155+ title = "Inflows by Token"
156+ customLegendName = "Token"
157+ customLegendOptions = { tokensUnique }
158+ hideDefaultLegend = { true }
159+ valueSymbol = "$"
160+ />
161+ </ React . Suspense >
162+ </ LazyChart >
163+ ) }
164+ </ div >
165+ ) }
167166 </ ProtocolOverviewLayout >
168167 )
169168}
0 commit comments