Skip to content

Commit 99849a5

Browse files
committed
feat: shift header dialogs if showing license bar
1 parent 414383b commit 99849a5

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

src/Shared/Components/Header/HeaderWithCreateButton/HeaderWithCreateButon.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { ReactComponent as DropDown } from '@Icons/ic-caret-down-small.svg'
2121
import { ReactComponent as ChartIcon } from '@Icons/ic-charts.svg'
2222
import { ReactComponent as AddIcon } from '@Icons/ic-add.svg'
2323
import { ReactComponent as JobIcon } from '@Icons/ic-k8s-job.svg'
24+
import { LicenseStatus } from '@Shared/Components/DevtronLicenseCard'
2425
import PageHeader from '../PageHeader'
2526
import { Modal, SERVER_MODE, URLS } from '../../../../Common'
2627
import { AppListConstants, ComponentSizeType } from '../../../constants'
@@ -35,9 +36,12 @@ export const HeaderWithCreateButton = ({ headerName }: HeaderWithCreateButtonPro
3536
const params = useParams<{ appType: string }>()
3637
const history = useHistory()
3738
const location = useLocation()
38-
const { serverMode } = useMainContext()
39+
const { serverMode, licenseData } = useMainContext()
3940
const [showCreateSelectionModal, setShowCreateSelectionModal] = useState(false)
4041

42+
const showingLicenseBar =
43+
licenseData && licenseData && (licenseData.licenseStatus !== LicenseStatus.ACTIVE || licenseData.isTrial)
44+
4145
const handleCreateButton = () => {
4246
setShowCreateSelectionModal((prevState) => !prevState)
4347
}
@@ -75,7 +79,7 @@ export const HeaderWithCreateButton = ({ headerName }: HeaderWithCreateButtonPro
7579

7680
const renderCreateSelectionModal = () => (
7781
<Modal
78-
rootClassName={`create-modal-wrapper
82+
rootClassName={`create-modal-wrapper${showingLicenseBar ? '__with-bar' : ''}
7983
${window._env_.FEATURE_PROMO_EMBEDDED_BUTTON_TEXT ? 'create-modal-wrapper--try-devtron' : ''}`}
8084
onClick={handleCreateButton}
8185
>

src/Shared/Components/Header/HeaderWithCreateButton/HeaderWithCreateButton.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
top: 59px;
2121
overflow: hidden;
2222

23+
// Adding 28px for license bar/ announcement banner
24+
&__with-bar {
25+
top: 87px;
26+
}
27+
2328
.create-modal-child {
2429
padding: 10px 15px;
2530
display: flex;

src/Shared/Components/Header/PageHeader.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import AnnouncementBanner from '../AnnouncementBanner/AnnouncementBanner'
3434
import { useMainContext, useTheme, useUserEmail } from '../../Providers'
3535
import { InfoIconTippy } from '../InfoIconTippy'
3636
import { IframePromoButton } from './IframePromoButton'
37+
import { LicenseStatus } from '../DevtronLicenseCard'
3738

3839
const PageHeader = ({
3940
headerName,
@@ -49,8 +50,14 @@ const PageHeader = ({
4950
showAnnouncementHeader,
5051
tippyProps,
5152
}: PageHeaderType) => {
52-
const { loginCount, setLoginCount, showGettingStartedCard, setShowGettingStartedCard, setGettingStartedClicked } =
53-
useMainContext()
53+
const {
54+
loginCount,
55+
setLoginCount,
56+
showGettingStartedCard,
57+
setShowGettingStartedCard,
58+
setGettingStartedClicked,
59+
licenseData,
60+
} = useMainContext()
5461
const { showSwitchThemeLocationTippy, handleShowSwitchThemeLocationTippyChange } = useTheme()
5562

5663
const { isTippyCustomized, tippyRedirectLink, TippyIcon, tippyMessage, onClickTippyButton, additionalContent } =
@@ -191,6 +198,8 @@ const PageHeader = ({
191198
<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>
192199
)
193200

201+
const showingLicenseBar = licenseData && (licenseData.licenseStatus !== LicenseStatus.ACTIVE || licenseData.isTrial)
202+
194203
const renderIframeButton = () => <IframePromoButton />
195204

196205
return (
@@ -267,7 +276,7 @@ const PageHeader = ({
267276
{showTabs && renderHeaderTabs()}
268277
{showHelpCard && (
269278
<HelpNav
270-
className={`help-card__more-option ${window._env_.K8S_CLIENT ? 'k8s-client-view' : ''}`}
279+
className={`help-card__more-option${showingLicenseBar ? '__with-bar' : ''} ${window._env_.K8S_CLIENT ? 'k8s-client-view' : ''}`}
271280
setShowHelpCard={setShowHelpCard}
272281
serverInfo={currentServerInfo.serverInfo}
273282
fetchingServerInfo={currentServerInfo.fetchingServerInfo}
@@ -289,7 +298,7 @@ const PageHeader = ({
289298
)}
290299
{showLogOutCard && (
291300
<LogoutCard
292-
className="logout-card__more-option mt-8"
301+
className={`logout-card__more-option${showingLicenseBar ? '__with-bar' : ''} mt-8`}
293302
userFirstLetter={email}
294303
setShowLogOutCard={setShowLogOutCard}
295304
showLogOutCard={showLogOutCard}

src/Shared/Components/Header/pageHeader.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
.help-card__more-option {
1818
top: 51px;
1919
right: 65px;
20+
21+
/* Adding 28px for license bar/ announcement banner */
22+
&__with-bar {
23+
top: 79px;
24+
}
2025
}
2126

2227
.help-card__more-option.k8s-client-view {
@@ -27,4 +32,9 @@
2732
.logout-card__more-option {
2833
top: 51px;
2934
right: 29px;
35+
36+
/* Adding 28px for license bar/ announcement banner */
37+
&__with-bar {
38+
top: 79px;
39+
}
3040
}

0 commit comments

Comments
 (0)