Guillim
2024-12-10 14:23:00 +01:00
committed by GitHub
parent 0a8960c2ed
commit afd3252cbe
9 changed files with 57 additions and 47 deletions

View File

@ -0,0 +1,13 @@
import styled from '@emotion/styled';
const StyledHr = styled.hr`
border: none;
border-top: 1px solid ${({ theme }) => theme.border.color.light};
margin: 0px;
margin-left: ${({ theme }) => theme.spacing(4)};
margin-right: ${({ theme }) => theme.spacing(4)};
`;
export const Separator = () => {
return <StyledHr />;
};

View File

@ -1,17 +1,15 @@
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { CardContent } from 'twenty-ui';
type StyledCardContentProps = { type StyledCardContentProps = {
disabled?: boolean; disabled?: boolean;
divider?: boolean;
}; };
export const StyledSettingsOptionCardContent = styled( export const StyledSettingsOptionCardContent = styled.div<StyledCardContentProps>`
CardContent,
)<StyledCardContentProps>`
align-items: center; align-items: center;
display: flex; display: flex;
gap: ${({ theme }) => theme.spacing(3)}; gap: ${({ theme }) => theme.spacing(3)};
background-color: ${({ theme }) => theme.background.secondary};
padding: ${({ theme }) => theme.spacing(4)};
`; `;
export const StyledSettingsOptionCardIcon = styled.div` export const StyledSettingsOptionCardIcon = styled.div`
align-items: center; align-items: center;

View File

@ -12,7 +12,6 @@ type SettingsOptionCardContentCounterProps = {
Icon?: IconComponent; Icon?: IconComponent;
title: React.ReactNode; title: React.ReactNode;
description?: string; description?: string;
divider?: boolean;
disabled?: boolean; disabled?: boolean;
value: number; value: number;
onChange: (value: number) => void; onChange: (value: number) => void;
@ -24,7 +23,6 @@ export const SettingsOptionCardContentCounter = ({
Icon, Icon,
title, title,
description, description,
divider,
disabled = false, disabled = false,
value, value,
onChange, onChange,
@ -32,7 +30,7 @@ export const SettingsOptionCardContentCounter = ({
maxValue, maxValue,
}: SettingsOptionCardContentCounterProps) => { }: SettingsOptionCardContentCounterProps) => {
return ( return (
<StyledSettingsOptionCardContent divider={divider} disabled={disabled}> <StyledSettingsOptionCardContent disabled={disabled}>
{Icon && ( {Icon && (
<StyledSettingsOptionCardIcon> <StyledSettingsOptionCardIcon>
<SettingsOptionIconCustomizer Icon={Icon} /> <SettingsOptionIconCustomizer Icon={Icon} />

View File

@ -12,9 +12,7 @@ type SettingsOptionCardContentSelectProps = {
Icon?: IconComponent; Icon?: IconComponent;
title: React.ReactNode; title: React.ReactNode;
description?: string; description?: string;
divider?: boolean;
disabled?: boolean; disabled?: boolean;
selectClassName?: string;
children?: React.ReactNode; children?: React.ReactNode;
}; };
@ -26,12 +24,11 @@ export const SettingsOptionCardContentSelect = ({
Icon, Icon,
title, title,
description, description,
divider,
disabled = false, disabled = false,
children, children,
}: SettingsOptionCardContentSelectProps) => { }: SettingsOptionCardContentSelectProps) => {
return ( return (
<StyledSettingsOptionCardContent divider={divider} disabled={disabled}> <StyledSettingsOptionCardContent disabled={disabled}>
{Icon && ( {Icon && (
<StyledSettingsOptionCardIcon> <StyledSettingsOptionCardIcon>
<SettingsOptionIconCustomizer Icon={Icon} /> <SettingsOptionIconCustomizer Icon={Icon} />

View File

@ -1,3 +1,4 @@
import { Separator } from '@/settings/components/Separator';
import { import {
StyledSettingsOptionCardContent, StyledSettingsOptionCardContent,
StyledSettingsOptionCardDescription, StyledSettingsOptionCardDescription,
@ -57,34 +58,34 @@ export const SettingsOptionCardContentToggle = ({
const toggleId = useId(); const toggleId = useId();
return ( return (
<StyledSettingsOptionCardToggleContent <>
divider={divider} <StyledSettingsOptionCardToggleContent disabled={disabled}>
disabled={disabled} {Icon && (
> <StyledSettingsOptionCardIcon>
{Icon && ( <SettingsOptionIconCustomizer Icon={Icon} />
<StyledSettingsOptionCardIcon> </StyledSettingsOptionCardIcon>
<SettingsOptionIconCustomizer Icon={Icon} /> )}
</StyledSettingsOptionCardIcon> <div>
)} <StyledSettingsOptionCardTitle>
<div> <label htmlFor={toggleId}>
<StyledSettingsOptionCardTitle> {title}
<label htmlFor={toggleId}> <StyledSettingsOptionCardToggleCover />
{title} </label>
<StyledSettingsOptionCardToggleCover /> </StyledSettingsOptionCardTitle>
</label> <StyledSettingsOptionCardDescription>
</StyledSettingsOptionCardTitle> {description}
<StyledSettingsOptionCardDescription> </StyledSettingsOptionCardDescription>
{description} </div>
</StyledSettingsOptionCardDescription> <StyledSettingsOptionCardToggleButton
</div> id={toggleId}
<StyledSettingsOptionCardToggleButton value={checked}
id={toggleId} onChange={onChange}
value={checked} disabled={disabled}
onChange={onChange} toggleSize="small"
disabled={disabled} color={advancedMode ? theme.color.yellow : theme.color.blue}
toggleSize="small" />
color={advancedMode ? theme.color.yellow : theme.color.blue} </StyledSettingsOptionCardToggleContent>
/> {divider && <Separator />}
</StyledSettingsOptionCardToggleContent> </>
); );
}; };

View File

@ -21,7 +21,6 @@ const SettingsOptionCardContentCounterWrapper = (
Icon={args.Icon} Icon={args.Icon}
title={args.title} title={args.title}
description={args.description} description={args.description}
divider={args.divider}
disabled={args.disabled} disabled={args.disabled}
minValue={args.minValue} minValue={args.minValue}
maxValue={args.maxValue} maxValue={args.maxValue}

View File

@ -3,6 +3,7 @@ import { z } from 'zod';
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { numberFieldDefaultValueSchema } from '@/object-record/record-field/validation-schemas/numberFieldDefaultValueSchema'; import { numberFieldDefaultValueSchema } from '@/object-record/record-field/validation-schemas/numberFieldDefaultValueSchema';
import { Separator } from '@/settings/components/Separator';
import { SettingsOptionCardContentCounter } from '@/settings/components/SettingsOptions/SettingsOptionCardContentCounter'; import { SettingsOptionCardContentCounter } from '@/settings/components/SettingsOptions/SettingsOptionCardContentCounter';
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect'; import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
import { Select } from '@/ui/input/components/Select'; import { Select } from '@/ui/input/components/Select';
@ -72,6 +73,7 @@ export const SettingsDataModelFieldNumberForm = ({
]} ]}
/> />
</SettingsOptionCardContentSelect> </SettingsOptionCardContentSelect>
<Separator />
<SettingsOptionCardContentCounter <SettingsOptionCardContentCounter
Icon={IconDecimal} Icon={IconDecimal}
title="Number of decimals" title="Number of decimals"

View File

@ -1,20 +1,20 @@
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle'; import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
import { SSOIdentitiesProvidersState } from '@/settings/security/states/SSOIdentitiesProvidersState';
import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar'; import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { useRecoilState, useRecoilValue } from 'recoil'; import { useRecoilState, useRecoilValue } from 'recoil';
import { import {
IconLink,
Card, Card,
IconGoogle, IconGoogle,
IconLink,
IconMicrosoft, IconMicrosoft,
IconPassword, IconPassword,
} from 'twenty-ui'; } from 'twenty-ui';
import { useUpdateWorkspaceMutation } from '~/generated/graphql';
import { AuthProviders } from '~/generated-metadata/graphql'; import { AuthProviders } from '~/generated-metadata/graphql';
import { useUpdateWorkspaceMutation } from '~/generated/graphql';
import { capitalize } from '~/utils/string/capitalize'; import { capitalize } from '~/utils/string/capitalize';
import { SSOIdentitiesProvidersState } from '@/settings/security/states/SSOIdentitiesProvidersState';
const StyledSettingsSecurityOptionsList = styled.div` const StyledSettingsSecurityOptionsList = styled.div`
display: flex; display: flex;
@ -122,13 +122,14 @@ export const SettingsSecurityOptionsList = () => {
<StyledSettingsSecurityOptionsList> <StyledSettingsSecurityOptionsList>
{currentWorkspace && ( {currentWorkspace && (
<> <>
<Card> <Card rounded>
<SettingsOptionCardContentToggle <SettingsOptionCardContentToggle
Icon={IconGoogle} Icon={IconGoogle}
title="Google" title="Google"
description="Allow logins through Google's single sign-on functionality." description="Allow logins through Google's single sign-on functionality."
checked={currentWorkspace.isGoogleAuthEnabled} checked={currentWorkspace.isGoogleAuthEnabled}
advancedMode advancedMode
divider
onChange={() => toggleAuthMethod('google')} onChange={() => toggleAuthMethod('google')}
/> />
<SettingsOptionCardContentToggle <SettingsOptionCardContentToggle
@ -137,6 +138,7 @@ export const SettingsSecurityOptionsList = () => {
description="Allow logins through Microsoft's single sign-on functionality." description="Allow logins through Microsoft's single sign-on functionality."
checked={currentWorkspace.isMicrosoftAuthEnabled} checked={currentWorkspace.isMicrosoftAuthEnabled}
advancedMode advancedMode
divider
onChange={() => toggleAuthMethod('microsoft')} onChange={() => toggleAuthMethod('microsoft')}
/> />
<SettingsOptionCardContentToggle <SettingsOptionCardContentToggle

View File

@ -162,7 +162,7 @@ export const SettingsWorkspaceMembers = () => {
)} )}
<Section> <Section>
<H2Title <H2Title
title="Members" title="Manage Members"
description="Manage the members of your space here" description="Manage the members of your space here"
/> />
<Table> <Table>