From 64b7da44b5511e626497aa66fce6f265fd855c5d Mon Sep 17 00:00:00 2001 From: hanif salafi Date: Mon, 13 Jan 2025 00:22:47 +0700 Subject: [PATCH 1/5] feat: update landing image filter --- .../(public)/document/filter/page.tsx | 3 +- app/[locale]/(public)/image/filter/page.tsx | 21 +++++-- app/[locale]/(public)/video/filter/page.tsx | 1 + app/[locale]/globals.css | 2 +- components/landing-page/new-content.tsx | 1 + components/ui/image-blurry.tsx | 61 +++++++++++++++++++ service/landing/landing.ts | 6 +- 7 files changed, 85 insertions(+), 10 deletions(-) create mode 100644 components/ui/image-blurry.tsx diff --git a/app/[locale]/(public)/document/filter/page.tsx b/app/[locale]/(public)/document/filter/page.tsx index edd10c88..e58cea5a 100644 --- a/app/[locale]/(public)/document/filter/page.tsx +++ b/app/[locale]/(public)/document/filter/page.tsx @@ -285,8 +285,9 @@ const FilterPage = () => { useEffect(() => { initFetch(); }, [page]); + const initFetch = async () => { - const response = await getListContent({ page: page - 1, size: 6, sortBy: "createdAt", contentTypeId: "3" }); + const response = await getListContent({ page: page - 1, size: 6, sortBy: "createdAt", contentTypeId: "3", isInt: locale == "en" ? true : false }); console.log(response); setDocumentData(response?.data?.data?.content); const data = response?.data?.data; diff --git a/app/[locale]/(public)/image/filter/page.tsx b/app/[locale]/(public)/image/filter/page.tsx index a7e9b1e7..03cf5000 100644 --- a/app/[locale]/(public)/image/filter/page.tsx +++ b/app/[locale]/(public)/image/filter/page.tsx @@ -15,6 +15,7 @@ import ReactDatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import { close, loading } from "@/config/swal"; import { useTranslations } from "next-intl"; +import ImageBlurry from "@/components/ui/image-blurry"; const columns: ColumnDef[] = [ { @@ -154,7 +155,8 @@ const FilterPage = () => { startDateString, endDateString, monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "" + monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + locale == "en" ? true : false, ); close(); // setGetTotalPage(response?.data?.data?.totalPages); @@ -368,7 +370,7 @@ const FilterPage = () => { {/* Left */}
-
+

Filter @@ -483,11 +485,20 @@ const FilterPage = () => { {imageData?.length > 0 ? (
{imageData?.map((image: any) => ( - + - -
+ {/* */} +
+ +
+
{formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| {image?.clickCount}{" "} diff --git a/app/[locale]/(public)/video/filter/page.tsx b/app/[locale]/(public)/video/filter/page.tsx index 15862735..915d1c46 100644 --- a/app/[locale]/(public)/video/filter/page.tsx +++ b/app/[locale]/(public)/video/filter/page.tsx @@ -289,6 +289,7 @@ const FilterPage = () => { size: 6, sortBy: "createdAt", contentTypeId: "2", + isInt: locale == "en" ? true : false, }); console.log(response); setVideoData(response?.data?.data?.content); diff --git a/app/[locale]/globals.css b/app/[locale]/globals.css index 18ad9f8a..688a4f26 100644 --- a/app/[locale]/globals.css +++ b/app/[locale]/globals.css @@ -582,4 +582,4 @@ html[dir="rtl"] .react-select .select__loading-indicator { /* Hide FullCalendar grid elements */ .fc-view-harness:has(.hide-calendar-grid) { display: none; -} +} \ No newline at end of file diff --git a/components/landing-page/new-content.tsx b/components/landing-page/new-content.tsx index ce002d84..70a45bc8 100644 --- a/components/landing-page/new-content.tsx +++ b/components/landing-page/new-content.tsx @@ -36,6 +36,7 @@ const NewContent = (props: { group: string, type: string }) => { group: props.group == "mabes" ? "" : props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName : props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-"+satkerName : "", + isInt: locale == "en" ? true : false }; const response = await getListContent(request); console.log("category", response); diff --git a/components/ui/image-blurry.tsx b/components/ui/image-blurry.tsx new file mode 100644 index 00000000..fc32ef6d --- /dev/null +++ b/components/ui/image-blurry.tsx @@ -0,0 +1,61 @@ +import React, { useEffect, useState } from 'react'; + +interface ImageBlurryProps { + src: string; + alt?: string; + classname?: string; + key?: string | number; + style?: React.CSSProperties; +} + +const ImageBlurry: React.FC = (props) => { + const { src, alt, classname, key, style } = props; + + const [imgSrc, setImgSrc] = useState(src); + const [isError, setIsError] = useState(false); + + useEffect(() => { + setImgSrc(src); + }, [src]); + + const handleImage = () => { + const pics = document.querySelectorAll('img'); + pics.forEach((pic) => { + if (pic.complete) { + checkImage(pic); + } else { + pic.addEventListener('load', function () { + checkImage(this); + }); + } + }); + }; + + const checkImage = (img: HTMLImageElement) => { + if (img.naturalHeight > img.naturalWidth) { + img.classList.add('portrait'); + } else if (Math.abs(img.naturalHeight - img.naturalWidth) < 10) { + img.classList.add('square'); + } else { + img.classList.add('landscape'); + } + }; + + const onLoad = () => { + console.log('Image loaded:', src); + handleImage(); + }; + + return ( + //
+ //
+ //
+ //
+
+
+
+
+ ); +}; + +export default ImageBlurry; diff --git a/service/landing/landing.ts b/service/landing/landing.ts index 96159ff3..4e00d550 100644 --- a/service/landing/landing.ts +++ b/service/landing/landing.ts @@ -11,7 +11,7 @@ export async function getCategoryData() { export async function getListContent(props: any) { return await httpGetInterceptor( - `media/public/list?enablePage=1&sort=desc&sortBy=${props.sortBy}&size=${props.size}&page=${props.page}&typeId=${props.contentTypeId}&title=${props.title}&group=${props.group}&categoryId=&fileFormats=&tags=&startDate=&endDate=&month=&year=` + `media/public/list?enablePage=1&sort=desc&sortBy=${props.sortBy}&size=${props.size}&isInt=${props.isInt}&typeId=${props.contentTypeId}&title=${props.title}&group=${props.group}&group=${props.group}&categoryId=&fileFormats=&tags=&startDate=&endDate=&month=&year=` ); } @@ -47,9 +47,9 @@ export async function publicDetailBlog(slug: any) { return await httpGetInterceptor(`blog/public/read/${slug}`); } -export async function listData(type: string, search: string, category: string, size = 10, page = 0, sortBy = "createdAt", format = "", tag = "", group = "", startDate = "", endDate = "", month = "", year = "") { +export async function listData(type: string, search: string, category: string, size = 10, page = 0, sortBy = "createdAt", format = "", tag = "", group = "", startDate = "", endDate = "", month = "", year = "", isInt = false) { return await httpGetInterceptor( - `media/public/list?enablePage=1&sort=desc&sortBy=${sortBy}&size=${size}&page=${page}&typeId=${type}&title=${search}&categoryId=${category}&fileFormats=${format}&tags=${tag}&group=${group}&startDate=${startDate}&endDate=${endDate}&month=${month}&year=${year}` + `media/public/list?enablePage=1&sort=desc&sortBy=${sortBy}&size=${size}&page=${page}&typeId=${type}&title=${search}&categoryId=${category}&fileFormats=${format}&tags=${tag}&group=${group}&startDate=${startDate}&endDate=${endDate}&month=${month}&year=${year}&isInt=${isInt}` ); } From 4122a482f772bd85b7edee10f0ff3b9720fa53d3 Mon Sep 17 00:00:00 2001 From: hanif salafi Date: Mon, 13 Jan 2025 00:32:06 +0700 Subject: [PATCH 2/5] feat: fixing image filter --- app/[locale]/(public)/image/filter/page.tsx | 103 ++++++++++---------- 1 file changed, 53 insertions(+), 50 deletions(-) diff --git a/app/[locale]/(public)/image/filter/page.tsx b/app/[locale]/(public)/image/filter/page.tsx index 03cf5000..bf4ee07e 100644 --- a/app/[locale]/(public)/image/filter/page.tsx +++ b/app/[locale]/(public)/image/filter/page.tsx @@ -188,7 +188,8 @@ const FilterPage = () => { startDateString, endDateString, monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "", - monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "" + monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "", + locale == "en" ? true : false, ); close(); // setGetTotalPage(response?.data?.data?.totalPages); @@ -472,57 +473,59 @@ const FilterPage = () => {
{/* Konten Kanan */} - -
-
-

{t("sortBy")}

- -
- - {imageData?.length > 0 ? ( -
- {imageData?.map((image: any) => ( - - - - {/* */} -
- -
-
- {formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| - {image?.clickCount}{" "} - - - {" "} -
-
{image?.title}
- -
-
- ))} +
+ +
+
+

{t("sortBy")}

+
- ) : ( -

- empty -

- )} - -
-
+ {imageData?.length > 0 ? ( +
+ {imageData?.map((image: any) => ( + + + + {/* */} +
+ +
+
+ {formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| + {image?.clickCount}{" "} + + + {" "} +
+
{image?.title}
+ +
+
+ ))} +
+ ) : ( +

+ empty +

+ )} + + {totalData > 1 && } +
+ +
); From 9ea4d15611e388592d4ecbdce3e996d0a4e47240 Mon Sep 17 00:00:00 2001 From: hanif salafi Date: Mon, 13 Jan 2025 07:35:40 +0700 Subject: [PATCH 3/5] feat: update category in landing, update menu admin polda --- .../agenda-setting/calender-view.tsx | 2 +- .../(polda)/polda/[polda_name]/page.tsx | 2 +- .../(satker)/satker/[satker_name]/page.tsx | 2 +- app/[locale]/page.tsx | 2 +- components/form/task/task-detail-form.tsx | 453 ++++++----- components/landing-page/content-category.tsx | 17 +- lib/menus.ts | 763 +++++++++++------- service/landing/landing.ts | 6 +- 8 files changed, 708 insertions(+), 539 deletions(-) diff --git a/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx b/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx index c3747ff5..4e6995e1 100644 --- a/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx +++ b/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx @@ -494,7 +494,7 @@ const CalendarView = ({ categories }: CalendarViewProps) => { - {roleId == 10 || roleId == 11 ? + {roleId == 11 || roleId == 12 ?
); }; diff --git a/app/[locale]/(public)/(satker)/satker/[satker_name]/page.tsx b/app/[locale]/(public)/(satker)/satker/[satker_name]/page.tsx index e00b68ee..b230f1a6 100644 --- a/app/[locale]/(public)/(satker)/satker/[satker_name]/page.tsx +++ b/app/[locale]/(public)/(satker)/satker/[satker_name]/page.tsx @@ -13,7 +13,7 @@ const page = () => { - +

); }; diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx index 9a20f27b..8a356fe5 100644 --- a/app/[locale]/page.tsx +++ b/app/[locale]/page.tsx @@ -22,7 +22,7 @@ const Home = ({ params: { locale } }: { params: { locale: string } }) => { {/* */} - +
diff --git a/components/form/task/task-detail-form.tsx b/components/form/task/task-detail-form.tsx index 8ff676db..250ac5be 100644 --- a/components/form/task/task-detail-form.tsx +++ b/components/form/task/task-detail-form.tsx @@ -1156,48 +1156,68 @@ export default function FormTaskDetail() {
-
-
- -
-
- -
-
+
+ {detail?.isDone !== true && + (Number(userLevelNumber) !== 3 || + Number(userLevelNumber) == 2) ? ( + + ) : ( + "" + ) } - > -
+
+
+ +
+
+ +
+
- Hasil Upload - + +
{isTableResult && ( @@ -1223,184 +1243,186 @@ export default function FormTaskDetail() { )} {showInput && ( -
-