@@ -31,12 +31,15 @@ interface CampaignConfig {
3131interface NetworkCampaigns {
3232 [ chainId : number ] : CampaignConfig ;
3333}
34-
34+ interface RouteCampaigns {
35+ [ route : string ] : CampaignConfig ;
36+ }
3537interface TopBarNotifyProps {
3638 campaigns : NetworkCampaigns ;
39+ routeCampaigns ?: RouteCampaigns ;
3740}
3841
39- export default function TopBarNotify ( { campaigns } : TopBarNotifyProps ) {
42+ export default function TopBarNotify ( { campaigns, routeCampaigns } : TopBarNotifyProps ) {
4043 const { breakpoints } = useTheme ( ) ;
4144 const md = useMediaQuery ( breakpoints . down ( 'md' ) ) ;
4245 const sm = useMediaQuery ( breakpoints . down ( 'sm' ) ) ;
@@ -49,7 +52,7 @@ export default function TopBarNotify({ campaigns }: TopBarNotifyProps) {
4952 return campaigns [ currentChainId ] || null ;
5053 } ;
5154
52- const currentCampaign = getCurrentCampaign ( ) ;
55+ const currentCampaign = routeCampaigns ?. [ router . pathname ] ?? getCurrentCampaign ( ) ?? null ;
5356
5457 const [ showWarning , setShowWarning ] = useState ( ( ) => {
5558 if ( ! currentCampaign ) return false ;
@@ -103,13 +106,13 @@ export default function TopBarNotify({ campaigns }: TopBarNotifyProps) {
103106 case 'route' :
104107 router . push ( currentCampaign . buttonAction . value ) ;
105108 break ;
106- // case 'modal':
107- // console.log(
108- // 'Modal action:',
109- // currentCampaign.buttonAction.value,
110- // currentCampaign.buttonAction.params
111- // );
112- break ;
109+ // case 'modal':
110+ // console.log(
111+ // 'Modal action:',
112+ // currentCampaign.buttonAction.value,
113+ // currentCampaign.buttonAction.params
114+ // );
115+ // break;
113116 }
114117 } ;
115118
0 commit comments