From cac3e116a3293f76b235a3cfe4184adac501cbc9 Mon Sep 17 00:00:00 2001
From: Ana Sofia Marin Alexandre <61988046+anamarn@users.noreply.github.com>
Date: Wed, 18 Sep 2024 18:32:41 +0200
Subject: [PATCH] Add SettingsCard for Config Data Type and Accounts Settings
(#7093)
https://github.com/twentyhq/twenty/issues/6950
Add new Settings Card for Config Data Type and accounts Settings
Before:
After:
---
.../SettingsAccountsSettingsSection.tsx | 30 +++++++++---
...ngsNavigationCard.tsx => SettingsCard.tsx} | 42 +++++++++++------
.../__stories__/SettingsCard.stories.tsx | 24 ++++++++++
.../data-model/constants/RelationTypes.ts | 15 +++---
.../constants/SettingsFieldTypeConfigs.ts | 4 +-
.../SettingsDataModelFieldTypeSelect.tsx | 47 +++++++------------
.../SettingsObjectFieldDataType.tsx | 11 ++---
.../icon/assets/illustration-array.svg | 8 ++++
.../icon/assets/illustration-many-to-many.svg | 8 ++++
.../icon/assets/illustration-one-to-many.svg | 4 +-
.../icon/assets/illustration-one-to-one.svg | 8 ++++
.../icon/components/IllustrationIconArray.tsx | 21 +++++++++
.../components/IllustrationIconManyToMany.tsx | 24 ++++++++++
.../components/IllustrationIconOneToOne.tsx | 25 ++++++++++
.../components/IllustrationIconWrapper.tsx | 4 +-
packages/twenty-ui/src/display/index.ts | 3 ++
.../twenty-ui/src/theme/constants/Icon.ts | 2 +-
17 files changed, 207 insertions(+), 73 deletions(-)
rename packages/twenty-front/src/modules/settings/components/{SettingsNavigationCard.tsx => SettingsCard.tsx} (68%)
create mode 100644 packages/twenty-front/src/modules/settings/components/__stories__/SettingsCard.stories.tsx
create mode 100644 packages/twenty-ui/src/display/icon/assets/illustration-array.svg
create mode 100644 packages/twenty-ui/src/display/icon/assets/illustration-many-to-many.svg
create mode 100644 packages/twenty-ui/src/display/icon/assets/illustration-one-to-one.svg
create mode 100644 packages/twenty-ui/src/display/icon/components/IllustrationIconArray.tsx
create mode 100644 packages/twenty-ui/src/display/icon/components/IllustrationIconManyToMany.tsx
create mode 100644 packages/twenty-ui/src/display/icon/components/IllustrationIconOneToOne.tsx
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsSettingsSection.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsSettingsSection.tsx
index 3bcb19ea0..5ca4cb832 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsSettingsSection.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsSettingsSection.tsx
@@ -1,11 +1,12 @@
import styled from '@emotion/styled';
import { H2Title, IconCalendarEvent, IconMailCog } from 'twenty-ui';
-import { SettingsNavigationCard } from '@/settings/components/SettingsNavigationCard';
+import { SettingsCard } from '@/settings/components/SettingsCard';
import { getSettingsPagePath } from '@/settings/utils/getSettingsPagePath';
import { SettingsPath } from '@/types/SettingsPath';
import { Section } from '@/ui/layout/section/components/Section';
import { UndecoratedLink } from '@/ui/navigation/link/components/UndecoratedLink';
+import { useTheme } from '@emotion/react';
const StyledCardsContainer = styled.div`
display: flex;
@@ -14,6 +15,7 @@ const StyledCardsContainer = styled.div`
`;
export const SettingsAccountsSettingsSection = () => {
+ const theme = useTheme();
return (
{
/>
-
- Set email visibility, manage your blocklist and more.
-
+
+ }
+ title="Emails"
+ description="Set email visibility, manage your blocklist and more."
+ />
-
- Configure and customize your calendar preferences.
-
+
+ }
+ title="Calendar"
+ description="Configure and customize your calendar preferences."
+ />
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsNavigationCard.tsx b/packages/twenty-front/src/modules/settings/components/SettingsCard.tsx
similarity index 68%
rename from packages/twenty-front/src/modules/settings/components/SettingsNavigationCard.tsx
rename to packages/twenty-front/src/modules/settings/components/SettingsCard.tsx
index 8d44dfcfc..7383b6e90 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsNavigationCard.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsCard.tsx
@@ -1,16 +1,16 @@
-import { ReactNode } from 'react';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
-import { IconChevronRight, IconComponent, Pill } from 'twenty-ui';
+import { IconChevronRight, Pill } from 'twenty-ui';
import { Card } from '@/ui/layout/card/components/Card';
import { CardContent } from '@/ui/layout/card/components/CardContent';
+import { ReactNode } from 'react';
-type SettingsNavigationCardProps = {
- children: ReactNode;
+type SettingsCardProps = {
+ description?: string;
disabled?: boolean;
soon?: boolean;
- Icon: IconComponent;
+ Icon: ReactNode;
onClick?: () => void;
title: string;
className?: string;
@@ -24,19 +24,23 @@ const StyledCard = styled(Card)<{
disabled ? theme.font.color.extraLight : theme.font.color.tertiary};
cursor: ${({ disabled, onClick }) =>
disabled ? 'not-allowed' : onClick ? 'pointer' : 'default'};
+ width: 100%;
+ & :hover {
+ background-color: ${({ theme }) => theme.background.quaternary};
+ }
`;
-const StyledCardContent = styled(CardContent)`
+const StyledCardContent = styled(CardContent)