14240 extensibility ability to create multiple custom domains for each workspace 2 (#14307)
Adds a public-domain core-module. Reorganize custom-domain files properly
This commit is contained in:
+5
-5
@@ -7,8 +7,8 @@ import styled from '@emotion/styled';
|
||||
import { Button } from 'twenty-ui/input';
|
||||
import { useDebouncedCallback } from 'use-debounce';
|
||||
import {
|
||||
type CustomDomainRecord,
|
||||
type CustomDomainValidRecords,
|
||||
type DomainRecord,
|
||||
type DomainValidRecords,
|
||||
} from '~/generated/graphql';
|
||||
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
|
||||
import { capitalize } from 'twenty-shared/utils';
|
||||
@@ -49,7 +49,7 @@ const StyledButton = styled(Button)`
|
||||
export const SettingsCustomDomainRecords = ({
|
||||
records,
|
||||
}: {
|
||||
records: CustomDomainValidRecords['records'];
|
||||
records: DomainValidRecords['records'];
|
||||
}) => {
|
||||
const { customDomainRecords } = useRecoilValue(customDomainRecordsState);
|
||||
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||
@@ -67,7 +67,7 @@ export const SettingsCustomDomainRecords = ({
|
||||
];
|
||||
|
||||
const defaultValues: { status: string; color: ThemeColor } =
|
||||
currentWorkspace?.customDomain === customDomainRecords?.customDomain
|
||||
currentWorkspace?.customDomain === customDomainRecords?.domain
|
||||
? {
|
||||
status: 'success',
|
||||
color: 'green',
|
||||
@@ -78,7 +78,7 @@ export const SettingsCustomDomainRecords = ({
|
||||
};
|
||||
|
||||
const rows = rowsDefinitions.map<
|
||||
{ name: string; status: string; color: ThemeColor } & CustomDomainRecord
|
||||
{ name: string; status: string; color: ThemeColor } & DomainRecord
|
||||
>((row) => {
|
||||
const record = records.find(
|
||||
({ validationType }) => validationType === row.validationType,
|
||||
|
||||
+7
-2
@@ -1,5 +1,5 @@
|
||||
import { useCheckCustomDomainValidRecordsMutation } from '~/generated-metadata/graphql';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import { customDomainRecordsState } from '@/settings/domains/states/customDomainRecordsState';
|
||||
@@ -9,9 +9,14 @@ export const useCheckCustomDomainValidRecords = () => {
|
||||
useCheckCustomDomainValidRecordsMutation();
|
||||
const { enqueueErrorSnackBar } = useSnackBar();
|
||||
|
||||
const setCustomDomainRecords = useSetRecoilState(customDomainRecordsState);
|
||||
const [{ isLoading }, setCustomDomainRecords] = useRecoilState(
|
||||
customDomainRecordsState,
|
||||
);
|
||||
|
||||
const checkCustomDomainRecords = () => {
|
||||
if (isLoading) {
|
||||
return;
|
||||
}
|
||||
setCustomDomainRecords((currentState) => ({
|
||||
...currentState,
|
||||
isLoading: true,
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { type CustomDomainValidRecords } from '~/generated/graphql';
|
||||
import { type DomainValidRecords } from '~/generated/graphql';
|
||||
import { createState } from 'twenty-ui/utilities';
|
||||
|
||||
export const customDomainRecordsState = createState<{
|
||||
customDomainRecords: CustomDomainValidRecords | null;
|
||||
customDomainRecords: DomainValidRecords | null;
|
||||
isLoading: boolean;
|
||||
}>({
|
||||
key: 'customDomainRecordsState',
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ export const CHECK_CUSTOM_DOMAIN_VALID_RECORDS = gql`
|
||||
mutation CheckCustomDomainValidRecords {
|
||||
checkCustomDomainValidRecords {
|
||||
id
|
||||
customDomain
|
||||
domain
|
||||
records {
|
||||
type
|
||||
key
|
||||
|
||||
Reference in New Issue
Block a user