Add search page
This commit is contained in:
parent
c11a5c3c2f
commit
a06c659cc8
|
@ -102,7 +102,7 @@ function SearchSection(props: {
|
|||
<Col>
|
||||
<SectionHeader
|
||||
label={label}
|
||||
href={`/home?s=${sort}${pill ? `&p=${pill}` : ''}`}
|
||||
href={`/search?s=${sort}${pill ? `&p=${pill}` : ''}`}
|
||||
/>
|
||||
<ContractSearch
|
||||
user={user}
|
||||
|
@ -185,11 +185,12 @@ function DailyProfitAndBalance(props: {
|
|||
const metrics = usePortfolioHistory(user?.id ?? '', 'daily') ?? []
|
||||
const [first, last] = [metrics[0], metrics[metrics.length - 1]]
|
||||
|
||||
if (first === undefined || last === undefined) return null
|
||||
|
||||
const profit =
|
||||
calculatePortfolioProfit(last) - calculatePortfolioProfit(first)
|
||||
const profitPercent = profit / first.investmentValue
|
||||
let profit = 0
|
||||
let profitPercent = 0
|
||||
if (first && last) {
|
||||
profit = calculatePortfolioProfit(last) - calculatePortfolioProfit(first)
|
||||
profitPercent = profit / first.investmentValue
|
||||
}
|
||||
|
||||
return (
|
||||
<Row className={'gap-4'}>
|
||||
|
|
25
web/pages/search.tsx
Normal file
25
web/pages/search.tsx
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { Page } from 'web/components/page'
|
||||
import { Col } from 'web/components/layout/col'
|
||||
import { ContractSearch } from 'web/components/contract-search'
|
||||
import { useTracking } from 'web/hooks/use-tracking'
|
||||
import { useUser } from 'web/hooks/use-user'
|
||||
import { usePrefetch } from 'web/hooks/use-prefetch'
|
||||
|
||||
export default function Search() {
|
||||
const user = useUser()
|
||||
usePrefetch(user?.id)
|
||||
|
||||
useTracking('view search')
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<Col className="mx-auto w-full p-2">
|
||||
<ContractSearch
|
||||
user={user}
|
||||
persistPrefix="search"
|
||||
useQueryUrlParam={true}
|
||||
/>
|
||||
</Col>
|
||||
</Page>
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user