11/* eslint-disable @typescript-eslint/no-explicit-any */
2- import { useState } from 'react'
2+ import { useEffect , useState } from 'react'
33import { NavLink , Outlet } from 'react-router-dom'
4+ import request from '@common/helpers/request'
45import Logo from '@resource/img/bitSmtpLogo.svg'
5- import exclusiveEarlyBirdOffer from '@resource/img/exclusiveEarlyBirdOffer.jpg '
6+ import exclusiveEarlyBirdOffer from '@resource/img/exclusiveEarlyBirdOffer.png '
67import { Layout as AntLayout , Modal } from 'antd'
78// eslint-disable-next-line import/no-extraneous-dependencies
89import confetti from 'canvas-confetti'
910import cls from './Layout.module.css'
1011
1112function Header ( ) {
1213 const [ isModalOpen , setIsModalOpen ] = useState ( false )
14+ const [ hideNewProductBtn , setHideNewProductBtn ] = useState ( false )
1315
1416 const handleConfetti = ( ) => {
1517 confetti ( {
@@ -43,6 +45,20 @@ function Header() {
4345 color : isActive ? '#fff' : ''
4446 } )
4547
48+ useEffect ( ( ) => {
49+ request ( 'new_product_nav_btn_visible_check' , null , null , 'GET' ) . then ( ( res : any ) => {
50+ if ( res . data ) {
51+ setHideNewProductBtn ( true )
52+ }
53+ } )
54+ } , [ ] )
55+
56+ const handleNewProductNavBtn = ( ) => {
57+ request ( 'hide_new_product_nav_btn' )
58+ setHideNewProductBtn ( true )
59+ setIsModalOpen ( false )
60+ }
61+
4662 return (
4763 < div className = { cls . layout } >
4864 < div className = { cls . topbar } >
@@ -66,15 +82,19 @@ function Header() {
6682 </ NavLink >
6783 ) ) }
6884 </ div >
69- < div className = { cls . bitSocialMenu } >
70- < button type = "button" onClick = { ( ) => showModal ( ) } className = { cls . btn } >
71- New Product Launch
72- < span className = { cls . star } />
73- < span className = { cls . star } />
74- < span className = { cls . star } />
75- < span className = { cls . star } />
76- </ button >
77- </ div >
85+ { ! hideNewProductBtn ? (
86+ < div className = { cls . bitSocialMenu } >
87+ < button type = "button" onClick = { ( ) => showModal ( ) } className = { cls . btn } >
88+ New Product Launch
89+ < span className = { cls . star } />
90+ < span className = { cls . star } />
91+ < span className = { cls . star } />
92+ < span className = { cls . star } />
93+ </ button >
94+ </ div >
95+ ) : (
96+ ''
97+ ) }
7898 </ div >
7999
80100 < Modal
@@ -100,6 +120,13 @@ function Header() {
100120 >
101121 { `Grab It Before It's Gone!` }
102122 </ a >
123+ < button
124+ type = "button"
125+ className = { cls . skipNewProductBtn }
126+ onClick = { ( ) => handleNewProductNavBtn ( ) }
127+ >
128+ Don't show it again
129+ </ button >
103130 </ div >
104131 </ Modal >
105132 </ div >
0 commit comments