@@ -18,8 +18,7 @@ import { useEffect, useState } from 'react'
1818import Tippy from '@tippyjs/react'
1919import './pageHeader.css'
2020import ReactGA from 'react-ga4'
21- import { ComponentSizeType } from '@Shared/constants'
22- import { getRandomColor , VisibleModal } from '../../../Common'
21+ import { getRandomColor } from '../../../Common'
2322import LogoutCard from '../LogoutCard'
2423import { setActionWithExpiry , handlePostHogEventUpdate } from './utils'
2524import { InstallationType , ServerInfo , PageHeaderType } from './types'
@@ -33,8 +32,7 @@ import { ReactComponent as DropDownIcon } from '../../../Assets/Icon/ic-chevron-
3332import AnnouncementBanner from '../AnnouncementBanner/AnnouncementBanner'
3433import { useMainContext , useUserEmail } from '../../Providers'
3534import { InfoIconTippy } from '../InfoIconTippy'
36- import { ButtonStyleType , ButtonVariantType } from '../Button/types'
37- import { Button } from '../Button'
35+ import { IframePromoButton } from './IframePromoButton'
3836
3937const PageHeader = ( {
4038 headerName,
@@ -64,8 +62,6 @@ const PageHeader = ({
6462 } ,
6563 )
6664 const [ expiryDate , setExpiryDate ] = useState ( 0 )
67- const [ showEmbeddedIframeModal , setEmbeddedIframeModal ] = useState ( false )
68- const embedIframeButtonText = window . _env_ . FEATURE_PROMO_EMBEDDED_BUTTON_TEXT
6965
7066 const getCurrentServerInfo = async ( ) => {
7167 try {
@@ -161,50 +157,8 @@ const PageHeader = ({
161157 < span className = "fs-12 fw-4 lh-18 pt-1 pb-1 pl-6 pr-6 ml-8 cn-9 bcy-5 br-4" > Beta</ span >
162158 )
163159
164- const onClickShowTryDevtronModal = ( ) => setEmbeddedIframeModal ( true )
165- const onClickCloseTryDevtronModal = ( ) => setEmbeddedIframeModal ( false )
160+ const renderIframeButton = ( ) => < IframePromoButton />
166161
167- const renderIframeDrawer = ( ) => (
168- < VisibleModal close = { onClickCloseTryDevtronModal } >
169- < div className = "modal-body--ci-material h-100 dc__overflow-hidden dc__border-left flex column dc__content-space w-100" >
170- < div className = "trigger-modal__header w-100" >
171- < h1 className = "modal__title flex left fs-16 fw-6-imp" data-testid = "app-details-url-heading" >
172- { window . _env_ . FEATURE_PROMO_EMBEDDED_MODAL_TITLE || embedIframeButtonText }
173- </ h1 >
174- < Button
175- ariaLabel = "Try Devtron"
176- dataTestId = "iframe-modal-close-button"
177- size = { ComponentSizeType . small }
178- onClick = { onClickCloseTryDevtronModal }
179- style = { ButtonStyleType . negativeGrey }
180- variant = { ButtonVariantType . borderLess }
181- icon = { < Close /> }
182- showAriaLabelInTippy = { false }
183- />
184- </ div >
185- < iframe
186- title = { window . _env_ . FEATURE_PROMO_EMBEDDED_MODAL_TITLE || embedIframeButtonText }
187- src = { window . _env_ . FEATURE_PROMO_EMBEDDED_IFRAME_URL }
188- width = "100%"
189- height = "100%"
190- className = "dc__no-border"
191- sandbox = "allow-same-origin allow-scripts"
192- referrerPolicy = "no-referrer"
193- />
194- </ div >
195- </ VisibleModal >
196- )
197-
198- const renderIframeButton = ( ) =>
199- embedIframeButtonText && (
200- < Button
201- dataTestId = "iframe-header-button"
202- size = { ComponentSizeType . small }
203- onClick = { onClickShowTryDevtronModal }
204- text = { embedIframeButtonText }
205- variant = { ButtonVariantType . secondary }
206- />
207- )
208162 return (
209163 < div
210164 className = { `dc__page-header dc__content-space cn-9 bcn-0 pl-20 pr-20 ${
@@ -314,7 +268,6 @@ const PageHeader = ({
314268 { renderLogoutHelpSection ( ) }
315269 </ div >
316270 ) }
317- { showEmbeddedIframeModal && renderIframeDrawer ( ) }
318271 { showAnnouncementHeader && < AnnouncementBanner parentClassName = "page-header-banner" /> }
319272 </ div >
320273 )
0 commit comments