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:
@ -60,8 +60,6 @@ export const ViewPickerListContent = () => {
|
|||||||
|
|
||||||
const { getIcon } = useIcons();
|
const { getIcon } = useIcons();
|
||||||
|
|
||||||
const indexView = viewsOnCurrentObject.find((view) => view.key === 'INDEX');
|
|
||||||
|
|
||||||
const handleDragEnd = useCallback(
|
const handleDragEnd = useCallback(
|
||||||
(result: DropResult) => {
|
(result: DropResult) => {
|
||||||
if (!result.destination) return;
|
if (!result.destination) return;
|
||||||
@ -81,33 +79,29 @@ export const ViewPickerListContent = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuItemsContainer>
|
<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
|
<DraggableList
|
||||||
onDragEnd={handleDragEnd}
|
onDragEnd={handleDragEnd}
|
||||||
draggableItems={viewsOnCurrentObject
|
draggableItems={viewsOnCurrentObject.map((view, index) => (
|
||||||
.filter((view) => indexView?.id !== view.id)
|
<DraggableItem
|
||||||
.map((view, index) => (
|
key={view.id}
|
||||||
<DraggableItem
|
draggableId={view.id}
|
||||||
key={view.id}
|
index={index}
|
||||||
draggableId={view.id}
|
isDragDisabled={viewsOnCurrentObject.length === 1}
|
||||||
index={index}
|
itemComponent={
|
||||||
isDragDisabled={viewsOnCurrentObject.length === 1}
|
view.key === 'INDEX' ? (
|
||||||
itemComponent={
|
<MenuItemDraggable
|
||||||
|
key={view.id}
|
||||||
|
iconButtons={[
|
||||||
|
{
|
||||||
|
Icon: IconLock,
|
||||||
|
},
|
||||||
|
].filter(isDefined)}
|
||||||
|
isIconDisplayedOnHoverOnly={false}
|
||||||
|
onClick={() => handleViewSelect(view.id)}
|
||||||
|
LeftIcon={getIcon(view.icon)}
|
||||||
|
text={view.name}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
<MenuItemDraggable
|
<MenuItemDraggable
|
||||||
key={view.id}
|
key={view.id}
|
||||||
iconButtons={[
|
iconButtons={[
|
||||||
@ -117,16 +111,15 @@ export const ViewPickerListContent = () => {
|
|||||||
handleEditViewButtonClick(event, view.id),
|
handleEditViewButtonClick(event, view.id),
|
||||||
},
|
},
|
||||||
].filter(isDefined)}
|
].filter(isDefined)}
|
||||||
isIconDisplayedOnHoverOnly={
|
isIconDisplayedOnHoverOnly={true}
|
||||||
indexView?.id === view.id ? false : true
|
|
||||||
}
|
|
||||||
onClick={() => handleViewSelect(view.id)}
|
onClick={() => handleViewSelect(view.id)}
|
||||||
LeftIcon={getIcon(view.icon)}
|
LeftIcon={getIcon(view.icon)}
|
||||||
text={view.name}
|
text={view.name}
|
||||||
/>
|
/>
|
||||||
}
|
)
|
||||||
/>
|
}
|
||||||
))}
|
/>
|
||||||
|
))}
|
||||||
/>
|
/>
|
||||||
</DropdownMenuItemsContainer>
|
</DropdownMenuItemsContainer>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
|
|||||||
Reference in New Issue
Block a user