diff --git a/src/pages/Gallary/ImageGallary.jsx b/src/pages/Gallary/ImageGallary.jsx
index 70f3cf9c..54573c56 100644
--- a/src/pages/Gallary/ImageGallary.jsx
+++ b/src/pages/Gallary/ImageGallary.jsx
@@ -212,7 +212,7 @@ const ImageGallery = () => {
map.set(id, name);
}
});
- return Array.from(map.entries());
+ return Array.from(map.entries()).sort((a, b) => a[1].localeCompare(b[1]));
}, [allImagesData]);
const getUniqueUploadedByUsers = useCallback(() => {
@@ -227,7 +227,7 @@ const ImageGallery = () => {
}
});
});
- return Array.from(uniqueUsersMap.entries());
+ return Array.from(uniqueUsersMap.entries()).sort((a, b) => a[1].localeCompare(b[1]));
}, [allImagesData]);
const buildings = getUniqueValuesWithIds("buildingId", "buildingName");
@@ -365,7 +365,7 @@ const ImageGallery = () => {
}, []);
const renderFilterCategory = (label, items, type) => (
-
+
toggleCollapse(type)}>
{label}
@@ -595,6 +595,14 @@ const ImageGallery = () => {
aria-label="Close"
>
+
+
+
+
{renderFilterCategory("Date Range", [], "dateRange")}
{renderFilterCategory("Building", buildings, "building")}
@@ -604,14 +612,7 @@ const ImageGallery = () => {
{renderFilterCategory("Uploaded By (User)", uploadedByUsers, "uploadedBy")}
{renderFilterCategory("Work Category", workCategories, "workCategory")}
-
-
-
-
+
diff --git a/src/pages/Gallary/ImageGallery.css b/src/pages/Gallary/ImageGallery.css
index 4f7ada69..3724e0f6 100644
--- a/src/pages/Gallary/ImageGallery.css
+++ b/src/pages/Gallary/ImageGallery.css
@@ -3,9 +3,7 @@
gap: 4px;
padding: 25px;
font-family: sans-serif;
- height: calc(100vh - 20px);
box-sizing: border-box;
- background-color: #f7f9fc;
transition: grid-template-columns 0.3s ease-in-out;
}
@@ -67,8 +65,9 @@
transition: background-color 0.2s ease, box-shadow 0.2s ease, width 0.3s ease-in-out,
height 0.3s ease-in-out, border-radius 0.3s ease-in-out, padding 0.3s ease-in-out;
position: absolute;
- top: 250px;
+ top: 150px;
right: 0;
+ position: fixed;
height: 40px;
width: 40px;
z-index: 100;
@@ -138,7 +137,7 @@
border-radius: 0 0 4px 4px;
max-height: 150px;
/* Default max-height for scrollable dropdowns */
- overflow-y: auto;
+
/* Default overflow for scrollable dropdowns */
transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
}
diff --git a/src/utils/dateUtils.jsx b/src/utils/dateUtils.jsx
index cb393e41..fbe47e74 100644
--- a/src/utils/dateUtils.jsx
+++ b/src/utils/dateUtils.jsx
@@ -20,12 +20,12 @@ export const getDateDifferenceInDays = (startDate, endDate) => {
return differenceInDays;
};
-export const formatDate = (date) => {
- if (!date) return ""; // Return an empty string if no date
- const dateObj = new Date(date);
- // return dateObj.toISOString().split("T")[0];
- return dateObj.toLocaleDateString('en-CA'); // Get the date in YYYY-MM-DD format
-};
+// export const formatDate = (date) => {
+// if (!date) return ""; // Return an empty string if no date
+// const dateObj = new Date(date);
+// // return dateObj.toISOString().split("T")[0];
+// return dateObj.toLocaleDateString('en-CA'); // Get the date in YYYY-MM-DD format
+// };
export const convertShortTime = (dateString) => {
const date = new Date(dateString);
@@ -61,3 +61,23 @@ export const checkIfCurrentDate = (dateString) => {
return currentDate.getTime() === inputDate.getTime();
};
+function utcToLocalTime(utcTime) {
+ // Convert string to Date if needed
+ const utcDate = typeof utcTime === 'string' ? new Date(utcTime) : utcTime;
+
+ return new Date(utcDate.getTime());
+}
+
+export const formatDate =(utcTime, options = {}) =>{
+ const localDate = utcToLocalTime(utcTime);
+
+ const defaultOptions = {
+ day: '2-digit',
+ month: '2-digit',
+ year: 'numeric',
+ ...options
+ };
+
+ return localDate.toLocaleDateString('en-GB', defaultOptions);
+}
+