0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

feat(console): change free tenant number limit to 10 (#4130)

This commit is contained in:
Darcy Ye 2023-07-13 17:09:05 +08:00 committed by GitHub
parent a030b0817f
commit c5b0f9bdc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 5 deletions

View file

@ -42,5 +42,3 @@ export const getCallbackUrl = (tenantId?: string) =>
); );
export const getSignOutRedirectPathname = () => (isCloud ? '/' : ossConsolePath); export const getSignOutRedirectPathname = () => (isCloud ? '/' : ossConsolePath);
export const maxFreeTenantNumbers = 3;

View file

@ -1,4 +1,4 @@
import { adminTenantId } from '@logto/schemas'; import { adminTenantId, maxFreeTenantLimit } from '@logto/schemas';
import { type TenantInfo } from '@logto/schemas/models'; import { type TenantInfo } from '@logto/schemas/models';
import classNames from 'classnames'; import classNames from 'classnames';
import { useContext, useMemo, useRef, useState } from 'react'; import { useContext, useMemo, useRef, useState } from 'react';
@ -8,7 +8,6 @@ import KeyboardArrowDown from '@/assets/icons/keyboard-arrow-down.svg';
import PlusSign from '@/assets/icons/plus.svg'; import PlusSign from '@/assets/icons/plus.svg';
import Tick from '@/assets/icons/tick.svg'; import Tick from '@/assets/icons/tick.svg';
import CreateTenantModal from '@/cloud/pages/Main/TenantLandingPage/TenantLandingPageContent/CreateTenantModal'; import CreateTenantModal from '@/cloud/pages/Main/TenantLandingPage/TenantLandingPageContent/CreateTenantModal';
import { maxFreeTenantNumbers } from '@/consts';
import { TenantsContext } from '@/contexts/TenantsProvider'; import { TenantsContext } from '@/contexts/TenantsProvider';
import Divider from '@/ds-components/Divider'; import Divider from '@/ds-components/Divider';
import Dropdown, { DropdownItem } from '@/ds-components/Dropdown'; import Dropdown, { DropdownItem } from '@/ds-components/Dropdown';
@ -31,7 +30,7 @@ export default function TenantSelector() {
const isCreateButtonDisabled = useMemo( const isCreateButtonDisabled = useMemo(
() => () =>
/** Should not block admin tenant owners from creating more than three tenants */ /** Should not block admin tenant owners from creating more than three tenants */
!tenants.some(({ id }) => id === adminTenantId) && tenants.length >= maxFreeTenantNumbers, !tenants.some(({ id }) => id === adminTenantId) && tenants.length >= maxFreeTenantLimit,
[tenants] [tenants]
); );
const anchorRef = useRef<HTMLDivElement>(null); const anchorRef = useRef<HTMLDivElement>(null);

View file

@ -2,3 +2,4 @@ export * from './cookie.js';
export * from './system.js'; export * from './system.js';
export * from './oidc.js'; export * from './oidc.js';
export * from './date.js'; export * from './date.js';
export * from './tenant.js';

View file

@ -0,0 +1 @@
export const maxFreeTenantLimit = 10;