Skip to content

Commit

Permalink
resolve marius issues no2
Browse files Browse the repository at this point in the history
  • Loading branch information
rheaSPK committed Nov 8, 2023
1 parent 275b3a4 commit 3ba9976
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | undefined>(undefined);
const [isDragMode, setIsDragMode] = useState(false);

Expand All @@ -171,7 +170,6 @@ const ExhibitionManipulator = () => {
if (over && active.id !== over.id) {
moveSections(active.id.toString(), over.id.toString());
}
//setSortableIds(sections!);
setActiveId(undefined);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ const ExhibitionPicture = ({
<IconButton
style={{ backgroundColor: 'white' }}
onClick={() => {
console.log('press');
deleteExhibitionPicture(exhibitionPicture.id);
}}
>
Expand Down Expand Up @@ -332,9 +331,7 @@ export const ExhibitionStateChanger = ({
sections,
setSections,
databaseSaver,
titlePicture,
setTitlePicture,
idealot,
setIdealot,
children,
}: PropsWithChildren<{
Expand All @@ -344,9 +341,7 @@ export const ExhibitionStateChanger = ({
sections: SectionState[];
setSections: Dispatch<SetStateAction<SectionState[]>>;
databaseSaver: ReturnType<typeof useExhibitionDatabaseSaver>;
titlePicture: DragElement | undefined;
setTitlePicture: Dispatch<SetStateAction<DragElement | undefined>>;
idealot: DragElement[] | undefined;
setIdealot: Dispatch<SetStateAction<DragElement[]>>;
}>) => {
const deleteExhibitionPicture = (exhibitionPictureId: string) => {
Expand Down Expand Up @@ -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);
Expand All @@ -448,7 +443,7 @@ const ExhibitionDragNDrop = ({
: section
);
setSections(newDraggablesOrder);
databaseSaver.moveOrderInExhibitionPicture(sections, sectionId);
databaseSaver.moveOrderInExhibitionPicture(newDraggablesOrder, sectionId);
};

const getSorting = () => {
Expand Down

0 comments on commit 3ba9976

Please sign in to comment.