Skip to content

Commit b0ec0ce

Browse files
committed
chore: sync main
2 parents 87cc77d + ff2a6cb commit b0ec0ce

20 files changed

+255
-208
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"test:coverage": "jest --coverage"
3232
},
3333
"dependencies": {
34-
"@aave/contract-helpers": "1.36.0",
35-
"@aave/math-utils": "1.36.0",
34+
"@aave/contract-helpers": "1.36.1",
35+
"@aave/math-utils": "1.36.1",
3636
"@amplitude/analytics-browser": "^2.13.0",
3737
"@bgd-labs/aave-address-book": "^4.25.1",
3838
"@cowprotocol/app-data": "^3.1.0",

pages/404.page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ export default function Aave404Page() {
4141
<Typography sx={{ mt: 3, mb: 5, maxWidth: 480 }}>
4242
<Trans>Sorry, we couldn&apos;t find the page you were looking for.</Trans>
4343
<br />
44-
<Trans>We suggest you go back to the Dashboard.</Trans>
44+
<Trans>We suggest you go back to the home page.</Trans>
4545
</Typography>
4646
<Link href="/" passHref>
4747
<Button variant="outlined" color="primary">
48-
<Trans>Back to Dashboard</Trans>
48+
<Trans>Back home</Trans>
4949
</Button>
5050
</Link>
5151
</Paper>

pages/dashboard.page.tsx

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { Trans } from '@lingui/macro';
2+
import { Box, Typography } from '@mui/material';
3+
import { useEffect, useState } from 'react';
4+
import StyledToggleButton from 'src/components/StyledToggleButton';
5+
import StyledToggleButtonGroup from 'src/components/StyledToggleButtonGroup';
6+
import { useRootStore } from 'src/store/root';
7+
import { useShallow } from 'zustand/shallow';
8+
9+
import { ConnectWalletPaper } from '../src/components/ConnectWalletPaper';
10+
import { ContentContainer } from '../src/components/ContentContainer';
11+
import { MainLayout } from '../src/layouts/MainLayout';
12+
import { useWeb3Context } from '../src/libs/hooks/useWeb3Context';
13+
import { DashboardContentWrapper } from '../src/modules/dashboard/DashboardContentWrapper';
14+
import { DashboardTopPanel } from '../src/modules/dashboard/DashboardTopPanel';
15+
16+
export default function Dashboard() {
17+
const { currentAccount } = useWeb3Context();
18+
const [trackEvent, currentMarket] = useRootStore(
19+
useShallow((store) => [store.trackEvent, store.currentMarket])
20+
);
21+
22+
const [mode, setMode] = useState<'supply' | 'borrow' | ''>('supply');
23+
24+
useEffect(() => {
25+
trackEvent('Page Viewed', {
26+
'Page Name': 'Dashboard',
27+
Market: currentMarket,
28+
});
29+
}, [trackEvent]);
30+
31+
return (
32+
<>
33+
<DashboardTopPanel />
34+
35+
<ContentContainer>
36+
{currentAccount && (
37+
<Box
38+
sx={{
39+
display: { xs: 'flex', lg: 'none' },
40+
justifyContent: { xs: 'center', xsm: 'flex-start' },
41+
mb: { xs: 3, xsm: 4 },
42+
}}
43+
>
44+
<StyledToggleButtonGroup
45+
color="primary"
46+
value={mode}
47+
exclusive
48+
onChange={(_, value) => setMode(value)}
49+
sx={{ width: { xs: '100%', xsm: '359px' }, height: '44px' }}
50+
>
51+
<StyledToggleButton value="supply" disabled={mode === 'supply'}>
52+
<Typography variant="subheader1">
53+
<Trans>Supply</Trans>
54+
</Typography>
55+
</StyledToggleButton>
56+
<StyledToggleButton value="borrow" disabled={mode === 'borrow'}>
57+
<Typography variant="subheader1">
58+
<Trans>Borrow</Trans>
59+
</Typography>
60+
</StyledToggleButton>
61+
</StyledToggleButtonGroup>
62+
</Box>
63+
)}
64+
65+
{currentAccount ? (
66+
<DashboardContentWrapper isBorrow={mode === 'borrow'} />
67+
) : (
68+
<ConnectWalletPaper />
69+
)}
70+
</ContentContainer>
71+
</>
72+
);
73+
}
74+
75+
Dashboard.getLayout = function getLayout(page: React.ReactElement) {
76+
return <MainLayout>{page}</MainLayout>;
77+
};

pages/index.page.tsx

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,13 @@
1-
import { Trans } from '@lingui/macro';
2-
import { Box, Typography } from '@mui/material';
3-
import { useEffect, useState } from 'react';
4-
import StyledToggleButton from 'src/components/StyledToggleButton';
5-
import StyledToggleButtonGroup from 'src/components/StyledToggleButtonGroup';
6-
import { useRootStore } from 'src/store/root';
7-
import { useShallow } from 'zustand/shallow';
8-
9-
import { ConnectWalletPaper } from '../src/components/ConnectWalletPaper';
10-
import { ContentContainer } from '../src/components/ContentContainer';
111
import { MainLayout } from '../src/layouts/MainLayout';
122
import { useWeb3Context } from '../src/libs/hooks/useWeb3Context';
13-
import { DashboardContentWrapper } from '../src/modules/dashboard/DashboardContentWrapper';
14-
import { DashboardTopPanel } from '../src/modules/dashboard/DashboardTopPanel';
3+
import Dashboard from './dashboard.page';
4+
import Markets from './markets.page';
155

166
export default function Home() {
177
const { currentAccount } = useWeb3Context();
18-
const [trackEvent, currentMarket] = useRootStore(
19-
useShallow((store) => [store.trackEvent, store.currentMarket])
20-
);
21-
22-
const [mode, setMode] = useState<'supply' | 'borrow' | ''>('supply');
23-
useEffect(() => {
24-
trackEvent('Page Viewed', {
25-
'Page Name': 'Dashboard',
26-
Market: currentMarket,
27-
});
28-
}, [trackEvent]);
29-
30-
return (
31-
<>
32-
<DashboardTopPanel />
33-
34-
<ContentContainer>
35-
{currentAccount && (
36-
<Box
37-
sx={{
38-
display: { xs: 'flex', lg: 'none' },
39-
justifyContent: { xs: 'center', xsm: 'flex-start' },
40-
mb: { xs: 3, xsm: 4 },
41-
}}
42-
>
43-
<StyledToggleButtonGroup
44-
color="primary"
45-
value={mode}
46-
exclusive
47-
onChange={(_, value) => setMode(value)}
48-
sx={{ width: { xs: '100%', xsm: '359px' }, height: '44px' }}
49-
>
50-
<StyledToggleButton value="supply" disabled={mode === 'supply'}>
51-
<Typography variant="subheader1">
52-
<Trans>Supply</Trans>
53-
</Typography>
54-
</StyledToggleButton>
55-
<StyledToggleButton value="borrow" disabled={mode === 'borrow'}>
56-
<Typography variant="subheader1">
57-
<Trans>Borrow</Trans>
58-
</Typography>
59-
</StyledToggleButton>
60-
</StyledToggleButtonGroup>
61-
</Box>
62-
)}
638

64-
{currentAccount ? (
65-
<DashboardContentWrapper isBorrow={mode === 'borrow'} />
66-
) : (
67-
<ConnectWalletPaper />
68-
)}
69-
</ContentContainer>
70-
</>
71-
);
9+
// Show dashboard if wallet is connected, otherwise show markets
10+
return currentAccount ? <Dashboard /> : <Markets />;
7211
}
7312

7413
Home.getLayout = function getLayout(page: React.ReactElement) {

pages/markets.page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export default function Markets() {
4545
'Page Name': 'Markets',
4646
});
4747
}, [trackEvent]);
48+
4849
return (
4950
<>
5051
<MarketsTopPanel />

src/components/primitives/Link.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link
121121
});
122122

