From 3ba99762a1fd9045bb973141ab8e7e1fd3b80b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon-Pierre=20Krautkra=CC=88mer?= Date: Wed, 8 Nov 2023 10:47:53 +0100 Subject: [PATCH] resolve marius issues no2 --- .../components/views/exhibitions/ExhibitionTool.tsx | 2 -- .../components/views/exhibitions/ExhibitonUtils.tsx | 11 +++-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/projects/bp-gallery/src/components/views/exhibitions/ExhibitionTool.tsx b/projects/bp-gallery/src/components/views/exhibitions/ExhibitionTool.tsx index 3dfaf8e35..09fb5bfe4 100644 --- a/projects/bp-gallery/src/components/views/exhibitions/ExhibitionTool.tsx +++ b/projects/bp-gallery/src/components/views/exhibitions/ExhibitionTool.tsx @@ -159,7 +159,6 @@ const ExhibitionManipulator = () => { if (node.currentTarget.scrollTop !== 0) scroll.current = Number(node.currentTarget.scrollTop); }; - //const [sortableIds, setSortableIds] = useState(sections!); //(sections?.map(elem => elem.id) ?? []); const [activeId, setActiveId] = useState(undefined); const [isDragMode, setIsDragMode] = useState(false); @@ -171,7 +170,6 @@ const ExhibitionManipulator = () => { if (over && active.id !== over.id) { moveSections(active.id.toString(), over.id.toString()); } - //setSortableIds(sections!); setActiveId(undefined); }; diff --git a/projects/bp-gallery/src/components/views/exhibitions/ExhibitonUtils.tsx b/projects/bp-gallery/src/components/views/exhibitions/ExhibitonUtils.tsx index b431db2e0..9ef8acfbf 100644 --- a/projects/bp-gallery/src/components/views/exhibitions/ExhibitonUtils.tsx +++ b/projects/bp-gallery/src/components/views/exhibitions/ExhibitonUtils.tsx @@ -184,7 +184,6 @@ const ExhibitionPicture = ({ { - console.log('press'); deleteExhibitionPicture(exhibitionPicture.id); }} > @@ -332,9 +331,7 @@ export const ExhibitionStateChanger = ({ sections, setSections, databaseSaver, - titlePicture, setTitlePicture, - idealot, setIdealot, children, }: PropsWithChildren<{ @@ -344,9 +341,7 @@ export const ExhibitionStateChanger = ({ sections: SectionState[]; setSections: Dispatch>; databaseSaver: ReturnType; - titlePicture: DragElement | undefined; setTitlePicture: Dispatch>; - idealot: DragElement[] | undefined; setIdealot: Dispatch>; }>) => { const deleteExhibitionPicture = (exhibitionPictureId: string) => { @@ -431,8 +426,8 @@ const ExhibitionDragNDrop = ({ const [isSorting, setIsSorting] = useState(false); const moveSections = (oldSectionId: string, newSectionId: string) => { - const oldIndex = sections.indexOf(sections.find(section => section.id === oldSectionId)!); - const newIndex = sections.indexOf(sections.find(section => section.id === newSectionId)!); + const oldIndex = sections.findIndex(section => section.id === oldSectionId); + const newIndex = sections.findIndex(section => section.id === newSectionId); const newSectionOrder = arrayMove(sections, oldIndex, newIndex); databaseSaver.updateSectionsOrder(newSectionOrder); setSections(newSectionOrder); @@ -448,7 +443,7 @@ const ExhibitionDragNDrop = ({ : section ); setSections(newDraggablesOrder); - databaseSaver.moveOrderInExhibitionPicture(sections, sectionId); + databaseSaver.moveOrderInExhibitionPicture(newDraggablesOrder, sectionId); }; const getSorting = () => {