-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Toggle Upgrade btn based on Enterprise license (#412)
- Loading branch information
1 parent
689593d
commit 6591381
Showing
4 changed files
with
33 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,15 @@ import { Button, Divider, Image, Stack } from '@mantine/core'; | |
import { FC, useCallback } from 'react'; | ||
import styles from './styles/Header.module.css'; | ||
import HelpModal from './HelpModal'; | ||
import _ from 'lodash'; | ||
import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/AppProvider'; | ||
import { OSS_LICENSE_TYPE } from '@/constants'; | ||
|
||
const PrimaryHeader: FC = () => { | ||
const classes = styles; | ||
const { logoContainer, imageSty } = classes; | ||
const [maximized, setAppStore] = useAppStore((store) => store.maximized); | ||
const [instanceConfig] = useAppStore((store) => store.instanceConfig); | ||
const toggleHelpModal = useCallback(() => setAppStore(appStoreReducers.toggleHelpModal), []); | ||
if (maximized) return null; | ||
|
||
|
@@ -31,14 +34,16 @@ const PrimaryHeader: FC = () => { | |
className={classes.rightSection} | ||
style={{ flexDirection: 'row', height: '100%', justifyContent: 'flex-end' }} | ||
gap={8}> | ||
<Button | ||
variant="outline" | ||
style={{ border: 'none' }} | ||
component={'a'} | ||
href="mailto:[email protected]?subject=Production%20Support%20Query" | ||
target="_blank"> | ||
Upgrade | ||
</Button> | ||
{instanceConfig?.license && _.isEqual(instanceConfig?.license, OSS_LICENSE_TYPE) && ( | ||
<Button | ||
variant="outline" | ||
style={{ border: 'none' }} | ||
component={'a'} | ||
href="mailto:[email protected]?subject=Production%20Support%20Query" | ||
target="_blank"> | ||
Upgrade | ||
</Button> | ||
)} | ||
<Divider orientation="vertical" /> | ||
<Button onClick={toggleHelpModal} style={{ border: 'none' }} variant="outline"> | ||
Help | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ import { useAbout } from '@/hooks/useGetAbout'; | |
import { IconInfoCircle } from '@tabler/icons-react'; | ||
import styles from './styles/InfoModal.module.css'; | ||
import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/AppProvider'; | ||
import { OSS_LICENSE_TYPE } from '@/constants'; | ||
import _ from 'lodash'; | ||
|
||
const { setInstanceConfig } = appStoreReducers; | ||
|
||
|
@@ -60,14 +62,16 @@ const InfoModal: FC<InfoModalProps> = (props) => { | |
<Box className={aboutTextInnerBox}> | ||
<Text className={aboutTextKey}> License: </Text> | ||
<Text className={aboutTextValue}> {getAboutData?.data.license} </Text> | ||
<Button | ||
variant="outline" | ||
component={'a'} | ||
href="mailto:[email protected]?subject=Production%20Support%20Query" | ||
target="_blank" | ||
className={actionBtn}> | ||
Upgrade to production support | ||
</Button> | ||
{_.isEqual(getAboutData?.data.license, OSS_LICENSE_TYPE) && ( | ||
<Button | ||
variant="outline" | ||
component={'a'} | ||
href="mailto:[email protected]?subject=Production%20Support%20Query" | ||
target="_blank" | ||
className={actionBtn}> | ||
Upgrade to production support | ||
</Button> | ||
)} | ||
</Box> | ||
</Box> | ||
<Box className={aboutTextBox}> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const OSS_LICENSE_TYPE = 'AGPL-3.0-only'; | ||
|
||
export { OSS_LICENSE_TYPE }; |