Skip to content

Commit

Permalink
minor improvements to disconnected dapp state (#852)
Browse files Browse the repository at this point in the history
* minor improvements to disconnected dapp state

* code simplify
  • Loading branch information
velopace authored Dec 10, 2021
1 parent 172907b commit 3fefd33
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
23 changes: 9 additions & 14 deletions dapp/src/components/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ const showExperimentalSoftwareNotice = false
const DappLinks = ({ dapp, page }) => {
const ousdBalance = useStoreState(AccountStore, (s) => s.balances['ousd'])
const lifetimeYield = useStoreState(AccountStore, (s) => s.lifetimeYield)
const showHistory =
(ousdBalance && parseFloat(ousdBalance) > 0) ||
(lifetimeYield && parseFloat(lifetimeYield) > 0)

return (
<>
Expand Down Expand Up @@ -70,17 +67,15 @@ const DappLinks = ({ dapp, page }) => {
</a>
</Link>
)}
{showHistory && (
<Link href="/history">
<a
className={`d-flex align-items-center ${
page === 'history' ? 'selected' : ''
}`}
>
{fbt('History', 'History')}
</a>
</Link>
)}
<Link href="/history">
<a
className={`d-flex align-items-center ${
page === 'history' ? 'selected' : ''
}`}
>
{fbt('History', 'History')}
</a>
</Link>
</div>
)}
<style jsx>{`
Expand Down
13 changes: 11 additions & 2 deletions dapp/src/components/buySell/BalanceHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const BalanceHeader = ({
(s) => s.animatedOusdBalance
)
const mintAnimationLimit = 0.5
const walletConnected = useStoreState(ContractStore, (s) => s.walletConnected)

const [balanceEmphasised, setBalanceEmphasised] = useState(false)
const prevOusdBalance = usePrevious(ousdBalance)
Expand Down Expand Up @@ -212,7 +213,11 @@ const BalanceHeader = ({
/>
<Statistic
title={fbt('Pending yield', 'Pending yield')}
value={formatCurrency(animatedExpectedIncrease, 2)}
value={
walletConnected
? formatCurrency(animatedExpectedIncrease, 2)
: '--.--'
}
type={'number'}
marginBottom={true}
/>
Expand All @@ -228,7 +233,11 @@ const BalanceHeader = ({
}/address/${account.toLowerCase()}`
: false
}
value={lifetimeYield ? formatCurrency(lifetimeYield, 2) : '--.--'}
value={
walletConnected && lifetimeYield
? formatCurrency(lifetimeYield, 2)
: '--.--'
}
type={'number'}
/>
</div>
Expand Down

0 comments on commit 3fefd33

Please sign in to comment.