-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new pricing plans design (#2374)
- Loading branch information
Showing
92 changed files
with
2,827 additions
and
1,972 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
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
55 changes: 55 additions & 0 deletions
55
webapp/src/component/billing/ActiveSubscription/ActivePlanTitle.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,55 @@ | ||
import { T } from '@tolgee/react'; | ||
import { Box, Typography } from '@mui/material'; | ||
|
||
import { components } from 'tg.service/billingApiSchema.generated'; | ||
import { useDateFormatter } from 'tg.hooks/useLocale'; | ||
import { PlanTitleText } from '../Plan/PlanTitle'; | ||
|
||
type Status = components['schemas']['SelfHostedEeSubscriptionModel']['status']; | ||
|
||
type Props = { | ||
name: string; | ||
status: Status; | ||
createdAt?: number; | ||
periodStart?: number; | ||
periodEnd?: number; | ||
highlightColor: string; | ||
}; | ||
|
||
export const ActivePlanTitle = ({ | ||
name, | ||
createdAt, | ||
periodStart, | ||
periodEnd, | ||
highlightColor, | ||
}: Props) => { | ||
const formatDate = useDateFormatter(); | ||
|
||
return ( | ||
<Box sx={{ mb: 1 }}> | ||
<PlanTitleText sx={{ color: highlightColor, mb: 1 }}> | ||
{name} | ||
</PlanTitleText> | ||
<Box display="grid"> | ||
{createdAt && ( | ||
<Typography variant="caption"> | ||
{createdAt && ( | ||
<Typography variant="caption"> | ||
<T keyName="active-plan-subscribed-at-tooltip" />:{' '} | ||
{formatDate(createdAt)} | ||
</Typography> | ||
)} | ||
</Typography> | ||
)} | ||
{Boolean(periodStart && periodEnd) && ( | ||
<Typography variant="caption"> | ||
<T | ||
keyName="active-plan-current-period" | ||
params={{ start: periodStart, end: periodEnd }} | ||
/> | ||
</Typography> | ||
)} | ||
</Box> | ||
</Box> | ||
); | ||
}; |
64 changes: 64 additions & 0 deletions
64
webapp/src/component/billing/ActiveSubscription/ActiveSubscriptionBanner.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,64 @@ | ||
import { useTranslate } from '@tolgee/react'; | ||
import { styled, useTheme } from '@mui/material'; | ||
import { PlanSubtitle } from '../Plan/PlanStyles'; | ||
import { components } from 'tg.service/apiSchema.generated'; | ||
|
||
type EeSubscriptionModelStatus = | ||
components['schemas']['EeSubscriptionModel']['status']; | ||
|
||
const StyledCustomLabel = styled('span')` | ||
font-size: 14px; | ||
font-weight: 400; | ||
text-transform: lowercase; | ||
`; | ||
|
||
type Props = { | ||
status: EeSubscriptionModelStatus; | ||
custom?: boolean; | ||
}; | ||
|
||
export const ActiveSubscriptionBanner = ({ status, custom }: Props) => { | ||
const { t } = useTranslate(); | ||
const theme = useTheme(); | ||
|
||
const statusMap: Record< | ||
EeSubscriptionModelStatus, | ||
{ label: string; color: 'secondary' | 'error' } | ||
> = { | ||
ACTIVE: { label: t('ee_license_status_label_active'), color: 'secondary' }, | ||
CANCELED: { | ||
label: t('ee_license_status_label_canceled'), | ||
color: 'error', | ||
}, | ||
PAST_DUE: { | ||
label: t('ee_license_status_label_past_due'), | ||
color: 'error', | ||
}, | ||
ERROR: { label: t('ee_license_status_label_error'), color: 'error' }, | ||
UNPAID: { label: t('ee_license_status_label_unpaid'), color: 'error' }, | ||
KEY_USED_BY_ANOTHER_INSTANCE: { | ||
label: t('ee_license_status_label_key_used_by_another_instance'), | ||
color: 'error', | ||
}, | ||
}; | ||
|
||
const { label, color } = statusMap[status]; | ||
const clrObject = theme.palette.tokens[color]; | ||
|
||
return ( | ||
<PlanSubtitle | ||
data-cy="billing-plan-subtitle" | ||
sx={{ background: clrObject._states.hover, color: clrObject.main }} | ||
> | ||
<span>{label}</span> | ||
{custom && ( | ||
<> | ||
{' '} | ||
<StyledCustomLabel className="noBackground"> | ||
{t('billing_subscription_custom')} | ||
</StyledCustomLabel> | ||
</> | ||
)} | ||
</PlanSubtitle> | ||
); | ||
}; |
39 changes: 39 additions & 0 deletions
39
webapp/src/component/billing/ActiveSubscription/CollapsedFeatures.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,39 @@ | ||
import { styled } from '@mui/material'; | ||
import { IncludedFeatures } from '../Plan/IncludedFeatures'; | ||
import { components } from 'tg.service/apiSchema.generated'; | ||
import { useState } from 'react'; | ||
import { | ||
ShowAllFeaturesButton, | ||
ShowAllFeaturesLink, | ||
} from '../Plan/ShowAllFeatures'; | ||
import { PlanFeaturesBox } from '../Plan/PlanStyles'; | ||
|
||
type Features = components['schemas']['EeSubscriptionModel']['enabledFeatures']; | ||
|
||
const StyledFeatures = styled(IncludedFeatures)` | ||
display: grid; | ||
grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); | ||
margin: 0px; | ||
`; | ||
|
||
type Props = { | ||
custom: boolean; | ||
features: Features; | ||
}; | ||
|
||
export const CollapsedFeatures = ({ custom, features }: Props) => { | ||
const [expanded, setExpanded] = useState(false); | ||
return ( | ||
<> | ||
{custom && expanded && ( | ||
<PlanFeaturesBox sx={{ gap: '18px', mb: 1 }}> | ||
<StyledFeatures features={features} /> | ||
</PlanFeaturesBox> | ||
)} | ||
{custom && !expanded && ( | ||
<ShowAllFeaturesButton onClick={() => setExpanded(true)} /> | ||
)} | ||
{!custom && <ShowAllFeaturesLink />} | ||
</> | ||
); | ||
}; |
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
4 changes: 2 additions & 2 deletions
4
...lfHostedEe/SelfHostedEeEstimatedCosts.tsx → ...bscription/SelfHostedEeEstimatedCosts.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
Oops, something went wrong.