From 85ccdfbf593dc04b27cbc38f4c1143fe03d6228e Mon Sep 17 00:00:00 2001 From: ingawei Date: Sat, 24 Sep 2022 13:54:06 -0700 Subject: [PATCH] added bottom bar, cleaned up profile bets --- web/components/bets-list.tsx | 37 ++--- .../portfolio/portfolio-value-graph.tsx | 131 +++++++++--------- .../portfolio/portfolio-value-section.tsx | 4 +- web/components/user-page.tsx | 8 +- 4 files changed, 80 insertions(+), 100 deletions(-) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 97d11758..d3528913 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -77,7 +77,7 @@ export function BetsList(props: { user: User }) { }, [contractList]) const [sort, setSort] = useState('newest') - const [filter, setFilter] = useState('open') + const [filter, setFilter] = useState('all') const [page, setPage] = useState(0) const start = page * CONTRACTS_PER_PAGE const end = start + CONTRACTS_PER_PAGE @@ -162,27 +162,20 @@ export function BetsList(props: { user: User }) { return ( - - - -
Investment value
-
- {formatMoney(currentNetInvestment)}{' '} - -
- - -
Total profit
-
- {formatMoney(totalPnl)}{' '} - -
- -
+ + +
+ Investment value +
+
+ {formatMoney(currentNetInvestment)}{' '} + +
+ - + - + {displayedContracts.length === 0 ? ( diff --git a/web/components/portfolio/portfolio-value-graph.tsx b/web/components/portfolio/portfolio-value-graph.tsx index df4d0e27..38a6dbf3 100644 --- a/web/components/portfolio/portfolio-value-graph.tsx +++ b/web/components/portfolio/portfolio-value-graph.tsx @@ -2,12 +2,9 @@ import { ResponsiveLine } from '@nivo/line' import { PortfolioMetrics } from 'common/user' import { formatMoney } from 'common/util/format' import dayjs from 'dayjs' -import { connectStorageEmulator } from 'firebase/storage' import { last, set } from 'lodash' import { memo } from 'react' 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' export const PortfolioValueGraph = memo(function PortfolioValueGraph(props: { @@ -102,72 +99,68 @@ export const PortfolioValueGraph = memo(function PortfolioValueGraph(props: { ) return ( -
-
= 800 ? 200 : 100) }} - onMouseLeave={() => setGraphDisplayNumber(null)} - > - 100 ? 0 : 6} - axisLeft={{ - tickValues: numYTickValues, - format: '.3s', - }} - enableGridX={false} - enableGridY={true} - gridYValues={numYTickValues} - enableSlices="x" - animate={false} - yFormat={(value) => formatMoney(+value)} - enableArea={true} - areaOpacity={0.1} - sliceTooltip={({ slice }) => { - slice.points.map((point) => - setGraphDisplayNumber(point.data.yFormatted) - ) - return ( -
- {slice.points.map((point) => ( -
- -
- {dayjs(point.data.xFormatted).format('MMM/D/YY')} -
-
- {dayjs(point.data.xFormatted).format('h:mm A')} -
- -
- ))} -
- ) - }} - >
-
+
= 800 ? 200 : 100) }} + onMouseLeave={() => setGraphDisplayNumber(null)} + > + 100 ? 0 : 6} + axisLeft={{ + tickValues: numYTickValues, + format: '.3s', + }} + enableGridX={false} + enableGridY={true} + gridYValues={numYTickValues} + enableSlices="x" + animate={false} + yFormat={(value) => formatMoney(+value)} + enableArea={true} + areaOpacity={0.1} + sliceTooltip={({ slice }) => { + slice.points.map((point) => + setGraphDisplayNumber(point.data.yFormatted) + ) + return ( +
+ {slice.points.map((point) => ( +
+ +
{dayjs(point.data.xFormatted).format('MMM/D/YY')}
+
+ {dayjs(point.data.xFormatted).format('h:mm A')} +
+ +
+ ))} +
+ ) + }} + >
) }) diff --git a/web/components/portfolio/portfolio-value-section.tsx b/web/components/portfolio/portfolio-value-section.tsx index 2b26d734..6f8f07f1 100644 --- a/web/components/portfolio/portfolio-value-section.tsx +++ b/web/components/portfolio/portfolio-value-section.tsx @@ -99,8 +99,8 @@ export const PortfolioValueSection = memo( ) diff --git a/web/components/user-page.tsx b/web/components/user-page.tsx index fd5d04ee..47d08e15 100644 --- a/web/components/user-page.tsx +++ b/web/components/user-page.tsx @@ -29,19 +29,12 @@ import { FollowersButton, FollowingButton } from './following-button' import { UserFollowButton } from './follow-button' import { GroupsButton } from 'web/components/groups/groups-button' import { PortfolioValueSection } from './portfolio/portfolio-value-section' -import { ReferralsButton } from 'web/components/referrals-button' import { formatMoney } from 'common/util/format' -import { ShareIconButton } from 'web/components/share-icon-button' -import { ENV_CONFIG } from 'common/envs/constants' import { BettingStreakModal, hasCompletedStreakToday, } from 'web/components/profile/betting-streak-modal' -import { REFERRAL_AMOUNT } from 'common/economy' 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' export function UserPage(props: { user: User }) { @@ -210,6 +203,7 @@ export function UserPage(props: { user: User }) { content: ( <> + ),