mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-22 21:50:43 +03:00
fix: Default View Font Color and Reordering (#7940)
This PR fixes issue #6114 I removed the separate check for default item and add it into the draggable list.
This commit is contained in:
parent
5b6487979c
commit
45b3992784
@ -60,8 +60,6 @@ export const ViewPickerListContent = () => {
|
||||
|
||||
const { getIcon } = useIcons();
|
||||
|
||||
const indexView = viewsOnCurrentObject.find((view) => view.key === 'INDEX');
|
||||
|
||||
const handleDragEnd = useCallback(
|
||||
(result: DropResult) => {
|
||||
if (!result.destination) return;
|
||||
@ -81,33 +79,29 @@ export const ViewPickerListContent = () => {
|
||||
return (
|
||||
<>
|
||||
<DropdownMenuItemsContainer>
|
||||
{indexView && (
|
||||
<MenuItemDraggable
|
||||
key={indexView.id}
|
||||
iconButtons={[
|
||||
{
|
||||
Icon: IconLock,
|
||||
},
|
||||
].filter(isDefined)}
|
||||
isIconDisplayedOnHoverOnly={false}
|
||||
onClick={() => handleViewSelect(indexView.id)}
|
||||
LeftIcon={getIcon(indexView.icon)}
|
||||
text={indexView.name}
|
||||
accent="placeholder"
|
||||
isDragDisabled
|
||||
/>
|
||||
)}
|
||||
<DraggableList
|
||||
onDragEnd={handleDragEnd}
|
||||
draggableItems={viewsOnCurrentObject
|
||||
.filter((view) => indexView?.id !== view.id)
|
||||
.map((view, index) => (
|
||||
<DraggableItem
|
||||
key={view.id}
|
||||
draggableId={view.id}
|
||||
index={index}
|
||||
isDragDisabled={viewsOnCurrentObject.length === 1}
|
||||
itemComponent={
|
||||
draggableItems={viewsOnCurrentObject.map((view, index) => (
|
||||
<DraggableItem
|
||||
key={view.id}
|
||||
draggableId={view.id}
|
||||
index={index}
|
||||
isDragDisabled={viewsOnCurrentObject.length === 1}
|
||||
itemComponent={
|
||||
view.key === 'INDEX' ? (
|
||||
<MenuItemDraggable
|
||||
key={view.id}
|
||||
iconButtons={[
|
||||
{
|
||||
Icon: IconLock,
|
||||
},
|
||||
].filter(isDefined)}
|
||||
isIconDisplayedOnHoverOnly={false}
|
||||
onClick={() => handleViewSelect(view.id)}
|
||||
LeftIcon={getIcon(view.icon)}
|
||||
text={view.name}
|
||||
/>
|
||||
) : (
|
||||
<MenuItemDraggable
|
||||
key={view.id}
|
||||
iconButtons={[
|
||||
@ -117,16 +111,15 @@ export const ViewPickerListContent = () => {
|
||||
handleEditViewButtonClick(event, view.id),
|
||||
},
|
||||
].filter(isDefined)}
|
||||
isIconDisplayedOnHoverOnly={
|
||||
indexView?.id === view.id ? false : true
|
||||
}
|
||||
isIconDisplayedOnHoverOnly={true}
|
||||
onClick={() => handleViewSelect(view.id)}
|
||||
LeftIcon={getIcon(view.icon)}
|
||||
text={view.name}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
)
|
||||
}
|
||||
/>
|
||||
))}
|
||||
/>
|
||||
</DropdownMenuItemsContainer>
|
||||
<DropdownMenuSeparator />
|
||||
|
Loading…
Reference in New Issue
Block a user