Skip to content

Commit 828f222

Browse files
committed
feat: send to specific market
1 parent 774e897 commit 828f222

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/layouts/MainLayout.tsx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
import { ChainId } from '@aave/contract-helpers';
22
import { Box } from '@mui/material';
3+
import { useRouter } from 'next/router';
34
import React, { ReactNode } from 'react';
45
import AnalyticsConsent from 'src/components/Analytics/AnalyticsConsent';
56
import { useModalContext } from 'src/hooks/useModal';
67
import { FeedbackModal } from 'src/layouts/FeedbackDialog';
8+
import { useRootStore } from 'src/store/root';
9+
import { CustomMarket } from 'src/ui-config/marketsConfig';
710
import { FORK_ENABLED } from 'src/utils/marketsAndNetworksConfig';
11+
import { useShallow } from 'zustand/shallow';
812

913
import { AppFooter } from './AppFooter';
1014
import { AppHeader } from './AppHeader';
1115
import TopBarNotify from './TopBarNotify';
1216

13-
const getCampaignConfigs = (openSwitch: (token?: string, chainId?: number) => void) => ({
17+
const getCampaignConfigs = (
18+
openSwitch: (token?: string, chainId?: number) => void,
19+
openMarket: (market: CustomMarket) => void
20+
) => ({
1421
[ChainId.base]: {
1522
notifyText: 'A new incentives campaign is live on the Base market',
1623
buttonText: 'Explore Base',
@@ -34,14 +41,15 @@ const getCampaignConfigs = (openSwitch: (token?: string, chainId?: number) => vo
3441
},
3542

3643
[ChainId.mainnet]: {
37-
notifyText: 'Swap tokens directly in the Aave App',
38-
buttonText: 'Swap Now',
44+
notifyText:
45+
'Users can now deposit 50% sUSDe & 50% USDe into Aave and earn promotional rewards for USDe (currently ~12% APY)',
46+
buttonText: 'Deposit Now',
3947
buttonAction: {
4048
type: 'function' as const,
41-
value: () => openSwitch('', ChainId.mainnet),
49+
value: () => openMarket(CustomMarket.proto_mainnet_v3),
4250
},
4351
bannerVersion: 'ethereum-swap-v1',
44-
icon: '/icons/networks/ethereum.svg',
52+
// icon: '/icons/networks/ethereum.svg',
4553
},
4654

4755
[ChainId.polygon]: {
@@ -113,8 +121,15 @@ const getCampaignConfigs = (openSwitch: (token?: string, chainId?: number) => vo
113121

114122
export function MainLayout({ children }: { children: ReactNode }) {
115123
const { openSwitch } = useModalContext();
124+
const router = useRouter();
125+
const setCurrentMarket = useRootStore(useShallow((store) => store.setCurrentMarket));
126+
127+
const openMarket = (market: CustomMarket) => {
128+
setCurrentMarket(market);
129+
router.push(`/markets/?marketName=${market}`);
130+
};
116131

117-
const campaignConfigs = getCampaignConfigs(openSwitch);
132+
const campaignConfigs = getCampaignConfigs(openSwitch, openMarket);
118133

119134
return (
120135
<>

0 commit comments

Comments
 (0)