From 38a0aae0307cd7fb1141eb9db9a5626a97546a1e Mon Sep 17 00:00:00 2001 From: selango1 Date: Mon, 4 Mar 2024 08:59:31 -0500 Subject: [PATCH] =?UTF-8?q?Update=20SettingsObjectAboutSection.tsx=20chang?= =?UTF-8?q?ed=20"Disable"=20CTA=20to=20"Deact=E2=80=A6=20(#4175)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update SettingsObjectAboutSection.tsx changed "Disable" CTA to "Deactivate" * Update SettingsObjects.tsx Additional changes: Disabled sections to inactive * Update SettingsObjectAboutSection.tsx I think you meant changing Disable to Deactivate * Update and rename SettingsObjectDisabledMenuDropDown.tsx to SettingsObjectInactiveMenuDropDown.tsx additional changes to #4153 * Update SettingsObjects.tsx * Update and rename SettingsObjectDisabledMenuDropDown.stories.tsx to SettingsObjectInactiveMenuDropDown.stories.tsx * fix typescript errors * respect issue requirements --------- Co-authored-by: bosiraphael --- .../hooks/useObjectMetadataItemForSettings.ts | 4 +-- .../components/SettingsObjectAboutSection.tsx | 12 ++++----- ...ettingsObjectFieldActiveActionDropdown.tsx | 14 +++++----- ...tingsObjectFieldDisabledActionDropdown.tsx | 6 ++--- ...=> SettingsObjectInactiveMenuDropDown.tsx} | 8 +++--- ...ngsObjectInactiveMenuDropDown.stories.tsx} | 12 ++++----- .../data-model/SettingsObjectDetail.tsx | 10 +++---- .../settings/data-model/SettingsObjects.tsx | 26 +++++++++---------- 8 files changed, 46 insertions(+), 46 deletions(-) rename packages/twenty-front/src/modules/settings/data-model/objects/{SettingsObjectDisabledMenuDropDown.tsx => SettingsObjectInactiveMenuDropDown.tsx} (88%) rename packages/twenty-front/src/modules/settings/data-model/objects/__stories__/{SettingsObjectDisabledMenuDropDown.stories.tsx => SettingsObjectInactiveMenuDropDown.stories.tsx} (84%) diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemForSettings.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemForSettings.ts index 773a46713..d97dfc840 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemForSettings.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemForSettings.ts @@ -16,7 +16,7 @@ export const useObjectMetadataItemForSettings = () => { const activeObjectMetadataItems = objectMetadataItems.filter( ({ isActive, isSystem }) => isActive && !isSystem, ); - const disabledObjectMetadataItems = objectMetadataItems.filter( + const inactiveObjectMetadataItems = objectMetadataItems.filter( ({ isActive, isSystem }) => !isActive && !isSystem, ); @@ -88,7 +88,7 @@ export const useObjectMetadataItemForSettings = () => { activateObjectMetadataItem, activeObjectMetadataItems, createObjectMetadataItem, - disabledObjectMetadataItems, + inactiveObjectMetadataItems, disableObjectMetadataItem, editObjectMetadataItem, eraseObjectMetadataItem, diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectAboutSection.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectAboutSection.tsx index 8abe35a90..884960cc9 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectAboutSection.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectAboutSection.tsx @@ -19,7 +19,7 @@ type SettingsAboutSectionProps = { iconKey?: string; isCustom: boolean; name: string; - onDisable: () => void; + onDeactivate: () => void; onEdit: () => void; }; @@ -49,7 +49,7 @@ export const SettingsAboutSection = ({ iconKey = '', isCustom, name, - onDisable, + onDeactivate, onEdit, }: SettingsAboutSectionProps) => { const theme = useTheme(); @@ -63,8 +63,8 @@ export const SettingsAboutSection = ({ closeDropdown(); }; - const handleDisable = () => { - onDisable(); + const handleDeactivate = () => { + onDeactivate(); closeDropdown(); }; @@ -92,9 +92,9 @@ export const SettingsAboutSection = ({ onClick={handleEdit} /> diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldActiveActionDropdown.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldActiveActionDropdown.tsx index fa8c7d955..62aa7726d 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldActiveActionDropdown.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldActiveActionDropdown.tsx @@ -14,7 +14,7 @@ import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem'; type SettingsObjectFieldActiveActionDropdownProps = { isCustomField?: boolean; - onDisable?: () => void; + onDeactivate?: () => void; onEdit: () => void; onSetAsLabelIdentifier?: () => void; scopeKey: string; @@ -22,7 +22,7 @@ type SettingsObjectFieldActiveActionDropdownProps = { export const SettingsObjectFieldActiveActionDropdown = ({ isCustomField, - onDisable, + onDeactivate, onEdit, onSetAsLabelIdentifier, scopeKey, @@ -36,8 +36,8 @@ export const SettingsObjectFieldActiveActionDropdown = ({ closeDropdown(); }; - const handleDisable = () => { - onDisable?.(); + const handleDeactivate = () => { + onDeactivate?.(); closeDropdown(); }; @@ -67,11 +67,11 @@ export const SettingsObjectFieldActiveActionDropdown = ({ onClick={handleSetAsLabelIdentifier} /> )} - {!!onDisable && ( + {!!onDeactivate && ( )} diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldDisabledActionDropdown.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldDisabledActionDropdown.tsx index 101d5aac2..ad618bd47 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldDisabledActionDropdown.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldDisabledActionDropdown.tsx @@ -6,17 +6,17 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown'; import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem'; -type SettingsObjectFieldDisabledActionDropdownProps = { +type SettingsObjectFieldInactiveActionDropdownProps = { isCustomField?: boolean; onActivate: () => void; onErase: () => void; scopeKey: string; }; -export const SettingsObjectFieldDisabledActionDropdown = ({ +export const SettingsObjectFieldInactiveActionDropdown = ({ onActivate, scopeKey, -}: SettingsObjectFieldDisabledActionDropdownProps) => { +}: SettingsObjectFieldInactiveActionDropdownProps) => { const dropdownId = `${scopeKey}-settings-field-disabled-action-dropdown`; const { closeDropdown } = useDropdown(dropdownId); diff --git a/packages/twenty-front/src/modules/settings/data-model/objects/SettingsObjectDisabledMenuDropDown.tsx b/packages/twenty-front/src/modules/settings/data-model/objects/SettingsObjectInactiveMenuDropDown.tsx similarity index 88% rename from packages/twenty-front/src/modules/settings/data-model/objects/SettingsObjectDisabledMenuDropDown.tsx rename to packages/twenty-front/src/modules/settings/data-model/objects/SettingsObjectInactiveMenuDropDown.tsx index 18bb9b5f2..c74fa8079 100644 --- a/packages/twenty-front/src/modules/settings/data-model/objects/SettingsObjectDisabledMenuDropDown.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/objects/SettingsObjectInactiveMenuDropDown.tsx @@ -6,20 +6,20 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown'; import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem'; -type SettingsObjectDisabledMenuDropDownProps = { +type SettingsObjectInactiveMenuDropDownProps = { isCustomObject: boolean; onActivate: () => void; onErase: () => void; scopeKey: string; }; -export const SettingsObjectDisabledMenuDropDown = ({ +export const SettingsObjectInactiveMenuDropDown = ({ onActivate, scopeKey, onErase, isCustomObject, -}: SettingsObjectDisabledMenuDropDownProps) => { - const dropdownId = `${scopeKey}-settings-object-disabled-menu-dropdown`; +}: SettingsObjectInactiveMenuDropDownProps) => { + const dropdownId = `${scopeKey}-settings-object-inactive-menu-dropdown`; const { closeDropdown } = useDropdown(dropdownId); diff --git a/packages/twenty-front/src/modules/settings/data-model/objects/__stories__/SettingsObjectDisabledMenuDropDown.stories.tsx b/packages/twenty-front/src/modules/settings/data-model/objects/__stories__/SettingsObjectInactiveMenuDropDown.stories.tsx similarity index 84% rename from packages/twenty-front/src/modules/settings/data-model/objects/__stories__/SettingsObjectDisabledMenuDropDown.stories.tsx rename to packages/twenty-front/src/modules/settings/data-model/objects/__stories__/SettingsObjectInactiveMenuDropDown.stories.tsx index 07f7a9494..e82e9a0eb 100644 --- a/packages/twenty-front/src/modules/settings/data-model/objects/__stories__/SettingsObjectDisabledMenuDropDown.stories.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/objects/__stories__/SettingsObjectInactiveMenuDropDown.stories.tsx @@ -3,7 +3,7 @@ import { expect, fn, userEvent, within } from '@storybook/test'; import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator'; -import { SettingsObjectDisabledMenuDropDown } from '../SettingsObjectDisabledMenuDropDown'; +import { SettingsObjectInactiveMenuDropDown } from '../SettingsObjectInactiveMenuDropDown'; const handleActivateMockFunction = fn(); const handleEraseMockFunction = fn(); @@ -16,11 +16,11 @@ const ClearMocksDecorator: Decorator = (Story, context) => { return ; }; -const meta: Meta = { - title: 'Modules/Settings/DataModel/SettingsObjectDisabledMenuDropDown', - component: SettingsObjectDisabledMenuDropDown, +const meta: Meta = { + title: 'Modules/Settings/DataModel/SettingsObjectInactiveMenuDropDown', + component: SettingsObjectInactiveMenuDropDown, args: { - scopeKey: 'settings-object-disabled-menu-dropdown', + scopeKey: 'settings-object-inactive-menu-dropdown', onActivate: handleActivateMockFunction, onErase: handleEraseMockFunction, }, @@ -31,7 +31,7 @@ const meta: Meta = { }; export default meta; -type Story = StoryObj; +type Story = StoryObj; export const Default: Story = {}; diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetail.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetail.tsx index e9b88b82c..7a76d1c9c 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetail.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetail.tsx @@ -10,7 +10,7 @@ import { isLabelIdentifierField } from '@/object-metadata/utils/isLabelIdentifie import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer'; import { SettingsAboutSection } from '@/settings/data-model/object-details/components/SettingsObjectAboutSection'; import { SettingsObjectFieldActiveActionDropdown } from '@/settings/data-model/object-details/components/SettingsObjectFieldActiveActionDropdown'; -import { SettingsObjectFieldDisabledActionDropdown } from '@/settings/data-model/object-details/components/SettingsObjectFieldDisabledActionDropdown'; +import { SettingsObjectFieldInactiveActionDropdown } from '@/settings/data-model/object-details/components/SettingsObjectFieldDisabledActionDropdown'; import { SettingsObjectFieldItemTableRow, StyledObjectFieldTableRow, @@ -94,7 +94,7 @@ export const SettingsObjectDetail = () => { iconKey={activeObjectMetadataItem.icon ?? undefined} name={activeObjectMetadataItem.labelPlural || ''} isCustom={activeObjectMetadataItem.isCustom} - onDisable={handleDisableObject} + onDeactivate={handleDisableObject} onEdit={() => navigate('./edit')} />
@@ -155,7 +155,7 @@ export const SettingsObjectDetail = () => { ) : undefined } - onDisable={ + onDeactivate={ isLabelIdentifier ? undefined : () => handleDisableField(activeMetadataField) @@ -168,7 +168,7 @@ export const SettingsObjectDetail = () => { )} {!!disabledMetadataFields.length && ( - + {disabledMetadataFields.map((disabledMetadataField) => ( { } fieldMetadataItem={disabledMetadataField} ActionIcon={ - diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjects.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjects.tsx index 438d68865..4e5af2b6a 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjects.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjects.tsx @@ -11,7 +11,7 @@ import { StyledObjectTableRow, } from '@/settings/data-model/object-details/components/SettingsObjectItemTableRow'; import { SettingsObjectCoverImage } from '@/settings/data-model/objects/SettingsObjectCoverImage'; -import { SettingsObjectDisabledMenuDropDown } from '@/settings/data-model/objects/SettingsObjectDisabledMenuDropDown'; +import { SettingsObjectInactiveMenuDropDown } from '@/settings/data-model/objects/SettingsObjectInactiveMenuDropDown'; import { IconChevronRight, IconPlus, IconSettings } from '@/ui/display/icon'; import { H1Title } from '@/ui/display/typography/components/H1Title'; import { H2Title } from '@/ui/display/typography/components/H2Title'; @@ -37,7 +37,7 @@ export const SettingsObjects = () => { const { activateObjectMetadataItem, activeObjectMetadataItems, - disabledObjectMetadataItems, + inactiveObjectMetadataItems, eraseObjectMetadataItem, } = useObjectMetadataItemForSettings(); @@ -89,25 +89,25 @@ export const SettingsObjects = () => { ))} )} - {!!disabledObjectMetadataItems.length && ( - - {disabledObjectMetadataItems.map( - (disabledObjectMetadataItem) => ( + {!!inactiveObjectMetadataItems.length && ( + + {inactiveObjectMetadataItems.map( + (inactiveObjectMetadataItem) => ( activateObjectMetadataItem( - disabledObjectMetadataItem, + inactiveObjectMetadataItem, ) } onErase={() => eraseObjectMetadataItem( - disabledObjectMetadataItem, + inactiveObjectMetadataItem, ) } />