mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
fix(console): remove feature tag for custom domain feature (#4916)
This commit is contained in:
parent
ae4f855c9e
commit
211a2bca4c
2 changed files with 4 additions and 31 deletions
|
@ -17,11 +17,10 @@ type FormData = {
|
||||||
};
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isCustomDomainEnabled: boolean;
|
|
||||||
onCustomDomainAdded: (domain: Domain) => void;
|
onCustomDomainAdded: (domain: Domain) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
function AddDomainForm({ isCustomDomainEnabled, onCustomDomainAdded }: Props) {
|
function AddDomainForm({ onCustomDomainAdded }: Props) {
|
||||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
|
@ -48,7 +47,6 @@ function AddDomainForm({ isCustomDomainEnabled, onCustomDomainAdded }: Props) {
|
||||||
return (
|
return (
|
||||||
<div className={styles.addDomain}>
|
<div className={styles.addDomain}>
|
||||||
<TextInput
|
<TextInput
|
||||||
readOnly={!isCustomDomainEnabled}
|
|
||||||
className={styles.textInput}
|
className={styles.textInput}
|
||||||
placeholder={t('domain.custom.custom_domain_placeholder')}
|
placeholder={t('domain.custom.custom_domain_placeholder')}
|
||||||
error={errors.domain?.message}
|
error={errors.domain?.message}
|
||||||
|
@ -66,7 +64,7 @@ function AddDomainForm({ isCustomDomainEnabled, onCustomDomainAdded }: Props) {
|
||||||
type="primary"
|
type="primary"
|
||||||
title="domain.custom.add_domain"
|
title="domain.custom.add_domain"
|
||||||
isLoading={isSubmitting}
|
isLoading={isSubmitting}
|
||||||
disabled={domainInput.length === 0 || !isCustomDomainEnabled}
|
disabled={domainInput.length === 0}
|
||||||
onClick={onSubmit}
|
onClick={onSubmit}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
import { withAppInsights } from '@logto/app-insights/react';
|
import { withAppInsights } from '@logto/app-insights/react';
|
||||||
import { useContext } from 'react';
|
|
||||||
|
|
||||||
import FeatureTag from '@/components/FeatureTag';
|
|
||||||
import FormCard from '@/components/FormCard';
|
import FormCard from '@/components/FormCard';
|
||||||
import InlineUpsell from '@/components/InlineUpsell';
|
|
||||||
import PageMeta from '@/components/PageMeta';
|
import PageMeta from '@/components/PageMeta';
|
||||||
import { ReservedPlanId } from '@/consts/subscriptions';
|
|
||||||
import { TenantsContext } from '@/contexts/TenantsProvider';
|
|
||||||
import FormField from '@/ds-components/FormField';
|
import FormField from '@/ds-components/FormField';
|
||||||
import useCustomDomain from '@/hooks/use-custom-domain';
|
import useCustomDomain from '@/hooks/use-custom-domain';
|
||||||
import useDocumentationUrl from '@/hooks/use-documentation-url';
|
import useDocumentationUrl from '@/hooks/use-documentation-url';
|
||||||
import useSubscriptionPlan from '@/hooks/use-subscription-plan';
|
|
||||||
|
|
||||||
import Skeleton from '../components/Skeleton';
|
import Skeleton from '../components/Skeleton';
|
||||||
|
|
||||||
|
@ -20,31 +14,18 @@ import DefaultDomain from './DefaultDomain';
|
||||||
import * as styles from './index.module.scss';
|
import * as styles from './index.module.scss';
|
||||||
|
|
||||||
function TenantDomainSettings() {
|
function TenantDomainSettings() {
|
||||||
const { currentTenantId } = useContext(TenantsContext);
|
|
||||||
const { data: customDomain, isLoading: isLoadingCustomDomain, mutate } = useCustomDomain(true);
|
const { data: customDomain, isLoading: isLoadingCustomDomain, mutate } = useCustomDomain(true);
|
||||||
const { data: currentPlan, error: fetchCurrentPlanError } = useSubscriptionPlan(currentTenantId);
|
|
||||||
const isLoadingCurrentPlan = !currentPlan && !fetchCurrentPlanError;
|
|
||||||
const { getDocumentationUrl } = useDocumentationUrl();
|
const { getDocumentationUrl } = useDocumentationUrl();
|
||||||
|
|
||||||
if (isLoadingCustomDomain || isLoadingCurrentPlan) {
|
if (isLoadingCustomDomain) {
|
||||||
return <Skeleton />;
|
return <Skeleton />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const customDomainEnabled =
|
|
||||||
Boolean(currentPlan?.quota.customDomainEnabled) ||
|
|
||||||
/**
|
|
||||||
* Note: this is for tenants which already have a custom domain before we have subscription features.
|
|
||||||
*/
|
|
||||||
Boolean(customDomain);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<PageMeta titleKey={['tenants.tabs.domains', 'tenants.title']} />
|
<PageMeta titleKey={['tenants.tabs.domains', 'tenants.title']} />
|
||||||
<FormCard
|
<FormCard
|
||||||
title="domain.custom.custom_domain"
|
title="domain.custom.custom_domain"
|
||||||
tag={
|
|
||||||
<FeatureTag isVisible={!customDomainEnabled} for="upsell" plan={ReservedPlanId.hobby} />
|
|
||||||
}
|
|
||||||
description="domain.custom.custom_domain_description"
|
description="domain.custom.custom_domain_description"
|
||||||
learnMoreLink={getDocumentationUrl('docs/recipes/custom-domain')}
|
learnMoreLink={getDocumentationUrl('docs/recipes/custom-domain')}
|
||||||
>
|
>
|
||||||
|
@ -52,13 +33,7 @@ function TenantDomainSettings() {
|
||||||
{customDomain ? (
|
{customDomain ? (
|
||||||
<CustomDomain customDomain={customDomain} onDeleteCustomDomain={mutate} />
|
<CustomDomain customDomain={customDomain} onDeleteCustomDomain={mutate} />
|
||||||
) : (
|
) : (
|
||||||
<AddDomainForm
|
<AddDomainForm onCustomDomainAdded={mutate} />
|
||||||
isCustomDomainEnabled={customDomainEnabled}
|
|
||||||
onCustomDomainAdded={mutate}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{!customDomain && !customDomainEnabled && (
|
|
||||||
<InlineUpsell for="custom_domain" className={styles.upsellNotification} />
|
|
||||||
)}
|
)}
|
||||||
</FormField>
|
</FormField>
|
||||||
</FormCard>
|
</FormCard>
|
||||||
|
|
Loading…
Add table
Reference in a new issue