From 1766eb552f08ed75093a9ec1972596013cc4848c Mon Sep 17 00:00:00 2001 From: Thomas Trompette Date: Fri, 31 May 2024 14:31:37 +0200 Subject: [PATCH] Remove else if on position calculation (#5691) As title fix --- .../components/TimelineActivities.tsx | 12 ++++-------- .../utils/get-dragged-record-position.util.ts | 12 ++++++++---- .../show-page/components/ShowPageRightContainer.tsx | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/twenty-front/src/modules/activities/timelineActivities/components/TimelineActivities.tsx b/packages/twenty-front/src/modules/activities/timelineActivities/components/TimelineActivities.tsx index f41c074050e4d..fac968ef1df64 100644 --- a/packages/twenty-front/src/modules/activities/timelineActivities/components/TimelineActivities.tsx +++ b/packages/twenty-front/src/modules/activities/timelineActivities/components/TimelineActivities.tsx @@ -25,14 +25,10 @@ const StyledMainContainer = styled.div` height: 100%; justify-content: center; - padding: ${({ theme }) => - theme.spacing(6) + - ' ' + - theme.spacing(6) + - ' ' + - theme.spacing(16) + - ' ' + - theme.spacing(6)}; + padding-top: ${({ theme }) => theme.spacing(6)}; + padding-right: ${({ theme }) => theme.spacing(6)}; + padding-bottom: ${({ theme }) => theme.spacing(16)}; + padding-left: ${({ theme }) => theme.spacing(6)}; gap: ${({ theme }) => theme.spacing(4)}; `; diff --git a/packages/twenty-front/src/modules/object-record/record-board/utils/get-dragged-record-position.util.ts b/packages/twenty-front/src/modules/object-record/record-board/utils/get-dragged-record-position.util.ts index 1a694c4e6ed6e..a1a9090af20f6 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/utils/get-dragged-record-position.util.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/utils/get-dragged-record-position.util.ts @@ -6,11 +6,15 @@ export const getDraggedRecordPosition = ( ): number => { if (isDefined(recordAfterPosition) && isDefined(recordBeforePosition)) { return (recordBeforePosition + recordAfterPosition) / 2; - } else if (isDefined(recordAfterPosition)) { + } + + if (isDefined(recordAfterPosition)) { return recordAfterPosition - 1; - } else if (isDefined(recordBeforePosition)) { + } + + if (isDefined(recordBeforePosition)) { return recordBeforePosition + 1; - } else { - return 1; } + + return 1; }; diff --git a/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageRightContainer.tsx b/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageRightContainer.tsx index fae2354e85ca2..4176e86b62db2 100644 --- a/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageRightContainer.tsx +++ b/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageRightContainer.tsx @@ -80,7 +80,7 @@ export const ShowPageRightContainer = ({ const shouldDisplayLogTab = useIsFeatureEnabled('IS_EVENT_OBJECT_ENABLED'); const shouldDisplayEmailsTab = emails && isCompanyOrPerson; - const TAB_LIST = [ + const tabs = [ { id: 'timeline', title: 'Timeline', @@ -131,7 +131,7 @@ export const ShowPageRightContainer = ({ case 'calendar': return ; default: - return null; + return <>; } }; @@ -141,7 +141,7 @@ export const ShowPageRightContainer = ({ {renderActiveTabContent()}