123123
export const ROUTES = {
124-
dashboard: '/',
124+
dashboard: '/dashboard',
125125
markets: '/markets',
126126
staking: '/staking',
127127
governance: '/governance',

src/helpers/useGovernanceDelegate.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,8 @@ export const useGovernanceDelegate = (
252252

253253
const unsignedPayloads: string[] = [];
254254
for (const tx of delegationParameters) {
255-
if (delegationType !== DelegationType.ALL) {
256-
const payload = await delegationTokenService.prepareV3DelegateByTypeSignature(tx);
257-
unsignedPayloads.push(payload);
258-
} else {
259-
const payload = await delegationTokenService.prepareV3DelegateByTypeSignature(tx);
260-
unsignedPayloads.push(payload);
261-
}
255+
const payload = await delegationTokenService.prepareV3DelegateByTypeSignature(tx);
256+
unsignedPayloads.push(payload);
262257
}
263258
try {
264259
const signedPayload: SignatureLike[] = [];
@@ -303,7 +298,6 @@ export const useGovernanceDelegate = (
303298
} else {
304299
let txs: EthereumTransactionTypeExtended[] = [];
305300
if (delegationType === DelegationType.ALL) {
306-
// TODO check if this is working as normal
307301
txs = await delegate({
308302
delegatee,
309303
governanceToken:
@@ -312,13 +306,8 @@ export const useGovernanceDelegate = (
312306
: delegationTokenType === DelegationTokenType.STKAAVE
313307
? governanceV3Config.votingAssets.stkAaveTokenAddress
314308
: governanceV3Config.votingAssets.aAaveTokenAddress,
315-
// delegationTokenType === DelegationTokenType.AAVE
316-
// ? governanceConfig.aaveTokenAddress
317-
// : governanceConfig.stkAaveTokenAddress,
318309
});
319310
} else {
320-
// TODO check if this is working as normal
321-
322311
txs = await delegateByType({
323312
delegatee,
324313
delegationType: delegationType.toString(),
@@ -328,9 +317,6 @@ export const useGovernanceDelegate = (
328317
: delegationTokenType === DelegationTokenType.STKAAVE
329318
? governanceV3Config.votingAssets.stkAaveTokenAddress
330319
: governanceV3Config.votingAssets.aAaveTokenAddress,
331-
// delegationTokenType === DelegationTokenType.AAVE
332-
// ? governanceConfig.aaveTokenAddress
333-
// : governanceConfig.stkAaveTokenAddress,
334320
});
335321
}
336322
setActionTx(txs[0]);

src/hooks/paraswap/useCollateralRepaySwap.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ export const useCollateralRepaySwap = ({
127127
} catch (e) {
128128
console.error(e);
129129
const message =
130-
convertParaswapErrorMessage(e.message) ||
131-
'There was an issue fetching data from Velora';
130+
convertParaswapErrorMessage(e.message) || 'There was an issue fetching data from Velora';
132131
setError(message);
133132
} finally {
134133
setLoading(false);

src/hooks/paraswap/useCollateralSwap.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ export const useCollateralSwap = ({
108108
} catch (e) {
109109
console.error(e);
110110
const message =
111-
convertParaswapErrorMessage(e.message) ||
112-
'There was an issue fetching data from Velora';
111+
convertParaswapErrorMessage(e.message) || 'There was an issue fetching data from Velora';
113112
setError(message);
114113
} finally {
115114
setLoading(false);

src/hooks/paraswap/useDebtSwitch.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ export const useDebtSwitch = ({
111111
} catch (e) {
112112
console.error(e);
113113
const message =
114-
convertParaswapErrorMessage(e.message) ||
115-
'There was an issue fetching data from Velora';
114+
convertParaswapErrorMessage(e.message) || 'There was an issue fetching data from Velora';
116115
setError(message);
117116
} finally {
118117
setLoading(false);

0 commit comments

Comments
 (0)