0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

chore(console): remove dev features flag from console client (#5368)

This commit is contained in:
Charles Zhao 2024-02-05 09:20:14 +08:00 committed by GitHub
parent cf049b26f9
commit d2fc3fd916
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 29 deletions

View file

@ -4,5 +4,6 @@ import { yes } from '@silverhand/essentials';
export const isProduction = process.env.NODE_ENV === 'production';
export const isCloud = yes(process.env.IS_CLOUD);
export const adminEndpoint = process.env.ADMIN_ENDPOINT;
// eslint-disable-next-line import/no-unused-modules
export const isDevFeaturesEnabled =
!isProduction || yes(process.env.DEV_FEATURES_ENABLED) || yes(process.env.INTEGRATION_TEST);

View file

@ -17,7 +17,7 @@ import ExternalLinkIcon from '@/assets/icons/external-link.svg';
import DomainStatusTag from '@/components/DomainStatusTag';
import FormCard from '@/components/FormCard';
import OpenExternalLink from '@/components/OpenExternalLink';
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
import { isCloud } from '@/consts/env';
import { openIdProviderConfigPath } from '@/consts/oidc';
import Button from '@/ds-components/Button';
import CopyToClipboard from '@/ds-components/CopyToClipboard';
@ -58,7 +58,7 @@ function ProtectedAppSettings({ data }: Props) {
`api/applications/${data.id}/protected-app-metadata/custom-domains`
);
const { data: systemDomainData } = useSWRImmutable<ProtectedAppsDomainConfig>(
isDevFeaturesEnabled && isCloud && 'api/systems/application'
isCloud && 'api/systems/application'
);
const api = useApi();
const [isDeletingCustomDomain, setIsDeletingCustomDomain] = useState(false);

View file

@ -11,7 +11,7 @@ import FeatureTag from '@/components/FeatureTag';
import { type SelectedGuide } from '@/components/Guide/GuideCard';
import GuideCardGroup from '@/components/Guide/GuideCardGroup';
import { useAppGuideMetadata } from '@/components/Guide/hooks';
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
import { isCloud } from '@/consts/env';
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
import { CheckboxGroup } from '@/ds-components/Checkbox';
import OverlayScrollbar from '@/ds-components/OverlayScrollbar';
@ -108,21 +108,23 @@ function GuideLibrary({ className, hasCardBorder, hasCardButton }: Props) {
<div className={styles.checkboxGroupContainer}>
<CheckboxGroup
className={styles.checkboxGroup}
options={allAppGuideCategories.map((category) => ({
title: `guide.categories.${category}`,
value: category,
...cond(
isCloud &&
category === 'ThirdParty' && {
tag: (
<FeatureTag
isVisible={currentPlan.quota.thirdPartyApplicationsLimit === 0}
plan={ReservedPlanId.Pro}
/>
),
}
),
}))}
options={allAppGuideCategories
.filter((category) => isCloud || category !== 'Protected')
.map((category) => ({
title: `guide.categories.${category}`,
value: category,
...cond(
isCloud &&
category === 'ThirdParty' && {
tag: (
<FeatureTag
isVisible={currentPlan.quota.thirdPartyApplicationsLimit === 0}
plan={ReservedPlanId.Pro}
/>
),
}
),
}))}
value={filterCategories}
onChange={(value) => {
const sortedValue = allAppGuideCategories.filter((category) =>
@ -149,8 +151,7 @@ function GuideLibrary({ className, hasCardBorder, hasCardButton }: Props) {
))}
{!keyword && (
<>
{isDevFeaturesEnabled &&
isCloud &&
{isCloud &&
(filterCategories.length === 0 ||
filterCategories.includes(ApplicationType.Protected)) && (
<ProtectedAppCard

View file

@ -13,7 +13,7 @@ import useSWRImmutable from 'swr/immutable';
import ContactUsPhraseLink from '@/components/ContactUsPhraseLink';
import PlanName from '@/components/PlanName';
import QuotaGuardFooter from '@/components/QuotaGuardFooter';
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
import { isCloud } from '@/consts/env';
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
import Button, { type Props as ButtonProps } from '@/ds-components/Button';
import FormField from '@/ds-components/FormField';
@ -44,9 +44,7 @@ function ProtectedAppForm({
hasRequiredLabel,
onCreateSuccess,
}: Props) {
const { data } = useSWRImmutable<ProtectedAppsDomainConfig>(
isDevFeaturesEnabled && isCloud && 'api/systems/application'
);
const { data } = useSWRImmutable<ProtectedAppsDomainConfig>(isCloud && 'api/systems/application');
const { currentPlan } = useContext(SubscriptionDataContext);
const { hasAppsReachedLimit } = useApplicationsUsage();
const { name: planName, quota } = currentPlan;

View file

@ -15,7 +15,7 @@ import GuideCardGroup from '@/components/Guide/GuideCardGroup';
import { useApiGuideMetadata, useAppGuideMetadata } from '@/components/Guide/hooks';
import PageMeta from '@/components/PageMeta';
import { ConnectorsTabs } from '@/consts';
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
import { isCloud } from '@/consts/env';
import { AppDataContext } from '@/contexts/AppDataProvider';
import { LinkButton } from '@/ds-components/Button';
import Card from '@/ds-components/Card';
@ -110,11 +110,9 @@ function GetStarted() {
</div>
<Card className={styles.card}>
<div className={styles.title}>
{isCloud && isDevFeaturesEnabled
? t('get_started.develop.title_cloud')
: t('get_started.develop.title')}
{t(`get_started.develop.title${isCloud ? '_cloud' : ''}`)}
</div>
{isCloud && isDevFeaturesEnabled && (
{isCloud && (
<>
<ProtectedAppCreationForm />
<div className={styles.subtitle}>{t('get_started.develop.subtitle_cloud')}</div>