Daily movers page
This commit is contained in:
parent
90f6aa7d06
commit
1d501ff88d
|
@ -11,8 +11,9 @@ export function ProbChangeTable(props: {
|
||||||
changes:
|
changes:
|
||||||
| { positiveChanges: CPMMContract[]; negativeChanges: CPMMContract[] }
|
| { positiveChanges: CPMMContract[]; negativeChanges: CPMMContract[] }
|
||||||
| undefined
|
| undefined
|
||||||
|
full?: boolean
|
||||||
}) {
|
}) {
|
||||||
const { changes } = props
|
const { changes, full } = props
|
||||||
|
|
||||||
if (!changes) return <LoadingIndicator />
|
if (!changes) return <LoadingIndicator />
|
||||||
|
|
||||||
|
@ -24,7 +25,10 @@ export function ProbChangeTable(props: {
|
||||||
negativeChanges.findIndex((c) => c.probChanges.day > -threshold) + 1
|
negativeChanges.findIndex((c) => c.probChanges.day > -threshold) + 1
|
||||||
)
|
)
|
||||||
const maxRows = Math.min(positiveChanges.length, negativeChanges.length)
|
const maxRows = Math.min(positiveChanges.length, negativeChanges.length)
|
||||||
const rows = Math.min(3, Math.min(maxRows, countOverThreshold))
|
const rows = Math.min(
|
||||||
|
full ? Infinity : 3,
|
||||||
|
Math.min(maxRows, countOverThreshold)
|
||||||
|
)
|
||||||
|
|
||||||
const filteredPositiveChanges = positiveChanges.slice(0, rows)
|
const filteredPositiveChanges = positiveChanges.slice(0, rows)
|
||||||
const filteredNegativeChanges = negativeChanges.slice(0, rows)
|
const filteredNegativeChanges = negativeChanges.slice(0, rows)
|
||||||
|
|
21
web/pages/experimental/daily-movers.tsx
Normal file
21
web/pages/experimental/daily-movers.tsx
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { ProbChangeTable } from 'web/components/contract/prob-change-table'
|
||||||
|
import { Col } from 'web/components/layout/col'
|
||||||
|
import { Page } from 'web/components/page'
|
||||||
|
import { Title } from 'web/components/title'
|
||||||
|
import { useProbChanges } from 'web/hooks/use-prob-changes'
|
||||||
|
import { useUser } from 'web/hooks/use-user'
|
||||||
|
|
||||||
|
export default function DailyMovers() {
|
||||||
|
const user = useUser()
|
||||||
|
|
||||||
|
const changes = useProbChanges(user?.id ?? '')
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Page>
|
||||||
|
<Col className="pm:mx-10 gap-4 sm:px-4 sm:pb-4">
|
||||||
|
<Title className="mx-4 !mb-0 sm:mx-0" text="Daily movers" />
|
||||||
|
<ProbChangeTable changes={changes} full />
|
||||||
|
</Col>
|
||||||
|
</Page>
|
||||||
|
)
|
||||||
|
}
|
|
@ -61,7 +61,7 @@ export default function Home() {
|
||||||
</Row>
|
</Row>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Row className={'w-full items-center gap-8'}>
|
<Row className={'mb-2 w-full items-center gap-8'}>
|
||||||
<SearchRow />
|
<SearchRow />
|
||||||
<DailyProfitAndBalance className="" user={user} />
|
<DailyProfitAndBalance className="" user={user} />
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -197,7 +197,7 @@ function DailyMoversSection(props: { userId: string | null | undefined }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className="gap-2">
|
<Col className="gap-2">
|
||||||
<SectionHeader label="Daily movers" href="daily-movers" />
|
<SectionHeader label="Daily movers" href="/experimental/daily-movers" />
|
||||||
<ProbChangeTable changes={changes} />
|
<ProbChangeTable changes={changes} />
|
||||||
</Col>
|
</Col>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user