diff --git a/ui/v2.5/src/components/Dialogs/SubmitDraft.tsx b/ui/v2.5/src/components/Dialogs/SubmitDraft.tsx index 22b10d9ea..c3eceae8b 100644 --- a/ui/v2.5/src/components/Dialogs/SubmitDraft.tsx +++ b/ui/v2.5/src/components/Dialogs/SubmitDraft.tsx @@ -59,8 +59,6 @@ export const SubmitStashBoxDraft: React.FC = ({ const handleSelectBox = (e: React.ChangeEvent) => setSelectedBox(Number.parseInt(e.currentTarget.value) ?? 0); - console.log(data); - return ( = ({ const [slideshowRunning, setSlideshowRunning] = useState(false); const handleLightBoxPage = useCallback( (direction: number) => { - const { currentPage } = filter; if (direction === -1) { - if (currentPage === 1) { + if (filter.currentPage === 1) { onChangePage(pageCount); } else { - onChangePage(currentPage - 1); + onChangePage(filter.currentPage - 1); } } else if (direction === 1) { - if (currentPage === pageCount) { + if (filter.currentPage === pageCount) { // return to the first page onChangePage(1); } else { - onChangePage(currentPage + 1); + onChangePage(filter.currentPage + 1); } } }, - [onChangePage, filter, pageCount] + [onChangePage, filter.currentPage, pageCount] ); const handleClose = useCallback(() => { setSlideshowRunning(false); }, [setSlideshowRunning]); - const showLightbox = useLightbox({ + const lightboxState = useMemo(() => { + return { + images, + showNavigation: false, + pageCallback: pageCount > 1 ? handleLightBoxPage : undefined, + pageHeader: `Page ${filter.currentPage} / ${pageCount}`, + slideshowEnabled: slideshowRunning, + onClose: handleClose, + }; + }, [ images, - showNavigation: false, - pageCallback: pageCount > 1 ? handleLightBoxPage : undefined, - pageHeader: `Page ${filter.currentPage} / ${pageCount}`, - slideshowEnabled: slideshowRunning, - onClose: handleClose, - }); + pageCount, + filter.currentPage, + slideshowRunning, + handleClose, + handleLightBoxPage, + ]); + + const showLightbox = useLightbox(lightboxState); const handleImageOpen = useCallback( (index) => {