Skip to content

Commit 3fefd33

Browse files
author
velopace
authored
minor improvements to disconnected dapp state (#852)
* minor improvements to disconnected dapp state * code simplify
1 parent 172907b commit 3fefd33

2 files changed

Lines changed: 20 additions & 16 deletions

File tree

dapp/src/components/Nav.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ const showExperimentalSoftwareNotice = false
2828
const DappLinks = ({ dapp, page }) => {
2929
const ousdBalance = useStoreState(AccountStore, (s) => s.balances['ousd'])
3030
const lifetimeYield = useStoreState(AccountStore, (s) => s.lifetimeYield)
31-
const showHistory =
32-
(ousdBalance && parseFloat(ousdBalance) > 0) ||
33-
(lifetimeYield && parseFloat(lifetimeYield) > 0)
3431

3532
return (
3633
<>
@@ -70,17 +67,15 @@ const DappLinks = ({ dapp, page }) => {
7067
</a>
7168
</Link>
7269
)}
73-
{showHistory && (
74-
<Link href="/history">
75-
<a
76-
className={`d-flex align-items-center ${
77-
page === 'history' ? 'selected' : ''
78-
}`}
79-
>
80-
{fbt('History', 'History')}
81-
</a>
82-
</Link>
83-
)}
70+
<Link href="/history">
71+
<a
72+
className={`d-flex align-items-center ${
73+
page === 'history' ? 'selected' : ''
74+
}`}
75+
>
76+
{fbt('History', 'History')}
77+
</a>
78+
</Link>
8479
</div>
8580
)}
8681
<style jsx>{`

dapp/src/components/buySell/BalanceHeader.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const BalanceHeader = ({
3737
(s) => s.animatedOusdBalance
3838
)
3939
const mintAnimationLimit = 0.5
40+
const walletConnected = useStoreState(ContractStore, (s) => s.walletConnected)
4041

4142
const [balanceEmphasised, setBalanceEmphasised] = useState(false)
4243
const prevOusdBalance = usePrevious(ousdBalance)
@@ -212,7 +213,11 @@ const BalanceHeader = ({
212213
/>
213214
<Statistic
214215
title={fbt('Pending yield', 'Pending yield')}
215-
value={formatCurrency(animatedExpectedIncrease, 2)}
216+
value={
217+
walletConnected
218+
? formatCurrency(animatedExpectedIncrease, 2)
219+
: '--.--'
220+
}
216221
type={'number'}
217222
marginBottom={true}
218223
/>
@@ -228,7 +233,11 @@ const BalanceHeader = ({
228233
}/address/${account.toLowerCase()}`
229234
: false
230235
}
231-
value={lifetimeYield ? formatCurrency(lifetimeYield, 2) : '--.--'}
236+
value={
237+
walletConnected && lifetimeYield
238+
? formatCurrency(lifetimeYield, 2)
239+
: '--.--'
240+
}
232241
type={'number'}
233242
/>
234243
</div>

0 commit comments

Comments
 (0)