Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/add enterprise badge to change req settings (#2585)
<!-- Thanks for creating a PR! To make it easier for reviewers and everyone else to understand what your changes relate to, please add some relevant content to the headings below. Feel free to ignore or delete sections that you don't think are relevant. Thank you! ❤️ --> Disable change requests for Pro and oss ## About the changes <!-- Describe the changes introduced. What are they and why are they being introduced? Feel free to also add screenshots or steps to view the changes if they're visual. --> <!-- Does it close an issue? Multiple? --> Closes # <!-- (For internal contributors): Does it relate to an issue on public roadmap? --> <!-- Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item: # --> ### Important files <!-- PRs can contain a lot of changes, but not all changes are equally important. Where should a reviewer start looking to get an overview of the changes? Are any files particularly important? --> ## Discussion points <!-- Anything about the PR you'd like to discuss before it gets merged? Got any questions or doubts? --> Signed-off-by: andreas-unleash <andreas@getunleash.ai> Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Co-authored-by: Nuno Góis <github@nunogois.com>
- Loading branch information
1 parent
cfc347f
commit 7af155f
Showing
8 changed files
with
548 additions
and
390 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
frontend/src/component/common/PremiumFeature/PremiumFeature.tsx
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,86 @@ | ||
import { ReactComponent as ProPlanIcon } from 'assets/icons/pro-enterprise-feature-badge.svg'; | ||
import { Box, Link, styled, Typography } from '@mui/material'; | ||
import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; | ||
|
||
const PremiumFeatureWrapper = styled(Box)(({ theme }) => ({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
padding: theme.spacing(1, 0.5), | ||
})); | ||
|
||
const StyledTitle = styled(Typography)(({ theme }) => ({ | ||
display: 'inline-flex', | ||
alignItems: 'center', | ||
fontWeight: theme.fontWeight.bold, | ||
fontSize: theme.fontSizes.smallBody, | ||
gap: theme.spacing(1), | ||
})); | ||
|
||
const StyledBody = styled(Typography)(({ theme }) => ({ | ||
fontSize: theme.fontSizes.smallBody, | ||
margin: theme.spacing(1, 0), | ||
})); | ||
|
||
const StyledLink = styled(Link)(({ theme }) => ({ | ||
fontSize: theme.fontSizes.smallBody, | ||
width: 'fit-content', | ||
})); | ||
|
||
enum FeatureLevelTitle { | ||
PRO = 'Pro & Enterprise feature', | ||
ENTERPRISE = 'Enterprise feature', | ||
} | ||
|
||
export enum PlausibleOrigin { | ||
PROJECT = 'Projects', | ||
ACCESS = 'Access', | ||
CHANGE_REQUEST = 'Change Request', | ||
} | ||
|
||
export interface PremiumFeatureProps { | ||
children: React.ReactNode; | ||
origin?: PlausibleOrigin; | ||
center?: boolean; | ||
enterpriseOnly?: boolean; | ||
} | ||
|
||
export const PremiumFeature = ({ | ||
children, | ||
origin, | ||
center, | ||
enterpriseOnly = false, | ||
}: PremiumFeatureProps) => { | ||
const tracker = usePlausibleTracker(); | ||
|
||
const handleClick = () => { | ||
if (origin) { | ||
tracker.trackEvent('upgrade_plan_clicked', { | ||
props: { origin }, | ||
}); | ||
} | ||
}; | ||
|
||
return ( | ||
<PremiumFeatureWrapper | ||
sx={{ | ||
alignItems: center ? 'center' : 'start', | ||
textAlign: center ? 'center' : 'left', | ||
}} | ||
> | ||
<StyledTitle> | ||
<ProPlanIcon /> | ||
{enterpriseOnly | ||
? FeatureLevelTitle.ENTERPRISE | ||
: FeatureLevelTitle.PRO} | ||
</StyledTitle> | ||
<StyledBody>{children}</StyledBody> | ||
<StyledLink | ||
href={'https://www.getunleash.io/plans'} | ||
target="_blank" | ||
onClick={handleClick} | ||
> | ||
Upgrade now | ||
</StyledLink> | ||
</PremiumFeatureWrapper> | ||
); | ||
}; |
48 changes: 0 additions & 48 deletions
48
frontend/src/component/common/ProFeatureTooltip/ProFeatureTooltip.tsx
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.