diff --git a/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx b/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx index 74409cb8..1e74bd95 100644 --- a/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx +++ b/app/[locale]/(protected)/contributor/content/image/components/table-image.tsx @@ -34,7 +34,7 @@ import { } from "@/components/ui/dropdown-menu"; import { Input } from "@/components/ui/input"; import { InputGroup, InputGroupText } from "@/components/ui/input-group"; -import { useParams } from "next/navigation"; +import { useParams, useSearchParams } from "next/navigation"; import TablePagination from "@/components/table/table-pagination"; import { listDataImage, listEnableCategory } from "@/service/content/content"; import Swal from "sweetalert2"; @@ -47,8 +47,7 @@ const TableImage = () => { const params = useParams(); const locale = params?.locale; const MySwal = withReactContent(Swal); - - // === STATES === + const searchParams = useSearchParams(); const [dataTable, setDataTable] = React.useState([]); const [totalData, setTotalData] = React.useState(1); const [totalPage, setTotalPage] = React.useState(1); @@ -63,8 +62,6 @@ const TableImage = () => { const [page, setPage] = React.useState(1); const [search, setSearch] = React.useState(""); const [searchTimeout, setSearchTimeout] = React.useState(null); - - // === FILTER STATES === const [categories, setCategories] = React.useState([]); const [selectedCategories, setSelectedCategories] = React.useState( [] @@ -105,14 +102,9 @@ const TableImage = () => { }, }); - // === EFFECTS === React.useEffect(() => { fetchData(); getCategories(); - }, [categoryFilter, statusFilter, page, showData, startDate, endDate]); - - React.useEffect(() => { - fetchData(); }, [ categoryFilter, statusFilter, @@ -121,11 +113,38 @@ const TableImage = () => { filterByCreator, filterBySource, filterByCreatorGroup, - // search, showData, page, ]); + React.useEffect(() => { + const pageFromUrl = searchParams?.get("page"); + if (pageFromUrl) { + setPage(Number(pageFromUrl)); + } + }, [searchParams]); + + // === EFFECTS === + // React.useEffect(() => { + // fetchData(); + // getCategories(); + // }, [categoryFilter, statusFilter, page, showData, startDate, endDate]); + + // React.useEffect(() => { + // fetchData(); + // }, [ + // categoryFilter, + // statusFilter, + // startDate, + // endDate, + // filterByCreator, + // filterBySource, + // filterByCreatorGroup, + // // search, + // showData, + // page, + // ]); + async function getCategories() { const category = await listEnableCategory("1"); const resCategory = category?.data?.data?.content; diff --git a/app/[locale]/(protected)/shared/curated-content/giat-penugasan/audio-visual.tsx b/app/[locale]/(protected)/shared/curated-content/giat-penugasan/audio-visual.tsx index b6936baa..f7be78ff 100644 --- a/app/[locale]/(protected)/shared/curated-content/giat-penugasan/audio-visual.tsx +++ b/app/[locale]/(protected)/shared/curated-content/giat-penugasan/audio-visual.tsx @@ -26,7 +26,7 @@ const VideoSliderPage = () => { }); const initFetch = async () => { const request = { - sortBy: type == "popular" ? "clickCount" : "createdAt", + sortBy: type == "popular" ? "favorite" : "createdAt", contentTypeId: "2", }; const response = await getListContent(request); diff --git a/app/[locale]/(protected)/shared/curated-content/giat-penugasan/audio.tsx b/app/[locale]/(protected)/shared/curated-content/giat-penugasan/audio.tsx index a95e3750..4baebf71 100644 --- a/app/[locale]/(protected)/shared/curated-content/giat-penugasan/audio.tsx +++ b/app/[locale]/(protected)/shared/curated-content/giat-penugasan/audio.tsx @@ -30,7 +30,7 @@ const AudioSliderPage = () => { }); const initFetch = async () => { const request = { - sortBy: type == "popular" ? "clickCount" : "createdAt", + sortBy: type == "popular" ? "favorite" : "createdAt", contentTypeId: "4", }; const response = await getListContent(request); diff --git a/app/[locale]/(protected)/shared/curated-content/giat-penugasan/image.tsx b/app/[locale]/(protected)/shared/curated-content/giat-penugasan/image.tsx index 54e823fd..ea3a1bc7 100644 --- a/app/[locale]/(protected)/shared/curated-content/giat-penugasan/image.tsx +++ b/app/[locale]/(protected)/shared/curated-content/giat-penugasan/image.tsx @@ -30,7 +30,7 @@ const ImageSliderPage = () => { }); const initFetch = async () => { const request = { - sortBy: type == "popular" ? "clickCount" : "createdAt", + sortBy: type == "popular" ? "favorite" : "createdAt", contentTypeId: "3", }; const response = await getListContent(request); diff --git a/app/[locale]/(protected)/shared/curated-content/giat-penugasan/teks.tsx b/app/[locale]/(protected)/shared/curated-content/giat-penugasan/teks.tsx index 3eda793a..e94d553e 100644 --- a/app/[locale]/(protected)/shared/curated-content/giat-penugasan/teks.tsx +++ b/app/[locale]/(protected)/shared/curated-content/giat-penugasan/teks.tsx @@ -30,7 +30,7 @@ const TeksSliderPage = () => { }); const initFetch = async () => { const request = { - sortBy: type == "popular" ? "clickCount" : "createdAt", + sortBy: type == "popular" ? "favorite" : "createdAt", contentTypeId: "1", }; const response = await getListContent(request); diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/all/filter/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/all/filter/page.tsx index c0687c4f..3241289c 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/all/filter/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/all/filter/page.tsx @@ -68,7 +68,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -97,7 +97,7 @@ export default function FilterPage() { setSearchTitle(title); setCategoryFilter(category ? category.split("&") : []); - setSortByOpt(sortBy === "popular" ? "clickCount" : "createdAt"); + setSortByOpt(sortBy === "popular" ? "favorite" : "createdAt"); }, [searchParams]); useEffect(() => { @@ -381,7 +381,7 @@ export default function FilterPage() { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/filter/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/filter/page.tsx index 6b234a07..0ee75684 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/filter/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/filter/page.tsx @@ -90,7 +90,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -435,7 +435,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/regional/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/regional/page.tsx index 71c90bf5..c412dd1f 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/regional/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/regional/page.tsx @@ -77,7 +77,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const [formatFilter, setFormatFilter] = useState([]); const pages = page ? page - 1 : 0; @@ -251,7 +251,7 @@ export default function FilterPage() { const handleSorting = (e: any) => { const value = e.target.value; - setSortByOpt(value === "latest" ? "createdAt" : "clickCount"); + setSortByOpt(value === "latest" ? "createdAt" : "favorite"); }; const handleDeleteDate = () => { diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/document/filter/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/document/filter/page.tsx index aee595b5..8767ffd1 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/document/filter/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/document/filter/page.tsx @@ -83,7 +83,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -451,7 +451,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/document/regional/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/document/regional/page.tsx index aa7c7f47..51028d74 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/document/regional/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/document/regional/page.tsx @@ -77,7 +77,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const [formatFilter, setFormatFilter] = useState([]); const pages = page ? page - 1 : 0; @@ -252,7 +252,7 @@ export default function FilterPage() { const handleSorting = (e: any) => { const value = e.target.value; - setSortByOpt(value === "latest" ? "createdAt" : "clickCount"); + setSortByOpt(value === "latest" ? "createdAt" : "favorite"); }; const handleDeleteDate = () => { diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/image/filter/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/image/filter/page.tsx index 45b55980..c1263dbe 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/image/filter/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/image/filter/page.tsx @@ -84,7 +84,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -432,7 +432,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/image/regional/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/image/regional/page.tsx index d83a0de5..78997ce7 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/image/regional/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/image/regional/page.tsx @@ -78,7 +78,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const [formatFilter, setFormatFilter] = useState([]); const pages = page ? page - 1 : 0; @@ -258,7 +258,7 @@ export default function FilterPage() { const handleSorting = (e: any) => { const value = e.target.value; - setSortByOpt(value === "latest" ? "createdAt" : "clickCount"); + setSortByOpt(value === "latest" ? "createdAt" : "favorite"); }; const handleDeleteDate = () => { diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/video/filter/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/video/filter/page.tsx index d4c2bb39..0d957a0a 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/video/filter/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/video/filter/page.tsx @@ -82,7 +82,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -445,7 +445,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/video/regional/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/video/regional/page.tsx index 1af0ecb0..fc5f548f 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/video/regional/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/video/regional/page.tsx @@ -77,7 +77,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const [formatFilter, setFormatFilter] = useState([]); const pages = page ? page - 1 : 0; @@ -252,7 +252,7 @@ export default function FilterPage() { const handleSorting = (e: any) => { const value = e.target.value; - setSortByOpt(value === "latest" ? "createdAt" : "clickCount"); + setSortByOpt(value === "latest" ? "createdAt" : "favorite"); }; const handleDeleteDate = () => { diff --git a/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/latest-news.tsx b/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/latest-news.tsx index 98105949..267edd65 100644 --- a/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/latest-news.tsx +++ b/app/[locale]/(public)/(polda)/tbnews/[polda_name]/components/latest-news.tsx @@ -119,7 +119,7 @@ const LatestNews = (props: { type: string }) => { // } async function fetchData() { - const sortBy = poldaName === "popular" ? "clickCount" : "createdAt"; + const sortBy = poldaName === "popular" ? "favorite" : "createdAt"; const res = await listData("1", "", "", 5, 0, sortBy, "", "", poldaName); let data = res?.data?.data?.content; setContent(data); diff --git a/app/[locale]/(public)/(satker)/satker/[satker_name]/all/filter/page.tsx b/app/[locale]/(public)/(satker)/satker/[satker_name]/all/filter/page.tsx index c0687c4f..3241289c 100644 --- a/app/[locale]/(public)/(satker)/satker/[satker_name]/all/filter/page.tsx +++ b/app/[locale]/(public)/(satker)/satker/[satker_name]/all/filter/page.tsx @@ -68,7 +68,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -97,7 +97,7 @@ export default function FilterPage() { setSearchTitle(title); setCategoryFilter(category ? category.split("&") : []); - setSortByOpt(sortBy === "popular" ? "clickCount" : "createdAt"); + setSortByOpt(sortBy === "popular" ? "favorite" : "createdAt"); }, [searchParams]); useEffect(() => { @@ -381,7 +381,7 @@ export default function FilterPage() { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/(satker)/satker/[satker_name]/audio/filter/page.tsx b/app/[locale]/(public)/(satker)/satker/[satker_name]/audio/filter/page.tsx index 8b8a8e97..0b08e148 100644 --- a/app/[locale]/(public)/(satker)/satker/[satker_name]/audio/filter/page.tsx +++ b/app/[locale]/(public)/(satker)/satker/[satker_name]/audio/filter/page.tsx @@ -90,7 +90,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -435,7 +435,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/(satker)/satker/[satker_name]/document/filter/page.tsx b/app/[locale]/(public)/(satker)/satker/[satker_name]/document/filter/page.tsx index fade069d..bc47d394 100644 --- a/app/[locale]/(public)/(satker)/satker/[satker_name]/document/filter/page.tsx +++ b/app/[locale]/(public)/(satker)/satker/[satker_name]/document/filter/page.tsx @@ -82,7 +82,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -442,7 +442,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/(satker)/satker/[satker_name]/image/filter/page.tsx b/app/[locale]/(public)/(satker)/satker/[satker_name]/image/filter/page.tsx index 2aaa37f3..ab68db80 100644 --- a/app/[locale]/(public)/(satker)/satker/[satker_name]/image/filter/page.tsx +++ b/app/[locale]/(public)/(satker)/satker/[satker_name]/image/filter/page.tsx @@ -83,7 +83,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -419,7 +419,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/(satker)/satker/[satker_name]/video/filter/page.tsx b/app/[locale]/(public)/(satker)/satker/[satker_name]/video/filter/page.tsx index bf376c11..9ae60b6e 100644 --- a/app/[locale]/(public)/(satker)/satker/[satker_name]/video/filter/page.tsx +++ b/app/[locale]/(public)/(satker)/satker/[satker_name]/video/filter/page.tsx @@ -79,7 +79,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -434,7 +434,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/all/filter/page.tsx b/app/[locale]/(public)/all/filter/page.tsx index e73be486..2319d691 100644 --- a/app/[locale]/(public)/all/filter/page.tsx +++ b/app/[locale]/(public)/all/filter/page.tsx @@ -69,7 +69,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -98,7 +98,7 @@ export default function FilterPage() { setSearchTitle(title); setCategoryFilter(category ? category.split("&") : []); - setSortByOpt(sortBy === "popular" ? "clickCount" : "createdAt"); + setSortByOpt(sortBy === "popular" ? "favorite" : "createdAt"); }, [searchParams]); useEffect(() => { @@ -382,7 +382,7 @@ export default function FilterPage() { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/audio/filter/page.tsx b/app/[locale]/(public)/audio/filter/page.tsx index 338c43dd..ed63aa82 100644 --- a/app/[locale]/(public)/audio/filter/page.tsx +++ b/app/[locale]/(public)/audio/filter/page.tsx @@ -82,7 +82,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -437,7 +437,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/document/filter/page.tsx b/app/[locale]/(public)/document/filter/page.tsx index 98b94829..f469a00c 100644 --- a/app/[locale]/(public)/document/filter/page.tsx +++ b/app/[locale]/(public)/document/filter/page.tsx @@ -83,7 +83,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -453,7 +453,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/image/filter/page.tsx b/app/[locale]/(public)/image/filter/page.tsx index 67b68cc8..5d46c021 100644 --- a/app/[locale]/(public)/image/filter/page.tsx +++ b/app/[locale]/(public)/image/filter/page.tsx @@ -85,7 +85,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -441,7 +441,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/regional/all-polda/audio/regional/page.tsx b/app/[locale]/(public)/regional/all-polda/audio/regional/page.tsx index 71c90bf5..c412dd1f 100644 --- a/app/[locale]/(public)/regional/all-polda/audio/regional/page.tsx +++ b/app/[locale]/(public)/regional/all-polda/audio/regional/page.tsx @@ -77,7 +77,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const [formatFilter, setFormatFilter] = useState([]); const pages = page ? page - 1 : 0; @@ -251,7 +251,7 @@ export default function FilterPage() { const handleSorting = (e: any) => { const value = e.target.value; - setSortByOpt(value === "latest" ? "createdAt" : "clickCount"); + setSortByOpt(value === "latest" ? "createdAt" : "favorite"); }; const handleDeleteDate = () => { diff --git a/app/[locale]/(public)/regional/all-polda/document/regional/page.tsx b/app/[locale]/(public)/regional/all-polda/document/regional/page.tsx index aa7c7f47..51028d74 100644 --- a/app/[locale]/(public)/regional/all-polda/document/regional/page.tsx +++ b/app/[locale]/(public)/regional/all-polda/document/regional/page.tsx @@ -77,7 +77,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const [formatFilter, setFormatFilter] = useState([]); const pages = page ? page - 1 : 0; @@ -252,7 +252,7 @@ export default function FilterPage() { const handleSorting = (e: any) => { const value = e.target.value; - setSortByOpt(value === "latest" ? "createdAt" : "clickCount"); + setSortByOpt(value === "latest" ? "createdAt" : "favorite"); }; const handleDeleteDate = () => { diff --git a/app/[locale]/(public)/regional/all-polda/image/regional/page.tsx b/app/[locale]/(public)/regional/all-polda/image/regional/page.tsx index d83a0de5..78997ce7 100644 --- a/app/[locale]/(public)/regional/all-polda/image/regional/page.tsx +++ b/app/[locale]/(public)/regional/all-polda/image/regional/page.tsx @@ -78,7 +78,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const [formatFilter, setFormatFilter] = useState([]); const pages = page ? page - 1 : 0; @@ -258,7 +258,7 @@ export default function FilterPage() { const handleSorting = (e: any) => { const value = e.target.value; - setSortByOpt(value === "latest" ? "createdAt" : "clickCount"); + setSortByOpt(value === "latest" ? "createdAt" : "favorite"); }; const handleDeleteDate = () => { diff --git a/app/[locale]/(public)/regional/all-polda/video/regional/page.tsx b/app/[locale]/(public)/regional/all-polda/video/regional/page.tsx index 1af0ecb0..fc5f548f 100644 --- a/app/[locale]/(public)/regional/all-polda/video/regional/page.tsx +++ b/app/[locale]/(public)/regional/all-polda/video/regional/page.tsx @@ -77,7 +77,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const [formatFilter, setFormatFilter] = useState([]); const pages = page ? page - 1 : 0; @@ -252,7 +252,7 @@ export default function FilterPage() { const handleSorting = (e: any) => { const value = e.target.value; - setSortByOpt(value === "latest" ? "createdAt" : "clickCount"); + setSortByOpt(value === "latest" ? "createdAt" : "favorite"); }; const handleDeleteDate = () => { diff --git a/app/[locale]/(public)/regional/filter/page.tsx b/app/[locale]/(public)/regional/filter/page.tsx index 9301ee6d..be2dc26a 100644 --- a/app/[locale]/(public)/regional/filter/page.tsx +++ b/app/[locale]/(public)/regional/filter/page.tsx @@ -69,7 +69,7 @@ export default function FilterPage() { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const isRegional = asPath?.includes("regional"); const isSatker = asPath?.includes("satker"); @@ -371,7 +371,7 @@ export default function FilterPage() { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change); diff --git a/app/[locale]/(public)/video/filter/page.tsx b/app/[locale]/(public)/video/filter/page.tsx index 9dabdbf6..e6c71b9c 100644 --- a/app/[locale]/(public)/video/filter/page.tsx +++ b/app/[locale]/(public)/video/filter/page.tsx @@ -82,7 +82,7 @@ const FilterPage = () => { const [monthYearFilter, setMonthYearFilter] = useState(); const [searchTitle, setSearchTitle] = useState(""); const [sortByOpt, setSortByOpt] = useState( - sortBy === "popular" ? "clickCount" : "createdAt" + sortBy === "popular" ? "favorite" : "createdAt" ); const poldaName = params?.polda_name; const satkerName = params?.satker_name; @@ -451,7 +451,7 @@ const FilterPage = () => { if (e.target.value == "terbaru") { setSortByOpt("createdAt"); } else { - setSortByOpt("clickCount"); + setSortByOpt("favorite"); } setChange(!change);