1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00
mihaisc b38f30a67a
Add top allocations (#1722)
* add top

* copy, section move

* asset teaser prototyping

* more moving elements around

* copy

* allocated on asset details stats area

* ve networks "hacks"

* fix type

* added hacks to display top allocation

* fixed chainIds

* remove comment

* add ve in asset stats

* remove console

* added formating and totals

* update total allocated

* update allocation

* fixed numbers

* fix build

* added teaser warn when no price

* number formatting

Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
2022-10-07 12:11:50 +01:00

79 lines
2.2 KiB
TypeScript

import React, { ReactElement, useEffect, useState } from 'react'
import Button from '@shared/atoms/Button'
import Bookmarks from './Bookmarks'
import { generateBaseQuery } from '@utils/aquarius'
import { useUserPreferences } from '@context/UserPreferences'
import { SortTermOptions } from '../../@types/aquarius/SearchQuery'
import TopSales from './TopSales'
import styles from './index.module.css'
import SectionQueryResult from './SectionQueryResult'
export default function HomePage(): ReactElement {
const [queryLatest, setQueryLatest] = useState<SearchQuery>()
const [queryMostSales, setQueryMostSales] = useState<SearchQuery>()
const [queryMostAllocation, setQueryMostAllocation] = useState<SearchQuery>()
const { chainIds } = useUserPreferences()
useEffect(() => {
const baseParams = {
chainIds,
esPaginationOptions: {
size: 6
},
sortOptions: {
sortBy: SortTermOptions.Created
} as SortOptions
} as BaseQueryParams
setQueryLatest(generateBaseQuery(baseParams))
const baseParamsSales = {
chainIds,
esPaginationOptions: {
size: 6
},
sortOptions: {
sortBy: SortTermOptions.Stats
} as SortOptions
} as BaseQueryParams
setQueryMostSales(generateBaseQuery(baseParamsSales))
const baseParamsAllocation = {
chainIds,
esPaginationOptions: {
size: 6
},
sortOptions: {
sortBy: SortTermOptions.Allocated
} as SortOptions
} as BaseQueryParams
setQueryMostAllocation(generateBaseQuery(baseParamsAllocation))
}, [chainIds])
return (
<>
<section className={styles.section}>
<h3>Bookmarks</h3>
<Bookmarks />
</section>
<SectionQueryResult
title="Highest veOCEAN Allocations"
query={queryMostAllocation}
/>
<SectionQueryResult title="Most Sales" query={queryMostSales} />
<TopSales title="Publishers With Most Sales" />
<SectionQueryResult
title="Recently Published"
query={queryLatest}
action={
<Button style="text" to="/search?sort=nft.created&sortOrder=desc">
All datasets and algorithms
</Button>
}
/>
</>
)
}