-
-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(console): update cloud API calls
- Loading branch information
Showing
52 changed files
with
1,461 additions
and
208 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
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
33 changes: 33 additions & 0 deletions
33
...ateTenantModal/SelectTenantBasicSkuModal/SkuCardItem/FeaturedSkuContent/index.module.scss
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,33 @@ | ||
@use '@/scss/underscore' as _; | ||
|
||
.list { | ||
flex: 1; | ||
margin-block: 0; | ||
padding-inline: 0; | ||
padding-bottom: _.unit(8); | ||
list-style: none; | ||
|
||
> li { | ||
display: flex; | ||
font: var(--font-body-2); | ||
align-items: center; | ||
gap: _.unit(2); | ||
|
||
.icon { | ||
width: 16px; | ||
height: 16px; | ||
|
||
&.failed { | ||
color: var(--color-on-error-container); | ||
} | ||
|
||
&.success { | ||
color: var(--color-on-success-container); | ||
} | ||
} | ||
|
||
&:not(:first-child) { | ||
margin-top: _.unit(3); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ents/CreateTenantModal/SelectTenantBasicSkuModal/SkuCardItem/FeaturedSkuContent/index.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,34 @@ | ||
import classNames from 'classnames'; | ||
|
||
import Failed from '@/assets/icons/failed.svg'; | ||
import Success from '@/assets/icons/success.svg'; | ||
|
||
import * as styles from './index.module.scss'; | ||
import useFeaturedSkuContent from './use-featured-sku-content'; | ||
|
||
type Props = { | ||
readonly skuId: string; | ||
}; | ||
|
||
function FeaturedSkuContent({ skuId }: Props) { | ||
const contentData = useFeaturedSkuContent(skuId); | ||
|
||
return ( | ||
<ul className={styles.list}> | ||
{contentData.map(({ title, isAvailable }) => { | ||
return ( | ||
<li key={title}> | ||
{isAvailable ? ( | ||
<Success className={classNames(styles.icon, styles.success)} /> | ||
) : ( | ||
<Failed className={classNames(styles.icon, styles.failed)} /> | ||
)} | ||
{title} | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
); | ||
} | ||
|
||
export default FeaturedSkuContent; |
77 changes: 77 additions & 0 deletions
77
...odal/SelectTenantBasicSkuModal/SkuCardItem/FeaturedSkuContent/use-featured-sku-content.ts
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,77 @@ | ||
import { ReservedPlanId } from '@logto/schemas'; | ||
import { cond } from '@silverhand/essentials'; | ||
import { useMemo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { | ||
freePlanAuditLogsRetentionDays, | ||
freePlanM2mLimit, | ||
freePlanMauLimit, | ||
freePlanPermissionsLimit, | ||
freePlanRoleLimit, | ||
proPlanAuditLogsRetentionDays, | ||
} from '@/consts/subscriptions'; | ||
|
||
type ContentData = { | ||
title: string; | ||
isAvailable: boolean; | ||
}; | ||
|
||
const useFeaturedSkuContent = (skuId: string) => { | ||
const { t } = useTranslation(undefined, { | ||
keyPrefix: 'admin_console.upsell.featured_plan_content', | ||
}); | ||
|
||
const contentData: ContentData[] = useMemo(() => { | ||
const isFreePlan = skuId === ReservedPlanId.Free; | ||
const planPhraseKey = isFreePlan ? 'free_plan' : 'pro_plan'; | ||
|
||
return [ | ||
{ | ||
title: t(`mau.${planPhraseKey}`, { ...cond(isFreePlan && { count: freePlanMauLimit }) }), | ||
isAvailable: true, | ||
}, | ||
{ | ||
title: t(`m2m.${planPhraseKey}`, { ...cond(isFreePlan && { count: freePlanM2mLimit }) }), | ||
isAvailable: true, | ||
}, | ||
{ | ||
title: t('third_party_apps'), | ||
isAvailable: !isFreePlan, | ||
}, | ||
{ | ||
title: t('mfa'), | ||
isAvailable: !isFreePlan, | ||
}, | ||
{ | ||
title: t('sso'), | ||
isAvailable: !isFreePlan, | ||
}, | ||
{ | ||
title: t(`role_and_permissions.${planPhraseKey}`, { | ||
...cond( | ||
isFreePlan && { | ||
roleCount: freePlanRoleLimit, | ||
permissionCount: freePlanPermissionsLimit, | ||
} | ||
), | ||
}), | ||
isAvailable: true, | ||
}, | ||
{ | ||
title: t('organizations'), | ||
isAvailable: !isFreePlan, | ||
}, | ||
{ | ||
title: t('audit_logs', { | ||
count: isFreePlan ? freePlanAuditLogsRetentionDays : proPlanAuditLogsRetentionDays, | ||
}), | ||
isAvailable: true, | ||
}, | ||
]; | ||
}, [t, skuId]); | ||
|
||
return contentData; | ||
}; | ||
|
||
export default useFeaturedSkuContent; |
Oops, something went wrong.