From 6f156a69b0dbf1ab3e73dcf66380e1b0d7f4b007 Mon Sep 17 00:00:00 2001 From: nitin <142569587+ehconitin@users.noreply.github.com> Date: Fri, 6 Jun 2025 00:14:21 +0530 Subject: [PATCH] feat: new tab list (#12384) closes #9904 --------- Co-authored-by: Charles Bochet --- .../RecordShowRightDrawerOpenRecordButton.tsx | 29 +- .../tasks/components/TaskGroups.tsx | 4 +- .../__stories__/TaskGroups.stories.tsx | 2 +- ...ommandMenuCloseAnimationCompleteCleanup.ts | 2 +- .../hooks/useCommandMenuHistory.ts | 2 +- .../CommandMenuWorkflowRunViewStepContent.tsx | 5 +- .../hooks/useRecordShowContainerTabs.ts | 4 +- .../record-show/types/RecordLayout.ts | 2 +- ...tingsAccountsCalendarChannelsContainer.tsx | 4 +- ...ttingsAccountsMessageChannelsContainer.tsx | 4 +- .../components/SettingsAdminContent.tsx | 2 +- .../components/SettingsAdminGeneral.tsx | 6 +- .../components/SettingsAdminTabContent.tsx | 2 +- .../roles/role/components/SettingsRole.tsx | 4 +- .../components/SettingsRoleCreateEffect.tsx | 2 +- .../components/SettingsRoleEditEffect.tsx | 2 +- ...ettingsServerlessFunctionCodeEditorTab.tsx | 10 +- .../components/ShowPageSubContainer.tsx | 16 +- .../layout/tab-list/components/TabAvatar.tsx | 23 ++ .../ui/layout/tab-list/components/TabList.tsx | 234 +++++++++++ .../tab-list/components/TabListDropdown.tsx | 73 ++++ .../TabListFromUrlOptionalEffect.tsx | 2 +- .../tab-list/components/TabMoreButton.tsx | 25 ++ .../__stories__/TabMoreButton.stories.tsx | 28 ++ .../__stories__/Tablist.stories.tsx | 82 ++++ .../layout/tab-list/constants/TabListGap.ts | 1 + .../tab-list/constants/TabListPadding.ts | 1 + .../{tab => tab-list}/scopes/TabListScope.tsx | 0 .../TabListScopeInternalContext.ts | 0 .../states/activeTabIdComponentState.ts | 2 +- .../TabListComponentInstanceContext.ts | 0 .../{tab => tab-list}/types/LayoutCard.ts | 0 .../types/RecordLayoutTab.ts | 4 +- .../layout/tab-list/types/SingleTabProps.ts | 13 + .../ui/layout/tab-list/types/TabListProps.ts | 10 + .../types/TabVisibilityConfig.ts | 0 .../ui/layout/tab-list/types/TabWidthsById.ts | 1 + .../utils/calculateVisibleTabCount.ts | 46 +++ .../modules/ui/layout/tab/components/Tab.tsx | 139 ------- .../ui/layout/tab/components/TabList.tsx | 110 ----- .../components/__stories__/Tab.stories.tsx | 65 --- .../__stories__/Tablist.stories.tsx | 60 --- .../dimensions/components/NodeDimension.tsx | 34 ++ .../useSetInitialWorkflowRunRightDrawerTab.ts | 2 +- .../WorkflowEditActionServerlessFunction.tsx | 4 +- .../WorkflowVariablesDropdownFieldItems.tsx | 2 +- .../data-model/SettingsObjectDetailPage.tsx | 4 +- .../SettingsServerlessFunctionDetail.tsx | 8 +- .../src/input/button/components/TabButton.tsx | 122 ++++++ .../__stories__/TabButton.stories.tsx | 377 ++++++++++++++++++ packages/twenty-ui/src/input/index.ts | 1 + 51 files changed, 1136 insertions(+), 439 deletions(-) create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/components/TabAvatar.tsx create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListDropdown.tsx rename packages/twenty-front/src/modules/ui/layout/{tab => tab-list}/components/TabListFromUrlOptionalEffect.tsx (91%) create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/components/TabMoreButton.tsx create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/TabMoreButton.stories.tsx create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/Tablist.stories.tsx create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/constants/TabListGap.ts create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/constants/TabListPadding.ts rename packages/twenty-front/src/modules/ui/layout/{tab => tab-list}/scopes/TabListScope.tsx (100%) rename packages/twenty-front/src/modules/ui/layout/{tab => tab-list}/scopes/scope-internal-context/TabListScopeInternalContext.ts (100%) rename packages/twenty-front/src/modules/ui/layout/{tab => tab-list}/states/activeTabIdComponentState.ts (87%) rename packages/twenty-front/src/modules/ui/layout/{tab => tab-list}/states/contexts/TabListComponentInstanceContext.ts (100%) rename packages/twenty-front/src/modules/ui/layout/{tab => tab-list}/types/LayoutCard.ts (100%) rename packages/twenty-front/src/modules/ui/layout/{tab => tab-list}/types/RecordLayoutTab.ts (56%) create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/types/SingleTabProps.ts create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListProps.ts rename packages/twenty-front/src/modules/ui/layout/{tab => tab-list}/types/TabVisibilityConfig.ts (100%) create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/types/TabWidthsById.ts create mode 100644 packages/twenty-front/src/modules/ui/layout/tab-list/utils/calculateVisibleTabCount.ts delete mode 100644 packages/twenty-front/src/modules/ui/layout/tab/components/Tab.tsx delete mode 100644 packages/twenty-front/src/modules/ui/layout/tab/components/TabList.tsx delete mode 100644 packages/twenty-front/src/modules/ui/layout/tab/components/__stories__/Tab.stories.tsx delete mode 100644 packages/twenty-front/src/modules/ui/layout/tab/components/__stories__/Tablist.stories.tsx create mode 100644 packages/twenty-front/src/modules/ui/utilities/dimensions/components/NodeDimension.tsx create mode 100644 packages/twenty-ui/src/input/button/components/TabButton.tsx create mode 100644 packages/twenty-ui/src/input/button/components/__stories__/TabButton.stories.tsx diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx index 9f1242007..8a00a26c9 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx @@ -3,31 +3,25 @@ import { getRightDrawerActionMenuDropdownIdFromActionMenuId } from '@/action-men import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; -import { getLinkToShowPage } from '@/object-metadata/utils/getLinkToShowPage'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { ObjectRecord } from '@/object-record/types/ObjectRecord'; import { AppPath } from '@/types/AppPath'; import { useDropdownV2 } from '@/ui/layout/dropdown/hooks/useDropdownV2'; import { getShowPageTabListComponentId } from '@/ui/layout/show-page/utils/getShowPageTabListComponentId'; -import { activeTabIdComponentState } from '@/ui/layout/tab/states/activeTabIdComponentState'; +import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys'; import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; import { useComponentInstanceStateContext } from '@/ui/utilities/state/component-state/hooks/useComponentInstanceStateContext'; import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2'; import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2'; -import styled from '@emotion/styled'; import { useCallback } from 'react'; -import { Link } from 'react-router-dom'; import { useRecoilValue } from 'recoil'; import { isDefined } from 'twenty-shared/utils'; import { IconBrowserMaximize } from 'twenty-ui/display'; import { Button } from 'twenty-ui/input'; import { getOsControlSymbol } from 'twenty-ui/utilities'; import { useNavigateApp } from '~/hooks/useNavigateApp'; -const StyledLink = styled(Link)` - text-decoration: none; -`; type RecordShowRightDrawerOpenRecordButtonProps = { objectNameSingular: string; @@ -117,18 +111,15 @@ export const RecordShowRightDrawerOpenRecordButton = ({ return null; } - const to = getLinkToShowPage(objectNameSingular, record); - return ( - -