portfolio graph: put profit first
This commit is contained in:
parent
1755fb15d4
commit
9fc1e855ff
|
@ -15,7 +15,7 @@ export const PortfolioValueSection = memo(
|
||||||
|
|
||||||
const [portfolioPeriod, setPortfolioPeriod] = useState<Period>('weekly')
|
const [portfolioPeriod, setPortfolioPeriod] = useState<Period>('weekly')
|
||||||
const portfolioHistory = usePortfolioHistory(userId, portfolioPeriod)
|
const portfolioHistory = usePortfolioHistory(userId, portfolioPeriod)
|
||||||
const [graphMode, setGraphMode] = useState<'profit' | 'value'>('value')
|
const [graphMode, setGraphMode] = useState<'profit' | 'value'>('profit')
|
||||||
const [graphDisplayNumber, setGraphDisplayNumber] = useState<
|
const [graphDisplayNumber, setGraphDisplayNumber] = useState<
|
||||||
number | string | null
|
number | string | null
|
||||||
>(null)
|
>(null)
|
||||||
|
@ -40,24 +40,6 @@ export const PortfolioValueSection = memo(
|
||||||
<>
|
<>
|
||||||
<Row className="mb-2 justify-between">
|
<Row className="mb-2 justify-between">
|
||||||
<Row className="gap-4 sm:gap-8">
|
<Row className="gap-4 sm:gap-8">
|
||||||
<Col
|
|
||||||
className={clsx(
|
|
||||||
'cursor-pointer',
|
|
||||||
graphMode != 'value' ? 'opacity-40 hover:opacity-80' : ''
|
|
||||||
)}
|
|
||||||
onClick={() => setGraphMode('value')}
|
|
||||||
>
|
|
||||||
<div className="text-greyscale-6 text-xs sm:text-sm">
|
|
||||||
Portfolio value
|
|
||||||
</div>
|
|
||||||
<div className={clsx('text-lg text-indigo-600 sm:text-xl')}>
|
|
||||||
{graphMode === 'value'
|
|
||||||
? graphDisplayNumber
|
|
||||||
? graphDisplayNumber
|
|
||||||
: formatMoney(totalValue)
|
|
||||||
: formatMoney(totalValue)}
|
|
||||||
</div>
|
|
||||||
</Col>
|
|
||||||
<Col
|
<Col
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'cursor-pointer',
|
'cursor-pointer',
|
||||||
|
@ -91,6 +73,25 @@ export const PortfolioValueSection = memo(
|
||||||
: formatMoney(totalProfit)}
|
: formatMoney(totalProfit)}
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
<Col
|
||||||
|
className={clsx(
|
||||||
|
'cursor-pointer',
|
||||||
|
graphMode != 'value' ? 'opacity-40 hover:opacity-80' : ''
|
||||||
|
)}
|
||||||
|
onClick={() => setGraphMode('value')}
|
||||||
|
>
|
||||||
|
<div className="text-greyscale-6 text-xs sm:text-sm">
|
||||||
|
Portfolio value
|
||||||
|
</div>
|
||||||
|
<div className={clsx('text-lg text-indigo-600 sm:text-xl')}>
|
||||||
|
{graphMode === 'value'
|
||||||
|
? graphDisplayNumber
|
||||||
|
? graphDisplayNumber
|
||||||
|
: formatMoney(totalValue)
|
||||||
|
: formatMoney(totalValue)}
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Row>
|
</Row>
|
||||||
<PortfolioValueGraph
|
<PortfolioValueGraph
|
||||||
|
|
Loading…
Reference in New Issue
Block a user