@@ -9,6 +9,7 @@ import { categoriesColumn } from '~/components/Table/Defi/columns'
9
9
import { TableWithSearch } from '~/components/Table/TableWithSearch'
10
10
import { useCalcGroupExtraTvlsByDay } from '~/hooks/data'
11
11
import Layout from '~/layout'
12
+ import { getPercentChange } from '~/utils'
12
13
import { withPerformanceLogging } from '~/utils/perf'
13
14
14
15
const AreaChart = dynamic ( ( ) => import ( '~/components/ECharts/AreaChart' ) , {
@@ -57,9 +58,9 @@ export const getStaticProps = withPerformanceLogging('categories', async () => {
57
58
name,
58
59
protocols : details . protocols > 0 ? details . protocols : '' ,
59
60
tvl : details . tvl ,
60
- tvlPrevDay : details . tvlPrevDay ?? 0 ,
61
- tvlPrevWeek : details . tvlPrevWeek ?? 0 ,
62
- tvlPrevMonth : details . tvlPrevMonth ?? 0 ,
61
+ change_1d : getPercentChange ( details . tvl , details . tvlPrevDay ) ,
62
+ change_7d : getPercentChange ( details . tvl , details . tvlPrevWeek ) ,
63
+ change_1m : getPercentChange ( details . tvl , details . tvlPrevMonth ) ,
63
64
revenue : details . revenue ,
64
65
description : descriptions [ name ] || ''
65
66
} )
@@ -164,24 +165,6 @@ export const descriptions = {
164
165
export default function Protocols ( { categories, chartData, categoryColors, uniqueCategories } ) {
165
166
const { chainsWithExtraTvlsByDay : categoriesWithExtraTvlsByDay } = useCalcGroupExtraTvlsByDay ( chartData )
166
167
167
- const [ selectedValue , setValue ] = React . useState ( 'Current' )
168
-
169
- const finalCategories = React . useMemo ( ( ) => {
170
- return selectedValue === 'Current'
171
- ? categories
172
- : categories . map ( ( category ) => {
173
- return {
174
- ...category ,
175
- tvl :
176
- selectedValue === 'Prev Day'
177
- ? category . tvlPrevDay
178
- : selectedValue === 'Prev Week'
179
- ? category . tvlPrevWeek
180
- : category . tvlPrevMonth
181
- }
182
- } )
183
- } , [ categories , selectedValue ] )
184
-
185
168
return (
186
169
< Layout title = { `Categories - DefiLlama` } defaultSEO >
187
170
< ProtocolsChainsSearch />
@@ -202,29 +185,11 @@ export default function Protocols({ categories, chartData, categoryColors, uniqu
202
185
</ div >
203
186
204
187
< TableWithSearch
205
- data = { finalCategories }
188
+ data = { categories }
206
189
columns = { categoriesColumn }
207
190
columnToSearch = { 'name' }
208
191
placeholder = { 'Search category...' }
209
- customFilters = {
210
- < div className = "flex items-center rounded-lg overflow-x-auto flex-nowrap w-fit" >
211
- { values . map ( ( value ) => {
212
- return (
213
- < button
214
- className = "flex-shrink-0 py-2 px-3 whitespace-nowrap font-medium text-sm text-black dark:text-white bg-[var(--link-bg)] hover:bg-[var(--link-hover-bg)] focus-visible:bg-[var(--link-hover-bg)] data-[active=true]:bg-[var(--link-active-bg)] data-[active=true]:text-white"
215
- data-active = { value === selectedValue }
216
- key = { value }
217
- onClick = { ( ) => setValue ( value ) }
218
- >
219
- { value }
220
- </ button >
221
- )
222
- } ) }
223
- </ div >
224
- }
225
192
/>
226
193
</ Layout >
227
194
)
228
195
}
229
-
230
- const values = [ 'Current' , 'Prev Day' , 'Prev Week' , 'Prev Month' ]
0 commit comments