mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
refactor(console): guard charge notification directly in the cloud version (#5150)
This commit is contained in:
parent
f33ef7067f
commit
ee268ac028
3 changed files with 15 additions and 12 deletions
|
@ -5,7 +5,6 @@ import { useContext } from 'react';
|
|||
import { Trans, useTranslation } from 'react-i18next';
|
||||
|
||||
import { pricingLink } from '@/consts';
|
||||
import { isDevFeaturesEnabled } from '@/consts/env';
|
||||
import { TenantsContext } from '@/contexts/TenantsProvider';
|
||||
import InlineNotification from '@/ds-components/InlineNotification';
|
||||
import TextLink from '@/ds-components/TextLink';
|
||||
|
@ -29,11 +28,6 @@ function ChargeNotification({ hasSurpassedLimit, quotaItem, quotaLimit, classNam
|
|||
const { currentTenantId } = useContext(TenantsContext);
|
||||
const { data: currentPlan } = useSubscriptionPlan(currentTenantId);
|
||||
|
||||
// Todo @xiaoyijun [Pricing] Remove feature flag
|
||||
if (!isDevFeaturesEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (
|
||||
!hasSurpassedLimit ||
|
||||
// No charge notification for free plan
|
||||
|
|
|
@ -14,6 +14,7 @@ import EmptyDataPlaceholder from '@/components/EmptyDataPlaceholder';
|
|||
import ItemPreview from '@/components/ItemPreview';
|
||||
import ListPage from '@/components/ListPage';
|
||||
import { defaultPageSize } from '@/consts';
|
||||
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
|
||||
import { ApiResourceDetailsTabs } from '@/consts/page-tabs';
|
||||
import CopyToClipboard from '@/ds-components/CopyToClipboard';
|
||||
import Tag from '@/ds-components/Tag';
|
||||
|
@ -79,7 +80,11 @@ function ApiResources() {
|
|||
},
|
||||
}}
|
||||
subHeader={
|
||||
<ChargeNotification hasSurpassedLimit={hasSurpassedLimit} quotaItem="api_resource" />
|
||||
isCloud &&
|
||||
// Todo @xiaoyijun [Pricing] Remove feature flag
|
||||
isDevFeaturesEnabled && (
|
||||
<ChargeNotification hasSurpassedLimit={hasSurpassedLimit} quotaItem="api_resource" />
|
||||
)
|
||||
}
|
||||
table={{
|
||||
rowGroups: [{ key: 'apiResources', data: apiResources }],
|
||||
|
|
|
@ -10,6 +10,7 @@ import ChargeNotification from '@/components/ChargeNotification';
|
|||
import ItemPreview from '@/components/ItemPreview';
|
||||
import PageMeta from '@/components/PageMeta';
|
||||
import { defaultPageSize } from '@/consts';
|
||||
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
|
||||
import Button from '@/ds-components/Button';
|
||||
import CardTitle from '@/ds-components/CardTitle';
|
||||
import CopyToClipboard from '@/ds-components/CopyToClipboard';
|
||||
|
@ -72,11 +73,14 @@ function Applications() {
|
|||
/>
|
||||
)}
|
||||
</div>
|
||||
<ChargeNotification
|
||||
hasSurpassedLimit={hasMachineToMachineAppsSurpassedLimit}
|
||||
quotaItem="machine_to_machine"
|
||||
className={styles.chargeNotification}
|
||||
/>
|
||||
{/* Todo @xiaoyijun [Pricing] Remove feature flag */}
|
||||
{isCloud && isDevFeaturesEnabled && (
|
||||
<ChargeNotification
|
||||
hasSurpassedLimit={hasMachineToMachineAppsSurpassedLimit}
|
||||
quotaItem="machine_to_machine"
|
||||
className={styles.chargeNotification}
|
||||
/>
|
||||
)}
|
||||
{!isLoading && !applications?.length && (
|
||||
<OverlayScrollbar className={styles.guideLibraryContainer}>
|
||||
<CardTitle
|
||||
|
|
Loading…
Reference in a new issue