feat(settings): review custom domain (#10393)

Introduce improved validation logic for custom domains, including regex
validation with descriptive error messages. Implement asynchronous
domain update functionality with a loading indicator and polling to
check record statuses. Refactor components to streamline functionality
and align with updated state management.

Fix https://github.com/twentyhq/core-team-issues/issues/453
This commit is contained in:
Antoine Moreaux
2025-02-24 11:31:45 +01:00
committed by GitHub
parent c5c6192434
commit 92462b3ae5
12 changed files with 232 additions and 139 deletions

View File

@ -1,6 +1,12 @@
import { useLingui } from '@lingui/react/macro';
import { useRecoilValue } from 'recoil';
import { H2Title, IconWorld, Section, UndecoratedLink } from 'twenty-ui';
import {
H2Title,
IconWorld,
Section,
UndecoratedLink,
Status,
} from 'twenty-ui';
import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState';
import { SettingsCard } from '@/settings/components/SettingsCard';
@ -12,11 +18,12 @@ import { WorkspaceLogoUploader } from '@/settings/workspace/components/Workspace
import { SettingsPath } from '@/types/SettingsPath';
import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer';
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
export const SettingsWorkspace = () => {
const isMultiWorkspaceEnabled = useRecoilValue(isMultiWorkspaceEnabledState);
const { t } = useLingui();
const currentWorkspace = useRecoilValue(currentWorkspaceState);
return (
<SubMenuTopBarContainer
title={t`General`}
@ -48,6 +55,11 @@ export const SettingsWorkspace = () => {
<SettingsCard
title={t`Customize Domain`}
Icon={<IconWorld />}
Status={
currentWorkspace?.customDomain ? (
<Status text={'Active'} color={'turquoise'} />
) : undefined
}
/>
</UndecoratedLink>
</Section>