mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -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 = {
|
||||
isCustomDomainEnabled: boolean;
|
||||
onCustomDomainAdded: (domain: Domain) => void;
|
||||
};
|
||||
|
||||
function AddDomainForm({ isCustomDomainEnabled, onCustomDomainAdded }: Props) {
|
||||
function AddDomainForm({ onCustomDomainAdded }: Props) {
|
||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
const {
|
||||
register,
|
||||
|
@ -48,7 +47,6 @@ function AddDomainForm({ isCustomDomainEnabled, onCustomDomainAdded }: Props) {
|
|||
return (
|
||||
<div className={styles.addDomain}>
|
||||
<TextInput
|
||||
readOnly={!isCustomDomainEnabled}
|
||||
className={styles.textInput}
|
||||
placeholder={t('domain.custom.custom_domain_placeholder')}
|
||||
error={errors.domain?.message}
|
||||
|
@ -66,7 +64,7 @@ function AddDomainForm({ isCustomDomainEnabled, onCustomDomainAdded }: Props) {
|
|||
type="primary"
|
||||
title="domain.custom.add_domain"
|
||||
isLoading={isSubmitting}
|
||||
disabled={domainInput.length === 0 || !isCustomDomainEnabled}
|
||||
disabled={domainInput.length === 0}
|
||||
onClick={onSubmit}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
import { withAppInsights } from '@logto/app-insights/react';
|
||||
import { useContext } from 'react';
|
||||
|
||||
import FeatureTag from '@/components/FeatureTag';
|
||||
import FormCard from '@/components/FormCard';
|
||||
import InlineUpsell from '@/components/InlineUpsell';
|
||||
import PageMeta from '@/components/PageMeta';
|
||||
import { ReservedPlanId } from '@/consts/subscriptions';
|
||||
import { TenantsContext } from '@/contexts/TenantsProvider';
|
||||
import FormField from '@/ds-components/FormField';
|
||||
import useCustomDomain from '@/hooks/use-custom-domain';
|
||||
import useDocumentationUrl from '@/hooks/use-documentation-url';
|
||||
import useSubscriptionPlan from '@/hooks/use-subscription-plan';
|
||||
|
||||
import Skeleton from '../components/Skeleton';
|
||||
|
||||
|
@ -20,31 +14,18 @@ import DefaultDomain from './DefaultDomain';
|
|||
import * as styles from './index.module.scss';
|
||||
|
||||
function TenantDomainSettings() {
|
||||
const { currentTenantId } = useContext(TenantsContext);
|
||||
const { data: customDomain, isLoading: isLoadingCustomDomain, mutate } = useCustomDomain(true);
|
||||
const { data: currentPlan, error: fetchCurrentPlanError } = useSubscriptionPlan(currentTenantId);
|
||||
const isLoadingCurrentPlan = !currentPlan && !fetchCurrentPlanError;
|
||||
const { getDocumentationUrl } = useDocumentationUrl();
|
||||
|
||||
if (isLoadingCustomDomain || isLoadingCurrentPlan) {
|
||||
if (isLoadingCustomDomain) {
|
||||
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 (
|
||||
<div className={styles.container}>
|
||||
<PageMeta titleKey={['tenants.tabs.domains', 'tenants.title']} />
|
||||
<FormCard
|
||||
title="domain.custom.custom_domain"
|
||||
tag={
|
||||
<FeatureTag isVisible={!customDomainEnabled} for="upsell" plan={ReservedPlanId.hobby} />
|
||||
}
|
||||
description="domain.custom.custom_domain_description"
|
||||
learnMoreLink={getDocumentationUrl('docs/recipes/custom-domain')}
|
||||
>
|
||||
|
@ -52,13 +33,7 @@ function TenantDomainSettings() {
|
|||
{customDomain ? (
|
||||
<CustomDomain customDomain={customDomain} onDeleteCustomDomain={mutate} />
|
||||
) : (
|
||||
<AddDomainForm
|
||||
isCustomDomainEnabled={customDomainEnabled}
|
||||
onCustomDomainAdded={mutate}
|
||||
/>
|
||||
)}
|
||||
{!customDomain && !customDomainEnabled && (
|
||||
<InlineUpsell for="custom_domain" className={styles.upsellNotification} />
|
||||
<AddDomainForm onCustomDomainAdded={mutate} />
|
||||
)}
|
||||
</FormField>
|
||||
</FormCard>
|
||||
|
|
Loading…
Reference in a new issue