review(front): refacto url-manager (#8861)
Replace https://github.com/twentyhq/twenty/pull/8855
This commit is contained in:
@ -1,9 +1,12 @@
|
||||
import { GithubVersionLink, H2Title, Section, IconWorld } from 'twenty-ui';
|
||||
import { Link } from 'react-router-dom';
|
||||
import {
|
||||
GithubVersionLink,
|
||||
H2Title,
|
||||
Section,
|
||||
IconWorld,
|
||||
UndecoratedLink,
|
||||
} from 'twenty-ui';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
|
||||
import { DeleteWorkspace } from '@/settings/profile/components/DeleteWorkspace';
|
||||
import { getSettingsPagePath } from '@/settings/utils/getSettingsPagePath';
|
||||
@ -16,10 +19,6 @@ import packageJson from '../../../package.json';
|
||||
import { SettingsCard } from '@/settings/components/SettingsCard';
|
||||
import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState';
|
||||
|
||||
const StyledLink = styled(Link)`
|
||||
text-decoration: none;
|
||||
`;
|
||||
|
||||
export const SettingsWorkspace = () => {
|
||||
const isMultiWorkspaceEnabled = useRecoilValue(isMultiWorkspaceEnabledState);
|
||||
return (
|
||||
@ -48,9 +47,9 @@ export const SettingsWorkspace = () => {
|
||||
title="Domain"
|
||||
description="Edit your subdomain name or set a custom domain."
|
||||
/>
|
||||
<StyledLink to={getSettingsPagePath(SettingsPath.Domain)}>
|
||||
<UndecoratedLink to={getSettingsPagePath(SettingsPath.Domain)}>
|
||||
<SettingsCard title="Customize Domain" Icon={<IconWorld />} />
|
||||
</StyledLink>
|
||||
</UndecoratedLink>
|
||||
</Section>
|
||||
)}
|
||||
|
||||
|
||||
@ -15,9 +15,9 @@ import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/Snac
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import { useUpdateWorkspaceMutation } from '~/generated/graphql';
|
||||
import { useUrlManager } from '@/url-manager/hooks/useUrlManager';
|
||||
import { urlManagerState } from '@/url-manager/states/url-manager.state';
|
||||
import { domainConfigurationState } from '@/domain-manager/states/domainConfigurationState';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { useBuildWorkspaceUrl } from '@/domain-manager/hooks/useBuildWorkspaceUrl';
|
||||
|
||||
const validationSchema = z
|
||||
.object({
|
||||
@ -39,17 +39,17 @@ const StyledDomain = styled.h2`
|
||||
color: ${({ theme }) => theme.font.color.secondary};
|
||||
font-size: ${({ theme }) => theme.font.size.md};
|
||||
font-weight: ${({ theme }) => theme.font.weight.medium};
|
||||
margin-left: 8px;
|
||||
margin-left: ${({ theme }) => theme.spacing(2)};
|
||||
`;
|
||||
|
||||
export const SettingsDomain = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const urlManager = useRecoilValue(urlManagerState);
|
||||
const domainConfiguration = useRecoilValue(domainConfigurationState);
|
||||
|
||||
const { enqueueSnackBar } = useSnackBar();
|
||||
const [updateWorkspace] = useUpdateWorkspaceMutation();
|
||||
const { buildWorkspaceUrl } = useUrlManager();
|
||||
const { buildWorkspaceUrl } = useBuildWorkspaceUrl();
|
||||
|
||||
const [currentWorkspace, setCurrentWorkspace] = useRecoilState(
|
||||
currentWorkspaceState,
|
||||
@ -142,8 +142,8 @@ export const SettingsDomain = () => {
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{isDefined(urlManager) && isDefined(urlManager.frontDomain) && (
|
||||
<StyledDomain>.{urlManager.frontDomain}</StyledDomain>
|
||||
{isDefined(domainConfiguration.frontDomain) && (
|
||||
<StyledDomain>.{domainConfiguration.frontDomain}</StyledDomain>
|
||||
)}
|
||||
</StyledDomainFromWrapper>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user