Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add enterprise badge to change req settings #2585

Merged
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a4d2216
make consistent
andreas-unleash Dec 1, 2022
ca609d9
make consistent
andreas-unleash Dec 1, 2022
65443c5
Merge branch 'main' into feat/add_enterprise_badge_to_change_req_sett…
andreas-unleash Dec 2, 2022
7380ea9
fix merge conflicts
andreas-unleash Dec 2, 2022
097ff36
change menu order: environments first
andreas-unleash Dec 2, 2022
ab7f478
change menu order: environments first
andreas-unleash Dec 2, 2022
9488a47
change menu order: environments first
andreas-unleash Dec 2, 2022
b1c758a
Update frontend/src/component/project/ProjectList/ProjectList.tsx
andreas-unleash Dec 2, 2022
00591bb
Update frontend/src/component/project/Project/ProjectSettings/ChangeR…
andreas-unleash Dec 2, 2022
7eaefa4
change menu order: environments first
andreas-unleash Dec 2, 2022
cdffff3
Merge remote-tracking branch 'origin/feat/add_enterprise_badge_to_cha…
andreas-unleash Dec 2, 2022
5c5262a
Update frontend/src/component/common/ProFeatureTooltip/ProFeatureTool…
andreas-unleash Dec 2, 2022
34c14ca
Update frontend/src/component/common/ProFeatureTooltip/ProFeatureTool…
andreas-unleash Dec 2, 2022
6a3c427
Update frontend/src/component/common/VerticalTabs/VerticalTab/Vertica…
andreas-unleash Dec 2, 2022
fe38138
Update frontend/src/component/project/Project/ProjectSettings/Project…
andreas-unleash Dec 2, 2022
15f82c4
Update frontend/src/component/project/ProjectAccess/ProjectAccess.tsx
andreas-unleash Dec 2, 2022
011aa43
Rename to PremiumFeature.tsx. Standartise component
andreas-unleash Dec 2, 2022
578535a
Merge remote-tracking branch 'origin/feat/add_enterprise_badge_to_cha…
andreas-unleash Dec 2, 2022
4c49687
Merge branch 'main' into feat/add_enterprise_badge_to_change_req_sett…
andreas-unleash Dec 5, 2022
bf1aaf0
revert
andreas-unleash Dec 5, 2022
f650832
Update frontend/src/component/common/PremiumFeature/PremiumFeature.tsx
andreas-unleash Dec 5, 2022
b9b99dd
Update frontend/src/component/common/PremiumFeature/PremiumFeature.tsx
andreas-unleash Dec 5, 2022
7a4cdc0
Update frontend/src/component/common/PremiumFeature/PremiumFeature.tsx
andreas-unleash Dec 5, 2022
1558a04
Update frontend/src/component/project/ProjectAccess/ProjectAccess.tsx
andreas-unleash Dec 5, 2022
e7fd5f8
Update frontend/src/component/common/PremiumFeature/PremiumFeature.tsx
andreas-unleash Dec 5, 2022
c11db9e
PR comment
andreas-unleash Dec 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
84 changes: 84 additions & 0 deletions frontend/src/component/common/PremiumFeature/PremiumFeature.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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',
}));

export enum FeatureLevelTitle {
andreas-unleash marked this conversation as resolved.
Show resolved Hide resolved
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;
andreas-unleash marked this conversation as resolved.
Show resolved Hide resolved
enterpriseOnly?: boolean;
center?: boolean;
}

export const PremiumFeature = ({
enterpriseOnly = false,
origin,
children,
center,
}: PremiumFeatureProps) => {
andreas-unleash marked this conversation as resolved.
Show resolved Hide resolved
const tracker = usePlausibleTracker();
const handleClick = () => {
andreas-unleash marked this conversation as resolved.
Show resolved Hide resolved
if (origin) {
tracker.trackEvent('upgrade_plan_clicked', {
props: { origin },
});
}
};
return (
andreas-unleash marked this conversation as resolved.
Show resolved Hide resolved
<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>
);
};

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
import { styled } from '@mui/material';
import { Button, styled } from '@mui/material';

const StyledTab = styled('button')<{ selected: boolean }>(
const StyledTab = styled(Button)<{ selected: boolean }>(
nunogois marked this conversation as resolved.
Show resolved Hide resolved
({ theme, selected }) => ({
cursor: 'pointer',
border: 0,
backgroundColor: selected
? theme.palette.background.paper
: 'transparent',
borderLeft: `${theme.spacing(1)} solid ${
selected ? theme.palette.primary.main : 'transparent'
}`,
borderRadius: theme.shape.borderRadiusMedium,
padding: theme.spacing(2, 4),
color: theme.palette.text.primary,
fontSize: theme.fontSizes.bodySize,
fontWeight: selected ? theme.fontWeight.bold : theme.fontWeight.medium,
textAlign: 'left',
transition: 'background-color 0.2s ease',
'&.MuiButton-root': {
cursor: 'pointer',
height: theme.spacing(6.5),
border: 0,
backgroundColor: selected
? theme.palette.background.paper
: 'transparent',
borderLeft: `${theme.spacing(1)} solid ${
selected ? theme.palette.primary.main : 'transparent'
}`,
borderRadius: theme.shape.borderRadiusMedium,
justifyContent: 'start',
transition: 'background-color 0.2s ease',
color: theme.palette.text.primary,
textAlign: 'left',
padding: theme.spacing(2, 4),
fontSize: theme.fontSizes.bodySize,
fontWeight: selected
? theme.fontWeight.bold
: theme.fontWeight.medium,
lineHeight: 1.2,
},
'&:hover': {
backgroundColor: theme.palette.neutral.light,
},
'&.Mui-disabled': {
pointerEvents: 'auto',
},
justifyContent: 'space-between',
})
);

Expand All @@ -34,7 +45,15 @@ export const VerticalTab = ({
selected,
onClick,
}: IVerticalTabProps) => (
<StyledTab selected={Boolean(selected)} onClick={onClick}>
<StyledTab
selected={Boolean(selected)}
onClick={onClick}
disableRipple
disableElevation
disableFocusRipple
disableTouchRipple
fullWidth
>
{label}
</StyledTab>
);