Skip to content

The open alternative to Salesforce, designed for AI.

Improve security settings card grouping and description overflow (#17928)

Thomas des Francs612f7c37a5d0
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsCardContentBase.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsCardContentBase.tsx
index 68938b8183a..87014ec321e 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsCardContentBase.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsCardContentBase.tsx
@@ -32,6 +32,11 @@ export const StyledSettingsCardTitle = styled.div`
margin-bottom: ${({ theme }) => theme.spacing(1)};
`;
+export const StyledSettingsCardTextContainer = styled.div`
+ flex: 1;
+ min-width: 0;
+`;
+
export const StyledSettingsCardDescription = styled.div`
color: ${({ theme }) => theme.font.color.secondary};
font-size: ${({ theme }) => theme.font.size.sm};
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentButton.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentButton.tsx
index 2fd576d013e..a34e5478756 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentButton.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentButton.tsx
@@ -2,21 +2,26 @@ import {
StyledSettingsCardContent,
StyledSettingsCardDescription,
StyledSettingsCardIcon,
+ StyledSettingsCardTextContainer,
StyledSettingsCardTitle,
} from '@/settings/components/SettingsOptions/SettingsCardContentBase';
import { SettingsOptionIconCustomizer } from '@/settings/components/SettingsOptions/SettingsOptionIconCustomizer';
import styled from '@emotion/styled';
-import { type IconComponent } from 'twenty-ui/display';
+import {
+ type IconComponent,
+ OverflowingTextWithTooltip,
+} from 'twenty-ui/display';
type SettingsOptionCardContentButtonProps = {
Icon?: IconComponent;
title: React.ReactNode;
- description?: string | React.ReactNode;
+ description?: string;
disabled?: boolean;
Button?: React.ReactNode;
};
const StyledButtonContainer = styled.div`
+ flex-shrink: 0;
margin-left: auto;
`;
@@ -34,12 +39,14 @@ export const SettingsOptionCardContentButton = ({
<SettingsOptionIconCustomizer Icon={Icon} />
</StyledSettingsCardIcon>
)}
- <div>
+ <StyledSettingsCardTextContainer>
<StyledSettingsCardTitle>{title}</StyledSettingsCardTitle>
- <StyledSettingsCardDescription>
- {description}
- </StyledSettingsCardDescription>
- </div>
+ {description && (
+ <StyledSettingsCardDescription>
+ <OverflowingTextWithTooltip text={description} />
+ </StyledSettingsCardDescription>
+ )}
+ </StyledSettingsCardTextContainer>
{Button && <StyledButtonContainer>{Button}</StyledButtonContainer>}
</StyledSettingsCardContent>
);
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentCounter.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentCounter.tsx
index b84d01e2c6b..22bd767d71d 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentCounter.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentCounter.tsx
@@ -3,10 +3,14 @@ import {
StyledSettingsCardContent,
StyledSettingsCardDescription,
StyledSettingsCardIcon,
+ StyledSettingsCardTextContainer,
StyledSettingsCardTitle,
} from '@/settings/components/SettingsOptions/SettingsCardContentBase';
import { SettingsOptionIconCustomizer } from '@/settings/components/SettingsOptions/SettingsOptionIconCustomizer';
-import { type IconComponent } from 'twenty-ui/display';
+import {
+ type IconComponent,
+ OverflowingTextWithTooltip,
+} from 'twenty-ui/display';
type SettingsOptionCardContentCounterProps = {
Icon?: IconComponent;
@@ -38,14 +42,14 @@ export const SettingsOptionCardContentCounter = ({
<SettingsOptionIconCustomizer Icon={Icon} />
</StyledSettingsCardIcon>
)}
- <div>
+ <StyledSettingsCardTextContainer>
<StyledSettingsCardTitle>{title}</StyledSettingsCardTitle>
{description && (
<StyledSettingsCardDescription>
- {description}
+ <OverflowingTextWithTooltip text={description} />
</StyledSettingsCardDescription>
)}
- </div>
+ </StyledSettingsCardTextContainer>
<SettingsCounter
value={value}
onChange={onChange}
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSelect.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSelect.tsx
index d5402a16593..254ce0b78dd 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSelect.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSelect.tsx
@@ -2,21 +2,26 @@ import {
StyledSettingsCardContent,
StyledSettingsCardDescription,
StyledSettingsCardIcon,
+ StyledSettingsCardTextContainer,
StyledSettingsCardTitle,
} from '@/settings/components/SettingsOptions/SettingsCardContentBase';
import { SettingsOptionIconCustomizer } from '@/settings/components/SettingsOptions/SettingsOptionIconCustomizer';
import styled from '@emotion/styled';
-import { type IconComponent } from 'twenty-ui/display';
+import {
+ type IconComponent,
+ OverflowingTextWithTooltip,
+} from 'twenty-ui/display';
type SettingsOptionCardContentSelectProps = {
Icon?: IconComponent;
title: React.ReactNode;
- description?: string | React.ReactNode;
+ description?: string;
disabled?: boolean;
children?: React.ReactNode;
};
const StyledSelectContainer = styled.div`
+ flex-shrink: 0;
justify-content: flex-end;
margin-left: auto;
max-width: 120px;
@@ -36,12 +41,14 @@ export const SettingsOptionCardContentSelect = ({
<SettingsOptionIconCustomizer Icon={Icon} />
</StyledSettingsCardIcon>
)}
- <div>
+ <StyledSettingsCardTextContainer>
<StyledSettingsCardTitle>{title}</StyledSettingsCardTitle>
- <StyledSettingsCardDescription>
- {description}
- </StyledSettingsCardDescription>
- </div>
+ {description && (
+ <StyledSettingsCardDescription>
+ <OverflowingTextWithTooltip text={description} />
+ </StyledSettingsCardDescription>
+ )}
+ </StyledSettingsCardTextContainer>
<StyledSelectContainer>{children}</StyledSelectContainer>
</StyledSettingsCardContent>
);
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx
index dc2dfd99889..fbdee0cd6bb 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx
@@ -3,13 +3,17 @@ import {
StyledSettingsCardContent,
StyledSettingsCardDescription,
StyledSettingsCardIcon,
+ StyledSettingsCardTextContainer,
StyledSettingsCardTitle,
} from '@/settings/components/SettingsOptions/SettingsCardContentBase';
import { SettingsOptionIconCustomizer } from '@/settings/components/SettingsOptions/SettingsOptionIconCustomizer';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { useId } from 'react';
-import { type IconComponent } from 'twenty-ui/display';
+import {
+ type IconComponent,
+ OverflowingTextWithTooltip,
+} from 'twenty-ui/display';
import { Toggle } from 'twenty-ui/input';
const StyledSettingsCardToggleContent = styled(StyledSettingsCardContent)`
@@ -27,6 +31,7 @@ const StyledSettingsCardToggleButton = styled(Toggle)<{
}>`
align-self: ${({ toggleCentered }) =>
toggleCentered ? 'center' : 'flex-start'};
+ flex-shrink: 0;
margin-left: auto;
`;
@@ -39,7 +44,7 @@ const StyledSettingsCardToggleCover = styled.span`
type SettingsOptionCardContentToggleProps = {
Icon?: IconComponent;
title: React.ReactNode;
- description?: React.ReactNode;
+ description?: string;
divider?: boolean;
disabled?: boolean;
advancedMode?: boolean;
@@ -70,17 +75,19 @@ export const SettingsOptionCardContentToggle = ({
<SettingsOptionIconCustomizer Icon={Icon} />
</StyledSettingsCardIcon>
)}
- <div>
+ <StyledSettingsCardTextContainer>
<StyledSettingsCardTitle>
<label htmlFor={toggleId}>
{title}
<StyledSettingsCardToggleCover />
</label>
</StyledSettingsCardTitle>
- <StyledSettingsCardDescription>
- {description}
- </StyledSettingsCardDescription>
- </div>
+ {description && (
+ <StyledSettingsCardDescription>
+ <OverflowingTextWithTooltip text={description} />
+ </StyledSettingsCardDescription>
+ )}
+ </StyledSettingsCardTextContainer>
<StyledSettingsCardToggleButton
id={toggleId}
value={checked}
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/components/SettingsDataModelFieldDateForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/components/SettingsDataModelFieldDateForm.tsx
index d0abb4179b0..6e7a34d719e 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/components/SettingsDataModelFieldDateForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/components/SettingsDataModelFieldDateForm.tsx
@@ -8,7 +8,6 @@ import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsO
import { ADVANCED_SETTINGS_ANIMATION_DURATION } from '@/settings/constants/AdvancedSettingsAnimationDurations';
import { useDateSettingsFormInitialValues } from '@/settings/data-model/fields/forms/date/hooks/useDateSettingsFormInitialValues';
import { getDisplayFormatLabel } from '@/settings/data-model/fields/forms/date/utils/getDisplayFormatLabel';
-import { getDisplayFormatSelectDescription } from '@/settings/data-model/fields/forms/date/utils/getDisplayFormatSelectDescription';
import { Select } from '@/ui/input/components/Select';
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
import styled from '@emotion/styled';
@@ -71,7 +70,9 @@ export const SettingsDataModelFieldDateForm = ({
isDateFieldCustomDisplayFormat(activeDisplayFormat);
const displayFormatSelectDescription =
- getDisplayFormatSelectDescription(activeDisplayFormat);
+ activeDisplayFormat === FieldDateDisplayFormat.CUSTOM
+ ? t`Enter in Unicode format`
+ : t`Choose the format used to display date value`;
return (
<>
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/utils/getDisplayFormatSelectDescription.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/utils/getDisplayFormatSelectDescription.tsx
deleted file mode 100644
index 29d6eca286d..00000000000
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/utils/getDisplayFormatSelectDescription.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { FieldDateDisplayFormat } from '@/object-record/record-field/ui/types/FieldMetadata';
-import { Trans } from '@lingui/react/macro';
-
-export const getDisplayFormatSelectDescription = (
- selectedDisplayFormat: FieldDateDisplayFormat,
-) => {
- if (selectedDisplayFormat === FieldDateDisplayFormat.CUSTOM) {
- return (
- <Trans>
- Enter in{' '}
- <a
- href="https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table"
- target="_blank"
- rel="noopener noreferrer"
- style={{ textDecoration: 'underline', color: 'inherit' }}
- >
- Unicode
- </a>{' '}
- format
- </Trans>
- );
- }
- return <Trans>Choose the format used to display date value</Trans>;
-};
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx
index b06e1ccbf07..1b10bb31bbb 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx
@@ -1,17 +1,14 @@
-import { Trans, useLingui } from '@lingui/react/macro';
+import { useLingui } from '@lingui/react/macro';
import { useFormContext } from 'react-hook-form';
import { useRecoilValue } from 'recoil';
-import { DOCUMENTATION_PATHS } from 'twenty-shared/constants';
import { FieldMetadataType } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import { IconLink } from 'twenty-ui/display';
-import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
-import { getDocumentationUrl } from '@/support/utils/getDocumentationUrl';
import { Select } from '@/ui/input/components/Select';
import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState';
import { RelationType } from '~/generated-metadata/graphql';
@@ -29,12 +26,6 @@ export const SettingsDataModelFieldRelationJunctionForm = ({
useFormContext<SettingsDataModelFieldEditFormValues>();
const isAdvancedModeEnabled = useRecoilValue(isAdvancedModeEnabledState);
- const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
-
- const documentationUrl = getDocumentationUrl({
- locale: currentWorkspaceMember?.locale,
- path: DOCUMENTATION_PATHS.USER_GUIDE_DATA_MODEL_HOW_TOS_CREATE_MANY_TO_MANY_RELATIONS,
- });
const { objectMetadataItem: sourceObjectMetadataItem } =
useObjectMetadataItem({ objectNameSingular });
@@ -163,19 +154,7 @@ export const SettingsDataModelFieldRelationJunctionForm = ({
<SettingsOptionCardContentToggle
Icon={IconLink}
title={t`This is a relation to a Junction Object`}
- description={
- <Trans>
- Build many-to-many relations.{' '}
- <a
- href={documentationUrl}
- target="_blank"
- rel="noopener noreferrer"
- style={{ textDecoration: 'underline', color: 'inherit' }}
- >
- Learn more
- </a>
- </Trans>
- }
+ description={t`Build many-to-many relations`}
checked={isJunctionConfigEnabled}
onChange={handleJunctionToggle}
divider={isJunctionConfigEnabled}
diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx
index 5c50391788d..ba6a70a8e45 100644
--- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx
+++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx
@@ -175,12 +175,11 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {
description={t`Allow the invitation of new users by sharing an invite link.`}
checked={currentWorkspace.isPublicInviteLinkEnabled}
advancedMode
+ divider
onChange={() =>
handleChange(!currentWorkspace.isPublicInviteLinkEnabled)
}
/>
- </Card>
- <Card rounded>
<Toggle2FA />
</Card>
</>
diff --git a/packages/twenty-front/src/pages/settings/security/SettingsSecurity.tsx b/packages/twenty-front/src/pages/settings/security/SettingsSecurity.tsx
index c41ec88961e..5d0c80fc70a 100644
--- a/packages/twenty-front/src/pages/settings/security/SettingsSecurity.tsx
+++ b/packages/twenty-front/src/pages/settings/security/SettingsSecurity.tsx
@@ -10,6 +10,7 @@ import { isClickHouseConfiguredState } from '@/client-config/states/isClickHouse
import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState';
import { SettingsOptionCardContentButton } from '@/settings/components/SettingsOptions/SettingsOptionCardContentButton';
import { SettingsOptionCardContentCounter } from '@/settings/components/SettingsOptions/SettingsOptionCardContentCounter';
+import { Separator } from '@/settings/components/Separator';
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
import { SettingsSSOIdentitiesProvidersListCard } from '@/settings/security/components/SSO/SettingsSSOIdentitiesProvidersListCard';
import { SettingsSecurityAuthBypassOptionsList } from '@/settings/security/components/SettingsSecurityAuthBypassOptionsList';
@@ -237,7 +238,7 @@ export const SettingsSecurity = () => {
<Card rounded>
<SettingsOptionCardContentButton
Icon={IconHistory}
- title={t`Audit Logs`}
+ title={t`Workspace Events`}
description={
!isClickHouseConfigured
? t`ClickHouse is required for audit logs. Contact your administrator.`
@@ -260,16 +261,19 @@ export const SettingsSecurity = () => {
}
/>
{isEventLogsEnabled && (
- <SettingsOptionCardContentCounter
- Icon={IconClockHour8}
- title={t`Log retention`}
- description={t`Number of days to retain audit logs (30-1095 days)`}
- value={currentWorkspace?.eventLogRetentionDays ?? 90}
- onChange={handleEventLogRetentionDaysChange}
- minValue={30}
- maxValue={1095}
- showButtons={false}
- />
+ <>
+ <Separator />
+ <SettingsOptionCardContentCounter
+ Icon={IconClockHour8}
+ title={t`Log retention`}
+ description={t`Number of days to retain audit logs (30-1095 days)`}
+ value={currentWorkspace?.eventLogRetentionDays ?? 90}
+ onChange={handleEventLogRetentionDaysChange}
+ minValue={30}
+ maxValue={1095}
+ showButtons={false}
+ />
+ </>
)}
</Card>
</Section>