11import { ChainId } from '@aave/contract-helpers' ;
22import { Box } from '@mui/material' ;
3+ import { useRouter } from 'next/router' ;
34import React , { ReactNode } from 'react' ;
45import AnalyticsConsent from 'src/components/Analytics/AnalyticsConsent' ;
56import { useModalContext } from 'src/hooks/useModal' ;
67import { FeedbackModal } from 'src/layouts/FeedbackDialog' ;
8+ import { useRootStore } from 'src/store/root' ;
9+ import { CustomMarket } from 'src/ui-config/marketsConfig' ;
710import { FORK_ENABLED } from 'src/utils/marketsAndNetworksConfig' ;
11+ import { useShallow } from 'zustand/shallow' ;
812
913import { AppFooter } from './AppFooter' ;
1014import { AppHeader } from './AppHeader' ;
1115import 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
114122export 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