diff --git a/src/pages/Gallary/ImageGallary.jsx b/src/pages/Gallary/ImageGallary.jsx index aeac34bd..eb7bd8ad 100644 --- a/src/pages/Gallary/ImageGallary.jsx +++ b/src/pages/Gallary/ImageGallary.jsx @@ -5,10 +5,11 @@ import { useSelector } from "react-redux"; import { useModal } from "./ModalContext"; import ImagePop from "./ImagePop"; import Avatar from "../../components/common/Avatar"; +import DateRangePicker from "../../components/common/DateRangePicker"; import eventBus from "../../services/eventBus"; import Breadcrumb from "../../components/common/Breadcrumb"; import { formatUTCToLocalTime } from "../../utils/dateUtils"; -import DateRangePicker from "../../components/common/DateRangePicker"; +import useImageGallery from "../../hooks/useImageGallery"; const SCROLL_THRESHOLD = 5; @@ -152,15 +153,8 @@ const ImageGallery = () => { const getUniqueValuesWithIds = useCallback((idKey, nameKey) => { const map = new Map(); allImagesData.forEach(batch => { - let id; - if (idKey === "floorIds") { - id = batch.floorIds; - } else { - id = batch[idKey]; - } - + let id = idKey === "floorIds" ? batch.floorIds : batch[idKey]; const name = batch[nameKey]; - if (id && name && !map.has(id)) { map.set(id, name); } @@ -245,9 +239,7 @@ const ImageGallery = () => { } return false; } - if ((oldVal === null && newVal === "") || (oldVal === "" && newVal === null)) { - return false; - } + if ((oldVal === null && newVal === "") || (oldVal === "" && newVal === null)) return false; return oldVal !== newVal; }); @@ -352,12 +344,7 @@ const ImageGallery = () => { return (