added bottom bar, cleaned up profile bets
This commit is contained in:
parent
8b2856b980
commit
85ccdfbf59
|
@ -77,7 +77,7 @@ export function BetsList(props: { user: User }) {
|
||||||
}, [contractList])
|
}, [contractList])
|
||||||
|
|
||||||
const [sort, setSort] = useState<BetSort>('newest')
|
const [sort, setSort] = useState<BetSort>('newest')
|
||||||
const [filter, setFilter] = useState<BetFilter>('open')
|
const [filter, setFilter] = useState<BetFilter>('all')
|
||||||
const [page, setPage] = useState(0)
|
const [page, setPage] = useState(0)
|
||||||
const start = page * CONTRACTS_PER_PAGE
|
const start = page * CONTRACTS_PER_PAGE
|
||||||
const end = start + CONTRACTS_PER_PAGE
|
const end = start + CONTRACTS_PER_PAGE
|
||||||
|
@ -162,27 +162,20 @@ export function BetsList(props: { user: User }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col>
|
<Col>
|
||||||
<Col className="mx-4 gap-4 sm:flex-row sm:justify-between md:mx-0">
|
<Row className="justify-between gap-4 sm:flex-row">
|
||||||
<Row className="gap-8">
|
|
||||||
<Col>
|
<Col>
|
||||||
<div className="text-sm text-gray-500">Investment value</div>
|
<div className="text-greyscale-6 text-xs sm:text-sm">
|
||||||
|
Investment value
|
||||||
|
</div>
|
||||||
<div className="text-lg">
|
<div className="text-lg">
|
||||||
{formatMoney(currentNetInvestment)}{' '}
|
{formatMoney(currentNetInvestment)}{' '}
|
||||||
<ProfitBadge profitPercent={investedProfitPercent} />
|
<ProfitBadge profitPercent={investedProfitPercent} />
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
|
||||||
<div className="text-sm text-gray-500">Total profit</div>
|
|
||||||
<div className="text-lg">
|
|
||||||
{formatMoney(totalPnl)}{' '}
|
|
||||||
<ProfitBadge profitPercent={totalProfitPercent} />
|
|
||||||
</div>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
|
|
||||||
<Row className="gap-8">
|
<Row className="gap-2">
|
||||||
<select
|
<select
|
||||||
className="select select-bordered self-start"
|
className="border-greyscale-4 self-start overflow-hidden rounded border px-2 py-2 text-sm"
|
||||||
value={filter}
|
value={filter}
|
||||||
onChange={(e) => setFilter(e.target.value as BetFilter)}
|
onChange={(e) => setFilter(e.target.value as BetFilter)}
|
||||||
>
|
>
|
||||||
|
@ -195,7 +188,7 @@ export function BetsList(props: { user: User }) {
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select
|
<select
|
||||||
className="select select-bordered self-start"
|
className="border-greyscale-4 self-start overflow-hidden rounded px-2 py-2 text-sm"
|
||||||
value={sort}
|
value={sort}
|
||||||
onChange={(e) => setSort(e.target.value as BetSort)}
|
onChange={(e) => setSort(e.target.value as BetSort)}
|
||||||
>
|
>
|
||||||
|
@ -205,7 +198,7 @@ export function BetsList(props: { user: User }) {
|
||||||
<option value="closeTime">Close date</option>
|
<option value="closeTime">Close date</option>
|
||||||
</select>
|
</select>
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Row>
|
||||||
|
|
||||||
<Col className="mt-6 divide-y">
|
<Col className="mt-6 divide-y">
|
||||||
{displayedContracts.length === 0 ? (
|
{displayedContracts.length === 0 ? (
|
||||||
|
|
|
@ -2,12 +2,9 @@ import { ResponsiveLine } from '@nivo/line'
|
||||||
import { PortfolioMetrics } from 'common/user'
|
import { PortfolioMetrics } from 'common/user'
|
||||||
import { formatMoney } from 'common/util/format'
|
import { formatMoney } from 'common/util/format'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { connectStorageEmulator } from 'firebase/storage'
|
|
||||||
import { last, set } from 'lodash'
|
import { last, set } from 'lodash'
|
||||||
import { memo } from 'react'
|
import { memo } from 'react'
|
||||||
import { useWindowSize } from 'web/hooks/use-window-size'
|
import { useWindowSize } from 'web/hooks/use-window-size'
|
||||||
import { nFormatter } from 'web/lib/util/appendNumber'
|
|
||||||
import { formatTime } from 'web/lib/util/time'
|
|
||||||
import { Col } from '../layout/col'
|
import { Col } from '../layout/col'
|
||||||
|
|
||||||
export const PortfolioValueGraph = memo(function PortfolioValueGraph(props: {
|
export const PortfolioValueGraph = memo(function PortfolioValueGraph(props: {
|
||||||
|
@ -102,7 +99,6 @@ export const PortfolioValueGraph = memo(function PortfolioValueGraph(props: {
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="animate-rapidpulse">
|
|
||||||
<div
|
<div
|
||||||
className="w-full overflow-hidden"
|
className="w-full overflow-hidden"
|
||||||
style={{ height: height ?? (!width || width >= 800 ? 200 : 100) }}
|
style={{ height: height ?? (!width || width >= 800 ? 200 : 100) }}
|
||||||
|
@ -154,9 +150,7 @@ export const PortfolioValueGraph = memo(function PortfolioValueGraph(props: {
|
||||||
className="text-xs font-semibold sm:text-sm"
|
className="text-xs font-semibold sm:text-sm"
|
||||||
>
|
>
|
||||||
<Col>
|
<Col>
|
||||||
<div>
|
<div>{dayjs(point.data.xFormatted).format('MMM/D/YY')}</div>
|
||||||
{dayjs(point.data.xFormatted).format('MMM/D/YY')}
|
|
||||||
</div>
|
|
||||||
<div className="text-greyscale-6 text-2xs font-normal sm:text-xs">
|
<div className="text-greyscale-6 text-2xs font-normal sm:text-xs">
|
||||||
{dayjs(point.data.xFormatted).format('h:mm A')}
|
{dayjs(point.data.xFormatted).format('h:mm A')}
|
||||||
</div>
|
</div>
|
||||||
|
@ -168,6 +162,5 @@ export const PortfolioValueGraph = memo(function PortfolioValueGraph(props: {
|
||||||
}}
|
}}
|
||||||
></ResponsiveLine>
|
></ResponsiveLine>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -99,8 +99,8 @@ export const PortfolioValueSection = memo(
|
||||||
<PortfolioPeriodSelection
|
<PortfolioPeriodSelection
|
||||||
portfolioPeriod={portfolioPeriod}
|
portfolioPeriod={portfolioPeriod}
|
||||||
setPortfolioPeriod={setPortfolioPeriod}
|
setPortfolioPeriod={setPortfolioPeriod}
|
||||||
className="mt-2 gap-4"
|
className="border-greyscale-2 mt-2 gap-4 border-b"
|
||||||
selectClassName="text-indigo-600 text-bold underline"
|
selectClassName="text-indigo-600 text-bold border-b border-indigo-600"
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,19 +29,12 @@ import { FollowersButton, FollowingButton } from './following-button'
|
||||||
import { UserFollowButton } from './follow-button'
|
import { UserFollowButton } from './follow-button'
|
||||||
import { GroupsButton } from 'web/components/groups/groups-button'
|
import { GroupsButton } from 'web/components/groups/groups-button'
|
||||||
import { PortfolioValueSection } from './portfolio/portfolio-value-section'
|
import { PortfolioValueSection } from './portfolio/portfolio-value-section'
|
||||||
import { ReferralsButton } from 'web/components/referrals-button'
|
|
||||||
import { formatMoney } from 'common/util/format'
|
import { formatMoney } from 'common/util/format'
|
||||||
import { ShareIconButton } from 'web/components/share-icon-button'
|
|
||||||
import { ENV_CONFIG } from 'common/envs/constants'
|
|
||||||
import {
|
import {
|
||||||
BettingStreakModal,
|
BettingStreakModal,
|
||||||
hasCompletedStreakToday,
|
hasCompletedStreakToday,
|
||||||
} from 'web/components/profile/betting-streak-modal'
|
} from 'web/components/profile/betting-streak-modal'
|
||||||
import { REFERRAL_AMOUNT } from 'common/economy'
|
|
||||||
import { LoansModal } from './profile/loans-modal'
|
import { LoansModal } from './profile/loans-modal'
|
||||||
import { UserLikesButton } from 'web/components/profile/user-likes-button'
|
|
||||||
import { PAST_BETS } from 'common/user'
|
|
||||||
import { capitalize } from 'lodash'
|
|
||||||
import { useIsMobile } from 'web/hooks/use-is-mobile'
|
import { useIsMobile } from 'web/hooks/use-is-mobile'
|
||||||
|
|
||||||
export function UserPage(props: { user: User }) {
|
export function UserPage(props: { user: User }) {
|
||||||
|
@ -210,6 +203,7 @@ export function UserPage(props: { user: User }) {
|
||||||
content: (
|
content: (
|
||||||
<>
|
<>
|
||||||
<PortfolioValueSection userId={user.id} />
|
<PortfolioValueSection userId={user.id} />
|
||||||
|
<Spacer h={4} />
|
||||||
<BetsList user={user} />
|
<BetsList user={user} />
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user