Skip to content

The open alternative to Salesforce, designed for AI.

Removed drag grip and accent is now tertiary in hidden fields (#6650)

nitin0531eb50153d
diff --git a/packages/twenty-front/src/modules/object-record/record-index/options/components/RecordIndexOptionsDropdownContent.tsx b/packages/twenty-front/src/modules/object-record/record-index/options/components/RecordIndexOptionsDropdownContent.tsx
index 73de518b07b..4d9c8631bf9 100644
--- a/packages/twenty-front/src/modules/object-record/record-index/options/components/RecordIndexOptionsDropdownContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-index/options/components/RecordIndexOptionsDropdownContent.tsx
@@ -182,6 +182,7 @@ export const RecordIndexOptionsDropdownContent = ({
onDragEnd={handleReorderFields}
onVisibilityChange={handleChangeFieldVisibility}
showSubheader={false}
+ showDragGrip={true}
/>
<DropdownMenuSeparator />
<DropdownMenuItemsContainer>
@@ -209,6 +210,7 @@ export const RecordIndexOptionsDropdownContent = ({
isDraggable={false}
onVisibilityChange={handleChangeFieldVisibility}
showSubheader={false}
+ showDragGrip={false}
/>
</>
)}
diff --git a/packages/twenty-front/src/modules/ui/navigation/menu-item/components/MenuItemDraggable.tsx b/packages/twenty-front/src/modules/ui/navigation/menu-item/components/MenuItemDraggable.tsx
index 98c01586b93..dfe895fd824 100644
--- a/packages/twenty-front/src/modules/ui/navigation/menu-item/components/MenuItemDraggable.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/menu-item/components/MenuItemDraggable.tsx
@@ -3,10 +3,7 @@ import { IconComponent } from 'twenty-ui';
import { LightIconButtonGroup } from '@/ui/input/button/components/LightIconButtonGroup';
import { MenuItemLeftContent } from '../internals/components/MenuItemLeftContent';
-import {
- StyledHoverableMenuItemBase,
- StyledMenuItemBase,
-} from '../internals/components/StyledMenuItemBase';
+import { StyledHoverableMenuItemBase } from '../internals/components/StyledMenuItemBase';
import { MenuItemAccent } from '../types/MenuItemAccent';
import { MenuItemIconButton } from './MenuItem';
@@ -24,6 +21,7 @@ export type MenuItemDraggableProps = {
isDragDisabled?: boolean;
isHoverDisabled?: boolean;
};
+
export const MenuItemDraggable = ({
LeftIcon,
accent = 'default',
@@ -34,22 +32,14 @@ export const MenuItemDraggable = ({
className,
isIconDisplayedOnHoverOnly = true,
showGrip = false,
- isHoverDisabled = false,
}: MenuItemDraggableProps) => {
const showIconButtons = Array.isArray(iconButtons) && iconButtons.length > 0;
- if (isHoverDisabled) {
- return (
- <StyledMenuItemBase accent={accent} isHoverBackgroundDisabled>
- <MenuItemLeftContent
- LeftIcon={LeftIcon}
- text={text}
- isDisabled={isDragDisabled}
- showGrip={showGrip}
- />
- </StyledMenuItemBase>
- );
- }
+ const cursorType = showGrip
+ ? isDragDisabled
+ ? 'not-allowed'
+ : 'drag'
+ : 'default';
return (
<StyledHoverableMenuItemBase
@@ -57,6 +47,7 @@ export const MenuItemDraggable = ({
accent={accent}
className={className}
isIconDisplayedOnHoverOnly={isIconDisplayedOnHoverOnly}
+ cursor={cursorType}
>
<MenuItemLeftContent
LeftIcon={LeftIcon}
diff --git a/packages/twenty-front/src/modules/ui/navigation/menu-item/internals/components/MenuItemLeftContent.tsx b/packages/twenty-front/src/modules/ui/navigation/menu-item/internals/components/MenuItemLeftContent.tsx
index d2281aea7da..f93f5a0056d 100644
--- a/packages/twenty-front/src/modules/ui/navigation/menu-item/internals/components/MenuItemLeftContent.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/menu-item/internals/components/MenuItemLeftContent.tsx
@@ -1,6 +1,6 @@
-import { ReactNode } from 'react';
import { useTheme } from '@emotion/react';
import { isString } from '@sniptt/guards';
+import { ReactNode } from 'react';
import {
IconComponent,
IconGripVertical,
@@ -34,13 +34,17 @@ export const MenuItemLeftContent = ({
<StyledMenuItemLeftContent className={className}>
{showGrip &&
(isDisabled ? (
- <IconGripVertical
- size={theme.icon.size.md}
- stroke={theme.icon.stroke.sm}
- color={
- isDisabled ? theme.font.color.extraLight : theme.font.color.light
- }
- />
+ <StyledDraggableItem>
+ <IconGripVertical
+ size={theme.icon.size.md}
+ stroke={theme.icon.stroke.sm}
+ color={
+ isDisabled
+ ? theme.font.color.extraLight
+ : theme.font.color.light
+ }
+ />
+ </StyledDraggableItem>
) : (
<StyledDraggableItem>
<IconGripVertical
diff --git a/packages/twenty-front/src/modules/ui/navigation/menu-item/internals/components/StyledMenuItemBase.tsx b/packages/twenty-front/src/modules/ui/navigation/menu-item/internals/components/StyledMenuItemBase.tsx
index f361efc6427..8ae22c23fc8 100644
--- a/packages/twenty-front/src/modules/ui/navigation/menu-item/internals/components/StyledMenuItemBase.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/menu-item/internals/components/StyledMenuItemBase.tsx
@@ -106,10 +106,14 @@ export const StyledMenuItemRightContent = styled.div`
export const StyledDraggableItem = styled.div`
cursor: grab;
+
+ align-items: center;
+ display: flex;
`;
export const StyledHoverableMenuItemBase = styled(StyledMenuItemBase)<{
isIconDisplayedOnHoverOnly?: boolean;
+ cursor?: 'drag' | 'default' | 'not-allowed';
}>`
${({ isIconDisplayedOnHoverOnly, theme }) =>
isIconDisplayedOnHoverOnly &&
@@ -131,4 +135,15 @@ export const StyledHoverableMenuItemBase = styled(StyledMenuItemBase)<{
& .hoverable-buttons {
transition: opacity ${({ theme }) => theme.animation.duration.instant}s ease;
}
+
+ cursor: ${({ cursor }) => {
+ switch (cursor) {
+ case 'drag':
+ return 'grab';
+ case 'not-allowed':
+ return 'not-allowed';
+ default:
+ return 'default';
+ }
+ }};
`;
diff --git a/packages/twenty-front/src/modules/views/components/ViewFieldsVisibilityDropdownSection.tsx b/packages/twenty-front/src/modules/views/components/ViewFieldsVisibilityDropdownSection.tsx
index edbbdf3c0a8..d8ba50b090b 100644
--- a/packages/twenty-front/src/modules/views/components/ViewFieldsVisibilityDropdownSection.tsx
+++ b/packages/twenty-front/src/modules/views/components/ViewFieldsVisibilityDropdownSection.tsx
@@ -1,10 +1,10 @@
-import { useRef, useState } from 'react';
-import { createPortal } from 'react-dom';
import {
DropResult,
OnDragEndResponder,
ResponderProvided,
} from '@hello-pangea/dnd';
+import { useRef, useState } from 'react';
+import { createPortal } from 'react-dom';
import {
AppTooltip,
IconEye,
@@ -33,6 +33,7 @@ type ViewFieldsVisibilityDropdownSectionProps = {
) => void;
title: string;
showSubheader: boolean;
+ showDragGrip: boolean;
};
export const ViewFieldsVisibilityDropdownSection = ({
@@ -42,6 +43,7 @@ export const ViewFieldsVisibilityDropdownSection = ({
onVisibilityChange,
title,
showSubheader = true,
+ showDragGrip,
}: ViewFieldsVisibilityDropdownSectionProps) => {
const handleOnDrag = (result: DropResult, provided: ResponderProvided) => {
onDragEnd?.(result, provided);
@@ -107,9 +109,8 @@ export const ViewFieldsVisibilityDropdownSection = ({
isTooltipOpen={openToolTipIndex === fieldIndex}
text={field.label}
className={`${title}-fixed-item-tooltip-anchor-${fieldIndex}`}
- accent={'placeholder'}
- isHoverDisabled={field.isVisible}
- showGrip
+ accent={showDragGrip ? 'placeholder' : 'default'}
+ showGrip={showDragGrip}
isDragDisabled
/>
))}