Merge branch 'dev-sabda' of https://gitlab.com/hanifsalafi/mediahub_redesign
This commit is contained in:
commit
6912aefb2a
|
|
@ -0,0 +1,635 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
|
import { getOnlyDate, getOnlyMonthAndYear } from "@/utils/globals";
|
||||||
|
import { useParams, usePathname, useSearchParams } from "next/navigation";
|
||||||
|
import {
|
||||||
|
getUserLevelListByParent,
|
||||||
|
listCategory,
|
||||||
|
listData,
|
||||||
|
listDataAll,
|
||||||
|
listDataRegional,
|
||||||
|
} from "@/service/landing/landing";
|
||||||
|
import {
|
||||||
|
ColumnDef,
|
||||||
|
ColumnFiltersState,
|
||||||
|
PaginationState,
|
||||||
|
SortingState,
|
||||||
|
VisibilityState,
|
||||||
|
getCoreRowModel,
|
||||||
|
getFilteredRowModel,
|
||||||
|
getPaginationRowModel,
|
||||||
|
getSortedRowModel,
|
||||||
|
useReactTable,
|
||||||
|
} from "@tanstack/react-table";
|
||||||
|
import { Reveal } from "@/components/landing-page/Reveal";
|
||||||
|
import { Link, useRouter } from "@/i18n/routing";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import ReactDatePicker from "react-datepicker";
|
||||||
|
import "react-datepicker/dist/react-datepicker.css";
|
||||||
|
import { close, loading } from "@/config/swal";
|
||||||
|
import FilterImageComponent from "@/components/landing-page/filter-all/image-filter-card";
|
||||||
|
import FilterVideoComponent from "@/components/landing-page/filter-all/video-filter-card";
|
||||||
|
import FilterDocumentComponent from "@/components/landing-page/filter-all/document-filter-card";
|
||||||
|
import FilterAudioComponent from "@/components/landing-page/filter-all/audio-filter-card";
|
||||||
|
|
||||||
|
export default function FilterPage() {
|
||||||
|
const router = useRouter();
|
||||||
|
const asPath = usePathname();
|
||||||
|
const params = useParams();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const locale = params?.locale;
|
||||||
|
const [imageData, setImageData] = useState<any>();
|
||||||
|
const [totalData, setTotalData] = React.useState<number>(1);
|
||||||
|
const [totalPage, setTotalPage] = React.useState<number>(1);
|
||||||
|
const [sorting, setSorting] = React.useState<SortingState>([]);
|
||||||
|
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
const [columnVisibility, setColumnVisibility] =
|
||||||
|
React.useState<VisibilityState>({});
|
||||||
|
const [rowSelection, setRowSelection] = React.useState({});
|
||||||
|
const [pagination, setPagination] = React.useState<PaginationState>({
|
||||||
|
pageIndex: 0,
|
||||||
|
pageSize: 10,
|
||||||
|
});
|
||||||
|
const [page, setPage] = useState(1);
|
||||||
|
const [totalContent, setTotalContent] = useState();
|
||||||
|
const [change, setChange] = useState(false);
|
||||||
|
const sortBy = searchParams?.get("sortBy");
|
||||||
|
const title = searchParams?.get("title");
|
||||||
|
const categorie = searchParams?.get("category");
|
||||||
|
const group = searchParams?.get("group");
|
||||||
|
const tag: any = searchParams?.get("tag");
|
||||||
|
const [contentImage, setContentImage] = useState([]);
|
||||||
|
const [, setGetTotalPage] = useState();
|
||||||
|
let typingTimer: any;
|
||||||
|
const doneTypingInterval = 1500;
|
||||||
|
const [search, setSearch] = useState();
|
||||||
|
const [categoryFilter, setCategoryFilter] = useState<any>([]);
|
||||||
|
const [monthYearFilter, setMonthYearFilter] = useState<any>();
|
||||||
|
const [searchTitle, setSearchTitle] = useState<string>("");
|
||||||
|
const [sortByOpt, setSortByOpt] = useState<any>(
|
||||||
|
sortBy === "popular" ? "clickCount" : "createdAt"
|
||||||
|
);
|
||||||
|
const isRegional = asPath?.includes("regional");
|
||||||
|
const isSatker = asPath?.includes("satker");
|
||||||
|
const [formatFilter, setFormatFilter] = useState<any>([]);
|
||||||
|
const pages = page ? page - 1 : 0;
|
||||||
|
const [startDateString, setStartDateString] = useState<any>();
|
||||||
|
const [endDateString, setEndDateString] = useState<any>();
|
||||||
|
const [dateRange, setDateRange] = useState<any>([null, null]);
|
||||||
|
const [calenderState, setCalenderState] = useState(false);
|
||||||
|
const [handleClose, setHandleClose] = useState(false);
|
||||||
|
const [categories, setCategories] = useState([]);
|
||||||
|
const [userLevels, setUserLevels] = useState([]);
|
||||||
|
const [contentAll, setContentAll] = useState([]);
|
||||||
|
|
||||||
|
// const [startDate, endDate] = dateRange;
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
const pageFromUrl = searchParams?.get("page");
|
||||||
|
if (pageFromUrl) {
|
||||||
|
setPage(Number(pageFromUrl));
|
||||||
|
}
|
||||||
|
}, [searchParams]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
getCategories();
|
||||||
|
// getSelectedCategory();
|
||||||
|
if (isSatker) {
|
||||||
|
getUserLevels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (categorie) {
|
||||||
|
setCategoryFilter(
|
||||||
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
"Kategori",
|
||||||
|
categorie,
|
||||||
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, [categorie]);
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// fetchData();
|
||||||
|
// }, [page, sortBy, sortByOpt, title]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
if (isRegional) {
|
||||||
|
getDataRegional();
|
||||||
|
} else {
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(monthYearFilter, "monthFilter");
|
||||||
|
initState();
|
||||||
|
}, [
|
||||||
|
change,
|
||||||
|
monthYearFilter,
|
||||||
|
sortBy,
|
||||||
|
sortByOpt,
|
||||||
|
title,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
categorie,
|
||||||
|
formatFilter,
|
||||||
|
]);
|
||||||
|
|
||||||
|
async function getCategories() {
|
||||||
|
const category = await listCategory("1");
|
||||||
|
const resCategory = category?.data?.data?.content;
|
||||||
|
setCategories(resCategory);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
function initState() {
|
||||||
|
if (dateRange[0] != null && dateRange[1] != null) {
|
||||||
|
setStartDateString(getOnlyDate(dateRange[0]));
|
||||||
|
setEndDateString(getOnlyDate(dateRange[1]));
|
||||||
|
setHandleClose(true);
|
||||||
|
console.log("date range", dateRange, getOnlyDate(dateRange[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
initState();
|
||||||
|
}, [calenderState]);
|
||||||
|
|
||||||
|
async function getData() {
|
||||||
|
if (asPath?.includes("/polda/") == true) {
|
||||||
|
if (asPath?.split("/")[2] !== "[polda_name]") {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
const filterGroup = group == undefined ? asPath.split("/")[2] : group;
|
||||||
|
loading();
|
||||||
|
const response = await listDataAll(
|
||||||
|
"",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
"",
|
||||||
|
tag,
|
||||||
|
filterGroup,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)
|
||||||
|
?.split("/")[0]
|
||||||
|
?.replace("0", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
// setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
// setContentImage(response.data?.data?.content);
|
||||||
|
// setTotalContent(response.data?.data?.totalElements);
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
setImageData(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setContentAll(response.data?.data?.content);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
loading();
|
||||||
|
const response = await listDataAll(
|
||||||
|
"",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
tag,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)
|
||||||
|
?.split("/")[0]
|
||||||
|
?.replace("0", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
// setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
// setContentImage(response.data?.data?.content);
|
||||||
|
// setTotalContent(response.data?.data?.totalElements);
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
setImageData(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setContentAll(response.data?.data?.content);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCategoryFilter = (e: boolean, id: string) => {
|
||||||
|
let filter = [...categoryFilter];
|
||||||
|
|
||||||
|
if (e) {
|
||||||
|
filter = [...categoryFilter, String(id)];
|
||||||
|
} else {
|
||||||
|
filter.splice(categoryFilter.indexOf(id), 1);
|
||||||
|
}
|
||||||
|
console.log("checkbox filter", filter);
|
||||||
|
setCategoryFilter(filter);
|
||||||
|
router.push(`?category=${filter.join("&")}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFormatFilter = (e: boolean, id: string) => {
|
||||||
|
let filter = [...formatFilter];
|
||||||
|
|
||||||
|
if (e) {
|
||||||
|
filter = [...formatFilter, id];
|
||||||
|
} else {
|
||||||
|
filter.splice(formatFilter.indexOf(id), 1);
|
||||||
|
}
|
||||||
|
console.log("Format filter", filter);
|
||||||
|
setFormatFilter(filter);
|
||||||
|
};
|
||||||
|
|
||||||
|
const cleanCheckbox = () => {
|
||||||
|
setCategoryFilter([]);
|
||||||
|
setFormatFilter([]);
|
||||||
|
router.push(`?category=&title=`);
|
||||||
|
setDateRange([null, null]);
|
||||||
|
setMonthYearFilter(null);
|
||||||
|
setChange(!change);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function getDataRegional() {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
loading();
|
||||||
|
const response = await listDataRegional(
|
||||||
|
"",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
format,
|
||||||
|
"",
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: "",
|
||||||
|
12,
|
||||||
|
pages,
|
||||||
|
sortByOpt
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentImage(response.data?.data?.content);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSelectedCategory() {
|
||||||
|
const filter = [];
|
||||||
|
|
||||||
|
if (categorie) {
|
||||||
|
const categoryArr = categorie.split(",");
|
||||||
|
|
||||||
|
for (const element of categoryArr) {
|
||||||
|
filter.push(Number(element));
|
||||||
|
}
|
||||||
|
|
||||||
|
setCategoryFilter(filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDeleteDate = () => {
|
||||||
|
setDateRange([null, null]);
|
||||||
|
setStartDateString("");
|
||||||
|
setEndDateString("");
|
||||||
|
setHandleClose(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSorting = (e: any) => {
|
||||||
|
console.log(e.target.value);
|
||||||
|
if (e.target.value == "terbaru") {
|
||||||
|
setSortByOpt("createdAt");
|
||||||
|
} else {
|
||||||
|
setSortByOpt("clickCount");
|
||||||
|
}
|
||||||
|
|
||||||
|
setChange(!change);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function getUserLevels() {
|
||||||
|
const res = await getUserLevelListByParent(761);
|
||||||
|
const userLevelList = res?.data?.data;
|
||||||
|
|
||||||
|
if (userLevelList !== null) {
|
||||||
|
let optionArr: any = [];
|
||||||
|
|
||||||
|
userLevelList?.map((option: any) => {
|
||||||
|
let optionData = {
|
||||||
|
id: option.id,
|
||||||
|
label: option.name,
|
||||||
|
value: option.id,
|
||||||
|
};
|
||||||
|
|
||||||
|
optionArr.push(optionData);
|
||||||
|
});
|
||||||
|
|
||||||
|
setUserLevels(optionArr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleKeyUp = () => {
|
||||||
|
clearTimeout(typingTimer);
|
||||||
|
typingTimer = setTimeout(doneTyping, doneTypingInterval);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function doneTyping() {
|
||||||
|
if (searchTitle == "" || searchTitle == undefined) {
|
||||||
|
router.push("?title=");
|
||||||
|
} else {
|
||||||
|
router.push(`?title=${searchTitle}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleKeyDown = () => {
|
||||||
|
clearTimeout(typingTimer);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col">
|
||||||
|
{/* Header */}
|
||||||
|
|
||||||
|
<div className="flex flex-col md:flex-row items-start gap-5 p-10 bg-[#f7f7f7] dark:bg-black">
|
||||||
|
<p>
|
||||||
|
{" "}
|
||||||
|
Konten {">"} <span className="font-bold">Semua Konten</span>
|
||||||
|
</p>
|
||||||
|
<p className="font-bold">|</p>
|
||||||
|
<p>{`Hasil Pencarian ${title} `}</p>
|
||||||
|
{`Terdapat ${contentAll?.length} konten yang dapat diunduh`}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Left */}
|
||||||
|
<div className="flex flex-col lg:flex-row gap-6 p-4">
|
||||||
|
<div className="lg:w-[25%] w-full bg-[#f7f7f7] dark:bg-black p-4 rounded-lg shadow-md">
|
||||||
|
<h2 className="text-lg font-semibold mb-4 flex items-center gap-1">
|
||||||
|
<Icon icon="stash:filter-light" fontSize={30} />
|
||||||
|
Filter
|
||||||
|
</h2>
|
||||||
|
<div className="border-t border-black my-4 dark:border-white"></div>
|
||||||
|
<div className="space-y-6">
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
htmlFor="search"
|
||||||
|
className="block text-sm font-medium text-gray-700 dark:text-white"
|
||||||
|
>
|
||||||
|
Pencarian
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
value={searchTitle}
|
||||||
|
onChange={(e) => setSearchTitle(e.target.value)}
|
||||||
|
onKeyUp={handleKeyUp}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
type="text"
|
||||||
|
id="search"
|
||||||
|
placeholder="Cari judul..."
|
||||||
|
className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-gray-700 dark:text-white">
|
||||||
|
Tahun & Bulan
|
||||||
|
</label>
|
||||||
|
<ReactDatePicker
|
||||||
|
selected={monthYearFilter}
|
||||||
|
className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
||||||
|
onChange={(date) => setMonthYearFilter(date)}
|
||||||
|
dateFormat="MM | yyyy"
|
||||||
|
placeholderText="Pilih Tahun dan Bulan"
|
||||||
|
showMonthYearPicker
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-gray-700 dark:text-white">
|
||||||
|
Tanggal
|
||||||
|
</label>
|
||||||
|
<div className="flex flex-row justify justify-between gap-2">
|
||||||
|
<ReactDatePicker
|
||||||
|
selectsRange
|
||||||
|
className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
||||||
|
startDate={dateRange[0]}
|
||||||
|
endDate={dateRange[1]}
|
||||||
|
onChange={(update) => {
|
||||||
|
setDateRange(update);
|
||||||
|
}}
|
||||||
|
placeholderText="Pilih Tanggal"
|
||||||
|
onCalendarClose={() => setCalenderState(!calenderState)}
|
||||||
|
/>
|
||||||
|
<div className="flex items-center">
|
||||||
|
{handleClose ? (
|
||||||
|
<Icon
|
||||||
|
icon="carbon:close-filled"
|
||||||
|
onClick={handleDeleteDate}
|
||||||
|
width="20"
|
||||||
|
inline
|
||||||
|
color="#216ba5"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3 className="text-sm font-medium text-gray-700 dark:text-white">
|
||||||
|
Kategori
|
||||||
|
</h3>
|
||||||
|
<ul className="mt-2 space-y-2">
|
||||||
|
{categories.map((category: any) => (
|
||||||
|
<li key={category?.id}>
|
||||||
|
<label
|
||||||
|
className="inline-flex items-center"
|
||||||
|
htmlFor={`${category.id}`}
|
||||||
|
>
|
||||||
|
<Checkbox
|
||||||
|
id={`${category.id}`}
|
||||||
|
value={category.id}
|
||||||
|
checked={categoryFilter.includes(String(category.id))}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleCategoryFilter(Boolean(e), category.id)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
{category?.name}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{/* Garis */}
|
||||||
|
<div className="border-t border-black my-4 dark:border-white"></div>
|
||||||
|
{/* Garis */}
|
||||||
|
<div>
|
||||||
|
<h3 className="text-sm font-medium text-gray-700 dark:text-white">
|
||||||
|
Format Konten
|
||||||
|
</h3>
|
||||||
|
<ul className="mt-2 space-y-2">
|
||||||
|
<li>
|
||||||
|
<label className="inline-flex items-center">
|
||||||
|
<Checkbox
|
||||||
|
id="png"
|
||||||
|
value="png"
|
||||||
|
checked={formatFilter.includes("image")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "image")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
Foto
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label className="inline-flex items-center">
|
||||||
|
<Checkbox
|
||||||
|
id="jpeg"
|
||||||
|
value="jpeg"
|
||||||
|
checked={formatFilter.includes("video")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "video")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
Audio Visual
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label className="inline-flex items-center">
|
||||||
|
<Checkbox
|
||||||
|
id="jpg"
|
||||||
|
value="jpg"
|
||||||
|
checked={formatFilter.includes("document")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "document")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
Teks
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label className="inline-flex items-center">
|
||||||
|
<Checkbox
|
||||||
|
id="jpg"
|
||||||
|
value="jpg"
|
||||||
|
checked={formatFilter.includes("audio")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "audio")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
Audio
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div className="border-t border-black dark:border-white my-4"></div>
|
||||||
|
<div className="text-center">
|
||||||
|
<a
|
||||||
|
onClick={cleanCheckbox}
|
||||||
|
className="text-[#bb3523] cursor-pointer"
|
||||||
|
>
|
||||||
|
<b>Reset Filter</b>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Konten Kanan */}
|
||||||
|
<Reveal>
|
||||||
|
<div className="flex-1 w-full">
|
||||||
|
<div className="flex flex-col items-end mb-4">
|
||||||
|
<h2 className="text-lg font-semibold">Urutkan berdasarkan</h2>
|
||||||
|
<select
|
||||||
|
defaultValue={sortBy == "popular" ? "terpopuler" : "terbaru"}
|
||||||
|
onChange={(e) => handleSorting(e)}
|
||||||
|
className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
||||||
|
>
|
||||||
|
<option value="terbaru">Terbaru</option>
|
||||||
|
<option value="terpopuler">Terpopuler</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col gap-2 w-full">
|
||||||
|
<FilterImageComponent
|
||||||
|
categoryFilter={categoryFilter}
|
||||||
|
sortByOpt={sortByOpt}
|
||||||
|
startDateString={startDateString}
|
||||||
|
endDateString={endDateString}
|
||||||
|
monthYearFilter={monthYearFilter}
|
||||||
|
/>
|
||||||
|
<FilterVideoComponent
|
||||||
|
categoryFilter={categoryFilter}
|
||||||
|
sortByOpt={sortByOpt}
|
||||||
|
startDateString={startDateString}
|
||||||
|
endDateString={endDateString}
|
||||||
|
monthYearFilter={monthYearFilter}
|
||||||
|
/>
|
||||||
|
<FilterDocumentComponent
|
||||||
|
categoryFilter={categoryFilter}
|
||||||
|
sortByOpt={sortByOpt}
|
||||||
|
startDateString={startDateString}
|
||||||
|
endDateString={endDateString}
|
||||||
|
monthYearFilter={monthYearFilter}
|
||||||
|
/>
|
||||||
|
<FilterAudioComponent
|
||||||
|
categoryFilter={categoryFilter}
|
||||||
|
sortByOpt={sortByOpt}
|
||||||
|
startDateString={startDateString}
|
||||||
|
endDateString={endDateString}
|
||||||
|
monthYearFilter={monthYearFilter}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Reveal>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import Footer from "@/components/landing-page/footer";
|
||||||
|
import Navbar from "@/components/landing-page/navbar";
|
||||||
|
|
||||||
|
const layout = async ({ children }: { children: React.ReactNode }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Navbar />
|
||||||
|
{children}
|
||||||
|
<Footer />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default layout;
|
||||||
|
|
@ -1,14 +1,46 @@
|
||||||
"use client";
|
"use client";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
import { getListContent } from "@/service/landing/landing";
|
import {
|
||||||
import { formatDateToIndonesian } from "@/utils/globals";
|
formatDateToIndonesian,
|
||||||
import { useParams, usePathname, useRouter, useSearchParams } from "next/navigation";
|
getOnlyDate,
|
||||||
import { ColumnDef, ColumnFiltersState, PaginationState, SortingState, VisibilityState, flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
getOnlyMonthAndYear,
|
||||||
|
} from "@/utils/globals";
|
||||||
|
import { useParams, usePathname, useSearchParams } from "next/navigation";
|
||||||
|
import {
|
||||||
|
getUserLevelListByParent,
|
||||||
|
listCategory,
|
||||||
|
listData,
|
||||||
|
listDataRegional,
|
||||||
|
} from "@/service/landing/landing";
|
||||||
|
import {
|
||||||
|
ColumnDef,
|
||||||
|
ColumnFiltersState,
|
||||||
|
PaginationState,
|
||||||
|
SortingState,
|
||||||
|
VisibilityState,
|
||||||
|
getCoreRowModel,
|
||||||
|
getFilteredRowModel,
|
||||||
|
getPaginationRowModel,
|
||||||
|
getSortedRowModel,
|
||||||
|
useReactTable,
|
||||||
|
} from "@tanstack/react-table";
|
||||||
import LandingPagination from "@/components/landing-page/pagination";
|
import LandingPagination from "@/components/landing-page/pagination";
|
||||||
import { Reveal } from "@/components/landing-page/Reveal";
|
import { Reveal } from "@/components/landing-page/Reveal";
|
||||||
import { Link } from "@/i18n/routing";
|
import { Link, useRouter } from "@/i18n/routing";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import ReactDatePicker from "react-datepicker";
|
||||||
|
import "react-datepicker/dist/react-datepicker.css";
|
||||||
|
import { close, loading } from "@/config/swal";
|
||||||
|
import {
|
||||||
|
Carousel,
|
||||||
|
CarouselContent,
|
||||||
|
CarouselItem,
|
||||||
|
CarouselNext,
|
||||||
|
CarouselPrevious,
|
||||||
|
} from "@/components/ui/carousel";
|
||||||
|
|
||||||
const columns: ColumnDef<any>[] = [
|
const columns: ColumnDef<any>[] = [
|
||||||
{
|
{
|
||||||
|
|
@ -18,43 +50,57 @@ const columns: ColumnDef<any>[] = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const categories = [
|
|
||||||
{ id: 1, title: "HUT HUMAS KE - 73" },
|
|
||||||
{ id: 2, title: "OPERASI ZEBRA 2024" },
|
|
||||||
{ id: 3, title: "PON XXI" },
|
|
||||||
{ id: 4, title: "OPS LILIN NATARU 2024" },
|
|
||||||
{ id: 5, title: "HUT HUMAS KE - 72" },
|
|
||||||
{ id: 6, title: "OPS MANTAP PRAJA & PILKADA 2024" },
|
|
||||||
{ id: 6, title: "OPS KETUPAT 2024" },
|
|
||||||
{ id: 6, title: "OPS PATUH 2024" },
|
|
||||||
{ id: 6, title: "HARI JUANG POLRI" },
|
|
||||||
{ id: 6, title: "HUT RI KE-79" },
|
|
||||||
{ id: 6, title: "HARI BHAYANGKARA KE-78" },
|
|
||||||
];
|
|
||||||
|
|
||||||
const formatAudio = [
|
|
||||||
{ id: 1, title: "WAV" },
|
|
||||||
{ id: 2, title: "MP3" },
|
|
||||||
];
|
|
||||||
|
|
||||||
const FilterPage = () => {
|
const FilterPage = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const pathname = usePathname();
|
const asPath = usePathname();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const locale = params?.locale;
|
const locale = params?.locale;
|
||||||
const [imageData, setImageData] = useState<any>();
|
const [audioData, setAudioData] = useState<any>();
|
||||||
const [totalData, setTotalData] = React.useState<number>(1);
|
const [totalData, setTotalData] = React.useState<number>(1);
|
||||||
const [totalPage, setTotalPage] = React.useState<number>(1);
|
const [totalPage, setTotalPage] = React.useState<number>(1);
|
||||||
const [sorting, setSorting] = React.useState<SortingState>([]);
|
const [sorting, setSorting] = React.useState<SortingState>([]);
|
||||||
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>([]);
|
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
|
||||||
const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>({});
|
[]
|
||||||
|
);
|
||||||
|
const [columnVisibility, setColumnVisibility] =
|
||||||
|
React.useState<VisibilityState>({});
|
||||||
const [rowSelection, setRowSelection] = React.useState({});
|
const [rowSelection, setRowSelection] = React.useState({});
|
||||||
const [pagination, setPagination] = React.useState<PaginationState>({
|
const [pagination, setPagination] = React.useState<PaginationState>({
|
||||||
pageIndex: 0,
|
pageIndex: 0,
|
||||||
pageSize: 6,
|
pageSize: 10,
|
||||||
});
|
});
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
|
const [totalContent, setTotalContent] = useState();
|
||||||
|
const [change, setChange] = useState(false);
|
||||||
|
const sortBy = searchParams?.get("sortBy");
|
||||||
|
const title = searchParams?.get("title");
|
||||||
|
const categorie = searchParams?.get("category");
|
||||||
|
const group = searchParams?.get("group");
|
||||||
|
const [contentImage, setContentImage] = useState([]);
|
||||||
|
const [, setGetTotalPage] = useState();
|
||||||
|
let typingTimer: any;
|
||||||
|
const doneTypingInterval = 1500;
|
||||||
|
const [search, setSearch] = useState();
|
||||||
|
const [categoryFilter, setCategoryFilter] = useState<any>([]);
|
||||||
|
const [monthYearFilter, setMonthYearFilter] = useState<any>();
|
||||||
|
const [searchTitle, setSearchTitle] = useState<string>("");
|
||||||
|
const [sortByOpt, setSortByOpt] = useState<any>(
|
||||||
|
sortBy === "popular" ? "clickCount" : "createdAt"
|
||||||
|
);
|
||||||
|
const isRegional = asPath?.includes("regional");
|
||||||
|
const isSatker = asPath?.includes("satker");
|
||||||
|
const [formatFilter, setFormatFilter] = useState<any>([]);
|
||||||
|
const pages = page ? page - 1 : 0;
|
||||||
|
const [startDateString, setStartDateString] = useState<any>();
|
||||||
|
const [endDateString, setEndDateString] = useState<any>();
|
||||||
|
const [dateRange, setDateRange] = useState<any>([null, null]);
|
||||||
|
const [calenderState, setCalenderState] = useState(false);
|
||||||
|
const [handleClose, setHandleClose] = useState(false);
|
||||||
|
const [categories, setCategories] = useState([]);
|
||||||
|
const [userLevels, setUserLevels] = useState([]);
|
||||||
|
|
||||||
|
// const [startDate, endDate] = dateRange;
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const pageFromUrl = searchParams?.get("page");
|
const pageFromUrl = searchParams?.get("page");
|
||||||
|
|
@ -63,8 +109,232 @@ const FilterPage = () => {
|
||||||
}
|
}
|
||||||
}, [searchParams]);
|
}, [searchParams]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
getCategories();
|
||||||
|
// getSelectedCategory();
|
||||||
|
if (isSatker) {
|
||||||
|
getUserLevels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (categorie) {
|
||||||
|
setCategoryFilter(
|
||||||
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
"Kategori",
|
||||||
|
categorie,
|
||||||
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, [categorie]);
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// fetchData();
|
||||||
|
// }, [page, sortBy, sortByOpt, title]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
if (isRegional) {
|
||||||
|
getDataRegional();
|
||||||
|
} else {
|
||||||
|
getDataAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(monthYearFilter, "monthFilter");
|
||||||
|
initState();
|
||||||
|
}, [
|
||||||
|
change,
|
||||||
|
asPath,
|
||||||
|
monthYearFilter,
|
||||||
|
page,
|
||||||
|
sortBy,
|
||||||
|
sortByOpt,
|
||||||
|
title,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
categorie,
|
||||||
|
formatFilter,
|
||||||
|
]);
|
||||||
|
|
||||||
|
async function getCategories() {
|
||||||
|
const category = await listCategory("1");
|
||||||
|
const resCategory = category?.data?.data?.content;
|
||||||
|
setCategories(resCategory);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
function initState() {
|
||||||
|
if (dateRange[0] != null && dateRange[1] != null) {
|
||||||
|
setStartDateString(getOnlyDate(dateRange[0]));
|
||||||
|
setEndDateString(getOnlyDate(dateRange[1]));
|
||||||
|
setHandleClose(true);
|
||||||
|
console.log("date range", dateRange, getOnlyDate(dateRange[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
initState();
|
||||||
|
}, [calenderState]);
|
||||||
|
|
||||||
|
async function getDataAll() {
|
||||||
|
if (asPath?.includes("/polda/") == true) {
|
||||||
|
if (asPath?.split("/")[2] !== "[polda_name]") {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
const filterGroup = group == undefined ? asPath.split("/")[2] : group;
|
||||||
|
loading();
|
||||||
|
const response = await listData(
|
||||||
|
"1",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
12,
|
||||||
|
pages,
|
||||||
|
sortByOpt,
|
||||||
|
format,
|
||||||
|
"",
|
||||||
|
filterGroup,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)
|
||||||
|
?.split("/")[0]
|
||||||
|
?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
// setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
// setContentImage(response.data?.data?.content);
|
||||||
|
// setTotalContent(response.data?.data?.totalElements);
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
setAudioData(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
loading();
|
||||||
|
const response = await listData(
|
||||||
|
"1",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
12,
|
||||||
|
pages,
|
||||||
|
sortByOpt,
|
||||||
|
format,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
// setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
// setContentImage(response.data?.data?.content);
|
||||||
|
// setTotalContent(response.data?.data?.totalElements);
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
setAudioData(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCategoryFilter = (e: boolean, id: string) => {
|
||||||
|
let filter = [...categoryFilter];
|
||||||
|
|
||||||
|
if (e) {
|
||||||
|
filter = [...categoryFilter, String(id)];
|
||||||
|
} else {
|
||||||
|
filter.splice(categoryFilter.indexOf(id), 1);
|
||||||
|
}
|
||||||
|
console.log("checkbox filter", filter);
|
||||||
|
setCategoryFilter(filter);
|
||||||
|
router.push(`?category=${filter.join("&")}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFormatFilter = (e: boolean, id: string) => {
|
||||||
|
let filter = [...formatFilter];
|
||||||
|
|
||||||
|
if (e) {
|
||||||
|
filter = [...formatFilter, id];
|
||||||
|
} else {
|
||||||
|
filter.splice(formatFilter.indexOf(id), 1);
|
||||||
|
}
|
||||||
|
console.log("Format filter", filter);
|
||||||
|
setFormatFilter(filter);
|
||||||
|
};
|
||||||
|
|
||||||
|
const cleanCheckbox = () => {
|
||||||
|
setCategoryFilter([]);
|
||||||
|
setFormatFilter([]);
|
||||||
|
router.push(`?category=&title=`);
|
||||||
|
setDateRange([null, null]);
|
||||||
|
setMonthYearFilter(null);
|
||||||
|
setChange(!change);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function getDataRegional() {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
loading();
|
||||||
|
const response = await listDataRegional(
|
||||||
|
"1",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
format,
|
||||||
|
"",
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: "",
|
||||||
|
12,
|
||||||
|
pages,
|
||||||
|
sortByOpt
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentImage(response.data?.data?.content);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
|
||||||
const table = useReactTable({
|
const table = useReactTable({
|
||||||
data: imageData,
|
data: audioData,
|
||||||
columns: columns,
|
columns: columns,
|
||||||
onSortingChange: setSorting,
|
onSortingChange: setSorting,
|
||||||
onColumnFiltersChange: setColumnFilters,
|
onColumnFiltersChange: setColumnFilters,
|
||||||
|
|
@ -84,127 +354,280 @@ const FilterPage = () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const [audioData, setAudioData] = useState<any>();
|
function getSelectedCategory() {
|
||||||
useEffect(() => {
|
const filter = [];
|
||||||
initFetch();
|
|
||||||
}, []);
|
if (categorie) {
|
||||||
const initFetch = async () => {
|
const categoryArr = categorie.split(",");
|
||||||
const response = await getListContent({ page: page - 1, size: 6, sortBy: "createdAt", contentTypeId: "4" });
|
|
||||||
console.log(response);
|
for (const element of categoryArr) {
|
||||||
setAudioData(response?.data?.data?.content);
|
filter.push(Number(element));
|
||||||
const data = response.data?.data;
|
}
|
||||||
const contentData = data?.content;
|
|
||||||
setAudioData(contentData);
|
setCategoryFilter(filter);
|
||||||
setTotalData(data?.totalElements);
|
}
|
||||||
setTotalPage(data?.totalPages);
|
}
|
||||||
|
|
||||||
|
const handleDeleteDate = () => {
|
||||||
|
setDateRange([null, null]);
|
||||||
|
setStartDateString("");
|
||||||
|
setEndDateString("");
|
||||||
|
setHandleClose(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleSorting = (e: any) => {
|
||||||
|
console.log(e.target.value);
|
||||||
|
if (e.target.value == "terbaru") {
|
||||||
|
setSortByOpt("createdAt");
|
||||||
|
} else {
|
||||||
|
setSortByOpt("clickCount");
|
||||||
|
}
|
||||||
|
|
||||||
|
setChange(!change);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function getUserLevels() {
|
||||||
|
const res = await getUserLevelListByParent(761);
|
||||||
|
const userLevelList = res?.data?.data;
|
||||||
|
|
||||||
|
if (userLevelList !== null) {
|
||||||
|
let optionArr: any = [];
|
||||||
|
|
||||||
|
userLevelList?.map((option: any) => {
|
||||||
|
let optionData = {
|
||||||
|
id: option.id,
|
||||||
|
label: option.name,
|
||||||
|
value: option.id,
|
||||||
|
};
|
||||||
|
|
||||||
|
optionArr.push(optionData);
|
||||||
|
});
|
||||||
|
|
||||||
|
setUserLevels(optionArr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleKeyUp = () => {
|
||||||
|
clearTimeout(typingTimer);
|
||||||
|
typingTimer = setTimeout(doneTyping, doneTypingInterval);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function doneTyping() {
|
||||||
|
if (searchTitle == "" || searchTitle == undefined) {
|
||||||
|
router.push("?title=");
|
||||||
|
} else {
|
||||||
|
router.push(`?title=${searchTitle}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleKeyDown = () => {
|
||||||
|
clearTimeout(typingTimer);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
|
|
||||||
<div className="flex flex-col md:flex-row items-start gap-5 p-10 bg-[#f7f7f7] dark:bg-black">
|
<div className="flex flex-col md:flex-row items-start gap-5 p-10 bg-[#f7f7f7] dark:bg-black">
|
||||||
<p>
|
<p>
|
||||||
{" "}
|
{" "}
|
||||||
Audio {">"} <span className="font-bold">Semua Audio</span>
|
Audio {">"} <span className="font-bold">Semua Audio</span>
|
||||||
</p>
|
</p>
|
||||||
<p className="font-bold">|</p>
|
<p className="font-bold">|</p>
|
||||||
<p>Terdapat 32499 artikel berisi Audio yang dapat diunduh </p>
|
<p>{`Terdapat ${totalContent} artikel berisi Audio yang dapat diunduh`}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Left */}
|
{/* Left */}
|
||||||
<div className="flex flex-col lg:flex-row gap-6 p-4">
|
<div className="flex flex-col lg:flex-row gap-6 p-4">
|
||||||
<Reveal>
|
<div className="lg:w-[25%] w-full bg-[#f7f7f7] dark:bg-black p-4 rounded-lg shadow-md">
|
||||||
{/* Sidebar Kiri */}
|
<h2 className="text-lg font-semibold mb-4 flex items-center gap-1">
|
||||||
<div className="lg:w-1/4 bg-white p-4 rounded-lg shadow-md">
|
|
||||||
<h2 className="text-lg font-semibold mb-4">
|
|
||||||
<Icon icon="stash:filter-light" fontSize={30} />
|
<Icon icon="stash:filter-light" fontSize={30} />
|
||||||
Filter
|
Filter
|
||||||
</h2>
|
</h2>
|
||||||
|
<div className="border-t border-black my-4 dark:border-white"></div>
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
{/* Pencarian */}
|
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="search" className="block text-sm font-medium text-gray-700 dark:text-white">
|
<label
|
||||||
|
htmlFor="search"
|
||||||
|
className="block text-sm font-medium text-gray-700 dark:text-white"
|
||||||
|
>
|
||||||
Pencarian
|
Pencarian
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="search" placeholder="Cari judul..." className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500" />
|
<Input
|
||||||
|
value={searchTitle}
|
||||||
|
onChange={(e) => setSearchTitle(e.target.value)}
|
||||||
|
onKeyUp={handleKeyUp}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
type="text"
|
||||||
|
id="search"
|
||||||
|
placeholder="Cari judul..."
|
||||||
|
className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tahun & Bulan */}
|
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="month" className="block text-sm font-medium text-gray-700 dark:text-white">
|
<label className="block text-sm font-medium text-gray-700 dark:text-white">
|
||||||
Pilih Tahun & Bulan
|
Tahun & Bulan
|
||||||
</label>
|
</label>
|
||||||
<input type="month" id="month" className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500" />
|
<ReactDatePicker
|
||||||
|
selected={monthYearFilter}
|
||||||
|
className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
||||||
|
onChange={(date) => setMonthYearFilter(date)}
|
||||||
|
dateFormat="MM | yyyy"
|
||||||
|
placeholderText="Pilih Tahun dan Bulan"
|
||||||
|
showMonthYearPicker
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tanggal */}
|
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="date" className="block text-sm font-medium text-gray-700 dark:text-white">
|
<label className="block text-sm font-medium text-gray-700 dark:text-white">
|
||||||
Pilih Tanggal
|
Tanggal
|
||||||
</label>
|
</label>
|
||||||
<input type="date" id="date" className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500" />
|
<div className="flex flex-row justify justify-between gap-2">
|
||||||
|
<ReactDatePicker
|
||||||
|
selectsRange
|
||||||
|
className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
||||||
|
startDate={dateRange[0]}
|
||||||
|
endDate={dateRange[1]}
|
||||||
|
onChange={(update) => {
|
||||||
|
setDateRange(update);
|
||||||
|
}}
|
||||||
|
placeholderText="Pilih Tanggal"
|
||||||
|
onCalendarClose={() => setCalenderState(!calenderState)}
|
||||||
|
/>
|
||||||
|
<div className="flex items-center">
|
||||||
|
{handleClose ? (
|
||||||
|
<Icon
|
||||||
|
icon="carbon:close-filled"
|
||||||
|
onClick={handleDeleteDate}
|
||||||
|
width="20"
|
||||||
|
inline
|
||||||
|
color="#216ba5"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Kategori */}
|
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-sm font-medium text-gray-700 dark:text-white">Kategori</h3>
|
<h3 className="text-sm font-medium text-gray-700 dark:text-white">
|
||||||
|
Kategori
|
||||||
|
</h3>
|
||||||
<ul className="mt-2 space-y-2">
|
<ul className="mt-2 space-y-2">
|
||||||
{categories.map((category) => (
|
{categories.map((category: any) => (
|
||||||
<li key={category?.id}>
|
<li key={category?.id}>
|
||||||
<label className="inline-flex items-center">
|
<label
|
||||||
<Checkbox id="terms" />
|
className="inline-flex items-center"
|
||||||
<span className="ml-2 text-gray-700 dark:text-white">{category.title}</span>
|
htmlFor={`${category.id}`}
|
||||||
|
>
|
||||||
|
<Checkbox
|
||||||
|
id={`${category.id}`}
|
||||||
|
value={category.id}
|
||||||
|
checked={categoryFilter.includes(String(category.id))}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleCategoryFilter(Boolean(e), category.id)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
{category?.name}
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{/* Garis */}
|
{/* Garis */}
|
||||||
<div className="border-t border-black my-4"></div>
|
<div className="border-t border-black my-4 dark:border-white"></div>
|
||||||
{/* Garis */}
|
{/* Garis */}
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-sm font-medium text-gray-700 dark:text-white">Format Foto</h3>
|
<h3 className="text-sm font-medium text-gray-700 dark:text-white">
|
||||||
|
Format Audio
|
||||||
|
</h3>
|
||||||
<ul className="mt-2 space-y-2">
|
<ul className="mt-2 space-y-2">
|
||||||
{formatAudio.map((format) => (
|
<li>
|
||||||
<li key={format?.id}>
|
|
||||||
<label className="inline-flex items-center">
|
<label className="inline-flex items-center">
|
||||||
<Checkbox id="terms" />
|
<Checkbox
|
||||||
<span className="ml-2 text-gray-700 dark:text-white">{format.title}</span>
|
id="png"
|
||||||
|
value="png"
|
||||||
|
checked={formatFilter.includes("wav")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "wav")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
WAV
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label className="inline-flex items-center">
|
||||||
|
<Checkbox
|
||||||
|
id="jpeg"
|
||||||
|
value="jpeg"
|
||||||
|
checked={formatFilter.includes("mp3")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "mp3")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
MP3
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
))}
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div className="border-t border-black dark:border-white my-4"></div>
|
<div className="border-t border-black dark:border-white my-4"></div>
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<a href="#" className="text-[#bb3523]">
|
<a
|
||||||
|
onClick={cleanCheckbox}
|
||||||
|
className="text-[#bb3523] cursor-pointer"
|
||||||
|
>
|
||||||
<b>Reset Filter</b>
|
<b>Reset Filter</b>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Reveal>
|
|
||||||
|
|
||||||
{/* Konten Kanan */}
|
{/* Konten Kanan */}
|
||||||
<Reveal>
|
<Reveal>
|
||||||
<div className="flex-1 w-auto">
|
<div className="flex-1">
|
||||||
<div className="flex flex-col items-end mb-4">
|
<div className="flex flex-col items-end mb-4">
|
||||||
<h2 className="text-lg font-semibold tetx-red-300">Urutkan berdasarkan</h2>
|
<h2 className="text-lg font-semibold">Urutkan berdasarkan</h2>
|
||||||
<select className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500">
|
<select
|
||||||
|
defaultValue={sortBy == "popular" ? "terpopuler" : "terbaru"}
|
||||||
|
onChange={(e) => handleSorting(e)}
|
||||||
|
className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
||||||
|
>
|
||||||
<option value="terbaru">Terbaru</option>
|
<option value="terbaru">Terbaru</option>
|
||||||
<option value="terlama">Terpopuler</option>
|
<option value="terpopuler">Terpopuler</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Card */}
|
|
||||||
{audioData?.length > 0 ? (
|
{audioData?.length > 0 ? (
|
||||||
<div className=" grid grid-cols-1 gap-6 lg:w-3/4">
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
|
{audioData?.map((image: any) => (
|
||||||
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
|
<CarouselContent>
|
||||||
{audioData?.map((audio: any) => (
|
{audioData?.map((audio: any) => (
|
||||||
|
<CarouselItem
|
||||||
|
key={audio?.id}
|
||||||
|
className="md:basis-1/2 lg:basis-1/3"
|
||||||
|
>
|
||||||
|
<div className="flex flex-row gap-6">
|
||||||
<Link
|
<Link
|
||||||
href={`/audio/detail/${audio?.slug}`}
|
href={`/audio/detail/${audio?.slug}`}
|
||||||
key={audio?.id}
|
className="flex flex-col sm:flex-row items-center bg-white dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full"
|
||||||
className="flex flex-col sm:flex-row items-center hover:scale-110 transition-transform duration-300 bg-white dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full"
|
>
|
||||||
|
<div className="flex items-center justify-center bg-red-500 text-white rounded-lg w-16 h-8 lg:h-16">
|
||||||
|
<svg
|
||||||
|
width="32"
|
||||||
|
height="34"
|
||||||
|
viewBox="0 0 32 34"
|
||||||
|
fill="null"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-center bg-[#bb3523] text-white rounded-lg w-16 h-16">
|
|
||||||
<svg width="32" height="34" viewBox="0 0 32 34" fill="null" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path
|
<path
|
||||||
d="M23.404 0.452014C23.7033 0.35857 24.0204 0.336816 24.3297 0.388509C24.639 0.440203 24.9318 0.563895 25.1845 0.749599C25.4371 0.935304 25.6426 1.17782 25.7843 1.45756C25.9259 1.73731 25.9998 2.04644 26 2.36001V14.414C25.3462 14.2296 24.6766 14.1064 24 14.046V8.36001L10 12.736V27C10 28.1264 9.6197 29.2197 8.92071 30.1029C8.22172 30.9861 7.24499 31.6075 6.14877 31.8663C5.05255 32.125 3.90107 32.0061 2.88089 31.5287C1.86071 31.0514 1.03159 30.2435 0.52787 29.2361C0.024152 28.2286 -0.124656 27.0806 0.105556 25.9781C0.335768 24.8755 0.931513 23.883 1.79627 23.1613C2.66102 22.4396 3.74413 22.031 4.87009 22.0017C5.99606 21.9724 7.09893 22.3242 8.00001 23V6.73601C7.99982 6.30956 8.13596 5.8942 8.38854 5.55059C8.64112 5.20698 8.99692 4.9531 9.40401 4.82601L23.404 0.452014ZM10 10.64L24 6.26601V2.36001L10 6.73601V10.64ZM5.00001 24C4.20436 24 3.44129 24.3161 2.87869 24.8787C2.31608 25.4413 2.00001 26.2044 2.00001 27C2.00001 27.7957 2.31608 28.5587 2.87869 29.1213C3.44129 29.6839 4.20436 30 5.00001 30C5.79566 30 6.55872 29.6839 7.12133 29.1213C7.68394 28.5587 8.00001 27.7957 8.00001 27C8.00001 26.2044 7.68394 25.4413 7.12133 24.8787C6.55872 24.3161 5.79566 24 5.00001 24ZM32 25C32 27.387 31.0518 29.6761 29.364 31.364C27.6761 33.0518 25.387 34 23 34C20.6131 34 18.3239 33.0518 16.636 31.364C14.9482 29.6761 14 27.387 14 25C14 22.6131 14.9482 20.3239 16.636 18.6361C18.3239 16.9482 20.6131 16 23 16C25.387 16 27.6761 16.9482 29.364 18.6361C31.0518 20.3239 32 22.6131 32 25ZM27.47 24.128L21.482 20.828C21.3298 20.7443 21.1583 20.7016 20.9846 20.7043C20.8108 20.707 20.6408 20.7549 20.4912 20.8433C20.3416 20.9317 20.2176 21.0576 20.1315 21.2086C20.0453 21.3595 20 21.5302 20 21.704V28.304C20 28.4778 20.0453 28.6486 20.1315 28.7995C20.2176 28.9504 20.3416 29.0763 20.4912 29.1647C20.6408 29.2531 20.8108 29.301 20.9846 29.3037C21.1583 29.3064 21.3298 29.2638 21.482 29.18L27.47 25.88C27.6268 25.7937 27.7575 25.6669 27.8486 25.5128C27.9397 25.3587 27.9877 25.183 27.9877 25.004C27.9877 24.825 27.9397 24.6493 27.8486 24.4952C27.7575 24.3412 27.6268 24.2143 27.47 24.128Z"
|
d="M23.404 0.452014C23.7033 0.35857 24.0204 0.336816 24.3297 0.388509C24.639 0.440203 24.9318 0.563895 25.1845 0.749599C25.4371 0.935304 25.6426 1.17782 25.7843 1.45756C25.9259 1.73731 25.9998 2.04644 26 2.36001V14.414C25.3462 14.2296 24.6766 14.1064 24 14.046V8.36001L10 12.736V27C10 28.1264 9.6197 29.2197 8.92071 30.1029C8.22172 30.9861 7.24499 31.6075 6.14877 31.8663C5.05255 32.125 3.90107 32.0061 2.88089 31.5287C1.86071 31.0514 1.03159 30.2435 0.52787 29.2361C0.024152 28.2286 -0.124656 27.0806 0.105556 25.9781C0.335768 24.8755 0.931513 23.883 1.79627 23.1613C2.66102 22.4396 3.74413 22.031 4.87009 22.0017C5.99606 21.9724 7.09893 22.3242 8.00001 23V6.73601C7.99982 6.30956 8.13596 5.8942 8.38854 5.55059C8.64112 5.20698 8.99692 4.9531 9.40401 4.82601L23.404 0.452014ZM10 10.64L24 6.26601V2.36001L10 6.73601V10.64ZM5.00001 24C4.20436 24 3.44129 24.3161 2.87869 24.8787C2.31608 25.4413 2.00001 26.2044 2.00001 27C2.00001 27.7957 2.31608 28.5587 2.87869 29.1213C3.44129 29.6839 4.20436 30 5.00001 30C5.79566 30 6.55872 29.6839 7.12133 29.1213C7.68394 28.5587 8.00001 27.7957 8.00001 27C8.00001 26.2044 7.68394 25.4413 7.12133 24.8787C6.55872 24.3161 5.79566 24 5.00001 24ZM32 25C32 27.387 31.0518 29.6761 29.364 31.364C27.6761 33.0518 25.387 34 23 34C20.6131 34 18.3239 33.0518 16.636 31.364C14.9482 29.6761 14 27.387 14 25C14 22.6131 14.9482 20.3239 16.636 18.6361C18.3239 16.9482 20.6131 16 23 16C25.387 16 27.6761 16.9482 29.364 18.6361C31.0518 20.3239 32 22.6131 32 25ZM27.47 24.128L21.482 20.828C21.3298 20.7443 21.1583 20.7016 20.9846 20.7043C20.8108 20.707 20.6408 20.7549 20.4912 20.8433C20.3416 20.9317 20.2176 21.0576 20.1315 21.2086C20.0453 21.3595 20 21.5302 20 21.704V28.304C20 28.4778 20.0453 28.6486 20.1315 28.7995C20.2176 28.9504 20.3416 29.0763 20.4912 29.1647C20.6408 29.2531 20.8108 29.301 20.9846 29.3037C21.1583 29.3064 21.3298 29.2638 21.482 29.18L27.47 25.88C27.6268 25.7937 27.7575 25.6669 27.8486 25.5128C27.9397 25.3587 27.9877 25.183 27.9877 25.004C27.9877 24.825 27.9397 24.6493 27.8486 24.4952C27.7575 24.3412 27.6268 24.2143 27.47 24.128Z"
|
||||||
fill="white"
|
fill="white"
|
||||||
|
|
@ -214,35 +637,46 @@ const FilterPage = () => {
|
||||||
|
|
||||||
<div className="flex flex-col flex-1">
|
<div className="flex flex-col flex-1">
|
||||||
<div className="text-gray-500 dark:text-gray-400 flex flex-row text-sm">
|
<div className="text-gray-500 dark:text-gray-400 flex flex-row text-sm">
|
||||||
{formatDateToIndonesian(new Date(audio?.createdAt))} {audio?.timezone ? audio?.timezone : "WIB"} | <Icon icon="formkit:eye" width="15" height="15" /> 518
|
{formatDateToIndonesian(
|
||||||
|
new Date(audio?.createdAt)
|
||||||
|
)}{" "}
|
||||||
|
{audio?.timezone ? audio?.timezone : "WIB"} |{" "}
|
||||||
|
<Icon
|
||||||
|
icon="formkit:eye"
|
||||||
|
width="15"
|
||||||
|
height="15"
|
||||||
|
/>{" "}
|
||||||
|
{audio?.clickCount}{" "}
|
||||||
</div>
|
</div>
|
||||||
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm">{audio?.title}</div>
|
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||||
</div>
|
{audio?.title}
|
||||||
<div className="flex items-center justify-center gap-3">
|
|
||||||
<div className="mt-2">
|
|
||||||
<img src="/assets/wave.svg" className="w-80" />
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-row items-center justify-center text-gray-500 dark:text-gray-400">
|
|
||||||
<img src="/assets/audio-icon.png" alt="#" className="flex items-center justify-center" />
|
|
||||||
<div className="flex mx-2 items-center justify-center">{audio?.duration}</div>
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
|
||||||
<path
|
|
||||||
fill="#f00"
|
|
||||||
d="M7.707 10.293a1 1 0 1 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0-1.414-1.414L11 11.586V6h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5v5.586zM9 4a1 1 0 0 1 2 0v2H9z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
</div>
|
||||||
|
</CarouselItem>
|
||||||
|
))}
|
||||||
|
</CarouselContent>
|
||||||
|
<CarouselPrevious />
|
||||||
|
<CarouselNext />
|
||||||
|
</Carousel>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<p className="flex items-center justify-center">
|
<p className="flex items-center justify-center text-black">
|
||||||
<img src="/assets/empty-data.png" alt="empty" className="h-60 w-60 my-4" />
|
<img
|
||||||
|
src="/assets/empty-data.png"
|
||||||
|
alt="empty"
|
||||||
|
className="h-60 w-60 my-4"
|
||||||
|
/>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<LandingPagination table={table} totalData={totalData} totalPage={totalPage} />
|
<LandingPagination
|
||||||
|
table={table}
|
||||||
|
totalData={totalData}
|
||||||
|
totalPage={totalPage}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Reveal>
|
</Reveal>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,395 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { close, error, loading, successCallback } from "@/config/swal";
|
||||||
|
import { checkWishlistStatus, deleteWishlist, getInfoProfile, mediaWishlist, saveWishlist } from "@/service/landing/landing";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { Link, useRouter } from "@/i18n/routing";
|
||||||
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
|
import HeaderManagement from "@/components/landing-page/header-management";
|
||||||
|
import SidebarManagement from "@/components/landing-page/sidebar-management";
|
||||||
|
import withReactContent from "sweetalert2-react-content";
|
||||||
|
import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
|
import Swal from "sweetalert2";
|
||||||
|
import { useToast } from "@/components/ui/use-toast";
|
||||||
|
|
||||||
|
const Galery = (props: any) => {
|
||||||
|
const [profile, setProfile] = useState<any>();
|
||||||
|
const [selectedTab, setSelectedTab] = useState("video");
|
||||||
|
const router = useRouter();
|
||||||
|
const MySwal = withReactContent(Swal);
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
// const { id } = router.query;
|
||||||
|
const page: any = searchParams?.get("page");
|
||||||
|
const title = searchParams?.get("title");
|
||||||
|
const category = searchParams?.get("category");
|
||||||
|
const pages = page ? page - 1 : 0;
|
||||||
|
const { isInstitute, instituteId } = props;
|
||||||
|
const userId = getCookiesDecrypt("uie");
|
||||||
|
const userRoleId = getCookiesDecrypt("urie");
|
||||||
|
|
||||||
|
const [totalContent, setTotalContent] = useState();
|
||||||
|
const [categoryFilter] = useState([]);
|
||||||
|
const [formatFilter] = useState([]);
|
||||||
|
const [sortBy] = useState();
|
||||||
|
const [change] = useState(false);
|
||||||
|
const [contentVideo, setContentVideo] = useState([]);
|
||||||
|
const [contentImage, setContentImage] = useState([]);
|
||||||
|
const [contentDocument, setContentDocument] = useState([]);
|
||||||
|
const [contentAudio, setContentAudio] = useState([]);
|
||||||
|
const [, setGetTotalPage] = useState([]);
|
||||||
|
const [refresh, setRefresh] = useState(false);
|
||||||
|
const [, setCopySuccess] = useState("");
|
||||||
|
const [, setWishlistId] = useState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataVideo();
|
||||||
|
}, [page, category, title]);
|
||||||
|
|
||||||
|
async function getDataVideo() {
|
||||||
|
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
const response = await mediaWishlist("2", isInstitute ? instituteId : "", name, filter, "9", pages, sortBy, format);
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentVideo(response.data?.data?.content);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
loading();
|
||||||
|
const response = await getInfoProfile();
|
||||||
|
|
||||||
|
// console.log(response?.data.data);
|
||||||
|
setProfile(response?.data?.data);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataVideo();
|
||||||
|
}, [change, refresh]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataDocument();
|
||||||
|
}, [page, category, title]);
|
||||||
|
|
||||||
|
async function getDataDocument() {
|
||||||
|
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
|
||||||
|
const response = await mediaWishlist("3", isInstitute ? instituteId : "", name, filter, "12", pages, sortBy, format);
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentDocument(response.data?.data?.content);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataDocument();
|
||||||
|
}, [change, refresh]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataAudio();
|
||||||
|
}, [page, category, title]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataAudio();
|
||||||
|
}, [change, refresh]);
|
||||||
|
|
||||||
|
async function getDataAudio() {
|
||||||
|
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
|
||||||
|
const response = await mediaWishlist("4", isInstitute ? instituteId : "", name, filter, "6", pages, sortBy, format);
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentAudio(response.data?.data?.content);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataAudio();
|
||||||
|
}, [change]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataImage();
|
||||||
|
}, [page, category, title, refresh]);
|
||||||
|
|
||||||
|
async function getDataImage() {
|
||||||
|
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
|
||||||
|
const response = await mediaWishlist("1", isInstitute ? instituteId : "", name, filter, "12", pages, sortBy, format);
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentImage(response.data?.data?.content);
|
||||||
|
// console.log("response", response);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
getDataImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
}, [page, refresh]);
|
||||||
|
|
||||||
|
async function checkWishlist(uploadId: any) {
|
||||||
|
if (userId) {
|
||||||
|
const res = await checkWishlistStatus(uploadId);
|
||||||
|
console.log(res.data?.data);
|
||||||
|
// const isAlreadyOnWishlist = res.data?.data == "-1" ? false : true;
|
||||||
|
// if (isAlreadyOnWishlist == true) {
|
||||||
|
// warning("Konten sudah Ada", `#`);
|
||||||
|
// }
|
||||||
|
setWishlistId(res.data?.data); // setIsSaved(isAlreadyOnWishlist);
|
||||||
|
// console.log("isSave", isAlreadyOnWishlist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSaveWishlist = async (uploadId: any) => {
|
||||||
|
if (Number(userRoleId) < 1 || userRoleId == undefined) {
|
||||||
|
router.push("/auth/login");
|
||||||
|
} else {
|
||||||
|
console.log("data", uploadId);
|
||||||
|
const data = {
|
||||||
|
mediaUploadId: uploadId,
|
||||||
|
};
|
||||||
|
|
||||||
|
loading();
|
||||||
|
checkWishlist(uploadId);
|
||||||
|
|
||||||
|
const res = await saveWishlist(data);
|
||||||
|
if (res.error) {
|
||||||
|
error(res.message);
|
||||||
|
console.log("simpan data", res);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
successCallback("Konten Berhasil Disimpan");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async function deleteProcess(id: any) {
|
||||||
|
loading();
|
||||||
|
const resDelete = await deleteWishlist(id);
|
||||||
|
|
||||||
|
if (resDelete.error) {
|
||||||
|
error(resDelete.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRefresh((prevRefresh) => !prevRefresh);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDelete = (id: any) => {
|
||||||
|
MySwal.fire({
|
||||||
|
title: "Hapus Data",
|
||||||
|
text: "",
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
cancelButtonColor: "#3085d6",
|
||||||
|
confirmButtonColor: "#d33",
|
||||||
|
confirmButtonText: "Hapus",
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
deleteProcess(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const copyToClip = async (url: any) => {
|
||||||
|
await navigator.clipboard.writeText(`https://mediahub.polri.go.id/video/detail/${url}`);
|
||||||
|
setCopySuccess("Copied");
|
||||||
|
// toast.success("Link Berhasil Di Copy");
|
||||||
|
};
|
||||||
|
|
||||||
|
const [hasMounted, setHasMounted] = useState(false);
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
useEffect(() => {
|
||||||
|
setHasMounted(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Render
|
||||||
|
if (!hasMounted) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<HeaderManagement />
|
||||||
|
<div className="flex flex-row">
|
||||||
|
<SidebarManagement />
|
||||||
|
<div className="w-2/3 p-12">
|
||||||
|
<div>
|
||||||
|
<h1 className="text-2xl font-semibold">Galeri Saya</h1>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col p-4">
|
||||||
|
<div className="mx-auto w-full max-w-7xl justify-start flex px-5 flex-col lg:flex-row gap-5 mb-4">
|
||||||
|
<Tabs value={selectedTab} onValueChange={setSelectedTab}>
|
||||||
|
<TabsList className="grid grid-cols-2 lg:flex lg:flex-row ">
|
||||||
|
<TabsTrigger
|
||||||
|
value="video"
|
||||||
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
|
>
|
||||||
|
Audio Visual
|
||||||
|
</TabsTrigger>
|
||||||
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
||||||
|
<TabsTrigger
|
||||||
|
value="audio"
|
||||||
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
|
>
|
||||||
|
Audio
|
||||||
|
</TabsTrigger>
|
||||||
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
||||||
|
<TabsTrigger
|
||||||
|
value="image"
|
||||||
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
|
>
|
||||||
|
Foto
|
||||||
|
</TabsTrigger>
|
||||||
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
||||||
|
<TabsTrigger
|
||||||
|
value="text"
|
||||||
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
|
>
|
||||||
|
Teks
|
||||||
|
</TabsTrigger>
|
||||||
|
</TabsList>
|
||||||
|
</Tabs>
|
||||||
|
</div>
|
||||||
|
<div className="px-0 lg:px-10">
|
||||||
|
{selectedTab == "video" ? (
|
||||||
|
contentVideo?.length > 0 ? (
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
|
{contentVideo?.map((video: any) => (
|
||||||
|
<Card key={video?.id} className="hover:scale-110 transition-transform duration-300">
|
||||||
|
<CardContent className="flex flex-col bg-black dark:bg-white w-full rounded-lg p-0">
|
||||||
|
<Link href={`/video/detail/${video?.mediaUpload?.slug}`}>
|
||||||
|
<img src={video?.mediaUpload?.thumbnailLink} className="h-40 object-cover items-center justify-center cursor-pointer rounded-lg place-self-center" />
|
||||||
|
<div className="font-semibold p-4 text-white text-xs lg:text-sm dark:text-black truncate w-full">{video?.mediaUpload?.title}</div>
|
||||||
|
</Link>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="flex items-center justify-center">
|
||||||
|
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
) : selectedTab == "audio" ? (
|
||||||
|
contentAudio?.length > 0 ? (
|
||||||
|
<div className=" grid grid-cols-1 gap-6 ">
|
||||||
|
{contentAudio?.map((audio: any) => (
|
||||||
|
<Link
|
||||||
|
href={`/audio/detail/${audio?.mediaUpload?.slug}`}
|
||||||
|
key={audio?.id}
|
||||||
|
className="flex flex-col sm:flex-row items-center hover:scale-110 transition-transform duration-300 bg-white dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full"
|
||||||
|
>
|
||||||
|
<div className="flex items-center justify-center bg-red-500 text-white rounded-lg w-16 h-8 lg:h-16">
|
||||||
|
<svg width="32" height="34" viewBox="0 0 32 34" fill="null" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path
|
||||||
|
d="M23.404 0.452014C23.7033 0.35857 24.0204 0.336816 24.3297 0.388509C24.639 0.440203 24.9318 0.563895 25.1845 0.749599C25.4371 0.935304 25.6426 1.17782 25.7843 1.45756C25.9259 1.73731 25.9998 2.04644 26 2.36001V14.414C25.3462 14.2296 24.6766 14.1064 24 14.046V8.36001L10 12.736V27C10 28.1264 9.6197 29.2197 8.92071 30.1029C8.22172 30.9861 7.24499 31.6075 6.14877 31.8663C5.05255 32.125 3.90107 32.0061 2.88089 31.5287C1.86071 31.0514 1.03159 30.2435 0.52787 29.2361C0.024152 28.2286 -0.124656 27.0806 0.105556 25.9781C0.335768 24.8755 0.931513 23.883 1.79627 23.1613C2.66102 22.4396 3.74413 22.031 4.87009 22.0017C5.99606 21.9724 7.09893 22.3242 8.00001 23V6.73601C7.99982 6.30956 8.13596 5.8942 8.38854 5.55059C8.64112 5.20698 8.99692 4.9531 9.40401 4.82601L23.404 0.452014ZM10 10.64L24 6.26601V2.36001L10 6.73601V10.64ZM5.00001 24C4.20436 24 3.44129 24.3161 2.87869 24.8787C2.31608 25.4413 2.00001 26.2044 2.00001 27C2.00001 27.7957 2.31608 28.5587 2.87869 29.1213C3.44129 29.6839 4.20436 30 5.00001 30C5.79566 30 6.55872 29.6839 7.12133 29.1213C7.68394 28.5587 8.00001 27.7957 8.00001 27C8.00001 26.2044 7.68394 25.4413 7.12133 24.8787C6.55872 24.3161 5.79566 24 5.00001 24ZM32 25C32 27.387 31.0518 29.6761 29.364 31.364C27.6761 33.0518 25.387 34 23 34C20.6131 34 18.3239 33.0518 16.636 31.364C14.9482 29.6761 14 27.387 14 25C14 22.6131 14.9482 20.3239 16.636 18.6361C18.3239 16.9482 20.6131 16 23 16C25.387 16 27.6761 16.9482 29.364 18.6361C31.0518 20.3239 32 22.6131 32 25ZM27.47 24.128L21.482 20.828C21.3298 20.7443 21.1583 20.7016 20.9846 20.7043C20.8108 20.707 20.6408 20.7549 20.4912 20.8433C20.3416 20.9317 20.2176 21.0576 20.1315 21.2086C20.0453 21.3595 20 21.5302 20 21.704V28.304C20 28.4778 20.0453 28.6486 20.1315 28.7995C20.2176 28.9504 20.3416 29.0763 20.4912 29.1647C20.6408 29.2531 20.8108 29.301 20.9846 29.3037C21.1583 29.3064 21.3298 29.2638 21.482 29.18L27.47 25.88C27.6268 25.7937 27.7575 25.6669 27.8486 25.5128C27.9397 25.3587 27.9877 25.183 27.9877 25.004C27.9877 24.825 27.9397 24.6493 27.8486 24.4952C27.7575 24.3412 27.6268 24.2143 27.47 24.128Z"
|
||||||
|
fill="white"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col flex-1">
|
||||||
|
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm">{audio?.mediaUpload?.title}</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center justify-center gap-3">
|
||||||
|
<div className="mt-2">
|
||||||
|
<img src="/assets/wave.svg" className="w-80" />
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row items-center justify-center text-gray-500 dark:text-gray-400">
|
||||||
|
<img src="/assets/audio-icon.png" alt="#" className="flex items-center justify-center" />
|
||||||
|
<div className="flex mx-2 items-center justify-center">{audio?.mediaUpload?.duration}</div>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
||||||
|
<path
|
||||||
|
fill="#f00"
|
||||||
|
d="M7.707 10.293a1 1 0 1 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0-1.414-1.414L11 11.586V6h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5v5.586zM9 4a1 1 0 0 1 2 0v2H9z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="flex items-center justify-center">
|
||||||
|
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
) : selectedTab == "image" ? (
|
||||||
|
contentImage?.length > 0 ? (
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
|
{contentImage?.map((image: any) => (
|
||||||
|
<Card key={image?.id} className="hover:scale-110 transition-transform duration-300">
|
||||||
|
<CardContent className="flex flex-col bg-black dark:bg-white w-full rounded-lg p-0">
|
||||||
|
<Link href={`/image/detail/${image?.mediaUpload?.slug}`}>
|
||||||
|
<img src={image?.mediaUpload?.thumbnailLink} className="h-40 object-cover items-center justify-center cursor-pointer rounded-lg place-self-center" />
|
||||||
|
<div className="font-semibold p-4 text-white text-xs lg:text-sm dark:text-black truncate w-full">{image?.mediaUpload?.title}</div>
|
||||||
|
</Link>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="flex items-center justify-center">
|
||||||
|
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
) : contentDocument.length > 0 ? (
|
||||||
|
<div className=" grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
|
{contentDocument?.map((document: any) => (
|
||||||
|
<Link href={`/document/detail/${document?.mediaUpload?.slug}`} key={document?.id} className="flex flex-col bg-yellow-500 sm:flex-row items-center dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full">
|
||||||
|
<div className="flex items-center justify-center rounded-lg w-16 h-16">
|
||||||
|
<svg width="28" height="34" viewBox="0 0 28 34" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path
|
||||||
|
d="M5.6665 17.4167C5.6665 17.0851 5.7982 16.7672 6.03262 16.5328C6.26704 16.2984 6.58498 16.1667 6.9165 16.1667C7.24802 16.1667 7.56597 16.2984 7.80039 16.5328C8.03481 16.7672 8.1665 17.0851 8.1665 17.4167C8.1665 17.7482 8.03481 18.0661 7.80039 18.3005C7.56597 18.535 7.24802 18.6667 6.9165 18.6667C6.58498 18.6667 6.26704 18.535 6.03262 18.3005C5.7982 18.0661 5.6665 17.7482 5.6665 17.4167ZM6.9165 21.1667C6.58498 21.1667 6.26704 21.2984 6.03262 21.5328C5.7982 21.7672 5.6665 22.0851 5.6665 22.4167C5.6665 22.7482 5.7982 23.0661 6.03262 23.3005C6.26704 23.535 6.58498 23.6667 6.9165 23.6667C7.24802 23.6667 7.56597 23.535 7.80039 23.3005C8.03481 23.0661 8.1665 22.7482 8.1665 22.4167C8.1665 22.0851 8.03481 21.7672 7.80039 21.5328C7.56597 21.2984 7.24802 21.1667 6.9165 21.1667ZM5.6665 27.4167C5.6665 27.0851 5.7982 26.7672 6.03262 26.5328C6.26704 26.2984 6.58498 26.1667 6.9165 26.1667C7.24802 26.1667 7.56597 26.2984 7.80039 26.5328C8.03481 26.7672 8.1665 27.0851 8.1665 27.4167C8.1665 27.7482 8.03481 28.0661 7.80039 28.3005C7.56597 28.535 7.24802 28.6667 6.9165 28.6667C6.58498 28.6667 6.26704 28.535 6.03262 28.3005C5.7982 28.0661 5.6665 27.7482 5.6665 27.4167ZM11.9165 16.1667C11.585 16.1667 11.267 16.2984 11.0326 16.5328C10.7982 16.7672 10.6665 17.0851 10.6665 17.4167C10.6665 17.7482 10.7982 18.0661 11.0326 18.3005C11.267 18.535 11.585 18.6667 11.9165 18.6667H21.0832C21.4147 18.6667 21.7326 18.535 21.9671 18.3005C22.2015 18.0661 22.3332 17.7482 22.3332 17.4167C22.3332 17.0851 22.2015 16.7672 21.9671 16.5328C21.7326 16.2984 21.4147 16.1667 21.0832 16.1667H11.9165ZM10.6665 22.4167C10.6665 22.0851 10.7982 21.7672 11.0326 21.5328C11.267 21.2984 11.585 21.1667 11.9165 21.1667H21.0832C21.4147 21.1667 21.7326 21.2984 21.9671 21.5328C22.2015 21.7672 22.3332 22.0851 22.3332 22.4167C22.3332 22.7482 22.2015 23.0661 21.9671 23.3005C21.7326 23.535 21.4147 23.6667 21.0832 23.6667H11.9165C11.585 23.6667 11.267 23.535 11.0326 23.3005C10.7982 23.0661 10.6665 22.7482 10.6665 22.4167ZM11.9165 26.1667C11.585 26.1667 11.267 26.2984 11.0326 26.5328C10.7982 26.7672 10.6665 27.0851 10.6665 27.4167C10.6665 27.7482 10.7982 28.0661 11.0326 28.3005C11.267 28.535 11.585 28.6667 11.9165 28.6667H21.0832C21.4147 28.6667 21.7326 28.535 21.9671 28.3005C22.2015 28.0661 22.3332 27.7482 22.3332 27.4167C22.3332 27.0851 22.2015 26.7672 21.9671 26.5328C21.7326 26.2984 21.4147 26.1667 21.0832 26.1667H11.9165ZM26.3565 11.0233L16.6415 1.31C16.6157 1.28605 16.5885 1.26378 16.5598 1.24333C16.5392 1.22742 16.5192 1.21074 16.4998 1.19333C16.3852 1.08512 16.2632 0.984882 16.1348 0.893332C16.0922 0.865802 16.0476 0.841298 16.0015 0.819999L15.9215 0.779999L15.8382 0.731666C15.7482 0.679999 15.6565 0.626665 15.5615 0.586665C15.2296 0.454104 14.8783 0.376423 14.5215 0.356665C14.4885 0.354519 14.4557 0.350625 14.4232 0.344999C14.3779 0.338012 14.3323 0.334114 14.2865 0.333332H3.99984C3.11578 0.333332 2.26794 0.684521 1.64281 1.30964C1.01769 1.93476 0.666504 2.78261 0.666504 3.66667V30.3333C0.666504 31.2174 1.01769 32.0652 1.64281 32.6904C2.26794 33.3155 3.11578 33.6667 3.99984 33.6667H23.9998C24.8839 33.6667 25.7317 33.3155 26.3569 32.6904C26.982 32.0652 27.3332 31.2174 27.3332 30.3333V13.38C27.333 12.496 26.9817 11.6483 26.3565 11.0233ZM24.8332 30.3333C24.8332 30.5543 24.7454 30.7663 24.5891 30.9226C24.4328 31.0789 24.2208 31.1667 23.9998 31.1667H3.99984C3.77882 31.1667 3.56686 31.0789 3.41058 30.9226C3.2543 30.7663 3.1665 30.5543 3.1665 30.3333V3.66667C3.1665 3.44565 3.2543 3.23369 3.41058 3.07741C3.56686 2.92113 3.77882 2.83333 3.99984 2.83333H13.9998V10.3333C13.9998 11.2174 14.351 12.0652 14.9761 12.6904C15.6013 13.3155 16.4491 13.6667 17.3332 13.6667H24.8332V30.3333ZM16.4998 4.70166L22.9632 11.1667H17.3332C17.1122 11.1667 16.9002 11.0789 16.7439 10.9226C16.5876 10.7663 16.4998 10.5543 16.4998 10.3333V4.70166Z"
|
||||||
|
fill="black"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col flex-1 gap-2">
|
||||||
|
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm">{document?.mediaUpload?.title}</div>
|
||||||
|
<div className="flex gap-2 items-center text-xs text-red-500 dark:text-red-500">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512">
|
||||||
|
<path fill="#f00" d="M224 30v256h-64l96 128l96-128h-64V30zM32 434v48h448v-48z" />
|
||||||
|
</svg>
|
||||||
|
Download Dokumen
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="flex items-center justify-center">
|
||||||
|
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Galery;
|
||||||
|
|
@ -0,0 +1,395 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { close, error, loading, successCallback } from "@/config/swal";
|
||||||
|
import { checkWishlistStatus, deleteWishlist, getInfoProfile, mediaWishlist, saveWishlist } from "@/service/landing/landing";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { Link, useRouter } from "@/i18n/routing";
|
||||||
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
|
import HeaderManagement from "@/components/landing-page/header-management";
|
||||||
|
import SidebarManagement from "@/components/landing-page/sidebar-management";
|
||||||
|
import withReactContent from "sweetalert2-react-content";
|
||||||
|
import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
|
import Swal from "sweetalert2";
|
||||||
|
import { useToast } from "@/components/ui/use-toast";
|
||||||
|
|
||||||
|
const Galery = (props: any) => {
|
||||||
|
const [profile, setProfile] = useState<any>();
|
||||||
|
const [selectedTab, setSelectedTab] = useState("video");
|
||||||
|
const router = useRouter();
|
||||||
|
const MySwal = withReactContent(Swal);
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
// const { id } = router.query;
|
||||||
|
const page: any = searchParams?.get("page");
|
||||||
|
const title = searchParams?.get("title");
|
||||||
|
const category = searchParams?.get("category");
|
||||||
|
const pages = page ? page - 1 : 0;
|
||||||
|
const { isInstitute, instituteId } = props;
|
||||||
|
const userId = getCookiesDecrypt("uie");
|
||||||
|
const userRoleId = getCookiesDecrypt("urie");
|
||||||
|
|
||||||
|
const [totalContent, setTotalContent] = useState();
|
||||||
|
const [categoryFilter] = useState([]);
|
||||||
|
const [formatFilter] = useState([]);
|
||||||
|
const [sortBy] = useState();
|
||||||
|
const [change] = useState(false);
|
||||||
|
const [contentVideo, setContentVideo] = useState([]);
|
||||||
|
const [contentImage, setContentImage] = useState([]);
|
||||||
|
const [contentDocument, setContentDocument] = useState([]);
|
||||||
|
const [contentAudio, setContentAudio] = useState([]);
|
||||||
|
const [, setGetTotalPage] = useState([]);
|
||||||
|
const [refresh, setRefresh] = useState(false);
|
||||||
|
const [, setCopySuccess] = useState("");
|
||||||
|
const [, setWishlistId] = useState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataVideo();
|
||||||
|
}, [page, category, title]);
|
||||||
|
|
||||||
|
async function getDataVideo() {
|
||||||
|
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
const response = await mediaWishlist("2", isInstitute ? instituteId : "", name, filter, "9", pages, sortBy, format);
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentVideo(response.data?.data?.content);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
loading();
|
||||||
|
const response = await getInfoProfile();
|
||||||
|
|
||||||
|
// console.log(response?.data.data);
|
||||||
|
setProfile(response?.data?.data);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataVideo();
|
||||||
|
}, [change, refresh]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataDocument();
|
||||||
|
}, [page, category, title]);
|
||||||
|
|
||||||
|
async function getDataDocument() {
|
||||||
|
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
|
||||||
|
const response = await mediaWishlist("3", isInstitute ? instituteId : "", name, filter, "12", pages, sortBy, format);
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentDocument(response.data?.data?.content);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataDocument();
|
||||||
|
}, [change, refresh]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataAudio();
|
||||||
|
}, [page, category, title]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataAudio();
|
||||||
|
}, [change, refresh]);
|
||||||
|
|
||||||
|
async function getDataAudio() {
|
||||||
|
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
|
||||||
|
const response = await mediaWishlist("4", isInstitute ? instituteId : "", name, filter, "6", pages, sortBy, format);
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentAudio(response.data?.data?.content);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataAudio();
|
||||||
|
}, [change]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataImage();
|
||||||
|
}, [page, category, title, refresh]);
|
||||||
|
|
||||||
|
async function getDataImage() {
|
||||||
|
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
|
||||||
|
const response = await mediaWishlist("1", isInstitute ? instituteId : "", name, filter, "12", pages, sortBy, format);
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentImage(response.data?.data?.content);
|
||||||
|
// console.log("response", response);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
getDataImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
}, [page, refresh]);
|
||||||
|
|
||||||
|
async function checkWishlist(uploadId: any) {
|
||||||
|
if (userId) {
|
||||||
|
const res = await checkWishlistStatus(uploadId);
|
||||||
|
console.log(res.data?.data);
|
||||||
|
// const isAlreadyOnWishlist = res.data?.data == "-1" ? false : true;
|
||||||
|
// if (isAlreadyOnWishlist == true) {
|
||||||
|
// warning("Konten sudah Ada", `#`);
|
||||||
|
// }
|
||||||
|
setWishlistId(res.data?.data); // setIsSaved(isAlreadyOnWishlist);
|
||||||
|
// console.log("isSave", isAlreadyOnWishlist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSaveWishlist = async (uploadId: any) => {
|
||||||
|
if (Number(userRoleId) < 1 || userRoleId == undefined) {
|
||||||
|
router.push("/auth/login");
|
||||||
|
} else {
|
||||||
|
console.log("data", uploadId);
|
||||||
|
const data = {
|
||||||
|
mediaUploadId: uploadId,
|
||||||
|
};
|
||||||
|
|
||||||
|
loading();
|
||||||
|
checkWishlist(uploadId);
|
||||||
|
|
||||||
|
const res = await saveWishlist(data);
|
||||||
|
if (res.error) {
|
||||||
|
error(res.message);
|
||||||
|
console.log("simpan data", res);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
successCallback("Konten Berhasil Disimpan");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async function deleteProcess(id: any) {
|
||||||
|
loading();
|
||||||
|
const resDelete = await deleteWishlist(id);
|
||||||
|
|
||||||
|
if (resDelete.error) {
|
||||||
|
error(resDelete.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRefresh((prevRefresh) => !prevRefresh);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDelete = (id: any) => {
|
||||||
|
MySwal.fire({
|
||||||
|
title: "Hapus Data",
|
||||||
|
text: "",
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
cancelButtonColor: "#3085d6",
|
||||||
|
confirmButtonColor: "#d33",
|
||||||
|
confirmButtonText: "Hapus",
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
deleteProcess(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const copyToClip = async (url: any) => {
|
||||||
|
await navigator.clipboard.writeText(`https://mediahub.polri.go.id/video/detail/${url}`);
|
||||||
|
setCopySuccess("Copied");
|
||||||
|
// toast.success("Link Berhasil Di Copy");
|
||||||
|
};
|
||||||
|
|
||||||
|
const [hasMounted, setHasMounted] = useState(false);
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
useEffect(() => {
|
||||||
|
setHasMounted(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Render
|
||||||
|
if (!hasMounted) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<HeaderManagement />
|
||||||
|
<div className="flex flex-row">
|
||||||
|
<SidebarManagement />
|
||||||
|
<div className="w-2/3 p-12">
|
||||||
|
<div>
|
||||||
|
<h1 className="text-2xl font-semibold">Galeri {profile?.institute?.name}</h1>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col p-4">
|
||||||
|
<div className="mx-auto w-full max-w-7xl justify-start flex px-5 flex-col lg:flex-row gap-5 mb-4">
|
||||||
|
<Tabs value={selectedTab} onValueChange={setSelectedTab}>
|
||||||
|
<TabsList className="grid grid-cols-2 lg:flex lg:flex-row ">
|
||||||
|
<TabsTrigger
|
||||||
|
value="video"
|
||||||
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
|
>
|
||||||
|
Audio Visual
|
||||||
|
</TabsTrigger>
|
||||||
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
||||||
|
<TabsTrigger
|
||||||
|
value="audio"
|
||||||
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
|
>
|
||||||
|
Audio
|
||||||
|
</TabsTrigger>
|
||||||
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
||||||
|
<TabsTrigger
|
||||||
|
value="image"
|
||||||
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
|
>
|
||||||
|
Foto
|
||||||
|
</TabsTrigger>
|
||||||
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
||||||
|
<TabsTrigger
|
||||||
|
value="text"
|
||||||
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
|
>
|
||||||
|
Teks
|
||||||
|
</TabsTrigger>
|
||||||
|
</TabsList>
|
||||||
|
</Tabs>
|
||||||
|
</div>
|
||||||
|
<div className="px-0 lg:px-10">
|
||||||
|
{selectedTab == "video" ? (
|
||||||
|
contentVideo?.length > 0 ? (
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
|
{contentVideo?.map((video: any) => (
|
||||||
|
<Card key={video?.id} className="hover:scale-110 transition-transform duration-300">
|
||||||
|
<CardContent className="flex flex-col bg-black dark:bg-white w-full rounded-lg p-0">
|
||||||
|
<Link href={`/video/detail/${video?.mediaUpload?.slug}`}>
|
||||||
|
<img src={video?.mediaUpload?.thumbnailLink} className="h-40 object-cover items-center justify-center cursor-pointer rounded-lg place-self-center" />
|
||||||
|
<div className="font-semibold p-4 text-white text-xs lg:text-sm dark:text-black truncate w-full">{video?.mediaUpload?.title}</div>
|
||||||
|
</Link>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="flex items-center justify-center">
|
||||||
|
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
) : selectedTab == "audio" ? (
|
||||||
|
contentAudio?.length > 0 ? (
|
||||||
|
<div className=" grid grid-cols-1 gap-6 ">
|
||||||
|
{contentAudio?.map((audio: any) => (
|
||||||
|
<Link
|
||||||
|
href={`/audio/detail/${audio?.mediaUpload?.slug}`}
|
||||||
|
key={audio?.id}
|
||||||
|
className="flex flex-col sm:flex-row items-center hover:scale-110 transition-transform duration-300 bg-white dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full"
|
||||||
|
>
|
||||||
|
<div className="flex items-center justify-center bg-red-500 text-white rounded-lg w-16 h-8 lg:h-16">
|
||||||
|
<svg width="32" height="34" viewBox="0 0 32 34" fill="null" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path
|
||||||
|
d="M23.404 0.452014C23.7033 0.35857 24.0204 0.336816 24.3297 0.388509C24.639 0.440203 24.9318 0.563895 25.1845 0.749599C25.4371 0.935304 25.6426 1.17782 25.7843 1.45756C25.9259 1.73731 25.9998 2.04644 26 2.36001V14.414C25.3462 14.2296 24.6766 14.1064 24 14.046V8.36001L10 12.736V27C10 28.1264 9.6197 29.2197 8.92071 30.1029C8.22172 30.9861 7.24499 31.6075 6.14877 31.8663C5.05255 32.125 3.90107 32.0061 2.88089 31.5287C1.86071 31.0514 1.03159 30.2435 0.52787 29.2361C0.024152 28.2286 -0.124656 27.0806 0.105556 25.9781C0.335768 24.8755 0.931513 23.883 1.79627 23.1613C2.66102 22.4396 3.74413 22.031 4.87009 22.0017C5.99606 21.9724 7.09893 22.3242 8.00001 23V6.73601C7.99982 6.30956 8.13596 5.8942 8.38854 5.55059C8.64112 5.20698 8.99692 4.9531 9.40401 4.82601L23.404 0.452014ZM10 10.64L24 6.26601V2.36001L10 6.73601V10.64ZM5.00001 24C4.20436 24 3.44129 24.3161 2.87869 24.8787C2.31608 25.4413 2.00001 26.2044 2.00001 27C2.00001 27.7957 2.31608 28.5587 2.87869 29.1213C3.44129 29.6839 4.20436 30 5.00001 30C5.79566 30 6.55872 29.6839 7.12133 29.1213C7.68394 28.5587 8.00001 27.7957 8.00001 27C8.00001 26.2044 7.68394 25.4413 7.12133 24.8787C6.55872 24.3161 5.79566 24 5.00001 24ZM32 25C32 27.387 31.0518 29.6761 29.364 31.364C27.6761 33.0518 25.387 34 23 34C20.6131 34 18.3239 33.0518 16.636 31.364C14.9482 29.6761 14 27.387 14 25C14 22.6131 14.9482 20.3239 16.636 18.6361C18.3239 16.9482 20.6131 16 23 16C25.387 16 27.6761 16.9482 29.364 18.6361C31.0518 20.3239 32 22.6131 32 25ZM27.47 24.128L21.482 20.828C21.3298 20.7443 21.1583 20.7016 20.9846 20.7043C20.8108 20.707 20.6408 20.7549 20.4912 20.8433C20.3416 20.9317 20.2176 21.0576 20.1315 21.2086C20.0453 21.3595 20 21.5302 20 21.704V28.304C20 28.4778 20.0453 28.6486 20.1315 28.7995C20.2176 28.9504 20.3416 29.0763 20.4912 29.1647C20.6408 29.2531 20.8108 29.301 20.9846 29.3037C21.1583 29.3064 21.3298 29.2638 21.482 29.18L27.47 25.88C27.6268 25.7937 27.7575 25.6669 27.8486 25.5128C27.9397 25.3587 27.9877 25.183 27.9877 25.004C27.9877 24.825 27.9397 24.6493 27.8486 24.4952C27.7575 24.3412 27.6268 24.2143 27.47 24.128Z"
|
||||||
|
fill="white"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col flex-1">
|
||||||
|
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm">{audio?.mediaUpload?.title}</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center justify-center gap-3">
|
||||||
|
<div className="mt-2">
|
||||||
|
<img src="/assets/wave.svg" className="w-80" />
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row items-center justify-center text-gray-500 dark:text-gray-400">
|
||||||
|
<img src="/assets/audio-icon.png" alt="#" className="flex items-center justify-center" />
|
||||||
|
<div className="flex mx-2 items-center justify-center">{audio?.mediaUpload?.duration}</div>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
||||||
|
<path
|
||||||
|
fill="#f00"
|
||||||
|
d="M7.707 10.293a1 1 0 1 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0-1.414-1.414L11 11.586V6h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5v5.586zM9 4a1 1 0 0 1 2 0v2H9z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="flex items-center justify-center">
|
||||||
|
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
) : selectedTab == "image" ? (
|
||||||
|
contentImage?.length > 0 ? (
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
|
{contentImage?.map((image: any) => (
|
||||||
|
<Card key={image?.id} className="hover:scale-110 transition-transform duration-300">
|
||||||
|
<CardContent className="flex flex-col bg-black dark:bg-white w-full rounded-lg p-0">
|
||||||
|
<Link href={`/image/detail/${image?.mediaUpload?.slug}`}>
|
||||||
|
<img src={image?.mediaUpload?.thumbnailLink} className="h-40 object-cover items-center justify-center cursor-pointer rounded-lg place-self-center" />
|
||||||
|
<div className="font-semibold p-4 text-white text-xs lg:text-sm dark:text-black truncate w-full">{image?.mediaUpload?.title}</div>
|
||||||
|
</Link>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="flex items-center justify-center">
|
||||||
|
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
) : contentDocument.length > 0 ? (
|
||||||
|
<div className=" grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
|
{contentDocument?.map((document: any) => (
|
||||||
|
<Link href={`/document/detail/${document?.mediaUpload?.slug}`} key={document?.id} className="flex flex-col bg-yellow-500 sm:flex-row items-center dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full">
|
||||||
|
<div className="flex items-center justify-center rounded-lg w-16 h-16">
|
||||||
|
<svg width="28" height="34" viewBox="0 0 28 34" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path
|
||||||
|
d="M5.6665 17.4167C5.6665 17.0851 5.7982 16.7672 6.03262 16.5328C6.26704 16.2984 6.58498 16.1667 6.9165 16.1667C7.24802 16.1667 7.56597 16.2984 7.80039 16.5328C8.03481 16.7672 8.1665 17.0851 8.1665 17.4167C8.1665 17.7482 8.03481 18.0661 7.80039 18.3005C7.56597 18.535 7.24802 18.6667 6.9165 18.6667C6.58498 18.6667 6.26704 18.535 6.03262 18.3005C5.7982 18.0661 5.6665 17.7482 5.6665 17.4167ZM6.9165 21.1667C6.58498 21.1667 6.26704 21.2984 6.03262 21.5328C5.7982 21.7672 5.6665 22.0851 5.6665 22.4167C5.6665 22.7482 5.7982 23.0661 6.03262 23.3005C6.26704 23.535 6.58498 23.6667 6.9165 23.6667C7.24802 23.6667 7.56597 23.535 7.80039 23.3005C8.03481 23.0661 8.1665 22.7482 8.1665 22.4167C8.1665 22.0851 8.03481 21.7672 7.80039 21.5328C7.56597 21.2984 7.24802 21.1667 6.9165 21.1667ZM5.6665 27.4167C5.6665 27.0851 5.7982 26.7672 6.03262 26.5328C6.26704 26.2984 6.58498 26.1667 6.9165 26.1667C7.24802 26.1667 7.56597 26.2984 7.80039 26.5328C8.03481 26.7672 8.1665 27.0851 8.1665 27.4167C8.1665 27.7482 8.03481 28.0661 7.80039 28.3005C7.56597 28.535 7.24802 28.6667 6.9165 28.6667C6.58498 28.6667 6.26704 28.535 6.03262 28.3005C5.7982 28.0661 5.6665 27.7482 5.6665 27.4167ZM11.9165 16.1667C11.585 16.1667 11.267 16.2984 11.0326 16.5328C10.7982 16.7672 10.6665 17.0851 10.6665 17.4167C10.6665 17.7482 10.7982 18.0661 11.0326 18.3005C11.267 18.535 11.585 18.6667 11.9165 18.6667H21.0832C21.4147 18.6667 21.7326 18.535 21.9671 18.3005C22.2015 18.0661 22.3332 17.7482 22.3332 17.4167C22.3332 17.0851 22.2015 16.7672 21.9671 16.5328C21.7326 16.2984 21.4147 16.1667 21.0832 16.1667H11.9165ZM10.6665 22.4167C10.6665 22.0851 10.7982 21.7672 11.0326 21.5328C11.267 21.2984 11.585 21.1667 11.9165 21.1667H21.0832C21.4147 21.1667 21.7326 21.2984 21.9671 21.5328C22.2015 21.7672 22.3332 22.0851 22.3332 22.4167C22.3332 22.7482 22.2015 23.0661 21.9671 23.3005C21.7326 23.535 21.4147 23.6667 21.0832 23.6667H11.9165C11.585 23.6667 11.267 23.535 11.0326 23.3005C10.7982 23.0661 10.6665 22.7482 10.6665 22.4167ZM11.9165 26.1667C11.585 26.1667 11.267 26.2984 11.0326 26.5328C10.7982 26.7672 10.6665 27.0851 10.6665 27.4167C10.6665 27.7482 10.7982 28.0661 11.0326 28.3005C11.267 28.535 11.585 28.6667 11.9165 28.6667H21.0832C21.4147 28.6667 21.7326 28.535 21.9671 28.3005C22.2015 28.0661 22.3332 27.7482 22.3332 27.4167C22.3332 27.0851 22.2015 26.7672 21.9671 26.5328C21.7326 26.2984 21.4147 26.1667 21.0832 26.1667H11.9165ZM26.3565 11.0233L16.6415 1.31C16.6157 1.28605 16.5885 1.26378 16.5598 1.24333C16.5392 1.22742 16.5192 1.21074 16.4998 1.19333C16.3852 1.08512 16.2632 0.984882 16.1348 0.893332C16.0922 0.865802 16.0476 0.841298 16.0015 0.819999L15.9215 0.779999L15.8382 0.731666C15.7482 0.679999 15.6565 0.626665 15.5615 0.586665C15.2296 0.454104 14.8783 0.376423 14.5215 0.356665C14.4885 0.354519 14.4557 0.350625 14.4232 0.344999C14.3779 0.338012 14.3323 0.334114 14.2865 0.333332H3.99984C3.11578 0.333332 2.26794 0.684521 1.64281 1.30964C1.01769 1.93476 0.666504 2.78261 0.666504 3.66667V30.3333C0.666504 31.2174 1.01769 32.0652 1.64281 32.6904C2.26794 33.3155 3.11578 33.6667 3.99984 33.6667H23.9998C24.8839 33.6667 25.7317 33.3155 26.3569 32.6904C26.982 32.0652 27.3332 31.2174 27.3332 30.3333V13.38C27.333 12.496 26.9817 11.6483 26.3565 11.0233ZM24.8332 30.3333C24.8332 30.5543 24.7454 30.7663 24.5891 30.9226C24.4328 31.0789 24.2208 31.1667 23.9998 31.1667H3.99984C3.77882 31.1667 3.56686 31.0789 3.41058 30.9226C3.2543 30.7663 3.1665 30.5543 3.1665 30.3333V3.66667C3.1665 3.44565 3.2543 3.23369 3.41058 3.07741C3.56686 2.92113 3.77882 2.83333 3.99984 2.83333H13.9998V10.3333C13.9998 11.2174 14.351 12.0652 14.9761 12.6904C15.6013 13.3155 16.4491 13.6667 17.3332 13.6667H24.8332V30.3333ZM16.4998 4.70166L22.9632 11.1667H17.3332C17.1122 11.1667 16.9002 11.0789 16.7439 10.9226C16.5876 10.7663 16.4998 10.5543 16.4998 10.3333V4.70166Z"
|
||||||
|
fill="black"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col flex-1 gap-2">
|
||||||
|
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm">{document?.mediaUpload?.title}</div>
|
||||||
|
<div className="flex gap-2 items-center text-xs text-red-500 dark:text-red-500">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512">
|
||||||
|
<path fill="#f00" d="M224 30v256h-64l96 128l96-128h-64V30zM32 434v48h448v-48z" />
|
||||||
|
</svg>
|
||||||
|
Download Dokumen
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="flex items-center justify-center">
|
||||||
|
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Galery;
|
||||||
|
|
@ -13,6 +13,7 @@ const layout = async ({ children }: { children: React.ReactNode }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
<Footer />
|
<Footer />
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -1,379 +0,0 @@
|
||||||
"use client";
|
|
||||||
|
|
||||||
import { Link } from "@/i18n/routing";
|
|
||||||
import { getInfoProfile, getListPorvinces, getUsersTeams } from "@/service/landing/landing";
|
|
||||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
|
||||||
import React, { useEffect, useState } from "react";
|
|
||||||
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel";
|
|
||||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
||||||
import { formatDateToIndonesian } from "@/utils/globals";
|
|
||||||
import { useParams } from "next/navigation";
|
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
|
||||||
|
|
||||||
const dummyContent = [
|
|
||||||
{ title: "Operasi Zebra Nataru", thumbnail: "/assets/img-header-blog.png", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" },
|
|
||||||
{ title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-2.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" },
|
|
||||||
{ title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" },
|
|
||||||
{ title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" },
|
|
||||||
{ title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" },
|
|
||||||
{ title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" },
|
|
||||||
];
|
|
||||||
|
|
||||||
const ContentManagement = () => {
|
|
||||||
const [profile, setProfile] = useState<any>();
|
|
||||||
const [province, setProvince] = useState([]);
|
|
||||||
const [, setUser] = useState();
|
|
||||||
const [selectedTab, setSelectedTab] = useState("video");
|
|
||||||
const params = useParams();
|
|
||||||
|
|
||||||
// const currentRoute = router.pathname;
|
|
||||||
// const profilePicture = Cookies.get("profile_picture");
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
async function initState() {
|
|
||||||
const response = await getInfoProfile();
|
|
||||||
setProfile(response?.data?.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getProvinces() {
|
|
||||||
const response = await getListPorvinces();
|
|
||||||
|
|
||||||
// console.log(response?.data.data);
|
|
||||||
setProvince(response?.data?.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// async function getDisticts() {
|
|
||||||
// const response = await getListDistricts();
|
|
||||||
// console.log(response?.data.data);
|
|
||||||
// setDistrict(response?.data.data);
|
|
||||||
// }
|
|
||||||
initState();
|
|
||||||
getProvinces(); // getDisticts();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
async function initState() {
|
|
||||||
if (profile != undefined) {
|
|
||||||
const response = await getUsersTeams(profile?.instituteId);
|
|
||||||
|
|
||||||
// console.log(response?.data?.data);
|
|
||||||
setUser(response?.data?.data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
initState();
|
|
||||||
}, [profile]);
|
|
||||||
|
|
||||||
function addDefaultProfile(ev: any) {
|
|
||||||
ev.target.src = "/assets/avatar-profile.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
const [hasMounted, setHasMounted] = useState(false);
|
|
||||||
// Hooks
|
|
||||||
useEffect(() => {
|
|
||||||
setHasMounted(true);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
// Render
|
|
||||||
if (!hasMounted) return null;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div>
|
|
||||||
{/* Header */}
|
|
||||||
<div className="bg-[#504e52] p-12">
|
|
||||||
<div className="flex justify-between mx-10">
|
|
||||||
<div className="flex items-center gap-2 ">
|
|
||||||
<img src="/assets/avatar-profile.png" alt="avatar" className="w-14 h-14" />
|
|
||||||
<div className="flex flex-col mx-2">
|
|
||||||
<p className="text-white text-sm font-semibold">{profile?.fullname}</p>
|
|
||||||
<p className="text-white text-sm font-light">{profile?.username}</p>
|
|
||||||
<p className="text-white text-sm font-light">
|
|
||||||
Aktif Sejak
|
|
||||||
{`${new Date(profile?.createdAt).getDate()}/${new Date(profile?.createdAt).getMonth() + 1}/${new Date(profile?.createdAt).getFullYear()} ${new Date(profile?.createdAt).getHours()}:${new Date(
|
|
||||||
profile?.createdAt
|
|
||||||
).getMinutes()}`}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Link href="/profile" className="flex items-center text-white gap-2">
|
|
||||||
<Icon icon="tdesign:setting-1-filled" />
|
|
||||||
Pengaturan
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex flex-col lg:flex-row">
|
|
||||||
{/* Konten Kiri */}
|
|
||||||
<div className="p-12 w-1/3">
|
|
||||||
<div className="border rounded-2xl border-black m-4">
|
|
||||||
<h1 className="text-xl p-5">Tentang Saya</h1>
|
|
||||||
<div>
|
|
||||||
<ul className="px-10 mb-4">
|
|
||||||
<li className="mb-5 font-light">
|
|
||||||
<p className="font-semibold">Email :</p>
|
|
||||||
{/* <p>msabdayagra@gmail.com</p> */}
|
|
||||||
<p>{profile?.email}</p>
|
|
||||||
</li>
|
|
||||||
<li className="mb-5 font-light">
|
|
||||||
<p className="font-semibold">No Handphone :</p>
|
|
||||||
{/* <p>0812-7561-7204</p> */}
|
|
||||||
<p>{profile?.phoneNumber}</p>
|
|
||||||
</li>
|
|
||||||
<li className="mb-5 font-light">
|
|
||||||
<p className="font-semibold">Alamat :</p>
|
|
||||||
{/* <p>Jl. Besar Tembung no.12</p> */}
|
|
||||||
<p>{profile?.address}</p>
|
|
||||||
</li>
|
|
||||||
<li className="mb-5 font-light">
|
|
||||||
<p className="font-semibold">Kategori :</p>
|
|
||||||
{/* <p>POLRI</p> */}
|
|
||||||
<p>{profile?.institute?.categoryRole?.name}</p>
|
|
||||||
</li>
|
|
||||||
<li className="mb-5 font-light">
|
|
||||||
<p className="font-semibold">Instansi/Perusahaan :</p>
|
|
||||||
{/* <p>Div Humas Polri</p> */}
|
|
||||||
<p>{profile?.institute?.name}</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="p-12">
|
|
||||||
<div className="mb-3">
|
|
||||||
<div className="hover:bg-slate-800 cursor-pointer rounded-lg flex justify-between">
|
|
||||||
<div className="flex items-center gap-2 text-lg">
|
|
||||||
<Icon icon="material-symbols-light:perm-media-rounded" />
|
|
||||||
<p className="text-sm">Galeri {profile?.institute?.name}</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="mb-3">
|
|
||||||
<div className="hover:bg-slate-800 cursor-pointer rounded-lg flex justify-between">
|
|
||||||
<div className="flex items-center gap-2 text-lg">
|
|
||||||
<Icon icon="heroicons:photo-solid" />
|
|
||||||
<p>Galeri Saya</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="mb-3">
|
|
||||||
<div className="hover:bg-slate-800 cursor-pointer rounded-lg flex justify-between">
|
|
||||||
<div className="flex items-center gap-2 text-lg">
|
|
||||||
<Icon icon="material-symbols-light:perm-media-rounded" />
|
|
||||||
<p>Galeri Rewrite</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="mb-3">
|
|
||||||
<div className="hover:bg-slate-800 cursor-pointer rounded-lg flex justify-between">
|
|
||||||
<div className="flex items-center gap-2 text-lg">
|
|
||||||
<Icon icon="mdi:users-group" />
|
|
||||||
<p>Tim Pengguna</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Kontent Kanan */}
|
|
||||||
<div className="w-2/3 p-12">
|
|
||||||
<div>
|
|
||||||
<h1 className="text-2xl font-semibold">Galeri {profile?.institute?.name}</h1>
|
|
||||||
</div>
|
|
||||||
<div className="px-4 lg:px-10 py-4">
|
|
||||||
<div className="flex flex-col p-4">
|
|
||||||
<div className="mx-auto w-full max-w-7xl justify-start flex px-5 flex-col lg:flex-row gap-5 mb-4">
|
|
||||||
<Tabs value={selectedTab} onValueChange={setSelectedTab}>
|
|
||||||
<TabsList className="grid grid-cols-2 lg:flex lg:flex-row ">
|
|
||||||
<TabsTrigger
|
|
||||||
value="video"
|
|
||||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
|
||||||
>
|
|
||||||
Audio Visual
|
|
||||||
</TabsTrigger>
|
|
||||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
|
||||||
<TabsTrigger
|
|
||||||
value="audio"
|
|
||||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
|
||||||
>
|
|
||||||
Audio
|
|
||||||
</TabsTrigger>
|
|
||||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
|
||||||
<TabsTrigger
|
|
||||||
value="image"
|
|
||||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
|
||||||
>
|
|
||||||
Foto
|
|
||||||
</TabsTrigger>
|
|
||||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
|
||||||
<TabsTrigger
|
|
||||||
value="text"
|
|
||||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
|
||||||
>
|
|
||||||
Teks
|
|
||||||
</TabsTrigger>
|
|
||||||
</TabsList>
|
|
||||||
</Tabs>
|
|
||||||
</div>
|
|
||||||
<div className="px-0 lg:px-10">
|
|
||||||
{selectedTab == "video" ? (
|
|
||||||
profile?.length > 0 ? (
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
||||||
{profile?.map((video: any) => (
|
|
||||||
<Card key={video?.id} className="hover:scale-110 transition-transform duration-300">
|
|
||||||
<CardContent className="flex flex-col text-xs lg:text-sm w-full p-0">
|
|
||||||
<Link href={`/video/detail/${video?.slug}`}>
|
|
||||||
<img src={video?.thumbnail} className="h-60 object-cover items-center justify-center cursor-pointer rounded-lg place-self-center" />
|
|
||||||
<div className="flex flex-row items-center gap-2 text-[10px] mx-2">
|
|
||||||
{formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| <Icon icon="formkit:eye" width="15" height="15" />
|
|
||||||
{video?.clickCount}{" "}
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 20 20">
|
|
||||||
<path
|
|
||||||
fill="#f00"
|
|
||||||
d="M7.707 10.293a1 1 0 1 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0-1.414-1.414L11 11.586V6h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5v5.586zM9 4a1 1 0 0 1 2 0v2H9z"
|
|
||||||
/>
|
|
||||||
</svg>{" "}
|
|
||||||
</div>
|
|
||||||
<div className="font-semibold pr-3 pb-3 mx-2 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible w-full">{video?.title}</div>
|
|
||||||
</Link>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<p className="flex items-center justify-center">
|
|
||||||
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
|
||||||
</p>
|
|
||||||
)
|
|
||||||
) : selectedTab == "audio" ? (
|
|
||||||
profile?.length > 0 ? (
|
|
||||||
<div className=" grid grid-cols-1 gap-6 ">
|
|
||||||
{profile?.map((audio: any) => (
|
|
||||||
<Link
|
|
||||||
href={`/audio/detail/${audio?.slug}`}
|
|
||||||
key={audio?.id}
|
|
||||||
className="flex flex-col sm:flex-row items-center hover:scale-110 transition-transform duration-300 bg-white dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full"
|
|
||||||
>
|
|
||||||
<div className="flex items-center justify-center bg-[#bb3523] text-white rounded-lg w-16 h-16">
|
|
||||||
<svg width="32" height="34" viewBox="0 0 32 34" fill="null" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path
|
|
||||||
d="M23.404 0.452014C23.7033 0.35857 24.0204 0.336816 24.3297 0.388509C24.639 0.440203 24.9318 0.563895 25.1845 0.749599C25.4371 0.935304 25.6426 1.17782 25.7843 1.45756C25.9259 1.73731 25.9998 2.04644 26 2.36001V14.414C25.3462 14.2296 24.6766 14.1064 24 14.046V8.36001L10 12.736V27C10 28.1264 9.6197 29.2197 8.92071 30.1029C8.22172 30.9861 7.24499 31.6075 6.14877 31.8663C5.05255 32.125 3.90107 32.0061 2.88089 31.5287C1.86071 31.0514 1.03159 30.2435 0.52787 29.2361C0.024152 28.2286 -0.124656 27.0806 0.105556 25.9781C0.335768 24.8755 0.931513 23.883 1.79627 23.1613C2.66102 22.4396 3.74413 22.031 4.87009 22.0017C5.99606 21.9724 7.09893 22.3242 8.00001 23V6.73601C7.99982 6.30956 8.13596 5.8942 8.38854 5.55059C8.64112 5.20698 8.99692 4.9531 9.40401 4.82601L23.404 0.452014ZM10 10.64L24 6.26601V2.36001L10 6.73601V10.64ZM5.00001 24C4.20436 24 3.44129 24.3161 2.87869 24.8787C2.31608 25.4413 2.00001 26.2044 2.00001 27C2.00001 27.7957 2.31608 28.5587 2.87869 29.1213C3.44129 29.6839 4.20436 30 5.00001 30C5.79566 30 6.55872 29.6839 7.12133 29.1213C7.68394 28.5587 8.00001 27.7957 8.00001 27C8.00001 26.2044 7.68394 25.4413 7.12133 24.8787C6.55872 24.3161 5.79566 24 5.00001 24ZM32 25C32 27.387 31.0518 29.6761 29.364 31.364C27.6761 33.0518 25.387 34 23 34C20.6131 34 18.3239 33.0518 16.636 31.364C14.9482 29.6761 14 27.387 14 25C14 22.6131 14.9482 20.3239 16.636 18.6361C18.3239 16.9482 20.6131 16 23 16C25.387 16 27.6761 16.9482 29.364 18.6361C31.0518 20.3239 32 22.6131 32 25ZM27.47 24.128L21.482 20.828C21.3298 20.7443 21.1583 20.7016 20.9846 20.7043C20.8108 20.707 20.6408 20.7549 20.4912 20.8433C20.3416 20.9317 20.2176 21.0576 20.1315 21.2086C20.0453 21.3595 20 21.5302 20 21.704V28.304C20 28.4778 20.0453 28.6486 20.1315 28.7995C20.2176 28.9504 20.3416 29.0763 20.4912 29.1647C20.6408 29.2531 20.8108 29.301 20.9846 29.3037C21.1583 29.3064 21.3298 29.2638 21.482 29.18L27.47 25.88C27.6268 25.7937 27.7575 25.6669 27.8486 25.5128C27.9397 25.3587 27.9877 25.183 27.9877 25.004C27.9877 24.825 27.9397 24.6493 27.8486 24.4952C27.7575 24.3412 27.6268 24.2143 27.47 24.128Z"
|
|
||||||
fill="white"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex flex-col flex-1">
|
|
||||||
<div className="text-gray-500 dark:text-gray-400 flex flex-row text-sm">
|
|
||||||
{formatDateToIndonesian(new Date(audio?.createdAt))} {audio?.timezone ? audio?.timezone : "WIB"} | <Icon icon="formkit:eye" width="15" height="15" /> 518
|
|
||||||
</div>
|
|
||||||
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm">{audio?.title}</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center justify-center gap-3">
|
|
||||||
<div className="mt-2">
|
|
||||||
<img src="/assets/wave.svg" className="w-80" />
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-row items-center justify-center text-gray-500 dark:text-gray-400">
|
|
||||||
<img src="/assets/audio-icon.png" alt="#" className="flex items-center justify-center" />
|
|
||||||
<div className="flex mx-2 items-center justify-center">{audio?.duration}</div>
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
|
||||||
<path
|
|
||||||
fill="#f00"
|
|
||||||
d="M7.707 10.293a1 1 0 1 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0-1.414-1.414L11 11.586V6h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5v5.586zM9 4a1 1 0 0 1 2 0v2H9z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<p className="flex items-center justify-center">
|
|
||||||
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
|
||||||
</p>
|
|
||||||
)
|
|
||||||
) : selectedTab == "image" ? (
|
|
||||||
profile?.length > 0 ? (
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
||||||
{profile?.map((image: any) => (
|
|
||||||
<Card key={image?.id} className="hover:scale-110 transition-transform duration-300">
|
|
||||||
<CardContent className="flex flex-col text-xs lg:text-sm w-full p-0">
|
|
||||||
<Link href={`/image/detail/${image?.slug}`}>
|
|
||||||
<img src={image?.thumbnail} className="h-60 object-cover items-center justify-center cursor-pointer rounded-lg place-self-center" />
|
|
||||||
<div className="flex flex-row items-center gap-2 text-[10px] mx-2">
|
|
||||||
{formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| <Icon icon="formkit:eye" width="15" height="15" />
|
|
||||||
{image?.clickCount}{" "}
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 20 20">
|
|
||||||
<path
|
|
||||||
fill="#f00"
|
|
||||||
d="M7.707 10.293a1 1 0 1 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0-1.414-1.414L11 11.586V6h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5v5.586zM9 4a1 1 0 0 1 2 0v2H9z"
|
|
||||||
/>
|
|
||||||
</svg>{" "}
|
|
||||||
</div>
|
|
||||||
<div className="font-semibold pr-3 pb-3 mx-2 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible w-full">{image?.title}</div>
|
|
||||||
</Link>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<p className="flex items-center justify-center">
|
|
||||||
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
|
||||||
</p>
|
|
||||||
)
|
|
||||||
) : profile.length > 0 ? (
|
|
||||||
<div className=" grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
||||||
{profile?.map((document: any) => (
|
|
||||||
<Link href={`/document/detail/${document?.slug}`} key={document?.id} className="flex flex-col bg-yellow-500 sm:flex-row items-center dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full">
|
|
||||||
<div className="flex items-center justify-center rounded-lg w-16 h-16">
|
|
||||||
<svg width="28" height="34" viewBox="0 0 28 34" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path
|
|
||||||
d="M5.6665 17.4167C5.6665 17.0851 5.7982 16.7672 6.03262 16.5328C6.26704 16.2984 6.58498 16.1667 6.9165 16.1667C7.24802 16.1667 7.56597 16.2984 7.80039 16.5328C8.03481 16.7672 8.1665 17.0851 8.1665 17.4167C8.1665 17.7482 8.03481 18.0661 7.80039 18.3005C7.56597 18.535 7.24802 18.6667 6.9165 18.6667C6.58498 18.6667 6.26704 18.535 6.03262 18.3005C5.7982 18.0661 5.6665 17.7482 5.6665 17.4167ZM6.9165 21.1667C6.58498 21.1667 6.26704 21.2984 6.03262 21.5328C5.7982 21.7672 5.6665 22.0851 5.6665 22.4167C5.6665 22.7482 5.7982 23.0661 6.03262 23.3005C6.26704 23.535 6.58498 23.6667 6.9165 23.6667C7.24802 23.6667 7.56597 23.535 7.80039 23.3005C8.03481 23.0661 8.1665 22.7482 8.1665 22.4167C8.1665 22.0851 8.03481 21.7672 7.80039 21.5328C7.56597 21.2984 7.24802 21.1667 6.9165 21.1667ZM5.6665 27.4167C5.6665 27.0851 5.7982 26.7672 6.03262 26.5328C6.26704 26.2984 6.58498 26.1667 6.9165 26.1667C7.24802 26.1667 7.56597 26.2984 7.80039 26.5328C8.03481 26.7672 8.1665 27.0851 8.1665 27.4167C8.1665 27.7482 8.03481 28.0661 7.80039 28.3005C7.56597 28.535 7.24802 28.6667 6.9165 28.6667C6.58498 28.6667 6.26704 28.535 6.03262 28.3005C5.7982 28.0661 5.6665 27.7482 5.6665 27.4167ZM11.9165 16.1667C11.585 16.1667 11.267 16.2984 11.0326 16.5328C10.7982 16.7672 10.6665 17.0851 10.6665 17.4167C10.6665 17.7482 10.7982 18.0661 11.0326 18.3005C11.267 18.535 11.585 18.6667 11.9165 18.6667H21.0832C21.4147 18.6667 21.7326 18.535 21.9671 18.3005C22.2015 18.0661 22.3332 17.7482 22.3332 17.4167C22.3332 17.0851 22.2015 16.7672 21.9671 16.5328C21.7326 16.2984 21.4147 16.1667 21.0832 16.1667H11.9165ZM10.6665 22.4167C10.6665 22.0851 10.7982 21.7672 11.0326 21.5328C11.267 21.2984 11.585 21.1667 11.9165 21.1667H21.0832C21.4147 21.1667 21.7326 21.2984 21.9671 21.5328C22.2015 21.7672 22.3332 22.0851 22.3332 22.4167C22.3332 22.7482 22.2015 23.0661 21.9671 23.3005C21.7326 23.535 21.4147 23.6667 21.0832 23.6667H11.9165C11.585 23.6667 11.267 23.535 11.0326 23.3005C10.7982 23.0661 10.6665 22.7482 10.6665 22.4167ZM11.9165 26.1667C11.585 26.1667 11.267 26.2984 11.0326 26.5328C10.7982 26.7672 10.6665 27.0851 10.6665 27.4167C10.6665 27.7482 10.7982 28.0661 11.0326 28.3005C11.267 28.535 11.585 28.6667 11.9165 28.6667H21.0832C21.4147 28.6667 21.7326 28.535 21.9671 28.3005C22.2015 28.0661 22.3332 27.7482 22.3332 27.4167C22.3332 27.0851 22.2015 26.7672 21.9671 26.5328C21.7326 26.2984 21.4147 26.1667 21.0832 26.1667H11.9165ZM26.3565 11.0233L16.6415 1.31C16.6157 1.28605 16.5885 1.26378 16.5598 1.24333C16.5392 1.22742 16.5192 1.21074 16.4998 1.19333C16.3852 1.08512 16.2632 0.984882 16.1348 0.893332C16.0922 0.865802 16.0476 0.841298 16.0015 0.819999L15.9215 0.779999L15.8382 0.731666C15.7482 0.679999 15.6565 0.626665 15.5615 0.586665C15.2296 0.454104 14.8783 0.376423 14.5215 0.356665C14.4885 0.354519 14.4557 0.350625 14.4232 0.344999C14.3779 0.338012 14.3323 0.334114 14.2865 0.333332H3.99984C3.11578 0.333332 2.26794 0.684521 1.64281 1.30964C1.01769 1.93476 0.666504 2.78261 0.666504 3.66667V30.3333C0.666504 31.2174 1.01769 32.0652 1.64281 32.6904C2.26794 33.3155 3.11578 33.6667 3.99984 33.6667H23.9998C24.8839 33.6667 25.7317 33.3155 26.3569 32.6904C26.982 32.0652 27.3332 31.2174 27.3332 30.3333V13.38C27.333 12.496 26.9817 11.6483 26.3565 11.0233ZM24.8332 30.3333C24.8332 30.5543 24.7454 30.7663 24.5891 30.9226C24.4328 31.0789 24.2208 31.1667 23.9998 31.1667H3.99984C3.77882 31.1667 3.56686 31.0789 3.41058 30.9226C3.2543 30.7663 3.1665 30.5543 3.1665 30.3333V3.66667C3.1665 3.44565 3.2543 3.23369 3.41058 3.07741C3.56686 2.92113 3.77882 2.83333 3.99984 2.83333H13.9998V10.3333C13.9998 11.2174 14.351 12.0652 14.9761 12.6904C15.6013 13.3155 16.4491 13.6667 17.3332 13.6667H24.8332V30.3333ZM16.4998 4.70166L22.9632 11.1667H17.3332C17.1122 11.1667 16.9002 11.0789 16.7439 10.9226C16.5876 10.7663 16.4998 10.5543 16.4998 10.3333V4.70166Z"
|
|
||||||
fill="black"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex flex-col flex-1 gap-2">
|
|
||||||
<div className="text-gray-500 dark:text-gray-400 flex flex-row items-center gap-2 text-xs">
|
|
||||||
{formatDateToIndonesian(new Date(document?.createdAt))} {document?.timezone ? document?.timezone : "WIB"} | <Icon icon="formkit:eye" width="15" height="15" /> 518
|
|
||||||
</div>
|
|
||||||
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm">{document?.title}</div>
|
|
||||||
<div className="flex gap-2 items-center text-xs text-red-500 dark:text-red-500">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512">
|
|
||||||
<path fill="#f00" d="M224 30v256h-64l96 128l96-128h-64V30zM32 434v48h448v-48z" />
|
|
||||||
</svg>
|
|
||||||
Download Dokumen
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<p className="flex items-center justify-center">
|
|
||||||
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ContentManagement;
|
|
||||||
|
|
@ -0,0 +1,306 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { close, error, loading } from "@/config/swal";
|
||||||
|
import { useRouter } from "@/i18n/routing";
|
||||||
|
import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
|
import { getContentRewrite, getInfoProfile } from "@/service/landing/landing";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import Swal from "sweetalert2";
|
||||||
|
import withReactContent from "sweetalert2-react-content";
|
||||||
|
import * as Yup from "yup";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
import { generateDataArticle } from "@/service/content/ai";
|
||||||
|
import HeaderManagement from "@/components/landing-page/header-management";
|
||||||
|
import SidebarManagement from "@/components/landing-page/sidebar-management";
|
||||||
|
import { saveContentRewrite } from "@/service/content/content";
|
||||||
|
import JoditEditor from "jodit-react";
|
||||||
|
|
||||||
|
const page = (props: any) => {
|
||||||
|
const { states } = props;
|
||||||
|
const [profile, setProfile] = useState();
|
||||||
|
const MySwal = withReactContent(Swal);
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const router = useRouter();
|
||||||
|
const [, setLoadingState] = useState(false);
|
||||||
|
const id: any = searchParams?.get("title");
|
||||||
|
const [content, setContent] = useState<any>([]);
|
||||||
|
const [isFromSPIT, setIsFromSPIT] = useState(false);
|
||||||
|
const [listSuggestion, setListSuggestion] = useState();
|
||||||
|
const [main, setMain] = useState();
|
||||||
|
const userId = getCookiesDecrypt("uie");
|
||||||
|
const userRoleId = getCookiesDecrypt("urie");
|
||||||
|
const [articleIds, setArticleIds] = useState<any>([]);
|
||||||
|
const [isGeneratedArticle, setIsGeneratedArticle] = useState(false);
|
||||||
|
const [selectedArticleId, setSelectedArticleId] = useState(null);
|
||||||
|
const [articleBody, setArticleBody] = useState<any>("");
|
||||||
|
const [selectedAdvConfig, setSelectedAdvConfig] = useState("");
|
||||||
|
const [selectedWritingStyle, setSelectedWritingStyle] = useState("");
|
||||||
|
const [selectedContextType, setSelectedContextType] = useState("");
|
||||||
|
const [selectedLanguage, setSelectedLanguage] = useState("");
|
||||||
|
const [selectedTitle, setSelectedTitle] = useState("");
|
||||||
|
const [selectedMainKeyword, setSelectedMainKeyword] = useState("");
|
||||||
|
const [selectedSEO, setSelectedSEO] = useState("");
|
||||||
|
const [selectedSize, setSelectedSize] = useState("");
|
||||||
|
const [detailArticle, setDetailArticle] = useState<any>(null);
|
||||||
|
const userLevelId = getCookiesDecrypt("ulie");
|
||||||
|
const roleId = getCookiesDecrypt("urie");
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// let userLevelId: number | undefined;
|
||||||
|
|
||||||
|
// if (userLevelId != undefined && userLevelId == 216) {
|
||||||
|
// setIsMabesApprover(true);
|
||||||
|
// }
|
||||||
|
// }, [userLevelId]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
loading();
|
||||||
|
const response = await getInfoProfile();
|
||||||
|
|
||||||
|
// console.log(response?.data.data);
|
||||||
|
setProfile(response?.data?.data);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getInitData() {
|
||||||
|
const response = await getContentRewrite(id);
|
||||||
|
const data = response?.data?.data;
|
||||||
|
setContent(data);
|
||||||
|
|
||||||
|
const cleanArticleBody = data?.articleBody?.replace(/<img[^>]*>/g, "");
|
||||||
|
setArticleBody(cleanArticleBody || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
getInitData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
let componentMounted = true;
|
||||||
|
|
||||||
|
const validationSchema = Yup.object().shape({
|
||||||
|
title: Yup.string().required("Judul tidak boleh kosong"),
|
||||||
|
});
|
||||||
|
|
||||||
|
const formOptions = {
|
||||||
|
resolver: yupResolver(validationSchema),
|
||||||
|
};
|
||||||
|
|
||||||
|
const {
|
||||||
|
register,
|
||||||
|
handleSubmit,
|
||||||
|
reset,
|
||||||
|
formState: { errors },
|
||||||
|
setValue,
|
||||||
|
} = useForm(formOptions);
|
||||||
|
|
||||||
|
const handleGenerateArtikel = async () => {
|
||||||
|
loading();
|
||||||
|
const request: any = {
|
||||||
|
advConfig: selectedAdvConfig,
|
||||||
|
style: selectedWritingStyle,
|
||||||
|
website: "None",
|
||||||
|
connectToWeb: true,
|
||||||
|
lang: selectedLanguage,
|
||||||
|
pointOfView: "None",
|
||||||
|
title: content?.title,
|
||||||
|
imageSource: "Web",
|
||||||
|
mainKeyword: content?.title,
|
||||||
|
additionalKeywords: content?.htmlDescription,
|
||||||
|
targetCountry: null,
|
||||||
|
articleSize: selectedSize,
|
||||||
|
projectId: 2,
|
||||||
|
createdBy: roleId,
|
||||||
|
clientId: "ngDLPPiorplznw2jTqVe3YFCz5xqKfUJ",
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = await generateDataArticle(request);
|
||||||
|
close();
|
||||||
|
|
||||||
|
if (res.error) {
|
||||||
|
console.error(res.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newArticleId = res?.data?.data?.id;
|
||||||
|
setIsGeneratedArticle(true);
|
||||||
|
|
||||||
|
setArticleIds((prevIds: any) => {
|
||||||
|
if (prevIds.length < 5) {
|
||||||
|
return [...prevIds, newArticleId];
|
||||||
|
} else {
|
||||||
|
const updatedIds = [...prevIds];
|
||||||
|
updatedIds[4] = newArticleId;
|
||||||
|
return updatedIds;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Cookies.set("nulisAIArticleIdTemp", articleIds);
|
||||||
|
};
|
||||||
|
const save = async (data: any) => {
|
||||||
|
const request = {
|
||||||
|
id: 1,
|
||||||
|
articleId: id.split("-")?.[0],
|
||||||
|
title: data.title,
|
||||||
|
articleBody: detailArticle?.articleBody,
|
||||||
|
metaTitle: detailArticle?.metaTitle,
|
||||||
|
metaDescription: detailArticle?.metaDescription,
|
||||||
|
mainKeyword: detailArticle?.mainKeyword,
|
||||||
|
additionalKeyword: detailArticle?.additionalKeyword,
|
||||||
|
articleSize: detailArticle?.articleSize,
|
||||||
|
style: detailArticle?.style,
|
||||||
|
website: detailArticle?.website,
|
||||||
|
imageUrl: detailArticle?.imageUrl,
|
||||||
|
};
|
||||||
|
loading();
|
||||||
|
const res = await saveContentRewrite(request);
|
||||||
|
if (res?.error) {
|
||||||
|
error(res?.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
successSubmit();
|
||||||
|
};
|
||||||
|
|
||||||
|
function successSubmit() {
|
||||||
|
MySwal.fire({
|
||||||
|
title: "Sukses",
|
||||||
|
icon: "success",
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "OK",
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSubmit(data: any) {
|
||||||
|
MySwal.fire({
|
||||||
|
title: "Simpan Data",
|
||||||
|
text: "",
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
cancelButtonColor: "#d33",
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Simpan",
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
save(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<HeaderManagement />
|
||||||
|
<div className="flex flex-row">
|
||||||
|
<SidebarManagement />
|
||||||
|
<div className="w-2/3 p-12">
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<div className="text-xl font-bold mb-5">Detail Content Rewrite</div>
|
||||||
|
<div className="p-8 border border-black rounded-lg">
|
||||||
|
<form method="POST" onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
{/* {content && ( */}
|
||||||
|
<>
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="mb-3">
|
||||||
|
<p className="font-semibold">Judul</p>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className={`w-full p-2 border rounded-md mb-3 border-black ${errors.title ? "is-invalid" : ""}`}
|
||||||
|
{...register("title", {
|
||||||
|
value: content?.title,
|
||||||
|
})}
|
||||||
|
id="title"
|
||||||
|
defaultValue={content?.title}
|
||||||
|
// onChange={(e) => setSelectedTitle(e.target.value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col justify-between lg:flex-row">
|
||||||
|
<div className="w-50%">
|
||||||
|
<div className="mb-3">
|
||||||
|
<p className="font-semibold">Main Keyword</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type="text" className="border mb-3 w-full rounded-md p-2 border-black" id="mainKeyword" name="mainKeyword" placeholder="Masukan Main Keyword disini!" defaultValue={content?.mainKeyword} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="w-50%">
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="title" className="font-semibold">
|
||||||
|
Additional Keyword{" "}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input
|
||||||
|
className="border mb-3 rounded-md p-2 border-black"
|
||||||
|
type="text"
|
||||||
|
id="additionalKeyword"
|
||||||
|
name="additionalKeyword"
|
||||||
|
// onChange={(e) =>
|
||||||
|
// setSelectedMainKeyword(e.target.value)
|
||||||
|
// }
|
||||||
|
placeholder="Masukan Additional Keyword disini!"
|
||||||
|
defaultValue={content?.additionalKeyword}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col justify-between lg:flex-row">
|
||||||
|
<div className="w-50%">
|
||||||
|
<div className="font-semibold mb-3">
|
||||||
|
<label htmlFor="metaTitle">Meta Title</label>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="border rounded-md mb-3 p-2 border-black"
|
||||||
|
id="metaTitle"
|
||||||
|
name="metaTitle"
|
||||||
|
// onChange={(e) =>
|
||||||
|
// setSelectedMainKeyword(e.target.value)
|
||||||
|
// }
|
||||||
|
placeholder="Masukan Meta Title disini!"
|
||||||
|
defaultValue={content?.metaTitle}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="w-50%">
|
||||||
|
<div className="font-semibold mb-3">
|
||||||
|
<label htmlFor="metaDescription">Meta Description</label>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="border rounded-md mb-3 p-2 border-black"
|
||||||
|
id="metaDescription"
|
||||||
|
name="metaDescription"
|
||||||
|
// onChange={(e) =>
|
||||||
|
// setSelectedMainKeyword(e.target.value)
|
||||||
|
// }
|
||||||
|
placeholder="Masukan Meta Description disini!"
|
||||||
|
defaultValue={content?.metaDescription}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="font-semibold mb-3">
|
||||||
|
<label htmlFor="description">Deskripsi Artikel</label>
|
||||||
|
</div>
|
||||||
|
{/* <JoditEditor value={content?.metaDescription} key={articleBody.id} onChange={(event: any) => setArticleBody(event.editor?.getData())} /> */}
|
||||||
|
{/* <JoditEditor ref={editor} value={field.value} className="dark:text-black" onChange={field.onChange} /> */}
|
||||||
|
{articleBody === null || articleBody === "" ? <div className="w-full px-0 text-sm">Deskripsi tidak boleh kosong</div> : ""}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
{/* )} */}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default page;
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import HeaderManagement from "@/components/landing-page/header-management";
|
||||||
|
import SidebarManagement from "@/components/landing-page/sidebar-management";
|
||||||
|
import { close, error, loading, successCallback } from "@/config/swal";
|
||||||
|
import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
|
import { checkWishlistStatus, deleteWishlist, getContentRewritePagination, getInfoProfile, saveWishlist } from "@/service/landing/landing";
|
||||||
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import Swal from "sweetalert2";
|
||||||
|
import withReactContent from "sweetalert2-react-content";
|
||||||
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
|
import { Link } from "@/i18n/routing";
|
||||||
|
|
||||||
|
const page = (props: any) => {
|
||||||
|
const [, setProfile] = useState();
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const MySwal = withReactContent(Swal);
|
||||||
|
const page: any = searchParams?.get("page");
|
||||||
|
const title = searchParams?.get("title");
|
||||||
|
const category = searchParams?.get("category");
|
||||||
|
const pages = page ? page - 1 : 0;
|
||||||
|
|
||||||
|
const { isInstitute, instituteId } = props;
|
||||||
|
const userId = getCookiesDecrypt("uie");
|
||||||
|
const userRoleId = getCookiesDecrypt("urie");
|
||||||
|
|
||||||
|
const [, setGetTotalPage] = useState();
|
||||||
|
const [totalContent, setTotalContent] = useState<any>();
|
||||||
|
const [contentImage, setContentImage] = useState([]);
|
||||||
|
|
||||||
|
const [categoryFilter] = useState([]);
|
||||||
|
const [formatFilter] = useState([]);
|
||||||
|
const [sortBy] = useState();
|
||||||
|
|
||||||
|
const [refresh, setRefresh] = useState(false);
|
||||||
|
const [, setCopySuccess] = useState("");
|
||||||
|
|
||||||
|
const [, setWishlistId] = useState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
loading();
|
||||||
|
const response = await getInfoProfile();
|
||||||
|
console.log(response?.data.data);
|
||||||
|
setProfile(response?.data?.data);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getData();
|
||||||
|
}, [page, category, title, refresh]);
|
||||||
|
|
||||||
|
async function getData() {
|
||||||
|
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
|
||||||
|
const response = await getContentRewritePagination(pages);
|
||||||
|
|
||||||
|
setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
setContentImage(response.data?.data?.content);
|
||||||
|
// console.log("response", response);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
console.log("KONTEN", response.data?.data?.content);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
}, [page, refresh]);
|
||||||
|
|
||||||
|
function addDefaultSrc(ev: any) {
|
||||||
|
ev.target.src = "/assets/img/image404.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteProcess(id: any) {
|
||||||
|
loading();
|
||||||
|
const resDelete = await deleteWishlist(id);
|
||||||
|
|
||||||
|
if (resDelete.error) {
|
||||||
|
error(resDelete.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRefresh((prevRefresh) => !prevRefresh);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDelete = (id: any) => {
|
||||||
|
MySwal.fire({
|
||||||
|
title: "Hapus Data",
|
||||||
|
text: "",
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
cancelButtonColor: "#3085d6",
|
||||||
|
confirmButtonColor: "#d33",
|
||||||
|
confirmButtonText: "Hapus",
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
deleteProcess(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const copyToClip = async (url: any) => {
|
||||||
|
await navigator.clipboard.writeText(`https://mediahub.polri.go.id/image/detail/${url}`);
|
||||||
|
setCopySuccess("Copied");
|
||||||
|
// toast.success("Link Berhasil Di Copy");
|
||||||
|
};
|
||||||
|
|
||||||
|
async function checkWishlist(uploadId: any) {
|
||||||
|
if (userId) {
|
||||||
|
const res = await checkWishlistStatus(uploadId);
|
||||||
|
console.log(res.data?.data);
|
||||||
|
// const isAlreadyOnWishlist = res.data?.data == "-1" ? false : true;
|
||||||
|
// if (isAlreadyOnWishlist == true) {
|
||||||
|
// warning("Konten sudah Ada", `#`);
|
||||||
|
// }
|
||||||
|
setWishlistId(res.data?.data); // setIsSaved(isAlreadyOnWishlist);
|
||||||
|
// console.log("isSave", isAlreadyOnWishlist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSaveWishlist = async (uploadId: any) => {
|
||||||
|
if (Number(userRoleId) < 1 || userRoleId == undefined) {
|
||||||
|
router.push("/auth/login");
|
||||||
|
} else {
|
||||||
|
console.log("data", uploadId);
|
||||||
|
const data = {
|
||||||
|
mediaUploadId: uploadId,
|
||||||
|
};
|
||||||
|
|
||||||
|
loading();
|
||||||
|
checkWishlist(uploadId);
|
||||||
|
|
||||||
|
const res = await saveWishlist(data);
|
||||||
|
if (res.error) {
|
||||||
|
error(res.message);
|
||||||
|
console.log("simpan data", res);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
successCallback("Konten Berhasil Disimpan");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<HeaderManagement />
|
||||||
|
<div className="flex flex-row">
|
||||||
|
<SidebarManagement />
|
||||||
|
<div className="w-2/3 p-12">
|
||||||
|
<div>
|
||||||
|
<h1 className="text-2xl font-semibold mb-4">Galeri Content Rewrite</h1>
|
||||||
|
</div>
|
||||||
|
<div className="px-0 lg:px-10">
|
||||||
|
{contentImage?.length > 0 ? (
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
|
{contentImage?.map((image: any) => (
|
||||||
|
<Card key={image?.id} className="hover:scale-110 transition-transform duration-300">
|
||||||
|
<CardContent className="flex flex-col bg-black dark:bg-white w-full rounded-lg p-0">
|
||||||
|
<Link href={`/content-management/rewrite/detail/${image.id}`}>
|
||||||
|
<img src={image?.thumbnailUrl} className="h-40 object-cover items-center justify-center cursor-pointer rounded-lg place-self-center" />
|
||||||
|
<div className="font-semibold p-4 text-white text-xs lg:text-sm dark:text-black truncate w-full">{image?.title}</div>
|
||||||
|
</Link>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="flex items-center justify-center">
|
||||||
|
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default page;
|
||||||
|
|
@ -0,0 +1,179 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import HeaderManagement from "@/components/landing-page/header-management";
|
||||||
|
import SidebarManagement from "@/components/landing-page/sidebar-management";
|
||||||
|
import { close, error, loading } from "@/config/swal";
|
||||||
|
import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
|
import { getInfoProfile, getUsersTeams } from "@/service/landing/landing";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
||||||
|
import withReactContent from "sweetalert2-react-content";
|
||||||
|
import Swal from "sweetalert2";
|
||||||
|
import { saveUserReports } from "@/service/content/content";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
||||||
|
const page = () => {
|
||||||
|
const [user, setUser] = useState<any>();
|
||||||
|
const [profile, setProfile] = useState<any>();
|
||||||
|
const instituteId = getCookiesDecrypt("uinse");
|
||||||
|
const [userSelected, setUserSelected] = useState();
|
||||||
|
const [reportMessage, setReportMessage] = useState<string>();
|
||||||
|
const MySwal = withReactContent(Swal);
|
||||||
|
|
||||||
|
// const launchModal = (user: any) => {
|
||||||
|
// setUserSelected(user);
|
||||||
|
// $("#modalDetailProfile").modal("show");
|
||||||
|
// };
|
||||||
|
async function onSubmit() {
|
||||||
|
MySwal.fire({
|
||||||
|
title: "Simpan Data",
|
||||||
|
text: "",
|
||||||
|
icon: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
cancelButtonColor: "#d33",
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Simpan",
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
loading();
|
||||||
|
const data = {
|
||||||
|
userId: user?.id,
|
||||||
|
message: reportMessage,
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await saveUserReports(data);
|
||||||
|
|
||||||
|
if (response?.error) {
|
||||||
|
error(response?.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
close();
|
||||||
|
|
||||||
|
successSubmit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function successSubmit() {
|
||||||
|
MySwal.fire({
|
||||||
|
title: "Sukses",
|
||||||
|
icon: "success",
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "OK",
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
("hide");
|
||||||
|
// $("#modalReportProfile").modal("hide");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function getTeams() {
|
||||||
|
if (instituteId != undefined) {
|
||||||
|
loading();
|
||||||
|
const response = await getUsersTeams(instituteId);
|
||||||
|
setUser(response?.data?.data);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getProfile() {
|
||||||
|
loading();
|
||||||
|
const response = await getInfoProfile();
|
||||||
|
setProfile(response?.data?.data);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
getTeams();
|
||||||
|
getProfile();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<HeaderManagement />
|
||||||
|
<div className="flex flex-row">
|
||||||
|
<SidebarManagement />
|
||||||
|
<div className="w-2/3 p-12">
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<p className="text-lg font-semibold">Tim {profile?.institute?.name}</p>
|
||||||
|
<p className="text-base mb-3">{user?.length} Anggota</p>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row gap-5">
|
||||||
|
{user?.map((row: any) => (
|
||||||
|
<div key={row?.id}>
|
||||||
|
<Dialog>
|
||||||
|
<DialogTrigger>
|
||||||
|
<div className="flex flex-col items-center">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="5em" height="5em" viewBox="0 0 16 16">
|
||||||
|
<path fill="currentColor" d="M11 7c0 1.66-1.34 3-3 3S5 8.66 5 7s1.34-3 3-3s3 1.34 3 3" />
|
||||||
|
<path
|
||||||
|
fill="black"
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M16 8c0 4.42-3.58 8-8 8s-8-3.58-8-8s3.58-8 8-8s8 3.58 8 8M4 13.75C4.16 13.484 5.71 11 7.99 11c2.27 0 3.83 2.49 3.99 2.75A6.98 6.98 0 0 0 14.99 8c0-3.87-3.13-7-7-7s-7 3.13-7 7c0 2.38 1.19 4.49 3.01 5.75"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<p className="font-semibold text-md">{row?.fullname}</p>
|
||||||
|
<p className="text-sm font-light">{row?.username || "username"}</p>
|
||||||
|
</div>
|
||||||
|
</DialogTrigger>
|
||||||
|
<DialogContent className="flex flex-row justify-center" size="sm">
|
||||||
|
<div className="flex flex-col w-full gap-2">
|
||||||
|
<div>
|
||||||
|
<h1 className="font-semibold">{row?.fullname}</h1>
|
||||||
|
</div>
|
||||||
|
<div className="border-b border-black w-full"></div>
|
||||||
|
<div className="gap-1">
|
||||||
|
<div className="font-light">{row?.email}</div>
|
||||||
|
<div className="font-light">{row?.phoneNumber}</div>
|
||||||
|
<div className="font-light">{row?.address}</div>
|
||||||
|
</div>
|
||||||
|
<div className="border-b border-black w-full"></div>
|
||||||
|
<div className="place-items-end">
|
||||||
|
<Dialog>
|
||||||
|
<DialogTrigger asChild>
|
||||||
|
<Button variant="outline" className="bg-red-500 rounded-md">
|
||||||
|
Report
|
||||||
|
</Button>
|
||||||
|
</DialogTrigger>
|
||||||
|
<DialogContent className="sm:max-w-[425px]">
|
||||||
|
<div className="flex flex-col w-full gap-2">
|
||||||
|
<div>
|
||||||
|
<h1 className="font-semibold">{row?.fullname}</h1>
|
||||||
|
</div>
|
||||||
|
<div className="border-b border-black w-full"></div>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<h1 className="text-red-600 mb-2">Alasan Report Akun</h1>
|
||||||
|
<textarea id="formControlTextarea1" rows={4} className="border border-black font-light" onChange={(e) => setReportMessage(e.target.value)} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<DialogFooter>
|
||||||
|
{/* <Button className="bg-purple-500 text-white" type="submit">
|
||||||
|
Batal
|
||||||
|
</Button> */}
|
||||||
|
<Button className="bg-red-500 text-white" type="submit" onClick={() => onSubmit()}>
|
||||||
|
Kirim
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default page;
|
||||||
|
|
@ -1,11 +1,3 @@
|
||||||
import LayoutProvider from "@/providers/layout.provider";
|
|
||||||
import LayoutContentProvider from "@/providers/content.provider";
|
|
||||||
import DashCodeSidebar from "@/components/partials/sidebar";
|
|
||||||
import DashCodeFooter from "@/components/partials/footer";
|
|
||||||
import ThemeCustomize from "@/components/partials/customizer";
|
|
||||||
import DashCodeHeader from "@/components/partials/header";
|
|
||||||
|
|
||||||
import { redirect } from "@/components/navigation";
|
|
||||||
import Footer from "@/components/landing-page/footer";
|
import Footer from "@/components/landing-page/footer";
|
||||||
import Navbar from "@/components/landing-page/navbar";
|
import Navbar from "@/components/landing-page/navbar";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,21 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useParams, usePathname, useRouter } from "next/navigation";
|
import { useParams, usePathname } from "next/navigation";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
import { getDetail } from "@/service/landing/landing";
|
import {
|
||||||
|
checkWishlistStatus,
|
||||||
|
deleteWishlist,
|
||||||
|
getDetail,
|
||||||
|
saveWishlist,
|
||||||
|
} from "@/service/landing/landing";
|
||||||
import VideoPlayer from "@/utils/video-player";
|
import VideoPlayer from "@/utils/video-player";
|
||||||
import NewContent from "@/components/landing-page/new-content";
|
import NewContent from "@/components/landing-page/new-content";
|
||||||
import { Link } from "@/i18n/routing";
|
import { Link, useRouter } from "@/i18n/routing";
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
|
import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
|
import { close, error, loading } from "@/config/swal";
|
||||||
|
import { useToast } from "@/components/ui/use-toast";
|
||||||
|
|
||||||
const DetailVideo = () => {
|
const DetailVideo = () => {
|
||||||
const [selectedSize, setSelectedSize] = useState<string>("L");
|
const [selectedSize, setSelectedSize] = useState<string>("L");
|
||||||
|
|
@ -15,19 +23,99 @@ const DetailVideo = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const slug = params?.slug;
|
const slug = String(params?.slug);
|
||||||
const [detailDataVideo, setDetailDataVideo] = useState<any>();
|
const [detailDataVideo, setDetailDataVideo] = useState<any>();
|
||||||
|
const [isSaved, setIsSaved] = useState(false);
|
||||||
|
const [wishlistId, setWishlistId] = useState();
|
||||||
|
const { toast } = useToast();
|
||||||
|
const [isDownloadAll, setIsDownloadAll] = useState(false);
|
||||||
|
const [downloadProgress, setDownloadProgress] = useState(0);
|
||||||
|
const [isFromSPIT, setIsFromSPIT] = useState(false);
|
||||||
|
const [main, setMain] = useState<any>();
|
||||||
|
const [resolutionSelected, setResolutionSelected] = useState("720");
|
||||||
|
|
||||||
|
const userId = getCookiesDecrypt("uie");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initFetch();
|
initFetch();
|
||||||
|
checkWishlist();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getDetail(String(slug));
|
const response = await getDetail(String(slug));
|
||||||
console.log("detailVideo", response);
|
console.log("detailVideo", response);
|
||||||
|
setIsFromSPIT(response?.data?.data?.isFromSPIT);
|
||||||
|
setMain({
|
||||||
|
id: response?.data?.data?.files[0]?.id,
|
||||||
|
type: response?.data?.data?.fileType.name,
|
||||||
|
url:
|
||||||
|
Number(response?.data?.data?.fileType?.id) == 4
|
||||||
|
? response?.data?.data?.files[0]?.secondaryUrl
|
||||||
|
: Number(response?.data?.data?.fileType?.id) == 2
|
||||||
|
? `${process.env.NEXT_PUBLIC_API}/media/view?id=${response?.data?.data?.files[0]?.id}&operation=file&type=video`
|
||||||
|
: response?.data?.data?.files[0]?.url,
|
||||||
|
thumbnailFileUrl: response?.data?.data?.files[0]?.thumbnailFileUrl,
|
||||||
|
names: response?.data?.data?.files[0]?.fileName,
|
||||||
|
format: response?.data?.data?.files[0]?.format,
|
||||||
|
widthPixel: response?.data?.data?.files[0]?.widthPixel,
|
||||||
|
heightPixel: response?.data?.data?.files[0]?.heightPixel,
|
||||||
|
size: response?.data?.data?.files[0]?.size,
|
||||||
|
caption: response?.data?.data?.files[0]?.caption,
|
||||||
|
});
|
||||||
setDetailDataVideo(response?.data?.data);
|
setDetailDataVideo(response?.data?.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const doBookmark = async () => {
|
||||||
|
if (userId) {
|
||||||
|
const data = {
|
||||||
|
mediaUploadId: slug?.split("-")?.[0],
|
||||||
|
};
|
||||||
|
|
||||||
|
loading();
|
||||||
|
const res = await saveWishlist(data);
|
||||||
|
if (res?.error) {
|
||||||
|
error(res.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
close();
|
||||||
|
toast({
|
||||||
|
title: "Konten berhasil disimpan",
|
||||||
|
});
|
||||||
|
checkWishlist();
|
||||||
|
} else {
|
||||||
|
router.push("/auth");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
async function checkWishlist() {
|
||||||
|
if (userId) {
|
||||||
|
const res = await checkWishlistStatus(slug.split("-")?.[0]);
|
||||||
|
console.log(res.data?.data);
|
||||||
|
const isAlreadyOnWishlist = res.data?.data !== "-1";
|
||||||
|
setWishlistId(res.data?.data);
|
||||||
|
setIsSaved(isAlreadyOnWishlist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDeleteWishlist = async () => {
|
||||||
|
if (userId) {
|
||||||
|
loading();
|
||||||
|
const res = await deleteWishlist(wishlistId);
|
||||||
|
|
||||||
|
if (res?.error) {
|
||||||
|
error(res.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
toast({
|
||||||
|
title: "Konten berhasil dihapus",
|
||||||
|
});
|
||||||
|
close();
|
||||||
|
checkWishlist();
|
||||||
|
} else {
|
||||||
|
router.push("/auth");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const sizes = [
|
const sizes = [
|
||||||
{ label: "XL", value: "3198 x 1798 px" },
|
{ label: "XL", value: "3198 x 1798 px" },
|
||||||
{ label: "L", value: "2399 x 1349 px" },
|
{ label: "L", value: "2399 x 1349 px" },
|
||||||
|
|
@ -36,6 +124,104 @@ const DetailVideo = () => {
|
||||||
{ label: "XS", value: "800 x 450 px" },
|
{ label: "XS", value: "800 x 450 px" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
async function sendActivityLog(activityTypeId: number) {
|
||||||
|
const data = {
|
||||||
|
activityTypeId,
|
||||||
|
mediaId: slug.split("-")?.[0],
|
||||||
|
url: window.location.href,
|
||||||
|
};
|
||||||
|
// set activity
|
||||||
|
// const response = await postActivityLog(data, token);
|
||||||
|
// console.log(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDownload = () => {
|
||||||
|
if (downloadProgress === 0) {
|
||||||
|
if (!userId) {
|
||||||
|
router.push("/auth/login");
|
||||||
|
} else {
|
||||||
|
sendActivityLog(2);
|
||||||
|
sendActivityLog(3);
|
||||||
|
|
||||||
|
if (isDownloadAll) {
|
||||||
|
let url: string;
|
||||||
|
const baseId = slug.split("-")?.[0];
|
||||||
|
|
||||||
|
// if (type === "1") {
|
||||||
|
url = `${process.env.NEXT_PUBLIC_API}/media/file/download-zip?id=${baseId}&resolution=${resolutionSelected}`;
|
||||||
|
// } else if (type === "2") {
|
||||||
|
// url = `${process.env.NEXT_PUBLIC_API}/media/file/download-zip?id=${baseId}&resolution=${imageSizeSelected}`;
|
||||||
|
// } else {
|
||||||
|
// url = `${process.env.NEXT_PUBLIC_API}/media/file/download-zip?id=${baseId}`;
|
||||||
|
// }
|
||||||
|
|
||||||
|
downloadFile(url, "FileDownload.zip");
|
||||||
|
} else {
|
||||||
|
if (isFromSPIT && main?.url?.includes("spit.humas")) {
|
||||||
|
downloadFile(`${main?.url}`, `${main.names}`);
|
||||||
|
} else {
|
||||||
|
const url = `${process.env.NEXT_PUBLIC_API}/media/view?id=${main?.id}&operation=file&type=video&resolution=${resolutionSelected}p`;
|
||||||
|
downloadFile(url, `${main.names}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// } else if (type === "1" && resolutionSelected?.length > 0) {
|
||||||
|
// if (isFromSPIT && main?.url?.includes("spit.humas")) {
|
||||||
|
// downloadFile(`${main?.url}`, `${main.names}`);
|
||||||
|
// } else {
|
||||||
|
// const url = `${process.env.NEXT_PUBLIC_API}/media/view?id=${main?.id}&operation=file&type=video&resolution=${resolutionSelected}p`;
|
||||||
|
// downloadFile(url, `${main.names}`);
|
||||||
|
// }
|
||||||
|
// } else if (type === "2" && imageSizeSelected?.length > 0) {
|
||||||
|
// const url = `${process.env.NEXT_PUBLIC_API}/media/view?id=${main?.id}&operation=file&type=image&resolution=${imageSizeSelected}`;
|
||||||
|
// downloadFile(url, `${main.names}`);
|
||||||
|
// } else if (type === "3" || type === "4") {
|
||||||
|
// downloadFile(`${main?.url}`, `${main.names}`);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const downloadFile = (fileUrl: string, name: string) => {
|
||||||
|
const xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
|
xhr.open("GET", fileUrl, true);
|
||||||
|
xhr.responseType = "blob";
|
||||||
|
|
||||||
|
xhr.addEventListener("progress", (event) => {
|
||||||
|
if (event.lengthComputable) {
|
||||||
|
const percentCompleted = Math.round((event.loaded / event.total) * 100);
|
||||||
|
setDownloadProgress(percentCompleted);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
xhr.addEventListener("readystatechange", () => {
|
||||||
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||||
|
const contentType =
|
||||||
|
xhr.getResponseHeader("content-type") || "application/octet-stream";
|
||||||
|
const extension = contentType.split("/")[1];
|
||||||
|
const filename = `${name}.${extension}`;
|
||||||
|
|
||||||
|
const blob = new Blob([xhr.response], {
|
||||||
|
type: contentType,
|
||||||
|
});
|
||||||
|
const downloadUrl = URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement("a");
|
||||||
|
|
||||||
|
a.href = downloadUrl;
|
||||||
|
a.download = filename;
|
||||||
|
document.body.append(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
xhr.onloadend = () => {
|
||||||
|
setDownloadProgress(0);
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="px-4 md:px-24 py-4">
|
<div className="px-4 md:px-24 py-4">
|
||||||
|
|
@ -51,7 +237,12 @@ const DetailVideo = () => {
|
||||||
{/* Footer Informasi */}
|
{/* Footer Informasi */}
|
||||||
<div className="text-sm text-gray-500 flex justify-between items-center border-t mt-4">
|
<div className="text-sm text-gray-500 flex justify-between items-center border-t mt-4">
|
||||||
<p className="flex flex-row items-center mt-3">
|
<p className="flex flex-row items-center mt-3">
|
||||||
oleh <span className="font-semibold text-black">{detailDataVideo?.uploadedBy?.userLevel?.name}</span> | Diupdate pada {detailDataVideo?.updatedAt} WIB |
|
oleh
|
||||||
|
<span className="font-semibold text-black">
|
||||||
|
{detailDataVideo?.uploadedBy?.userLevel?.name}
|
||||||
|
</span>
|
||||||
|
| Diupdate pada {detailDataVideo?.updatedAt}{" "}
|
||||||
|
WIB |
|
||||||
<Icon icon="formkit:eye" width="15" height="15" />
|
<Icon icon="formkit:eye" width="15" height="15" />
|
||||||
|
|
||||||
{detailDataVideo?.clickCount}
|
{detailDataVideo?.clickCount}
|
||||||
|
|
@ -61,42 +252,83 @@ const DetailVideo = () => {
|
||||||
|
|
||||||
{/* Keterangan */}
|
{/* Keterangan */}
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<h1 className="flex flex-row font-bold text-2xl my-8">{detailDataVideo?.title}</h1>
|
<h1 className="flex flex-row font-bold text-2xl my-8">
|
||||||
<div className="font-light text-justify" dangerouslySetInnerHTML={{ __html: detailDataVideo?.htmlDescription }} />
|
{detailDataVideo?.title}
|
||||||
|
</h1>
|
||||||
|
<div
|
||||||
|
className="font-light text-justify"
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: detailDataVideo?.htmlDescription,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Bagian Kanan */}
|
{/* Bagian Kanan */}
|
||||||
<div className="md:w-1/4 p-4 bg-[#f7f7f7] rounded-lg mx-4 h-fit">
|
<div className="md:w-1/4 p-4 bg-[#f7f7f7] rounded-lg mx-4 h-fit">
|
||||||
<div className="flex flex-col mb-3 items-center justify-center cursor-pointer">
|
{isSaved ? (
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="2.5em" height="2.5em" viewBox="0 0 24 24">
|
<a
|
||||||
<path fill="black" d="m17 18l-5-2.18L7 18V5h10m0-2H7a2 2 0 0 0-2 2v16l7-3l7 3V5a2 2 0 0 0-2-2" />
|
onClick={() => handleDeleteWishlist()}
|
||||||
</svg>
|
className="flex flex-col mb-3 items-center justify-center cursor-pointer"
|
||||||
|
>
|
||||||
|
<Icon icon="material-symbols:bookmark" width={40} />
|
||||||
|
<p className="text-base lg:text-lg">Hapus</p>
|
||||||
|
</a>
|
||||||
|
) : (
|
||||||
|
<a
|
||||||
|
onClick={() => doBookmark()}
|
||||||
|
className="flex flex-col mb-3 items-center justify-center cursor-pointer"
|
||||||
|
>
|
||||||
|
<Icon icon="material-symbols:bookmark-outline" width={40} />
|
||||||
<p className="text-base lg:text-lg">Simpan</p>
|
<p className="text-base lg:text-lg">Simpan</p>
|
||||||
</div>
|
</a>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* garis */}
|
{/* garis */}
|
||||||
<div className="border-t border-black my-4"></div>
|
<div className="border-t border-black my-4"></div>
|
||||||
|
|
||||||
<Link href="" className="bg-red-600 text-white text-xs font-bold px-3 py-3 my-3 flex justify-center items-center rounded">
|
<Link
|
||||||
{detailDataVideo?.category?.name}
|
href={`/all/filter?title=polda&category=${detailDataVideo?.category.id}`}
|
||||||
|
className="bg-red-600 text-white text-xs font-bold px-3 py-3 my-3 flex justify-center items-center rounded"
|
||||||
|
>
|
||||||
|
{detailDataVideo?.categoryName}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<div className="flex justify-center flex-wrap gap-2 mb-4">
|
<div className="flex justify-center flex-wrap gap-2 mb-4">
|
||||||
<p className="bg-gray-200 text-gray-700 text-xs px-3 py-1 rounded-full cursor-pointer hover:bg-gray-500">poldajabar</p>
|
{detailDataVideo?.tags.split(",").map((tag: string) => (
|
||||||
<p className="bg-gray-200 text-gray-700 text-xs px-3 py-1 rounded-full cursor-pointer hover:bg-gray-500">pilkadamai2024</p>
|
<a
|
||||||
|
onClick={() => router.push(`/all/filter?tag=${tag}`)}
|
||||||
|
key={tag}
|
||||||
|
className="bg-gray-200 text-gray-700 text-xs px-3 py-1 rounded-full cursor-pointer hover:bg-gray-500 hover:text-white"
|
||||||
|
>
|
||||||
|
{tag}
|
||||||
|
</a>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="border-t border-black my-4"></div>
|
<div className="border-t border-black my-4"></div>
|
||||||
|
|
||||||
{/* Opsi Ukuran Foto */}
|
{/* Opsi Ukuran Foto */}
|
||||||
<h4 className="flex text-lg justify-center items-center font-semibold my-3">Opsi Ukuran Foto</h4>
|
<h4 className="flex text-lg justify-center items-center font-semibold my-3">
|
||||||
|
Opsi Ukuran Foto
|
||||||
|
</h4>
|
||||||
|
|
||||||
<div className="border-t border-black my-4"></div>
|
<div className="border-t border-black my-4"></div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{sizes.map((size) => (
|
{sizes.map((size) => (
|
||||||
<label key={size.label} className="flex items-center space-x-2 cursor-pointer">
|
<label
|
||||||
<input type="radio" name="size" value={size.label} checked={selectedSize === size.label} onChange={() => setSelectedSize(size.label)} className="text-red-600 focus:ring-red-600" />
|
key={size.label}
|
||||||
|
className="flex items-center space-x-2 cursor-pointer"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="size"
|
||||||
|
value={size.label}
|
||||||
|
checked={selectedSize === size.label}
|
||||||
|
onChange={() => setSelectedSize(size.label)}
|
||||||
|
className="text-red-600 focus:ring-red-600"
|
||||||
|
/>
|
||||||
<div className="text-sm">
|
<div className="text-sm">
|
||||||
{size.label} ----------------- {size.value}
|
{size.label} ----------------- {size.value}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -107,15 +339,30 @@ const DetailVideo = () => {
|
||||||
{/* Download Semua */}
|
{/* Download Semua */}
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
<label className="flex items-center space-x-2 text-sm">
|
<label className="flex items-center space-x-2 text-sm">
|
||||||
<input type="checkbox" className="text-red-600 focus:ring-red-600" />
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
className="text-red-600 focus:ring-red-600"
|
||||||
|
onChange={() => setIsDownloadAll(!isDownloadAll)}
|
||||||
|
/>
|
||||||
<span>Download Semua File?</span>
|
<span>Download Semua File?</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tombol Download */}
|
{/* Tombol Download */}
|
||||||
<button className="mt-4 bg-red-600 text-white w-full py-2 flex justify-center items-center gap-1 rounded-md text-sm hover:bg-red-700">
|
<button
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
onClick={handleDownload}
|
||||||
<path fill="white" d="m12 16l-5-5l1.4-1.45l2.6 2.6V4h2v8.15l2.6-2.6L17 11zm-6 4q-.825 0-1.412-.587T4 18v-3h2v3h12v-3h2v3q0 .825-.587 1.413T18 20z" />
|
className="mt-4 bg-red-600 text-white w-full py-2 flex justify-center items-center gap-1 rounded-md text-sm hover:bg-red-700"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="1em"
|
||||||
|
height="1em"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill="white"
|
||||||
|
d="m12 16l-5-5l1.4-1.45l2.6 2.6V4h2v8.15l2.6-2.6L17 11zm-6 4q-.825 0-1.412-.587T4 18v-3h2v3h12v-3h2v3q0 .825-.587 1.413T18 20z"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
Download
|
Download
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -127,8 +374,13 @@ const DetailVideo = () => {
|
||||||
<div className="flex flex-col my-16 p-10 bg-[#f7f7f7]">
|
<div className="flex flex-col my-16 p-10 bg-[#f7f7f7]">
|
||||||
<div className="gap-5 flex flex-col px-4 lg:px-14">
|
<div className="gap-5 flex flex-col px-4 lg:px-14">
|
||||||
<p className="flex items-start text-lg">Berikan Komentar</p>
|
<p className="flex items-start text-lg">Berikan Komentar</p>
|
||||||
<Textarea placeholder="Type your comments here." className="flex w-full" />
|
<Textarea
|
||||||
<button className="flex items-start bg-[#bb3523] text-white rounded-lg w-fit px-4 py-1">Kirim</button>
|
placeholder="Type your comments here."
|
||||||
|
className="flex w-full"
|
||||||
|
/>
|
||||||
|
<button className="flex items-start bg-[#bb3523] text-white rounded-lg w-fit px-4 py-1">
|
||||||
|
Kirim
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,31 @@ import React, { useEffect, useState } from "react";
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
import { formatDateToIndonesian, getOnlyDate, getOnlyMonthAndYear } from "@/utils/globals";
|
import {
|
||||||
|
formatDateToIndonesian,
|
||||||
|
getOnlyDate,
|
||||||
|
getOnlyMonthAndYear,
|
||||||
|
} from "@/utils/globals";
|
||||||
import { useParams, usePathname, useSearchParams } from "next/navigation";
|
import { useParams, usePathname, useSearchParams } from "next/navigation";
|
||||||
import { getListContent, getUserLevelListByParent, listCategory, listData, listDataRegional } from "@/service/landing/landing";
|
import {
|
||||||
import { ColumnDef, ColumnFiltersState, PaginationState, SortingState, VisibilityState, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
getListContent,
|
||||||
|
getUserLevelListByParent,
|
||||||
|
listCategory,
|
||||||
|
listData,
|
||||||
|
listDataRegional,
|
||||||
|
} from "@/service/landing/landing";
|
||||||
|
import {
|
||||||
|
ColumnDef,
|
||||||
|
ColumnFiltersState,
|
||||||
|
PaginationState,
|
||||||
|
SortingState,
|
||||||
|
VisibilityState,
|
||||||
|
getCoreRowModel,
|
||||||
|
getFilteredRowModel,
|
||||||
|
getPaginationRowModel,
|
||||||
|
getSortedRowModel,
|
||||||
|
useReactTable,
|
||||||
|
} from "@tanstack/react-table";
|
||||||
import LandingPagination from "@/components/landing-page/pagination";
|
import LandingPagination from "@/components/landing-page/pagination";
|
||||||
import { Reveal } from "@/components/landing-page/Reveal";
|
import { Reveal } from "@/components/landing-page/Reveal";
|
||||||
import { Link, useRouter } from "@/i18n/routing";
|
import { Link, useRouter } from "@/i18n/routing";
|
||||||
|
|
@ -33,8 +54,11 @@ const FilterPage = () => {
|
||||||
const [totalData, setTotalData] = React.useState<number>(1);
|
const [totalData, setTotalData] = React.useState<number>(1);
|
||||||
const [totalPage, setTotalPage] = React.useState<number>(1);
|
const [totalPage, setTotalPage] = React.useState<number>(1);
|
||||||
const [sorting, setSorting] = React.useState<SortingState>([]);
|
const [sorting, setSorting] = React.useState<SortingState>([]);
|
||||||
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>([]);
|
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
|
||||||
const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>({});
|
[]
|
||||||
|
);
|
||||||
|
const [columnVisibility, setColumnVisibility] =
|
||||||
|
React.useState<VisibilityState>({});
|
||||||
const [rowSelection, setRowSelection] = React.useState({});
|
const [rowSelection, setRowSelection] = React.useState({});
|
||||||
const [pagination, setPagination] = React.useState<PaginationState>({
|
const [pagination, setPagination] = React.useState<PaginationState>({
|
||||||
pageIndex: 0,
|
pageIndex: 0,
|
||||||
|
|
@ -48,13 +72,13 @@ const FilterPage = () => {
|
||||||
const categorie = searchParams?.get("category");
|
const categorie = searchParams?.get("category");
|
||||||
const group = searchParams?.get("group");
|
const group = searchParams?.get("group");
|
||||||
const [, setGetTotalPage] = useState();
|
const [, setGetTotalPage] = useState();
|
||||||
let typingTimer: any;
|
|
||||||
const doneTypingInterval = 1500;
|
|
||||||
const [contentVideo, setContentVideo] = useState([]);
|
const [contentVideo, setContentVideo] = useState([]);
|
||||||
const [categoryFilter, setCategoryFilter] = useState<any>([]);
|
const [categoryFilter, setCategoryFilter] = useState<any>([]);
|
||||||
const [monthYearFilter, setMonthYearFilter] = useState<any>();
|
const [monthYearFilter, setMonthYearFilter] = useState<any>();
|
||||||
const [searchTitle, setSearchTitle] = useState<string>("");
|
const [searchTitle, setSearchTitle] = useState<string>("");
|
||||||
const [sortByOpt, setSortByOpt] = useState<any>(sortBy === "popular" ? "clickCount" : "createdAt");
|
const [sortByOpt, setSortByOpt] = useState<any>(
|
||||||
|
sortBy === "popular" ? "clickCount" : "createdAt"
|
||||||
|
);
|
||||||
const isRegional = asPath?.includes("regional");
|
const isRegional = asPath?.includes("regional");
|
||||||
const isSatker = asPath?.includes("satker");
|
const isSatker = asPath?.includes("satker");
|
||||||
const [formatFilter, setFormatFilter] = useState<any>([]);
|
const [formatFilter, setFormatFilter] = useState<any>([]);
|
||||||
|
|
@ -90,8 +114,14 @@ const FilterPage = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (categorie) {
|
if (categorie) {
|
||||||
setCategoryFilter(categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]);
|
setCategoryFilter(
|
||||||
console.log("Kategori", categorie, categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]);
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
"Kategori",
|
||||||
|
categorie,
|
||||||
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, [categorie]);
|
}, [categorie]);
|
||||||
|
|
||||||
|
|
@ -109,7 +139,19 @@ const FilterPage = () => {
|
||||||
}
|
}
|
||||||
console.log(monthYearFilter, "monthFilter");
|
console.log(monthYearFilter, "monthFilter");
|
||||||
initState();
|
initState();
|
||||||
}, [change, asPath, monthYearFilter, page, sortBy, sortByOpt, title, startDateString, endDateString, categorie, formatFilter]);
|
}, [
|
||||||
|
change,
|
||||||
|
asPath,
|
||||||
|
monthYearFilter,
|
||||||
|
page,
|
||||||
|
sortBy,
|
||||||
|
sortByOpt,
|
||||||
|
title,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
categorie,
|
||||||
|
formatFilter,
|
||||||
|
]);
|
||||||
|
|
||||||
async function getCategories() {
|
async function getCategories() {
|
||||||
const category = await listCategory("2");
|
const category = await listCategory("2");
|
||||||
|
|
@ -132,7 +174,10 @@ const FilterPage = () => {
|
||||||
async function getDataAll() {
|
async function getDataAll() {
|
||||||
if (asPath?.includes("/polda/") == true) {
|
if (asPath?.includes("/polda/") == true) {
|
||||||
if (asPath?.split("/")[2] !== "[polda_name]") {
|
if (asPath?.split("/")[2] !== "[polda_name]") {
|
||||||
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || "";
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
const name = title == undefined ? "" : title;
|
const name = title == undefined ? "" : title;
|
||||||
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
|
@ -150,8 +195,14 @@ const FilterPage = () => {
|
||||||
filterGroup,
|
filterGroup,
|
||||||
startDateString,
|
startDateString,
|
||||||
endDateString,
|
endDateString,
|
||||||
monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "",
|
monthYearFilter
|
||||||
monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : ""
|
? getOnlyMonthAndYear(monthYearFilter)
|
||||||
|
?.split("/")[0]
|
||||||
|
?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
);
|
);
|
||||||
close();
|
close();
|
||||||
// setGetTotalPage(response.data?.data?.totalPages);
|
// setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
|
@ -165,7 +216,10 @@ const FilterPage = () => {
|
||||||
setTotalContent(response.data?.data?.totalElements);
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || "";
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
const name = title == undefined ? "" : title;
|
const name = title == undefined ? "" : title;
|
||||||
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
|
@ -182,8 +236,12 @@ const FilterPage = () => {
|
||||||
"",
|
"",
|
||||||
startDateString,
|
startDateString,
|
||||||
endDateString,
|
endDateString,
|
||||||
monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "",
|
monthYearFilter
|
||||||
monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : ""
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
);
|
);
|
||||||
close();
|
close();
|
||||||
// setGetTotalPage(response.data?.data?.totalPages);
|
// setGetTotalPage(response.data?.data?.totalPages);
|
||||||
|
|
@ -233,7 +291,10 @@ const FilterPage = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function getDataRegional() {
|
async function getDataRegional() {
|
||||||
const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : categorie || "";
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
const name = title == undefined ? "" : title;
|
const name = title == undefined ? "" : title;
|
||||||
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
const format = formatFilter == undefined ? "" : formatFilter?.join(",");
|
||||||
|
|
@ -246,8 +307,12 @@ const FilterPage = () => {
|
||||||
"",
|
"",
|
||||||
startDateString,
|
startDateString,
|
||||||
endDateString,
|
endDateString,
|
||||||
monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "") : "",
|
monthYearFilter
|
||||||
monthYearFilter ? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1] : "",
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: "",
|
||||||
12,
|
12,
|
||||||
pages,
|
pages,
|
||||||
sortByOpt
|
sortByOpt
|
||||||
|
|
@ -284,7 +349,12 @@ const FilterPage = () => {
|
||||||
initFetch();
|
initFetch();
|
||||||
}, [page]);
|
}, [page]);
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getListContent({ page: page - 1, size: 6, sortBy: "createdAt", contentTypeId: "2" });
|
const response = await getListContent({
|
||||||
|
page: page - 1,
|
||||||
|
size: 6,
|
||||||
|
sortBy: "createdAt",
|
||||||
|
contentTypeId: "2",
|
||||||
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
setVideoData(response?.data?.data?.content);
|
setVideoData(response?.data?.data?.content);
|
||||||
const data = response.data?.data;
|
const data = response.data?.data;
|
||||||
|
|
@ -347,6 +417,8 @@ const FilterPage = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let typingTimer: any;
|
||||||
|
const doneTypingInterval = 1500;
|
||||||
const handleKeyUp = () => {
|
const handleKeyUp = () => {
|
||||||
clearTimeout(typingTimer);
|
clearTimeout(typingTimer);
|
||||||
typingTimer = setTimeout(doneTyping, doneTypingInterval);
|
typingTimer = setTimeout(doneTyping, doneTypingInterval);
|
||||||
|
|
@ -371,7 +443,8 @@ const FilterPage = () => {
|
||||||
<div className="flex flex-col md:flex-row items-start gap-5 p-10 bg-[#f7f7f7] dark:bg-black">
|
<div className="flex flex-col md:flex-row items-start gap-5 p-10 bg-[#f7f7f7] dark:bg-black">
|
||||||
<p>
|
<p>
|
||||||
{" "}
|
{" "}
|
||||||
Audio Visual {">"} <span className="font-bold">Semua Audio Visual</span>
|
Audio Visual {">"}{" "}
|
||||||
|
<span className="font-bold">Semua Audio Visual</span>
|
||||||
</p>
|
</p>
|
||||||
<p className="font-bold">|</p>
|
<p className="font-bold">|</p>
|
||||||
<p>{`Terdapat ${totalContent} artikel berisi Audio Visual yang dapat diunduh`}</p>
|
<p>{`Terdapat ${totalContent} artikel berisi Audio Visual yang dapat diunduh`}</p>
|
||||||
|
|
@ -387,7 +460,10 @@ const FilterPage = () => {
|
||||||
<div className="border-t border-black my-4 dark:border-white"></div>
|
<div className="border-t border-black my-4 dark:border-white"></div>
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="search" className="block text-sm font-medium text-gray-700 dark:text-white">
|
<label
|
||||||
|
htmlFor="search"
|
||||||
|
className="block text-sm font-medium text-gray-700 dark:text-white"
|
||||||
|
>
|
||||||
Pencarian
|
Pencarian
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -403,7 +479,9 @@ const FilterPage = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 dark:text-white">Tahun & Bulan</label>
|
<label className="block text-sm font-medium text-gray-700 dark:text-white">
|
||||||
|
Tahun & Bulan
|
||||||
|
</label>
|
||||||
<ReactDatePicker
|
<ReactDatePicker
|
||||||
selected={monthYearFilter}
|
selected={monthYearFilter}
|
||||||
className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
className="mt-1 w-full border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
||||||
|
|
@ -415,7 +493,9 @@ const FilterPage = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 dark:text-white">Tanggal</label>
|
<label className="block text-sm font-medium text-gray-700 dark:text-white">
|
||||||
|
Tanggal
|
||||||
|
</label>
|
||||||
<div className="flex flex-row justify justify-between gap-2">
|
<div className="flex flex-row justify justify-between gap-2">
|
||||||
<ReactDatePicker
|
<ReactDatePicker
|
||||||
selectsRange
|
selectsRange
|
||||||
|
|
@ -428,18 +508,44 @@ const FilterPage = () => {
|
||||||
placeholderText="Pilih Tanggal"
|
placeholderText="Pilih Tanggal"
|
||||||
onCalendarClose={() => setCalenderState(!calenderState)}
|
onCalendarClose={() => setCalenderState(!calenderState)}
|
||||||
/>
|
/>
|
||||||
<div className="flex items-center">{handleClose ? <Icon icon="carbon:close-filled" onClick={handleDeleteDate} width="20" inline color="#216ba5" /> : ""}</div>
|
<div className="flex items-center">
|
||||||
|
{handleClose ? (
|
||||||
|
<Icon
|
||||||
|
icon="carbon:close-filled"
|
||||||
|
onClick={handleDeleteDate}
|
||||||
|
width="20"
|
||||||
|
inline
|
||||||
|
color="#216ba5"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-sm font-medium text-gray-700 dark:text-white">Kategori</h3>
|
<h3 className="text-sm font-medium text-gray-700 dark:text-white">
|
||||||
|
Kategori
|
||||||
|
</h3>
|
||||||
<ul className="mt-2 space-y-2">
|
<ul className="mt-2 space-y-2">
|
||||||
{categories.map((category: any) => (
|
{categories.map((category: any) => (
|
||||||
<li key={category?.id}>
|
<li key={category?.id}>
|
||||||
<label className="inline-flex items-center" htmlFor={`${category.id}`}>
|
<label
|
||||||
<Checkbox id={`${category.id}`} value={category.id} checked={categoryFilter.includes(String(category.id))} onCheckedChange={(e) => handleCategoryFilter(Boolean(e), category.id)} />
|
className="inline-flex items-center"
|
||||||
<span className="ml-2 text-gray-700 dark:text-white">{category?.name}</span>
|
htmlFor={`${category.id}`}
|
||||||
|
>
|
||||||
|
<Checkbox
|
||||||
|
id={`${category.id}`}
|
||||||
|
value={category.id}
|
||||||
|
checked={categoryFilter.includes(String(category.id))}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleCategoryFilter(Boolean(e), category.id)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
{category?.name}
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|
@ -449,43 +555,93 @@ const FilterPage = () => {
|
||||||
<div className="border-t border-black my-4 dark:border-white"></div>
|
<div className="border-t border-black my-4 dark:border-white"></div>
|
||||||
{/* Garis */}
|
{/* Garis */}
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-sm font-medium text-gray-700 dark:text-white">Format Foto</h3>
|
<h3 className="text-sm font-medium text-gray-700 dark:text-white">
|
||||||
|
Format Foto
|
||||||
|
</h3>
|
||||||
<ul className="mt-2 space-y-2">
|
<ul className="mt-2 space-y-2">
|
||||||
<li>
|
<li>
|
||||||
<label className="inline-flex items-center">
|
<label className="inline-flex items-center">
|
||||||
<Checkbox id="mk4" value="mk4" checked={formatFilter.includes("mk4")} onCheckedChange={(e) => handleFormatFilter(Boolean(e), "mk4")} />
|
<Checkbox
|
||||||
<span className="ml-2 text-gray-700 dark:text-white">MK4</span>
|
id="mk4"
|
||||||
|
value="mk4"
|
||||||
|
checked={formatFilter.includes("mk4")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "mk4")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
MK4
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label className="inline-flex items-center">
|
<label className="inline-flex items-center">
|
||||||
<Checkbox id="mov" value="mov" checked={formatFilter.includes("mov")} onCheckedChange={(e) => handleFormatFilter(Boolean(e), "mov")} />
|
<Checkbox
|
||||||
<span className="ml-2 text-gray-700 dark:text-white">MOV</span>
|
id="mov"
|
||||||
|
value="mov"
|
||||||
|
checked={formatFilter.includes("mov")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "mov")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
MOV
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label className="inline-flex items-center">
|
<label className="inline-flex items-center">
|
||||||
<Checkbox id="mp4" value="mp4" checked={formatFilter.includes("mp4")} onCheckedChange={(e) => handleFormatFilter(Boolean(e), "mp4")} />
|
<Checkbox
|
||||||
<span className="ml-2 text-gray-700 dark:text-white">MP4</span>
|
id="mp4"
|
||||||
|
value="mp4"
|
||||||
|
checked={formatFilter.includes("mp4")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "mp4")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
MP4
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label className="inline-flex items-center">
|
<label className="inline-flex items-center">
|
||||||
<Checkbox id="avi" value="avi" checked={formatFilter.includes("avi")} onCheckedChange={(e) => handleFormatFilter(Boolean(e), "avi")} />
|
<Checkbox
|
||||||
<span className="ml-2 text-gray-700 dark:text-white">AVI</span>
|
id="avi"
|
||||||
|
value="avi"
|
||||||
|
checked={formatFilter.includes("avi")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "avi")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
AVI
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label className="inline-flex items-center">
|
<label className="inline-flex items-center">
|
||||||
<Checkbox id="wmv" value="wmv" checked={formatFilter.includes("wmv")} onCheckedChange={(e) => handleFormatFilter(Boolean(e), "wmv")} />
|
<Checkbox
|
||||||
<span className="ml-2 text-gray-700 dark:text-white">WMV</span>
|
id="wmv"
|
||||||
|
value="wmv"
|
||||||
|
checked={formatFilter.includes("wmv")}
|
||||||
|
onCheckedChange={(e) =>
|
||||||
|
handleFormatFilter(Boolean(e), "wmv")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="ml-2 text-gray-700 dark:text-white">
|
||||||
|
WMV
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div className="border-t border-black dark:border-white my-4"></div>
|
<div className="border-t border-black dark:border-white my-4"></div>
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<a onClick={cleanCheckbox} className="text-[#bb3523] cursor-pointer">
|
<a
|
||||||
|
onClick={cleanCheckbox}
|
||||||
|
className="text-[#bb3523] cursor-pointer"
|
||||||
|
>
|
||||||
<b>Reset Filter</b>
|
<b>Reset Filter</b>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -497,7 +653,11 @@ const FilterPage = () => {
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<div className="flex flex-col items-end mb-4">
|
<div className="flex flex-col items-end mb-4">
|
||||||
<h2 className="text-lg font-semibold">Urutkan berdasarkan</h2>
|
<h2 className="text-lg font-semibold">Urutkan berdasarkan</h2>
|
||||||
<select defaultValue={sortBy == "popular" ? "terpopuler" : "terbaru"} onChange={(e) => handleSorting(e)} className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500">
|
<select
|
||||||
|
defaultValue={sortBy == "popular" ? "terpopuler" : "terbaru"}
|
||||||
|
onChange={(e) => handleSorting(e)}
|
||||||
|
className="border rounded-md py-2 px-3 focus:ring-red-500 focus:border-red-500"
|
||||||
|
>
|
||||||
<option value="terbaru">Terbaru</option>
|
<option value="terbaru">Terbaru</option>
|
||||||
<option value="terpopuler">Terpopuler</option>
|
<option value="terpopuler">Terpopuler</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -506,21 +666,36 @@ const FilterPage = () => {
|
||||||
{videoData?.length > 0 ? (
|
{videoData?.length > 0 ? (
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
{videoData?.map((video: any) => (
|
{videoData?.map((video: any) => (
|
||||||
<Card key={video?.id} className="hover:scale-110 transition-transform duration-300">
|
<Card
|
||||||
|
key={video?.id}
|
||||||
|
className="hover:scale-110 transition-transform duration-300"
|
||||||
|
>
|
||||||
<CardContent className="flex flex-col text-xs lg:text-sm w-full p-0">
|
<CardContent className="flex flex-col text-xs lg:text-sm w-full p-0">
|
||||||
<Link href={`/video/detail/${video?.slug}`}>
|
<Link href={`/video/detail/${video?.slug}`}>
|
||||||
<img src={video?.thumbnailLink} className="h-60 object-cover items-center justify-center cursor-pointer rounded-lg place-self-center" />
|
<img
|
||||||
|
src={video?.thumbnailLink}
|
||||||
|
className="h-60 object-cover items-center justify-center cursor-pointer rounded-lg place-self-center"
|
||||||
|
/>
|
||||||
<div className="flex flex-row items-center gap-2 text-[10px] mx-2">
|
<div className="flex flex-row items-center gap-2 text-[10px] mx-2">
|
||||||
{formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| <Icon icon="formkit:eye" width="15" height="15" />
|
{formatDateToIndonesian(new Date(video?.createdAt))}{" "}
|
||||||
|
{video?.timezone ? video?.timezone : "WIB"}|{" "}
|
||||||
|
<Icon icon="formkit:eye" width="15" height="15" />
|
||||||
{video?.clickCount}{" "}
|
{video?.clickCount}{" "}
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 20 20">
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="1em"
|
||||||
|
height="1em"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
>
|
||||||
<path
|
<path
|
||||||
fill="#f00"
|
fill="#f00"
|
||||||
d="M7.707 10.293a1 1 0 1 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0-1.414-1.414L11 11.586V6h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5v5.586zM9 4a1 1 0 0 1 2 0v2H9z"
|
d="M7.707 10.293a1 1 0 1 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0-1.414-1.414L11 11.586V6h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5v5.586zM9 4a1 1 0 0 1 2 0v2H9z"
|
||||||
/>
|
/>
|
||||||
</svg>{" "}
|
</svg>{" "}
|
||||||
</div>
|
</div>
|
||||||
<div className="font-semibold pr-3 pb-3 mx-2 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible w-full">{video?.title}</div>
|
<div className="font-semibold pr-3 pb-3 mx-2 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible w-full">
|
||||||
|
{video?.title}
|
||||||
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
@ -528,11 +703,19 @@ const FilterPage = () => {
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<p className="flex items-center justify-center">
|
<p className="flex items-center justify-center">
|
||||||
<img src="/assets/empty-data.png" alt="empty" className="h-60 w-60 my-4" />
|
<img
|
||||||
|
src="/assets/empty-data.png"
|
||||||
|
alt="empty"
|
||||||
|
className="h-60 w-60 my-4"
|
||||||
|
/>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<LandingPagination table={table} totalData={totalData} totalPage={totalPage} />
|
<LandingPagination
|
||||||
|
table={table}
|
||||||
|
totalData={totalData}
|
||||||
|
totalPage={totalPage}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Reveal>
|
</Reveal>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,7 @@ import MountedProvider from "@/providers/mounted.provider";
|
||||||
|
|
||||||
const Home = ({ params: { locale } }: { params: { locale: string } }) => {
|
const Home = ({ params: { locale } }: { params: { locale: string } }) => {
|
||||||
return (
|
return (
|
||||||
<MountedProvider
|
<MountedProvider isProtected={false}>
|
||||||
isProtected={false}
|
|
||||||
>
|
|
||||||
<ReactLenis root>
|
<ReactLenis root>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<Hero />
|
<Hero />
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,6 @@ import { Reveal } from "./Reveal";
|
||||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
import { Link } from "@/i18n/routing";
|
import { Link } from "@/i18n/routing";
|
||||||
|
|
||||||
const Coverage: React.FC = () => {
|
|
||||||
const [searchTerm, setSearchTerm] = useState("");
|
|
||||||
const [seeAllValue, setSeeAllValue] = useState(false);
|
|
||||||
|
|
||||||
const regions = [
|
const regions = [
|
||||||
{ name: "Polda Metro Jaya", slug: "metro-jaya", logo: "/assets/polda/polda-metro.png" },
|
{ name: "Polda Metro Jaya", slug: "metro-jaya", logo: "/assets/polda/polda-metro.png" },
|
||||||
{ name: "Polda Jawa Barat", slug: "jawa-barat", logo: "/assets/polda/polda-jabar.png" },
|
{ name: "Polda Jawa Barat", slug: "jawa-barat", logo: "/assets/polda/polda-jabar.png" },
|
||||||
|
|
@ -47,6 +43,18 @@ const Coverage: React.FC = () => {
|
||||||
{ name: "Internasional", slug: "internasional", logo: "/assets/polda/internasional.png" },
|
{ name: "Internasional", slug: "internasional", logo: "/assets/polda/internasional.png" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const Coverage: React.FC = () => {
|
||||||
|
const [seeAllValue, setSeeAllValue] = useState(false);
|
||||||
|
const [searchTerm, setSearchTerm] = useState("");
|
||||||
|
const [filteredList, setFilteredList] = useState<typeof regions | undefined>(regions);
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
const value = searchTerm.toLowerCase();
|
||||||
|
|
||||||
|
const filtered = regions.filter((polda) => polda.name.toLowerCase().includes(value));
|
||||||
|
setFilteredList(filtered);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="max-w-screen-xl mx-auto px-4 lg:px-12 py-6">
|
<div className="max-w-screen-xl mx-auto px-4 lg:px-12 py-6">
|
||||||
<Reveal>
|
<Reveal>
|
||||||
|
|
@ -58,15 +66,16 @@ const Coverage: React.FC = () => {
|
||||||
|
|
||||||
{/* Pencarian */}
|
{/* Pencarian */}
|
||||||
<div className="flex items-center justify-center gap-4 mb-6">
|
<div className="flex items-center justify-center gap-4 mb-6">
|
||||||
<input type="text" placeholder="Pencarian" className="w-4/5 px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-[#bb3523] focus:outline-none" value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} />
|
<input onChange={(e) => setSearchTerm(e.target.value)} type="text" placeholder="Pencarian" className="w-4/5 px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-[#bb3523] focus:outline-none" />
|
||||||
<button className="px-2 w-1/5 lg:px-4 py-2 bg-[#bb3523] text-xs lg:text-base text-white flex justify-center items-center gap-2 rounded-md hover:bg-red-700">
|
<button onClick={handleSearch} className="px-2 w-1/5 lg:px-4 py-2 bg-[#bb3523] text-xs lg:text-base text-white flex justify-center items-center gap-2 rounded-md hover:bg-red-700">
|
||||||
Cari Liputan <Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
Cari Polda <Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Grid Wilayah */}
|
{/* Grid Wilayah */}
|
||||||
<div className="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-9 gap-6">
|
<div className="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-9 gap-6">
|
||||||
{regions.map((region, index) =>
|
{filteredList && filteredList.length > 0 ? (
|
||||||
|
filteredList.map((region, index) =>
|
||||||
!seeAllValue ? (
|
!seeAllValue ? (
|
||||||
index < 9 ? (
|
index < 9 ? (
|
||||||
<Link href={`/polda/${region.slug}`} key={index} className="flex flex-col items-center text-center group">
|
<Link href={`/polda/${region.slug}`} key={index} className="flex flex-col items-center text-center group">
|
||||||
|
|
@ -86,13 +95,18 @@ const Coverage: React.FC = () => {
|
||||||
<p className="text-md font-semibold">{region.name}</p>
|
<p className="text-md font-semibold">{region.name}</p>
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<p className="text-center text-[#bb3523] font-semibold">Polda Tidak Ditemukan</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
{filteredList && filteredList.length > 9 && (
|
||||||
<div className="flex justify-center py-5">
|
<div className="flex justify-center py-5">
|
||||||
<Button onClick={() => setSeeAllValue(!seeAllValue)} className="bg-white hover:bg-[#bb3523] text-[#bb3523] hover:text-white border-2 border-[#bb3523]">
|
<Button onClick={() => setSeeAllValue(!seeAllValue)} className="bg-white hover:bg-[#bb3523] text-[#bb3523] hover:text-white border-2 border-[#bb3523]">
|
||||||
Lihat Lebih {seeAllValue ? "Sedikit" : "Banyak"}
|
Lihat Lebih {seeAllValue ? "Sedikit" : "Banyak"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</Reveal>
|
</Reveal>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,6 @@ import { Reveal } from "./Reveal";
|
||||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
import { Link } from "@/i18n/routing";
|
import { Link } from "@/i18n/routing";
|
||||||
|
|
||||||
const Division = () => {
|
|
||||||
const [searchTerm, setSearchTerm] = useState("");
|
|
||||||
const [seeAllValue, setSeeAllValue] = useState(false);
|
|
||||||
|
|
||||||
const regions = [
|
const regions = [
|
||||||
{ name: "SIBER", slug: "siber", logo: "/assets/satker/siber.png" },
|
{ name: "SIBER", slug: "siber", logo: "/assets/satker/siber.png" },
|
||||||
{ name: "DIVKUM", slug: "divkum", logo: "/assets/satker/divkum.png" },
|
{ name: "DIVKUM", slug: "divkum", logo: "/assets/satker/divkum.png" },
|
||||||
|
|
@ -49,6 +45,18 @@ const Division = () => {
|
||||||
{ name: "SETUPA POLRI", slug: "setupa-polri", logo: "/assets/satker/setupa-polri.png" },
|
{ name: "SETUPA POLRI", slug: "setupa-polri", logo: "/assets/satker/setupa-polri.png" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const Division = () => {
|
||||||
|
const [searchTerm, setSearchTerm] = useState("");
|
||||||
|
const [seeAllValue, setSeeAllValue] = useState(false);
|
||||||
|
const [filteredList, setFilteredList] = useState<typeof regions | undefined>(regions);
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
const value = searchTerm.toLowerCase();
|
||||||
|
|
||||||
|
const filtered = regions.filter((satker) => satker.name.toLowerCase().includes(value));
|
||||||
|
setFilteredList(filtered);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="max-w-screen-xl mx-auto px-4 lg:px-12 py-6">
|
<div className="max-w-screen-xl mx-auto px-4 lg:px-12 py-6">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
|
|
@ -60,18 +68,19 @@ const Division = () => {
|
||||||
|
|
||||||
{/* Pencarian */}
|
{/* Pencarian */}
|
||||||
<div className="flex items-center justify-center gap-4 mb-6">
|
<div className="flex items-center justify-center gap-4 mb-6">
|
||||||
<input type="text" placeholder="Pencarian" className="w-4/5 px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-[#bb3523] focus:outline-none" value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} />
|
<input onChange={(e) => setSearchTerm(e.target.value)} type="text" placeholder="Pencarian" className="w-4/5 px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-[#bb3523] focus:outline-none" />
|
||||||
<button className="px-2 w-1/5 lg:px-4 py-2 bg-[#bb3523] text-xs lg:text-base flex justify-center items-center gap-2 text-white rounded-md hover:bg-red-700">
|
<button onClick={handleSearch} className="px-2 w-1/5 lg:px-4 py-2 bg-[#bb3523] text-xs lg:text-base flex justify-center items-center gap-2 text-white rounded-md hover:bg-red-700">
|
||||||
Cari Liputan <Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
Cari Satker <Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Grid Wilayah */}
|
{/* Grid Wilayah */}
|
||||||
<div className="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-7 gap-6">
|
<div className="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-7 gap-6">
|
||||||
{regions.map((region, index) =>
|
{filteredList && filteredList.length > 0 ? (
|
||||||
|
filteredList.map((region, index) =>
|
||||||
!seeAllValue ? (
|
!seeAllValue ? (
|
||||||
index < 7 ? (
|
index < 7 ? (
|
||||||
<Link href={`/satker/${region.slug}`} key={index} className="flex flex-col items-center text-center group">
|
<Link href={`/polda/${region.slug}`} key={index} className="flex flex-col items-center text-center group">
|
||||||
<div className="relative w-20 h-20 rounded-full border-2 border-[#bb3523] overflow-hidden mb-2 flex items-center justify-center">
|
<div className="relative w-20 h-20 rounded-full border-2 border-[#bb3523] overflow-hidden mb-2 flex items-center justify-center">
|
||||||
<img src={region.logo} alt={region.name} className="w-3/4 h-3/4 object-contain group-hover:scale-110 transition-transform duration-300" />
|
<img src={region.logo} alt={region.name} className="w-3/4 h-3/4 object-contain group-hover:scale-110 transition-transform duration-300" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -81,20 +90,25 @@ const Division = () => {
|
||||||
""
|
""
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<Link href={`/satker/${region.slug}`} key={index} className="flex flex-col items-center text-center group">
|
<Link href={`/polda/${region.slug}`} key={index} className="flex flex-col items-center text-center group">
|
||||||
<div className="relative w-20 h-20 rounded-full border-2 border-[#bb3523] overflow-hidden mb-2 flex items-center justify-center">
|
<div className="relative w-20 h-20 rounded-full border-2 border-[#bb3523] overflow-hidden mb-2 flex items-center justify-center">
|
||||||
<img src={region.logo} alt={region.name} className="w-3/4 h-3/4 object-contain group-hover:scale-110 transition-transform duration-300" />
|
<img src={region.logo} alt={region.name} className="w-3/4 h-3/4 object-contain group-hover:scale-110 transition-transform duration-300" />
|
||||||
</div>
|
</div>
|
||||||
<p className="text-md font-semibold">{region.name}</p>
|
<p className="text-md font-semibold">{region.name}</p>
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<p className="items-center text-center text-[#bb3523] text-lg font-semibold">Satker Tidak Ditemukan</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
{filteredList && filteredList.length > 9 && (
|
||||||
<div className="flex justify-center py-5">
|
<div className="flex justify-center py-5">
|
||||||
<Button onClick={() => setSeeAllValue(!seeAllValue)} className="bg-white hover:bg-[#bb3523] text-[#bb3523] hover:text-white border-2 border-[#bb3523]">
|
<Button onClick={() => setSeeAllValue(!seeAllValue)} className="bg-white hover:bg-[#bb3523] text-[#bb3523] hover:text-white border-2 border-[#bb3523]">
|
||||||
Lihat Lebih {seeAllValue ? "Sedikit" : "Banyak"}
|
Lihat Lebih {seeAllValue ? "Sedikit" : "Banyak"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</Reveal>
|
</Reveal>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,188 @@
|
||||||
|
"use client";
|
||||||
|
import {
|
||||||
|
Carousel,
|
||||||
|
CarouselContent,
|
||||||
|
CarouselItem,
|
||||||
|
CarouselNext,
|
||||||
|
CarouselPrevious,
|
||||||
|
} from "@/components/ui/carousel";
|
||||||
|
import { close, loading } from "@/config/swal";
|
||||||
|
import { Link, usePathname } from "@/i18n/routing";
|
||||||
|
import { listData } from "@/service/landing/landing";
|
||||||
|
import { formatDateToIndonesian, getOnlyMonthAndYear } from "@/utils/globals";
|
||||||
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
|
import { pages } from "next/dist/build/templates/app-page";
|
||||||
|
import { useParams, useSearchParams } from "next/navigation";
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export default function FilterAudioComponent(props: {
|
||||||
|
categoryFilter?: any;
|
||||||
|
sortByOpt?: string;
|
||||||
|
startDateString?: string;
|
||||||
|
endDateString?: string;
|
||||||
|
monthYearFilter?: any;
|
||||||
|
}) {
|
||||||
|
const {
|
||||||
|
categoryFilter,
|
||||||
|
sortByOpt,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter,
|
||||||
|
} = props;
|
||||||
|
const [newContent, setNewContent] = useState<any>();
|
||||||
|
const asPath = usePathname();
|
||||||
|
const params = useParams();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const [imageData, setImageData] = useState<any>();
|
||||||
|
const [totalData, setTotalData] = useState<number>(1);
|
||||||
|
const [totalPage, setTotalPage] = useState<number>(1);
|
||||||
|
const sortBy = searchParams?.get("sortBy");
|
||||||
|
const title = searchParams?.get("title");
|
||||||
|
const categorie = searchParams?.get("category");
|
||||||
|
const group = searchParams?.get("group");
|
||||||
|
const [totalContent, setTotalContent] = useState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataAll();
|
||||||
|
}, [
|
||||||
|
title,
|
||||||
|
categoryFilter,
|
||||||
|
categorie,
|
||||||
|
group,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter,
|
||||||
|
sortByOpt,
|
||||||
|
]);
|
||||||
|
|
||||||
|
async function getDataAll() {
|
||||||
|
if (asPath?.includes("/polda/") == true) {
|
||||||
|
if (asPath?.split("/")[2] !== "[polda_name]") {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const filterGroup = group == undefined ? asPath.split("/")[2] : group;
|
||||||
|
loading();
|
||||||
|
const response = await listData(
|
||||||
|
"4",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
12,
|
||||||
|
0,
|
||||||
|
sortByOpt,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
filterGroup,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)
|
||||||
|
?.split("/")[0]
|
||||||
|
?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
setNewContent(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
loading();
|
||||||
|
const response = await listData(
|
||||||
|
"4",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
12,
|
||||||
|
0,
|
||||||
|
sortByOpt,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
|
||||||
|
setNewContent(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newContent?.length > 0 ? (
|
||||||
|
<div className="flex flex-col gap-3">
|
||||||
|
<p>{`Audio(${totalContent})`}</p>
|
||||||
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
|
<CarouselContent>
|
||||||
|
{newContent?.map((audio: any) => (
|
||||||
|
<CarouselItem key={audio?.id} className="md:basis-1/2 lg:basis-1/3">
|
||||||
|
<div className="flex flex-row gap-6">
|
||||||
|
<Link
|
||||||
|
href={`/audio/detail/${audio?.slug}`}
|
||||||
|
className="flex flex-col sm:flex-row items-center bg-white dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full"
|
||||||
|
>
|
||||||
|
<div className="flex items-center justify-center bg-red-500 text-white rounded-lg w-16 h-8 lg:h-16">
|
||||||
|
<svg
|
||||||
|
width="32"
|
||||||
|
height="34"
|
||||||
|
viewBox="0 0 32 34"
|
||||||
|
fill="null"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M23.404 0.452014C23.7033 0.35857 24.0204 0.336816 24.3297 0.388509C24.639 0.440203 24.9318 0.563895 25.1845 0.749599C25.4371 0.935304 25.6426 1.17782 25.7843 1.45756C25.9259 1.73731 25.9998 2.04644 26 2.36001V14.414C25.3462 14.2296 24.6766 14.1064 24 14.046V8.36001L10 12.736V27C10 28.1264 9.6197 29.2197 8.92071 30.1029C8.22172 30.9861 7.24499 31.6075 6.14877 31.8663C5.05255 32.125 3.90107 32.0061 2.88089 31.5287C1.86071 31.0514 1.03159 30.2435 0.52787 29.2361C0.024152 28.2286 -0.124656 27.0806 0.105556 25.9781C0.335768 24.8755 0.931513 23.883 1.79627 23.1613C2.66102 22.4396 3.74413 22.031 4.87009 22.0017C5.99606 21.9724 7.09893 22.3242 8.00001 23V6.73601C7.99982 6.30956 8.13596 5.8942 8.38854 5.55059C8.64112 5.20698 8.99692 4.9531 9.40401 4.82601L23.404 0.452014ZM10 10.64L24 6.26601V2.36001L10 6.73601V10.64ZM5.00001 24C4.20436 24 3.44129 24.3161 2.87869 24.8787C2.31608 25.4413 2.00001 26.2044 2.00001 27C2.00001 27.7957 2.31608 28.5587 2.87869 29.1213C3.44129 29.6839 4.20436 30 5.00001 30C5.79566 30 6.55872 29.6839 7.12133 29.1213C7.68394 28.5587 8.00001 27.7957 8.00001 27C8.00001 26.2044 7.68394 25.4413 7.12133 24.8787C6.55872 24.3161 5.79566 24 5.00001 24ZM32 25C32 27.387 31.0518 29.6761 29.364 31.364C27.6761 33.0518 25.387 34 23 34C20.6131 34 18.3239 33.0518 16.636 31.364C14.9482 29.6761 14 27.387 14 25C14 22.6131 14.9482 20.3239 16.636 18.6361C18.3239 16.9482 20.6131 16 23 16C25.387 16 27.6761 16.9482 29.364 18.6361C31.0518 20.3239 32 22.6131 32 25ZM27.47 24.128L21.482 20.828C21.3298 20.7443 21.1583 20.7016 20.9846 20.7043C20.8108 20.707 20.6408 20.7549 20.4912 20.8433C20.3416 20.9317 20.2176 21.0576 20.1315 21.2086C20.0453 21.3595 20 21.5302 20 21.704V28.304C20 28.4778 20.0453 28.6486 20.1315 28.7995C20.2176 28.9504 20.3416 29.0763 20.4912 29.1647C20.6408 29.2531 20.8108 29.301 20.9846 29.3037C21.1583 29.3064 21.3298 29.2638 21.482 29.18L27.47 25.88C27.6268 25.7937 27.7575 25.6669 27.8486 25.5128C27.9397 25.3587 27.9877 25.183 27.9877 25.004C27.9877 24.825 27.9397 24.6493 27.8486 24.4952C27.7575 24.3412 27.6268 24.2143 27.47 24.128Z"
|
||||||
|
fill="white"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col flex-1">
|
||||||
|
<div className="text-gray-500 dark:text-gray-400 flex flex-row text-sm">
|
||||||
|
{formatDateToIndonesian(new Date(audio?.createdAt))}{" "}
|
||||||
|
{audio?.timezone ? audio?.timezone : "WIB"} |{" "}
|
||||||
|
<Icon icon="formkit:eye" width="15" height="15" />{" "}
|
||||||
|
{audio?.clickCount}{" "}
|
||||||
|
</div>
|
||||||
|
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||||
|
{audio?.title}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</CarouselItem>
|
||||||
|
))}
|
||||||
|
</CarouselContent>
|
||||||
|
<CarouselPrevious />
|
||||||
|
<CarouselNext />
|
||||||
|
</Carousel>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,202 @@
|
||||||
|
"use client";
|
||||||
|
import {
|
||||||
|
Carousel,
|
||||||
|
CarouselContent,
|
||||||
|
CarouselItem,
|
||||||
|
CarouselNext,
|
||||||
|
CarouselPrevious,
|
||||||
|
} from "@/components/ui/carousel";
|
||||||
|
import { close, loading } from "@/config/swal";
|
||||||
|
import { Link, usePathname } from "@/i18n/routing";
|
||||||
|
import { listData } from "@/service/landing/landing";
|
||||||
|
import { formatDateToIndonesian, getOnlyMonthAndYear } from "@/utils/globals";
|
||||||
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
|
import { pages } from "next/dist/build/templates/app-page";
|
||||||
|
import { useParams, useSearchParams } from "next/navigation";
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export default function FilterDocumentComponent(props: {
|
||||||
|
categoryFilter?: any;
|
||||||
|
sortByOpt?: string;
|
||||||
|
startDateString?: string;
|
||||||
|
endDateString?: string;
|
||||||
|
monthYearFilter?: any;
|
||||||
|
}) {
|
||||||
|
const {
|
||||||
|
categoryFilter,
|
||||||
|
sortByOpt,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter,
|
||||||
|
} = props;
|
||||||
|
const [newContent, setNewContent] = useState<any>();
|
||||||
|
const asPath = usePathname();
|
||||||
|
const params = useParams();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const [imageData, setImageData] = useState<any>();
|
||||||
|
const [totalData, setTotalData] = useState<number>(1);
|
||||||
|
const [totalPage, setTotalPage] = useState<number>(1);
|
||||||
|
const sortBy = searchParams?.get("sortBy");
|
||||||
|
const title = searchParams?.get("title");
|
||||||
|
const categorie = searchParams?.get("category");
|
||||||
|
const group = searchParams?.get("group");
|
||||||
|
const [totalContent, setTotalContent] = useState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataAll();
|
||||||
|
}, [
|
||||||
|
title,
|
||||||
|
categoryFilter,
|
||||||
|
categorie,
|
||||||
|
group,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter,
|
||||||
|
sortByOpt,
|
||||||
|
]);
|
||||||
|
|
||||||
|
async function getDataAll() {
|
||||||
|
if (asPath?.includes("/polda/") == true) {
|
||||||
|
if (asPath?.split("/")[2] !== "[polda_name]") {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const filterGroup = group == undefined ? asPath.split("/")[2] : group;
|
||||||
|
loading();
|
||||||
|
const response = await listData(
|
||||||
|
"3",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
12,
|
||||||
|
0,
|
||||||
|
sortByOpt,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
filterGroup,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)
|
||||||
|
?.split("/")[0]
|
||||||
|
?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
setNewContent(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
loading();
|
||||||
|
const response = await listData(
|
||||||
|
"3",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
12,
|
||||||
|
0,
|
||||||
|
sortByOpt,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
|
||||||
|
setNewContent(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newContent?.length > 0 ? (
|
||||||
|
<div className="flex flex-col gap-3">
|
||||||
|
<p>{`Document(${totalContent})`}</p>
|
||||||
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
|
<CarouselContent>
|
||||||
|
{newContent?.map((text: any) => (
|
||||||
|
<CarouselItem key={text?.id} className="md:basis-1/2 lg:basis-1/3">
|
||||||
|
<div className="md:basis-1/2 lg:basis-1/3">
|
||||||
|
<Link
|
||||||
|
href={`/document/detail/${text?.slug}`}
|
||||||
|
className="flex flex-col bg-yellow-500 sm:flex-row items-center dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4"
|
||||||
|
>
|
||||||
|
<div className="flex items-center justify-center rounded-lg w-16 h-2 lg:h-16">
|
||||||
|
<svg
|
||||||
|
width="28"
|
||||||
|
height="34"
|
||||||
|
viewBox="0 0 28 34"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M5.6665 17.4167C5.6665 17.0851 5.7982 16.7672 6.03262 16.5328C6.26704 16.2984 6.58498 16.1667 6.9165 16.1667C7.24802 16.1667 7.56597 16.2984 7.80039 16.5328C8.03481 16.7672 8.1665 17.0851 8.1665 17.4167C8.1665 17.7482 8.03481 18.0661 7.80039 18.3005C7.56597 18.535 7.24802 18.6667 6.9165 18.6667C6.58498 18.6667 6.26704 18.535 6.03262 18.3005C5.7982 18.0661 5.6665 17.7482 5.6665 17.4167ZM6.9165 21.1667C6.58498 21.1667 6.26704 21.2984 6.03262 21.5328C5.7982 21.7672 5.6665 22.0851 5.6665 22.4167C5.6665 22.7482 5.7982 23.0661 6.03262 23.3005C6.26704 23.535 6.58498 23.6667 6.9165 23.6667C7.24802 23.6667 7.56597 23.535 7.80039 23.3005C8.03481 23.0661 8.1665 22.7482 8.1665 22.4167C8.1665 22.0851 8.03481 21.7672 7.80039 21.5328C7.56597 21.2984 7.24802 21.1667 6.9165 21.1667ZM5.6665 27.4167C5.6665 27.0851 5.7982 26.7672 6.03262 26.5328C6.26704 26.2984 6.58498 26.1667 6.9165 26.1667C7.24802 26.1667 7.56597 26.2984 7.80039 26.5328C8.03481 26.7672 8.1665 27.0851 8.1665 27.4167C8.1665 27.7482 8.03481 28.0661 7.80039 28.3005C7.56597 28.535 7.24802 28.6667 6.9165 28.6667C6.58498 28.6667 6.26704 28.535 6.03262 28.3005C5.7982 28.0661 5.6665 27.7482 5.6665 27.4167ZM11.9165 16.1667C11.585 16.1667 11.267 16.2984 11.0326 16.5328C10.7982 16.7672 10.6665 17.0851 10.6665 17.4167C10.6665 17.7482 10.7982 18.0661 11.0326 18.3005C11.267 18.535 11.585 18.6667 11.9165 18.6667H21.0832C21.4147 18.6667 21.7326 18.535 21.9671 18.3005C22.2015 18.0661 22.3332 17.7482 22.3332 17.4167C22.3332 17.0851 22.2015 16.7672 21.9671 16.5328C21.7326 16.2984 21.4147 16.1667 21.0832 16.1667H11.9165ZM10.6665 22.4167C10.6665 22.0851 10.7982 21.7672 11.0326 21.5328C11.267 21.2984 11.585 21.1667 11.9165 21.1667H21.0832C21.4147 21.1667 21.7326 21.2984 21.9671 21.5328C22.2015 21.7672 22.3332 22.0851 22.3332 22.4167C22.3332 22.7482 22.2015 23.0661 21.9671 23.3005C21.7326 23.535 21.4147 23.6667 21.0832 23.6667H11.9165C11.585 23.6667 11.267 23.535 11.0326 23.3005C10.7982 23.0661 10.6665 22.7482 10.6665 22.4167ZM11.9165 26.1667C11.585 26.1667 11.267 26.2984 11.0326 26.5328C10.7982 26.7672 10.6665 27.0851 10.6665 27.4167C10.6665 27.7482 10.7982 28.0661 11.0326 28.3005C11.267 28.535 11.585 28.6667 11.9165 28.6667H21.0832C21.4147 28.6667 21.7326 28.535 21.9671 28.3005C22.2015 28.0661 22.3332 27.7482 22.3332 27.4167C22.3332 27.0851 22.2015 26.7672 21.9671 26.5328C21.7326 26.2984 21.4147 26.1667 21.0832 26.1667H11.9165ZM26.3565 11.0233L16.6415 1.31C16.6157 1.28605 16.5885 1.26378 16.5598 1.24333C16.5392 1.22742 16.5192 1.21074 16.4998 1.19333C16.3852 1.08512 16.2632 0.984882 16.1348 0.893332C16.0922 0.865802 16.0476 0.841298 16.0015 0.819999L15.9215 0.779999L15.8382 0.731666C15.7482 0.679999 15.6565 0.626665 15.5615 0.586665C15.2296 0.454104 14.8783 0.376423 14.5215 0.356665C14.4885 0.354519 14.4557 0.350625 14.4232 0.344999C14.3779 0.338012 14.3323 0.334114 14.2865 0.333332H3.99984C3.11578 0.333332 2.26794 0.684521 1.64281 1.30964C1.01769 1.93476 0.666504 2.78261 0.666504 3.66667V30.3333C0.666504 31.2174 1.01769 32.0652 1.64281 32.6904C2.26794 33.3155 3.11578 33.6667 3.99984 33.6667H23.9998C24.8839 33.6667 25.7317 33.3155 26.3569 32.6904C26.982 32.0652 27.3332 31.2174 27.3332 30.3333V13.38C27.333 12.496 26.9817 11.6483 26.3565 11.0233ZM24.8332 30.3333C24.8332 30.5543 24.7454 30.7663 24.5891 30.9226C24.4328 31.0789 24.2208 31.1667 23.9998 31.1667H3.99984C3.77882 31.1667 3.56686 31.0789 3.41058 30.9226C3.2543 30.7663 3.1665 30.5543 3.1665 30.3333V3.66667C3.1665 3.44565 3.2543 3.23369 3.41058 3.07741C3.56686 2.92113 3.77882 2.83333 3.99984 2.83333H13.9998V10.3333C13.9998 11.2174 14.351 12.0652 14.9761 12.6904C15.6013 13.3155 16.4491 13.6667 17.3332 13.6667H24.8332V30.3333ZM16.4998 4.70166L22.9632 11.1667H17.3332C17.1122 11.1667 16.9002 11.0789 16.7439 10.9226C16.5876 10.7663 16.4998 10.5543 16.4998 10.3333V4.70166Z"
|
||||||
|
fill="black"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex w-full pr-10 flex-col flex-1">
|
||||||
|
<div className="text-gray-500 dark:text-gray-400 flex flex-row items-center text-xs gap-0 lg:gap-1 mt-1 lg:text-sm">
|
||||||
|
{formatDateToIndonesian(new Date(text?.createdAt))}
|
||||||
|
{text?.timezone ? text?.timezone : "WIB"}|
|
||||||
|
<Icon icon="formkit:eye" width="15" height="15" />
|
||||||
|
{text?.clickCount}
|
||||||
|
</div>
|
||||||
|
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible ">
|
||||||
|
{text?.title}
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-2 items-center text-sm text-red-500 dark:text-red-500">
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="1em"
|
||||||
|
height="1em"
|
||||||
|
viewBox="0 0 512 512"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill="#f00"
|
||||||
|
d="M224 30v256h-64l96 128l96-128h-64V30zM32 434v48h448v-48z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
Download Dokumen
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</CarouselItem>
|
||||||
|
))}
|
||||||
|
</CarouselContent>
|
||||||
|
<CarouselPrevious />
|
||||||
|
<CarouselNext />
|
||||||
|
</Carousel>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,174 @@
|
||||||
|
"use client";
|
||||||
|
import {
|
||||||
|
Carousel,
|
||||||
|
CarouselContent,
|
||||||
|
CarouselItem,
|
||||||
|
CarouselNext,
|
||||||
|
CarouselPrevious,
|
||||||
|
} from "@/components/ui/carousel";
|
||||||
|
import { close, loading } from "@/config/swal";
|
||||||
|
import { Link, usePathname } from "@/i18n/routing";
|
||||||
|
import { listData } from "@/service/landing/landing";
|
||||||
|
import { formatDateToIndonesian, getOnlyMonthAndYear } from "@/utils/globals";
|
||||||
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
|
import { pages } from "next/dist/build/templates/app-page";
|
||||||
|
import { useParams, useSearchParams } from "next/navigation";
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export default function FilterImageComponent(props: {
|
||||||
|
categoryFilter?: any;
|
||||||
|
sortByOpt?: string;
|
||||||
|
startDateString?: string;
|
||||||
|
endDateString?: string;
|
||||||
|
monthYearFilter?: any;
|
||||||
|
}) {
|
||||||
|
const {
|
||||||
|
categoryFilter,
|
||||||
|
sortByOpt,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter,
|
||||||
|
} = props;
|
||||||
|
const [newContent, setNewContent] = useState<any>();
|
||||||
|
const asPath = usePathname();
|
||||||
|
const params = useParams();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const [totalData, setTotalData] = useState<number>(1);
|
||||||
|
const [totalPage, setTotalPage] = useState<number>(1);
|
||||||
|
const sortBy = searchParams?.get("sortBy");
|
||||||
|
const title = searchParams?.get("title");
|
||||||
|
const categorie = searchParams?.get("category");
|
||||||
|
const group = searchParams?.get("group");
|
||||||
|
const [totalContent, setTotalContent] = useState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataAll();
|
||||||
|
}, [
|
||||||
|
title,
|
||||||
|
categoryFilter,
|
||||||
|
categorie,
|
||||||
|
group,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter,
|
||||||
|
sortByOpt,
|
||||||
|
]);
|
||||||
|
|
||||||
|
async function getDataAll() {
|
||||||
|
if (asPath?.includes("/polda/") == true) {
|
||||||
|
if (asPath?.split("/")[2] !== "[polda_name]") {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const filterGroup = group == undefined ? asPath.split("/")[2] : group;
|
||||||
|
loading();
|
||||||
|
const response = await listData(
|
||||||
|
"1",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
12,
|
||||||
|
0,
|
||||||
|
sortByOpt,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
filterGroup,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)
|
||||||
|
?.split("/")[0]
|
||||||
|
?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
setNewContent(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
loading();
|
||||||
|
const response = await listData(
|
||||||
|
"1",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
12,
|
||||||
|
0,
|
||||||
|
sortByOpt,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
|
||||||
|
setNewContent(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newContent?.length > 0 ? (
|
||||||
|
<div className="flex flex-col gap-3">
|
||||||
|
<p>{`Foto(${totalContent})`}</p>
|
||||||
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
|
<CarouselContent>
|
||||||
|
{newContent?.map((image: any) => (
|
||||||
|
<CarouselItem key={image?.id} className="md:basis-1/2 lg:basis-1/3">
|
||||||
|
<Link
|
||||||
|
href={`/image/detail/${image?.slug}`}
|
||||||
|
className="relative group rounded-md overflow-hidden shadow-md hover:shadow-lg"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={image?.thumbnailLink}
|
||||||
|
className="w-full h-40 lg:h-60 object-cover rounded-lg group-hover:scale-100 transition-transform duration-300"
|
||||||
|
/>
|
||||||
|
<div className="absolute bottom-0 rounded-lg left-0 right-0 border-l-4 border-[#bb3523] bg-gray-600 text-white p-2">
|
||||||
|
<h1 className="text-sm font-semibold h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||||
|
{image?.title}
|
||||||
|
</h1>
|
||||||
|
<p className="flex flex-row items-center text-sm gap-2">
|
||||||
|
{formatDateToIndonesian(new Date(image?.createdAt))}{" "}
|
||||||
|
{image?.timezone ? image?.timezone : "WIB"}|{" "}
|
||||||
|
<Icon icon="formkit:eye" width="15" height="15" />{" "}
|
||||||
|
{image?.clickCount}{" "}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
</CarouselItem>
|
||||||
|
))}
|
||||||
|
</CarouselContent>
|
||||||
|
<CarouselPrevious />
|
||||||
|
<CarouselNext />
|
||||||
|
</Carousel>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,175 @@
|
||||||
|
"use client";
|
||||||
|
import {
|
||||||
|
Carousel,
|
||||||
|
CarouselContent,
|
||||||
|
CarouselItem,
|
||||||
|
CarouselNext,
|
||||||
|
CarouselPrevious,
|
||||||
|
} from "@/components/ui/carousel";
|
||||||
|
import { close, loading } from "@/config/swal";
|
||||||
|
import { Link, usePathname } from "@/i18n/routing";
|
||||||
|
import { listData } from "@/service/landing/landing";
|
||||||
|
import { formatDateToIndonesian, getOnlyMonthAndYear } from "@/utils/globals";
|
||||||
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
|
import { pages } from "next/dist/build/templates/app-page";
|
||||||
|
import { useParams, useSearchParams } from "next/navigation";
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export default function FilterVideoComponent(props: {
|
||||||
|
categoryFilter?: any;
|
||||||
|
sortByOpt?: string;
|
||||||
|
startDateString?: string;
|
||||||
|
endDateString?: string;
|
||||||
|
monthYearFilter?: any;
|
||||||
|
}) {
|
||||||
|
const {
|
||||||
|
categoryFilter,
|
||||||
|
sortByOpt,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter,
|
||||||
|
} = props;
|
||||||
|
const [newContent, setNewContent] = useState<any>();
|
||||||
|
const asPath = usePathname();
|
||||||
|
const params = useParams();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const [imageData, setImageData] = useState<any>();
|
||||||
|
const [totalData, setTotalData] = useState<number>(1);
|
||||||
|
const [totalPage, setTotalPage] = useState<number>(1);
|
||||||
|
const sortBy = searchParams?.get("sortBy");
|
||||||
|
const title = searchParams?.get("title");
|
||||||
|
const categorie = searchParams?.get("category");
|
||||||
|
const group = searchParams?.get("group");
|
||||||
|
const [totalContent, setTotalContent] = useState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getDataAll();
|
||||||
|
}, [
|
||||||
|
title,
|
||||||
|
categoryFilter,
|
||||||
|
categorie,
|
||||||
|
group,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter,
|
||||||
|
sortByOpt,
|
||||||
|
]);
|
||||||
|
|
||||||
|
async function getDataAll() {
|
||||||
|
if (asPath?.includes("/polda/") == true) {
|
||||||
|
if (asPath?.split("/")[2] !== "[polda_name]") {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
const filterGroup = group == undefined ? asPath.split("/")[2] : group;
|
||||||
|
loading();
|
||||||
|
const response = await listData(
|
||||||
|
"2",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
12,
|
||||||
|
0,
|
||||||
|
sortByOpt,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
filterGroup,
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)
|
||||||
|
?.split("/")[0]
|
||||||
|
?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
setNewContent(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const filter =
|
||||||
|
categoryFilter?.length > 0
|
||||||
|
? categoryFilter?.sort().join(",")
|
||||||
|
: categorie || "";
|
||||||
|
|
||||||
|
const name = title == undefined ? "" : title;
|
||||||
|
loading();
|
||||||
|
const response = await listData(
|
||||||
|
"2",
|
||||||
|
name,
|
||||||
|
filter,
|
||||||
|
12,
|
||||||
|
0,
|
||||||
|
sortByOpt,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
startDateString,
|
||||||
|
endDateString,
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[0]?.replace("", "")
|
||||||
|
: "",
|
||||||
|
monthYearFilter
|
||||||
|
? getOnlyMonthAndYear(monthYearFilter)?.split("/")[1]
|
||||||
|
: ""
|
||||||
|
);
|
||||||
|
close();
|
||||||
|
|
||||||
|
const data = response.data?.data;
|
||||||
|
const contentData = data?.content;
|
||||||
|
|
||||||
|
setNewContent(contentData);
|
||||||
|
setTotalData(data?.totalElements);
|
||||||
|
setTotalPage(data?.totalPages);
|
||||||
|
setTotalContent(response.data?.data?.totalElements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newContent?.length > 0 ? (
|
||||||
|
<div className="flex flex-col gap-3">
|
||||||
|
<p>{`Audio Visual(${totalContent})`}</p>
|
||||||
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
|
<CarouselContent>
|
||||||
|
{newContent?.map((video: any) => (
|
||||||
|
<CarouselItem key={video?.id} className="md:basis-1/2 lg:basis-1/3">
|
||||||
|
<Link
|
||||||
|
href={`/video/detail/${video?.slug}`}
|
||||||
|
className="relative group overflow-hidden shadow-md hover:shadow-lg"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={video?.thumbnailLink}
|
||||||
|
className="w-full rounded-lg h-48 lg:h-60 object-cover group-hover:scale-100 transition-transform duration-300"
|
||||||
|
/>
|
||||||
|
<div className="absolute bottom-0 left-0 right-0 bg-gray-600 border-l-4 border-[#bb3523] rounded-lg backdrop-blur-sm text-white p-2">
|
||||||
|
<h1 className="text-sm lg:text-lg mb-2 font-semibold h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||||
|
{video?.title}
|
||||||
|
</h1>
|
||||||
|
<p className="flex flex-row items-center text-[10px] gap-2">
|
||||||
|
{formatDateToIndonesian(new Date(video?.createdAt))}{" "}
|
||||||
|
{video?.timezone ? video?.timezone : "WIB"} |{" "}
|
||||||
|
<Icon icon="formkit:eye" width="15" height="15" />{" "}
|
||||||
|
{video.clickCount}{" "}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
</CarouselItem>
|
||||||
|
))}
|
||||||
|
</CarouselContent>
|
||||||
|
<CarouselPrevious />
|
||||||
|
<CarouselNext />
|
||||||
|
</Carousel>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { Link } from "@/i18n/routing";
|
||||||
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
|
import { getInfoProfile, getListPorvinces, getUsersTeams } from "@/service/landing/landing";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
|
||||||
|
const HeaderManagement = () => {
|
||||||
|
const [profile, setProfile] = useState<any>();
|
||||||
|
const [province, setProvince] = useState([]);
|
||||||
|
const [, setUser] = useState();
|
||||||
|
const [selectedTab, setSelectedTab] = useState("video");
|
||||||
|
const params = useParams();
|
||||||
|
|
||||||
|
// const currentRoute = router.pathname;
|
||||||
|
// const profilePicture = Cookies.get("profile_picture");
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
const response = await getInfoProfile();
|
||||||
|
setProfile(response?.data?.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getProvinces() {
|
||||||
|
const response = await getListPorvinces();
|
||||||
|
|
||||||
|
// console.log(response?.data.data);
|
||||||
|
setProvince(response?.data?.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// async function getDisticts() {
|
||||||
|
// const response = await getListDistricts();
|
||||||
|
// console.log(response?.data.data);
|
||||||
|
// setDistrict(response?.data.data);
|
||||||
|
// }
|
||||||
|
initState();
|
||||||
|
getProvinces(); // getDisticts();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
if (profile != undefined) {
|
||||||
|
const response = await getUsersTeams(profile?.instituteId);
|
||||||
|
|
||||||
|
// console.log(response?.data?.data);
|
||||||
|
setUser(response?.data?.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
}, [profile]);
|
||||||
|
|
||||||
|
function addDefaultProfile(ev: any) {
|
||||||
|
ev.target.src = "/assets/avatar-profile.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
const [hasMounted, setHasMounted] = useState(false);
|
||||||
|
// Hooks
|
||||||
|
useEffect(() => {
|
||||||
|
setHasMounted(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Render
|
||||||
|
if (!hasMounted) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{/* Header */}
|
||||||
|
<div className="bg-[#504e52] p-12">
|
||||||
|
<div className="flex justify-between mx-10">
|
||||||
|
<div className="flex items-center gap-2 ">
|
||||||
|
<img src="/assets/avatar-profile.png" alt="avatar" className="w-14 h-14" />
|
||||||
|
<div className="flex flex-col mx-2">
|
||||||
|
<p className="text-white text-sm font-semibold">{profile?.fullname}</p>
|
||||||
|
<p className="text-white text-sm font-light">{profile?.username}</p>
|
||||||
|
<p className="text-white text-sm font-light">
|
||||||
|
Aktif Sejak
|
||||||
|
{`${new Date(profile?.createdAt).getDate()}/${new Date(profile?.createdAt).getMonth() + 1}/${new Date(profile?.createdAt).getFullYear()} ${new Date(profile?.createdAt).getHours()}:${new Date(
|
||||||
|
profile?.createdAt
|
||||||
|
).getMinutes()}`}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Link href="/profile" className="flex items-center text-white gap-2">
|
||||||
|
<Icon icon="tdesign:setting-1-filled" />
|
||||||
|
Pengaturan
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default HeaderManagement;
|
||||||
|
|
@ -5,7 +5,13 @@ import "swiper/css/navigation";
|
||||||
import { getHeroData } from "@/service/landing/landing";
|
import { getHeroData } from "@/service/landing/landing";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useParams, usePathname, useRouter } from "next/navigation";
|
import { useParams, usePathname, useRouter } from "next/navigation";
|
||||||
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel";
|
import {
|
||||||
|
Carousel,
|
||||||
|
CarouselContent,
|
||||||
|
CarouselItem,
|
||||||
|
CarouselNext,
|
||||||
|
CarouselPrevious,
|
||||||
|
} from "@/components/ui/carousel";
|
||||||
|
|
||||||
const Hero: React.FC = () => {
|
const Hero: React.FC = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -23,22 +29,34 @@ const Hero: React.FC = () => {
|
||||||
setHeroData(response?.data?.data?.content);
|
setHeroData(response?.data?.data?.content);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col lg:flex-row items-start gap-8 px-4 lg:px-20 py-4 mx-auto w-auto mt-6">
|
<div className="flex flex-col lg:flex-row items-start justify-center gap-8 px-4 lg:px-20 py-4 mx-auto w-auto mt-6">
|
||||||
{/* Section Gambar Utama */}
|
{/* Section Gambar Utama */}
|
||||||
<Carousel className="lg:w-2/3 w-full lg:h-full ">
|
<Carousel className="lg:w-2/3 w-full lg:h-full ">
|
||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{heroData?.map((list: any) => (
|
{heroData?.map((list: any) => (
|
||||||
<CarouselItem key={list?.id}>
|
<CarouselItem key={list?.id}>
|
||||||
<div className="relative h-[310px] lg:h-[420px]">
|
<div className="relative h-[310px] lg:h-[420px]">
|
||||||
<img src={list?.thumbnailLink} alt="Gambar Utama" className="w-full h-[310px] lg:h-[420px] rounded-lg" />
|
<img
|
||||||
|
src={list?.thumbnailLink}
|
||||||
|
alt="Gambar Utama"
|
||||||
|
className="w-full h-[310px] lg:h-[420px] rounded-lg object-cover"
|
||||||
|
/>
|
||||||
<div className="absolute bottom-0 left-0 right-0 bg-transparent backdrop-blur-sm text-black dark:text-white p-4 rounded-b-lg">
|
<div className="absolute bottom-0 left-0 right-0 bg-transparent backdrop-blur-sm text-black dark:text-white p-4 rounded-b-lg">
|
||||||
<span className="text-white bg-[#bb3523] rounded-md w-full h-full font-semibold uppercase text-sm px-4 py-1">{list?.categoryName}</span>
|
<span className="text-white bg-[#bb3523] rounded-md w-full h-full font-semibold uppercase text-sm px-4 py-1">
|
||||||
|
{list?.categoryName}
|
||||||
|
</span>
|
||||||
<Link href={`${locale}/image/detail/${list?.slug}`}>
|
<Link href={`${locale}/image/detail/${list?.slug}`}>
|
||||||
<h2 className="text-lg font-bold mt-2">{list?.title}</h2>
|
<h2 className="text-lg font-bold mt-2">{list?.title}</h2>
|
||||||
</Link>
|
</Link>
|
||||||
<p className="text-xs flex flex-row items-center gap-1 mt-1">
|
<p className="text-xs flex flex-row items-center gap-1 mt-1">
|
||||||
{formatDateToIndonesian(new Date(list?.createdAt))} {list?.timezone ? list?.timezone : "WIB"}|{" "}
|
{formatDateToIndonesian(new Date(list?.createdAt))}{" "}
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1.2em" height="1.2em" viewBox="0 0 24 24">
|
{list?.timezone ? list?.timezone : "WIB"}|{" "}
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="1.2em"
|
||||||
|
height="1.2em"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
d="M11.5 18c4 0 7.46-2.22 9.24-5.5C18.96 9.22 15.5 7 11.5 7s-7.46 2.22-9.24 5.5C4.04 15.78 7.5 18 11.5 18m0-12c4.56 0 8.5 2.65 10.36 6.5C20 16.35 16.06 19 11.5 19S3 16.35 1.14 12.5C3 8.65 6.94 6 11.5 6m0 2C14 8 16 10 16 12.5S14 17 11.5 17S7 15 7 12.5S9 8 11.5 8m0 1A3.5 3.5 0 0 0 8 12.5a3.5 3.5 0 0 0 3.5 3.5a3.5 3.5 0 0 0 3.5-3.5A3.5 3.5 0 0 0 11.5 9"
|
d="M11.5 18c4 0 7.46-2.22 9.24-5.5C18.96 9.22 15.5 7 11.5 7s-7.46 2.22-9.24 5.5C4.04 15.78 7.5 18 11.5 18m0-12c4.56 0 8.5 2.65 10.36 6.5C20 16.35 16.06 19 11.5 19S3 16.35 1.14 12.5C3 8.65 6.94 6 11.5 6m0 2C14 8 16 10 16 12.5S14 17 11.5 17S7 15 7 12.5S9 8 11.5 8m0 1A3.5 3.5 0 0 0 8 12.5a3.5 3.5 0 0 0 3.5 3.5a3.5 3.5 0 0 0 3.5-3.5A3.5 3.5 0 0 0 11.5 9"
|
||||||
|
|
@ -56,21 +74,35 @@ const Hero: React.FC = () => {
|
||||||
</Carousel>
|
</Carousel>
|
||||||
|
|
||||||
{/* Section Kanan */}
|
{/* Section Kanan */}
|
||||||
<div className="lg:w-1/3 w-full">
|
<div className=" ">
|
||||||
<ul className="py-4 lg:py-0 flex flex-row lg:flex-col gap-4 flex-nowrap w-full overflow-x-auto">
|
<ul className="py-4 lg:py-0 flex flex-row lg:flex-col gap-4 flex-nowrap w-full overflow-x-auto">
|
||||||
{heroData?.map((item: any) => (
|
{heroData?.map((item: any) => (
|
||||||
<li key={item?.id} className="flex gap-4 flex-row lg:w-full ">
|
<li key={item?.id} className="flex gap-4 flex-row lg:w-full ">
|
||||||
<div className="flex-shrink-0 w-24 rounded-lg">
|
<div className="flex-shrink-0 w-24 rounded-lg">
|
||||||
<img src={item?.thumbnailLink} alt={item?.title} className="w-full max-h-14 object-cover rounded-lg" />
|
<img
|
||||||
|
src={item?.thumbnailLink}
|
||||||
|
alt={item?.title}
|
||||||
|
className="w-full max-h-14 object-cover rounded-lg"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-[280px] lg:w-auto">
|
<div className="w-[280px] lg:w-auto">
|
||||||
<span className="text-white bg-[#bb3523] px-4 py-1 rounded-lg flex text-xs font-bold uppercase w-fit">{item?.categoryName}</span>
|
<span className="text-white bg-[#bb3523] px-4 py-1 rounded-lg flex text-xs font-bold uppercase w-fit">
|
||||||
|
{item?.categoryName}
|
||||||
|
</span>
|
||||||
<Link href={`${locale}/image/detail/${item?.slug}`}>
|
<Link href={`${locale}/image/detail/${item?.slug}`}>
|
||||||
<h3 className="text-sm font-bold mt-2">{textEllipsis(item?.title, 30)}</h3>
|
<h3 className="text-sm font-bold mt-2">
|
||||||
|
{textEllipsis(item?.title, 30)}
|
||||||
|
</h3>
|
||||||
</Link>
|
</Link>
|
||||||
<p className="text-[10px] flex flex-row items-center gap-1 text-gray-500 mt-1">
|
<p className="text-[10px] flex flex-row items-center gap-1 text-gray-500 mt-1">
|
||||||
{formatDateToIndonesian(new Date(item?.createdAt))} {item?.timezone ? item?.timezone : "WIB"} |{" "}
|
{formatDateToIndonesian(new Date(item?.createdAt))}{" "}
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1.2em" height="1.2em" viewBox="0 0 24 24">
|
{item?.timezone ? item?.timezone : "WIB"} |{" "}
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="1.2em"
|
||||||
|
height="1.2em"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
d="M11.5 18c4 0 7.46-2.22 9.24-5.5C18.96 9.22 15.5 7 11.5 7s-7.46 2.22-9.24 5.5C4.04 15.78 7.5 18 11.5 18m0-12c4.56 0 8.5 2.65 10.36 6.5C20 16.35 16.06 19 11.5 19S3 16.35 1.14 12.5C3 8.65 6.94 6 11.5 6m0 2C14 8 16 10 16 12.5S14 17 11.5 17S7 15 7 12.5S9 8 11.5 8m0 1A3.5 3.5 0 0 0 8 12.5a3.5 3.5 0 0 0 3.5 3.5a3.5 3.5 0 0 0 3.5-3.5A3.5 3.5 0 0 0 11.5 9"
|
d="M11.5 18c4 0 7.46-2.22 9.24-5.5C18.96 9.22 15.5 7 11.5 7s-7.46 2.22-9.24 5.5C4.04 15.78 7.5 18 11.5 18m0-12c4.56 0 8.5 2.65 10.36 6.5C20 16.35 16.06 19 11.5 19S3 16.35 1.14 12.5C3 8.65 6.94 6 11.5 6m0 2C14 8 16 10 16 12.5S14 17 11.5 17S7 15 7 12.5S9 8 11.5 8m0 1A3.5 3.5 0 0 0 8 12.5a3.5 3.5 0 0 0 3.5 3.5a3.5 3.5 0 0 0 3.5-3.5A3.5 3.5 0 0 0 11.5 9"
|
||||||
|
|
|
||||||
|
|
@ -6,28 +6,14 @@ import { FiFile, FiImage, FiMusic, FiYoutube } from "react-icons/fi";
|
||||||
import { useParams, usePathname, useRouter } from "next/navigation";
|
import { useParams, usePathname, useRouter } from "next/navigation";
|
||||||
import { generateLocalizedPath } from "@/utils/globals";
|
import { generateLocalizedPath } from "@/utils/globals";
|
||||||
import { Link } from "@/i18n/routing";
|
import { Link } from "@/i18n/routing";
|
||||||
import {
|
import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, navigationMenuTriggerStyle } from "@/components/ui/navigation-menu";
|
||||||
NavigationMenu,
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../ui/dropdown-menu";
|
||||||
NavigationMenuContent,
|
|
||||||
NavigationMenuItem,
|
|
||||||
NavigationMenuLink,
|
|
||||||
NavigationMenuList,
|
|
||||||
NavigationMenuTrigger,
|
|
||||||
navigationMenuTriggerStyle,
|
|
||||||
} from "@/components/ui/navigation-menu";
|
|
||||||
import {
|
|
||||||
DropdownMenu,
|
|
||||||
DropdownMenuContent,
|
|
||||||
DropdownMenuGroup,
|
|
||||||
DropdownMenuItem,
|
|
||||||
DropdownMenuSeparator,
|
|
||||||
DropdownMenuTrigger,
|
|
||||||
} from "../ui/dropdown-menu";
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { Icon } from "../ui/icon";
|
import { Icon } from "../ui/icon";
|
||||||
import { getCookiesDecrypt } from "@/lib/utils";
|
import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import { getInfoProfile } from "@/service/auth";
|
import { getInfoProfile } from "@/service/auth";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
type Detail = {
|
type Detail = {
|
||||||
id: number;
|
id: number;
|
||||||
|
|
@ -54,6 +40,7 @@ const Navbar = () => {
|
||||||
const levelName = getCookiesDecrypt("ulnae");
|
const levelName = getCookiesDecrypt("ulnae");
|
||||||
const roleId = getCookiesDecrypt("urie");
|
const roleId = getCookiesDecrypt("urie");
|
||||||
const [detail, setDetail] = useState<Detail>();
|
const [detail, setDetail] = useState<Detail>();
|
||||||
|
const t = useTranslations("Menu");
|
||||||
|
|
||||||
const onLogout = () => {
|
const onLogout = () => {
|
||||||
Object.keys(Cookies.get()).forEach((cookieName) => {
|
Object.keys(Cookies.get()).forEach((cookieName) => {
|
||||||
|
|
@ -89,41 +76,18 @@ const Navbar = () => {
|
||||||
<div className="flex items-center justify-between px-4 lg:px-20 py-4 gap-3">
|
<div className="flex items-center justify-between px-4 lg:px-20 py-4 gap-3">
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<Link href="/" className="flex items-center">
|
<Link href="/" className="flex items-center">
|
||||||
<img
|
<img src="/assets/mediahub-logo.gif" alt="Media Hub Logo" className="object-contain h-20" />
|
||||||
src="/assets/mediahub-logo.gif"
|
|
||||||
alt="Media Hub Logo"
|
|
||||||
className="object-contain h-20"
|
|
||||||
/>
|
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{/* Mobile Menu Toggle */}
|
{/* Mobile Menu Toggle */}
|
||||||
<button
|
<button className="text-black dark:text-white right-0 size-20 h-10 w-10 lg:hidden" onClick={() => setMenuOpen(!menuOpen)}>
|
||||||
className="text-black dark:text-white right-0 size-20 h-10 w-10 lg:hidden"
|
|
||||||
onClick={() => setMenuOpen(!menuOpen)}
|
|
||||||
>
|
|
||||||
{menuOpen ? (
|
{menuOpen ? (
|
||||||
<svg
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<path fill="#000" d="m13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29l-4.3 4.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l4.29-4.3l4.29 4.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42Z" />
|
||||||
width="24"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fill="#000"
|
|
||||||
d="m13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29l-4.3 4.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l4.29-4.3l4.29 4.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
</svg>
|
||||||
) : (
|
) : (
|
||||||
<svg
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<path fill="#000" d="M4 6a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1m0 6a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1m1 5a1 1 0 1 0 0 2h14a1 1 0 1 0 0-2z" />
|
||||||
width="24"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fill="#000"
|
|
||||||
d="M4 6a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1m0 6a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1m1 5a1 1 0 1 0 0 2h14a1 1 0 1 0 0-2z"
|
|
||||||
/>
|
|
||||||
</svg>
|
</svg>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -136,73 +100,35 @@ const Navbar = () => {
|
||||||
<NavigationMenuItem>
|
<NavigationMenuItem>
|
||||||
<NavigationMenuTrigger>
|
<NavigationMenuTrigger>
|
||||||
<a className="dark:text-white text-black flex flex-row justify-center items-center cursor-pointer">
|
<a className="dark:text-white text-black flex flex-row justify-center items-center cursor-pointer">
|
||||||
<svg
|
<svg className="mx-2 dark:" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
className="mx-2 dark:"
|
|
||||||
width="25"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 25 24"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path
|
<path
|
||||||
d="M20 7.5H5C4.6023 7.5004 4.221 7.65856 3.93978 7.93978C3.65856 8.221 3.5004 8.6023 3.5 9V19.5C3.5004 19.8977 3.65856 20.279 3.93978 20.5602C4.221 20.8414 4.6023 20.9996 5 21H20C20.3977 20.9996 20.779 20.8414 21.0602 20.5602C21.3414 20.279 21.4996 19.8977 21.5 19.5V9C21.4996 8.6023 21.3414 8.221 21.0602 7.93978C20.779 7.65856 20.3977 7.5004 20 7.5ZM10.25 17.25V11.25L15.5 14.25L10.25 17.25ZM5 4.5H20V6H5V4.5ZM6.5 1.5H18.5V3H6.5V1.5Z"
|
d="M20 7.5H5C4.6023 7.5004 4.221 7.65856 3.93978 7.93978C3.65856 8.221 3.5004 8.6023 3.5 9V19.5C3.5004 19.8977 3.65856 20.279 3.93978 20.5602C4.221 20.8414 4.6023 20.9996 5 21H20C20.3977 20.9996 20.779 20.8414 21.0602 20.5602C21.3414 20.279 21.4996 19.8977 21.5 19.5V9C21.4996 8.6023 21.3414 8.221 21.0602 7.93978C20.779 7.65856 20.3977 7.5004 20 7.5ZM10.25 17.25V11.25L15.5 14.25L10.25 17.25ZM5 4.5H20V6H5V4.5ZM6.5 1.5H18.5V3H6.5V1.5Z"
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
Konten
|
{t("content")}
|
||||||
</a>
|
</a>
|
||||||
</NavigationMenuTrigger>
|
</NavigationMenuTrigger>
|
||||||
<NavigationMenuContent className="p-0 rounded-md overflow-hidden w-full">
|
<NavigationMenuContent className="p-0 rounded-md overflow-hidden w-full">
|
||||||
<NavigationMenuLink
|
<NavigationMenuLink onClick={() => router.push(generateLocalizedPath("/video/filter", String(locale)))} className="flex items-start gap-1.5 p-2 ">
|
||||||
onClick={() =>
|
|
||||||
router.push(
|
|
||||||
generateLocalizedPath("/video/filter", String(locale))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
className="flex items-start gap-1.5 p-2 "
|
|
||||||
>
|
|
||||||
<p className="text-slate-600 dark:text-white hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
<p className="text-slate-600 dark:text-white hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
||||||
<FiYoutube className="mr-2" />
|
<FiYoutube className="mr-2" />
|
||||||
Video
|
Video
|
||||||
</p>
|
</p>
|
||||||
</NavigationMenuLink>
|
</NavigationMenuLink>
|
||||||
<NavigationMenuLink
|
<NavigationMenuLink onClick={() => router.push(generateLocalizedPath("/audio/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2 ">
|
||||||
onClick={() =>
|
|
||||||
router.push(
|
|
||||||
generateLocalizedPath("/audio/filter", String(locale))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
className="flex place-items-start gap-1.5 p-2 "
|
|
||||||
>
|
|
||||||
<p className="text-slate-600 dark:text-white hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
<p className="text-slate-600 dark:text-white hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
||||||
<FiMusic className="mr-2" />
|
<FiMusic className="mr-2" />
|
||||||
Audio
|
Audio
|
||||||
</p>
|
</p>
|
||||||
</NavigationMenuLink>
|
</NavigationMenuLink>
|
||||||
<NavigationMenuLink
|
<NavigationMenuLink onClick={() => router.push(generateLocalizedPath("/image/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2">
|
||||||
onClick={() =>
|
|
||||||
router.push(
|
|
||||||
generateLocalizedPath("/image/filter", String(locale))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
className="flex place-items-start gap-1.5 p-2"
|
|
||||||
>
|
|
||||||
<p className="text-slate-600 dark:text-white hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
<p className="text-slate-600 dark:text-white hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
||||||
<FiImage className="mr-2" />
|
<FiImage className="mr-2" />
|
||||||
Foto
|
Foto
|
||||||
</p>
|
</p>
|
||||||
</NavigationMenuLink>
|
</NavigationMenuLink>
|
||||||
<NavigationMenuLink
|
<NavigationMenuLink onClick={() => router.push(generateLocalizedPath("/document/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2">
|
||||||
onClick={() =>
|
|
||||||
router.push(
|
|
||||||
generateLocalizedPath(
|
|
||||||
"/document/filter",
|
|
||||||
String(locale)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
className="flex place-items-start gap-1.5 p-2"
|
|
||||||
>
|
|
||||||
<p className="text-slate-600 dark:text-white hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
<p className="text-slate-600 dark:text-white hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
||||||
<FiFile className="mr-2" />
|
<FiFile className="mr-2" />
|
||||||
Teks
|
Teks
|
||||||
|
|
@ -214,14 +140,7 @@ const Navbar = () => {
|
||||||
<Link href="/schedule" legacyBehavior passHref>
|
<Link href="/schedule" legacyBehavior passHref>
|
||||||
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
||||||
<span>
|
<span>
|
||||||
<svg
|
<svg className="mr-2" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
className="mr-2"
|
|
||||||
width="25"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 25 24"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path
|
<path
|
||||||
d="M19.5 4H18.5V3C18.5 2.4 18.1 2 17.5 2C16.9 2 16.5 2.4 16.5 3V4H8.5V3C8.5 2.4 8.1 2 7.5 2C6.9 2 6.5 2.4 6.5 3V4H5.5C3.8 4 2.5 5.3 2.5 7V8H22.5V7C22.5 5.3 21.2 4 19.5 4ZM2.5 19C2.5 20.7 3.8 22 5.5 22H19.5C21.2 22 22.5 20.7 22.5 19V10H2.5V19ZM17.5 12C18.1 12 18.5 12.4 18.5 13C18.5 13.6 18.1 14 17.5 14C16.9 14 16.5 13.6 16.5 13C16.5 12.4 16.9 12 17.5 12ZM17.5 16C18.1 16 18.5 16.4 18.5 17C18.5 17.6 18.1 18 17.5 18C16.9 18 16.5 17.6 16.5 17C16.5 16.4 16.9 16 17.5 16ZM12.5 12C13.1 12 13.5 12.4 13.5 13C13.5 13.6 13.1 14 12.5 14C11.9 14 11.5 13.6 11.5 13C11.5 12.4 11.9 12 12.5 12ZM12.5 16C13.1 16 13.5 16.4 13.5 17C13.5 17.6 13.1 18 12.5 18C11.9 18 11.5 17.6 11.5 17C11.5 16.4 11.9 16 12.5 16ZM7.5 12C8.1 12 8.5 12.4 8.5 13C8.5 13.6 8.1 14 7.5 14C6.9 14 6.5 13.6 6.5 13C6.5 12.4 6.9 12 7.5 12ZM7.5 16C8.1 16 8.5 16.4 8.5 17C8.5 17.6 8.1 18 7.5 18C6.9 18 6.5 17.6 6.5 17C6.5 16.4 6.9 16 7.5 16Z"
|
d="M19.5 4H18.5V3C18.5 2.4 18.1 2 17.5 2C16.9 2 16.5 2.4 16.5 3V4H8.5V3C8.5 2.4 8.1 2 7.5 2C6.9 2 6.5 2.4 6.5 3V4H5.5C3.8 4 2.5 5.3 2.5 7V8H22.5V7C22.5 5.3 21.2 4 19.5 4ZM2.5 19C2.5 20.7 3.8 22 5.5 22H19.5C21.2 22 22.5 20.7 22.5 19V10H2.5V19ZM17.5 12C18.1 12 18.5 12.4 18.5 13C18.5 13.6 18.1 14 17.5 14C16.9 14 16.5 13.6 16.5 13C16.5 12.4 16.9 12 17.5 12ZM17.5 16C18.1 16 18.5 16.4 18.5 17C18.5 17.6 18.1 18 17.5 18C16.9 18 16.5 17.6 16.5 17C16.5 16.4 16.9 16 17.5 16ZM12.5 12C13.1 12 13.5 12.4 13.5 13C13.5 13.6 13.1 14 12.5 14C11.9 14 11.5 13.6 11.5 13C11.5 12.4 11.9 12 12.5 12ZM12.5 16C13.1 16 13.5 16.4 13.5 17C13.5 17.6 13.1 18 12.5 18C11.9 18 11.5 17.6 11.5 17C11.5 16.4 11.9 16 12.5 16ZM7.5 12C8.1 12 8.5 12.4 8.5 13C8.5 13.6 8.1 14 7.5 14C6.9 14 6.5 13.6 6.5 13C6.5 12.4 6.9 12 7.5 12ZM7.5 16C8.1 16 8.5 16.4 8.5 17C8.5 17.6 8.1 18 7.5 18C6.9 18 6.5 17.6 6.5 17C6.5 16.4 6.9 16 7.5 16Z"
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
|
|
@ -236,14 +155,7 @@ const Navbar = () => {
|
||||||
<Link href="/indeks" legacyBehavior passHref>
|
<Link href="/indeks" legacyBehavior passHref>
|
||||||
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
||||||
<span>
|
<span>
|
||||||
<svg
|
<svg className="mr-2" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
className="mr-2"
|
|
||||||
width="25"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 25 24"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path
|
<path
|
||||||
fill-rule="evenodd"
|
fill-rule="evenodd"
|
||||||
clip-rule="evenodd"
|
clip-rule="evenodd"
|
||||||
|
|
@ -265,40 +177,22 @@ const Navbar = () => {
|
||||||
</Link>
|
</Link>
|
||||||
<div className="flex items-center space-x-1 ">
|
<div className="flex items-center space-x-1 ">
|
||||||
<a href="https://tvradio.polri.go.id/">
|
<a href="https://tvradio.polri.go.id/">
|
||||||
<img
|
<img src="/assets/polriTv.png" className="object-contain h-10 flex-auto " />
|
||||||
src="/assets/polriTv.png"
|
|
||||||
className="object-contain h-10 flex-auto "
|
|
||||||
/>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="relative inline-block text-left">
|
<div className="relative inline-block text-left">
|
||||||
{/* Tombol Utama */}
|
{/* Tombol Utama */}
|
||||||
<button
|
<button onClick={() => setIsOpen(!isOpen)} className="flex items-center space-x-2 p-2 text-gray-700 bg-slate-200 rounded-lg">
|
||||||
onClick={() => setIsOpen(!isOpen)}
|
|
||||||
className="flex items-center space-x-2 p-2 text-gray-700 bg-slate-200 rounded-lg"
|
|
||||||
>
|
|
||||||
<img
|
<img
|
||||||
src={
|
src={language === "id" ? "https://upload.wikimedia.org/wikipedia/commons/9/9f/Flag_of_Indonesia.svg" : "https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg"}
|
||||||
language === "id"
|
|
||||||
? "https://upload.wikimedia.org/wikipedia/commons/9/9f/Flag_of_Indonesia.svg"
|
|
||||||
: "https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg"
|
|
||||||
}
|
|
||||||
alt={language === "id" ? "Ind" : "Eng"}
|
alt={language === "id" ? "Ind" : "Eng"}
|
||||||
className="w-3 h-3"
|
className="w-3 h-3"
|
||||||
/>
|
/>
|
||||||
<span>{language === "id" ? "Ind" : "Eng"}</span>
|
<span>{language === "id" ? "Ind" : "Eng"}</span>
|
||||||
<span className="text-gray-500">
|
<span className="text-gray-500">
|
||||||
<svg
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 32 32">
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<path fill="currentColor" d="M8.037 11.166L14.5 22.36c.825 1.43 2.175 1.43 3 0l6.463-11.195c.826-1.43.15-2.598-1.5-2.598H9.537c-1.65 0-2.326 1.17-1.5 2.6z" />
|
||||||
width="15"
|
|
||||||
height="15"
|
|
||||||
viewBox="0 0 32 32"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fill="currentColor"
|
|
||||||
d="M8.037 11.166L14.5 22.36c.825 1.43 2.175 1.43 3 0l6.463-11.195c.826-1.43.15-2.598-1.5-2.598H9.537c-1.65 0-2.326 1.17-1.5 2.6z"
|
|
||||||
/>
|
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -306,30 +200,12 @@ const Navbar = () => {
|
||||||
{/* Dropdown Menu */}
|
{/* Dropdown Menu */}
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
<div className="absolute right-0 mt-2 w-auto bg-slate-200 border rounded-md shadow-lg z-10">
|
<div className="absolute right-0 mt-2 w-auto bg-slate-200 border rounded-md shadow-lg z-10">
|
||||||
<button
|
<button onClick={() => handleLanguageChange("id")} className={`flex items-center space-x-2 w-full px-4 py-2 ${language === "id" ? "font-medium" : ""}`}>
|
||||||
onClick={() => handleLanguageChange("id")}
|
<img src="https://upload.wikimedia.org/wikipedia/commons/9/9f/Flag_of_Indonesia.svg" alt="Indonesia" className="w-5 h-5" />
|
||||||
className={`flex items-center space-x-2 w-full px-4 py-2 ${
|
|
||||||
language === "id" ? "font-medium" : ""
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="https://upload.wikimedia.org/wikipedia/commons/9/9f/Flag_of_Indonesia.svg"
|
|
||||||
alt="Indonesia"
|
|
||||||
className="w-5 h-5"
|
|
||||||
/>
|
|
||||||
<span>Ind</span>
|
<span>Ind</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button onClick={() => handleLanguageChange("en")} className={`flex items-center space-x-2 w-full px-4 py-2 ${language === "en" ? "font-medium" : ""}`}>
|
||||||
onClick={() => handleLanguageChange("en")}
|
<img src="https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg" alt="English" className="w-5 h-5" />
|
||||||
className={`flex items-center space-x-2 w-full px-4 py-2 ${
|
|
||||||
language === "en" ? "font-medium" : ""
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg"
|
|
||||||
alt="English"
|
|
||||||
className="w-5 h-5"
|
|
||||||
/>
|
|
||||||
<span>Eng</span>
|
<span>Eng</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -337,18 +213,9 @@ const Navbar = () => {
|
||||||
</div>
|
</div>
|
||||||
<ThemeSwitcher />
|
<ThemeSwitcher />
|
||||||
<div className="relative text-gray-600 dark:text-white">
|
<div className="relative text-gray-600 dark:text-white">
|
||||||
<input
|
<input type="text" placeholder="Pencarian" className="pl-8 pr-4 py-1 w-28 text-[13px] border rounded-full focus:outline-none dark:text-white" />
|
||||||
type="text"
|
|
||||||
placeholder="Pencarian"
|
|
||||||
className="pl-8 pr-4 py-1 w-28 text-[13px] border rounded-full focus:outline-none dark:text-white"
|
|
||||||
/>
|
|
||||||
<span className="absolute left-4 top-1/2 transform -translate-y-1/2">
|
<span className="absolute left-4 top-1/2 transform -translate-y-1/2">
|
||||||
<svg
|
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24">
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
width="13"
|
|
||||||
height="13"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
fill-rule="evenodd"
|
fill-rule="evenodd"
|
||||||
|
|
@ -403,25 +270,14 @@ const Navbar = () => {
|
||||||
)}
|
)}
|
||||||
</div> */}
|
</div> */}
|
||||||
|
|
||||||
{roleId === "5" ||
|
{roleId === "5" || roleId === "6" || roleId === "7" || roleId === "8" ? (
|
||||||
roleId === "6" ||
|
|
||||||
roleId === "7" ||
|
|
||||||
roleId === "8" ? (
|
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild className="cursor-pointer">
|
<DropdownMenuTrigger asChild className="cursor-pointer">
|
||||||
{detail !== undefined ? (
|
{detail !== undefined ? (
|
||||||
<div className="flex items-center gap-3 text-default-800">
|
<div className="flex items-center gap-3 text-default-800">
|
||||||
<Image
|
<Image src={"/assets/avatar-profile.png"} alt={"Image"} width={36} height={36} className="rounded-full" />
|
||||||
src={"/assets/avatar-profile.png"}
|
|
||||||
alt={"Image"}
|
|
||||||
width={36}
|
|
||||||
height={36}
|
|
||||||
className="rounded-full"
|
|
||||||
/>
|
|
||||||
<div>
|
<div>
|
||||||
<div className="text-sm font-medium capitalize lg:block hidden whitespace-nowrap">
|
<div className="text-sm font-medium capitalize lg:block hidden whitespace-nowrap">{detail?.fullname}</div>
|
||||||
{detail?.fullname}
|
|
||||||
</div>
|
|
||||||
<p className="text-xs whitespace-nowrap">({detail?.fullname})</p>
|
<p className="text-xs whitespace-nowrap">({detail?.fullname})</p>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-base me-2.5 lg:inline-block hidden">
|
<span className="text-base me-2.5 lg:inline-block hidden">
|
||||||
|
|
@ -443,14 +299,10 @@ const Navbar = () => {
|
||||||
{
|
{
|
||||||
name: "Kelola Konten",
|
name: "Kelola Konten",
|
||||||
icon: "stash:save-ribbon-duotone",
|
icon: "stash:save-ribbon-duotone",
|
||||||
href: "/content-management",
|
href: "/content-management/galery",
|
||||||
},
|
},
|
||||||
].map((item, index) => (
|
].map((item, index) => (
|
||||||
<Link
|
<Link href={item.href} key={`info-menu-${index}`} className="cursor-pointer">
|
||||||
href={item.href}
|
|
||||||
key={`info-menu-${index}`}
|
|
||||||
className="cursor-pointer"
|
|
||||||
>
|
|
||||||
<DropdownMenuItem className="flex items-center gap-2 text-sm font-medium text-default-600 capitalize px-3 py-1.5 cursor-pointer">
|
<DropdownMenuItem className="flex items-center gap-2 text-sm font-medium text-default-600 capitalize px-3 py-1.5 cursor-pointer">
|
||||||
<Icon icon={item.icon} className="w-4 h-4" />
|
<Icon icon={item.icon} className="w-4 h-4" />
|
||||||
{item.name}
|
{item.name}
|
||||||
|
|
@ -462,11 +314,7 @@ const Navbar = () => {
|
||||||
<DropdownMenuItem className="flex items-center gap-2 text-sm font-medium text-default-600 capitalize my-1 px-3 cursor-pointer">
|
<DropdownMenuItem className="flex items-center gap-2 text-sm font-medium text-default-600 capitalize my-1 px-3 cursor-pointer">
|
||||||
<div>
|
<div>
|
||||||
<Link href={"/"}>
|
<Link href={"/"}>
|
||||||
<button
|
<button type="submit" className="w-full flex items-center gap-2" onClick={onLogout}>
|
||||||
type="submit"
|
|
||||||
className="w-full flex items-center gap-2"
|
|
||||||
onClick={onLogout}
|
|
||||||
>
|
|
||||||
<Icon icon="heroicons:power" className="w-4 h-4" />
|
<Icon icon="heroicons:power" className="w-4 h-4" />
|
||||||
Log out
|
Log out
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -475,30 +323,15 @@ const Navbar = () => {
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
) : roleId === "2" ||
|
) : roleId === "2" || roleId === "3" || roleId === "4" || roleId === "9" || roleId === "10" || roleId === "11" || roleId === "12" || roleId === "13" ? (
|
||||||
roleId === "3" ||
|
|
||||||
roleId === "4" ||
|
|
||||||
roleId === "9" ||
|
|
||||||
roleId === "10" ||
|
|
||||||
roleId === "11" ||
|
|
||||||
roleId === "12" ||
|
|
||||||
roleId === "13" ? (
|
|
||||||
// Dropdown menu for roleId === 3
|
// Dropdown menu for roleId === 3
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild className="cursor-pointer">
|
<DropdownMenuTrigger asChild className="cursor-pointer">
|
||||||
{detail !== undefined ? (
|
{detail !== undefined ? (
|
||||||
<div className="flex items-center gap-3 text-default-800">
|
<div className="flex items-center gap-3 text-default-800">
|
||||||
<Image
|
<Image src={"/assets/avatar-profile.png"} alt={"Image"} width={36} height={36} className="rounded-full" />
|
||||||
src={"/assets/avatar-profile.png"}
|
|
||||||
alt={"Image"}
|
|
||||||
width={36}
|
|
||||||
height={36}
|
|
||||||
className="rounded-full"
|
|
||||||
/>
|
|
||||||
<div>
|
<div>
|
||||||
<div className="text-sm font-medium capitalize lg:block hidden">
|
<div className="text-sm font-medium capitalize lg:block hidden">{detail?.fullname}</div>
|
||||||
{detail?.fullname}
|
|
||||||
</div>
|
|
||||||
<p className="text-xs">({detail?.fullname})</p>
|
<p className="text-xs">({detail?.fullname})</p>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-base me-2.5 lg:inline-block hidden">
|
<span className="text-base me-2.5 lg:inline-block hidden">
|
||||||
|
|
@ -523,11 +356,7 @@ const Navbar = () => {
|
||||||
href: "/dashboard",
|
href: "/dashboard",
|
||||||
},
|
},
|
||||||
].map((item, index) => (
|
].map((item, index) => (
|
||||||
<Link
|
<Link href={item.href} key={`info-menu-${index}`} className="cursor-pointer">
|
||||||
href={item.href}
|
|
||||||
key={`info-menu-${index}`}
|
|
||||||
className="cursor-pointer"
|
|
||||||
>
|
|
||||||
<DropdownMenuItem className="flex items-center gap-2 text-sm font-medium text-default-600 capitalize px-3 py-1.5 cursor-pointer">
|
<DropdownMenuItem className="flex items-center gap-2 text-sm font-medium text-default-600 capitalize px-3 py-1.5 cursor-pointer">
|
||||||
<Icon icon={item.icon} className="w-4 h-4" />
|
<Icon icon={item.icon} className="w-4 h-4" />
|
||||||
{item.name}
|
{item.name}
|
||||||
|
|
@ -539,11 +368,7 @@ const Navbar = () => {
|
||||||
<DropdownMenuItem className="flex items-center gap-2 text-sm font-medium text-default-600 capitalize my-1 px-3 cursor-pointer">
|
<DropdownMenuItem className="flex items-center gap-2 text-sm font-medium text-default-600 capitalize my-1 px-3 cursor-pointer">
|
||||||
<div>
|
<div>
|
||||||
<Link href={"/"}>
|
<Link href={"/"}>
|
||||||
<button
|
<button type="submit" className="w-full flex items-center gap-2" onClick={onLogout}>
|
||||||
type="submit"
|
|
||||||
className="w-full flex items-center gap-2"
|
|
||||||
onClick={onLogout}
|
|
||||||
>
|
|
||||||
<Icon icon="heroicons:power" className="w-4 h-4" />
|
<Icon icon="heroicons:power" className="w-4 h-4" />
|
||||||
Log out
|
Log out
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -555,16 +380,10 @@ const Navbar = () => {
|
||||||
) : (
|
) : (
|
||||||
// Masuk and Daftar buttons for roleId === null
|
// Masuk and Daftar buttons for roleId === null
|
||||||
<div className="flex justify-center items-center mx-3 gap-5">
|
<div className="flex justify-center items-center mx-3 gap-5">
|
||||||
<Link
|
<Link href="/auth" className="w-full lg:w-fit px-4 py-1 bg-[#bb3523] text-white font-semibold rounded-md hover:bg-red-700 text-center">
|
||||||
href="/auth"
|
|
||||||
className="w-full lg:w-fit px-4 py-1 bg-[#bb3523] text-white font-semibold rounded-md hover:bg-red-700 text-center"
|
|
||||||
>
|
|
||||||
Masuk
|
Masuk
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link href="#" className="w-full lg:w-fit px-4 py-1 border border-[#bb3523] text-[#bb3523] font-semibold rounded-md hover:bg-[#bb3523] text-center hover:text-white">
|
||||||
href="#"
|
|
||||||
className="w-full lg:w-fit px-4 py-1 border border-[#bb3523] text-[#bb3523] font-semibold rounded-md hover:bg-[#bb3523] text-center hover:text-white"
|
|
||||||
>
|
|
||||||
Daftar
|
Daftar
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -580,14 +399,7 @@ const Navbar = () => {
|
||||||
<NavigationMenuItem>
|
<NavigationMenuItem>
|
||||||
<NavigationMenuTrigger>
|
<NavigationMenuTrigger>
|
||||||
<a className="dark:text-white text-black flex flex-row justify-center items-center cursor-pointer">
|
<a className="dark:text-white text-black flex flex-row justify-center items-center cursor-pointer">
|
||||||
<svg
|
<svg className="mx-2" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
className="mx-2"
|
|
||||||
width="25"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 25 24"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path
|
<path
|
||||||
d="M20 7.5H5C4.6023 7.5004 4.221 7.65856 3.93978 7.93978C3.65856 8.221 3.5004 8.6023 3.5 9V19.5C3.5004 19.8977 3.65856 20.279 3.93978 20.5602C4.221 20.8414 4.6023 20.9996 5 21H20C20.3977 20.9996 20.779 20.8414 21.0602 20.5602C21.3414 20.279 21.4996 19.8977 21.5 19.5V9C21.4996 8.6023 21.3414 8.221 21.0602 7.93978C20.779 7.65856 20.3977 7.5004 20 7.5ZM10.25 17.25V11.25L15.5 14.25L10.25 17.25ZM5 4.5H20V6H5V4.5ZM6.5 1.5H18.5V3H6.5V1.5Z"
|
d="M20 7.5H5C4.6023 7.5004 4.221 7.65856 3.93978 7.93978C3.65856 8.221 3.5004 8.6023 3.5 9V19.5C3.5004 19.8977 3.65856 20.279 3.93978 20.5602C4.221 20.8414 4.6023 20.9996 5 21H20C20.3977 20.9996 20.779 20.8414 21.0602 20.5602C21.3414 20.279 21.4996 19.8977 21.5 19.5V9C21.4996 8.6023 21.3414 8.221 21.0602 7.93978C20.779 7.65856 20.3977 7.5004 20 7.5ZM10.25 17.25V11.25L15.5 14.25L10.25 17.25ZM5 4.5H20V6H5V4.5ZM6.5 1.5H18.5V3H6.5V1.5Z"
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
|
|
@ -597,56 +409,25 @@ const Navbar = () => {
|
||||||
</a>
|
</a>
|
||||||
</NavigationMenuTrigger>
|
</NavigationMenuTrigger>
|
||||||
<NavigationMenuContent className="p-0 rounded-md overflow-hidden w-full">
|
<NavigationMenuContent className="p-0 rounded-md overflow-hidden w-full">
|
||||||
<NavigationMenuLink
|
<NavigationMenuLink onClick={() => router.push(generateLocalizedPath("/video/filter", String(locale)))} className="flex items-start gap-1.5 p-2 hover:bg-white">
|
||||||
onClick={() =>
|
|
||||||
router.push(
|
|
||||||
generateLocalizedPath("/video/filter", String(locale))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
className="flex items-start gap-1.5 p-2 hover:bg-white"
|
|
||||||
>
|
|
||||||
<p className="text-slate-600 hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
<p className="text-slate-600 hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
||||||
<FiYoutube className="mr-2" />
|
<FiYoutube className="mr-2" />
|
||||||
Video
|
Video
|
||||||
</p>
|
</p>
|
||||||
</NavigationMenuLink>
|
</NavigationMenuLink>
|
||||||
<NavigationMenuLink
|
<NavigationMenuLink onClick={() => router.push(generateLocalizedPath("/audio/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2 hover:bg-white">
|
||||||
onClick={() =>
|
|
||||||
router.push(
|
|
||||||
generateLocalizedPath("/audio/filter", String(locale))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
className="flex place-items-start gap-1.5 p-2 hover:bg-white"
|
|
||||||
>
|
|
||||||
<p className="text-slate-600 hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
<p className="text-slate-600 hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
||||||
<FiMusic className="mr-2" />
|
<FiMusic className="mr-2" />
|
||||||
Audio
|
Audio
|
||||||
</p>
|
</p>
|
||||||
</NavigationMenuLink>
|
</NavigationMenuLink>
|
||||||
<NavigationMenuLink
|
<NavigationMenuLink onClick={() => router.push(generateLocalizedPath("/image/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2 hover:bg-white">
|
||||||
onClick={() =>
|
|
||||||
router.push(
|
|
||||||
generateLocalizedPath("/image/filter", String(locale))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
className="flex place-items-start gap-1.5 p-2 hover:bg-white"
|
|
||||||
>
|
|
||||||
<p className="text-slate-600 hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
<p className="text-slate-600 hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
||||||
<FiImage className="mr-2" />
|
<FiImage className="mr-2" />
|
||||||
Foto
|
Foto
|
||||||
</p>
|
</p>
|
||||||
</NavigationMenuLink>
|
</NavigationMenuLink>
|
||||||
<NavigationMenuLink
|
<NavigationMenuLink onClick={() => router.push(generateLocalizedPath("/document/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2 hover:bg-white">
|
||||||
onClick={() =>
|
|
||||||
router.push(
|
|
||||||
generateLocalizedPath(
|
|
||||||
"/document/filter",
|
|
||||||
String(locale)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
className="flex place-items-start gap-1.5 p-2 hover:bg-white"
|
|
||||||
>
|
|
||||||
<p className="text-slate-600 hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
<p className="text-slate-600 hover:text-[#bb3523] flex flex-row justify-center items-center px-5 py-2 cursor-pointer">
|
||||||
<FiFile className="mr-2" />
|
<FiFile className="mr-2" />
|
||||||
Teks
|
Teks
|
||||||
|
|
@ -658,14 +439,7 @@ const Navbar = () => {
|
||||||
<Link href="/schedule" legacyBehavior passHref>
|
<Link href="/schedule" legacyBehavior passHref>
|
||||||
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
||||||
<span>
|
<span>
|
||||||
<svg
|
<svg className="mr-2" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
className="mr-2"
|
|
||||||
width="25"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 25 24"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path
|
<path
|
||||||
d="M19.5 4H18.5V3C18.5 2.4 18.1 2 17.5 2C16.9 2 16.5 2.4 16.5 3V4H8.5V3C8.5 2.4 8.1 2 7.5 2C6.9 2 6.5 2.4 6.5 3V4H5.5C3.8 4 2.5 5.3 2.5 7V8H22.5V7C22.5 5.3 21.2 4 19.5 4ZM2.5 19C2.5 20.7 3.8 22 5.5 22H19.5C21.2 22 22.5 20.7 22.5 19V10H2.5V19ZM17.5 12C18.1 12 18.5 12.4 18.5 13C18.5 13.6 18.1 14 17.5 14C16.9 14 16.5 13.6 16.5 13C16.5 12.4 16.9 12 17.5 12ZM17.5 16C18.1 16 18.5 16.4 18.5 17C18.5 17.6 18.1 18 17.5 18C16.9 18 16.5 17.6 16.5 17C16.5 16.4 16.9 16 17.5 16ZM12.5 12C13.1 12 13.5 12.4 13.5 13C13.5 13.6 13.1 14 12.5 14C11.9 14 11.5 13.6 11.5 13C11.5 12.4 11.9 12 12.5 12ZM12.5 16C13.1 16 13.5 16.4 13.5 17C13.5 17.6 13.1 18 12.5 18C11.9 18 11.5 17.6 11.5 17C11.5 16.4 11.9 16 12.5 16ZM7.5 12C8.1 12 8.5 12.4 8.5 13C8.5 13.6 8.1 14 7.5 14C6.9 14 6.5 13.6 6.5 13C6.5 12.4 6.9 12 7.5 12ZM7.5 16C8.1 16 8.5 16.4 8.5 17C8.5 17.6 8.1 18 7.5 18C6.9 18 6.5 17.6 6.5 17C6.5 16.4 6.9 16 7.5 16Z"
|
d="M19.5 4H18.5V3C18.5 2.4 18.1 2 17.5 2C16.9 2 16.5 2.4 16.5 3V4H8.5V3C8.5 2.4 8.1 2 7.5 2C6.9 2 6.5 2.4 6.5 3V4H5.5C3.8 4 2.5 5.3 2.5 7V8H22.5V7C22.5 5.3 21.2 4 19.5 4ZM2.5 19C2.5 20.7 3.8 22 5.5 22H19.5C21.2 22 22.5 20.7 22.5 19V10H2.5V19ZM17.5 12C18.1 12 18.5 12.4 18.5 13C18.5 13.6 18.1 14 17.5 14C16.9 14 16.5 13.6 16.5 13C16.5 12.4 16.9 12 17.5 12ZM17.5 16C18.1 16 18.5 16.4 18.5 17C18.5 17.6 18.1 18 17.5 18C16.9 18 16.5 17.6 16.5 17C16.5 16.4 16.9 16 17.5 16ZM12.5 12C13.1 12 13.5 12.4 13.5 13C13.5 13.6 13.1 14 12.5 14C11.9 14 11.5 13.6 11.5 13C11.5 12.4 11.9 12 12.5 12ZM12.5 16C13.1 16 13.5 16.4 13.5 17C13.5 17.6 13.1 18 12.5 18C11.9 18 11.5 17.6 11.5 17C11.5 16.4 11.9 16 12.5 16ZM7.5 12C8.1 12 8.5 12.4 8.5 13C8.5 13.6 8.1 14 7.5 14C6.9 14 6.5 13.6 6.5 13C6.5 12.4 6.9 12 7.5 12ZM7.5 16C8.1 16 8.5 16.4 8.5 17C8.5 17.6 8.1 18 7.5 18C6.9 18 6.5 17.6 6.5 17C6.5 16.4 6.9 16 7.5 16Z"
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
|
|
@ -680,14 +454,7 @@ const Navbar = () => {
|
||||||
<Link href="/indeks" legacyBehavior passHref>
|
<Link href="/indeks" legacyBehavior passHref>
|
||||||
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
|
||||||
<span>
|
<span>
|
||||||
<svg
|
<svg className="mr-2" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
className="mr-2"
|
|
||||||
width="25"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 25 24"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path
|
<path
|
||||||
fill-rule="evenodd"
|
fill-rule="evenodd"
|
||||||
clip-rule="evenodd"
|
clip-rule="evenodd"
|
||||||
|
|
@ -709,39 +476,21 @@ const Navbar = () => {
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center space-x-1 mx-3 text-yellow-600 font-medium">
|
<div className="flex items-center space-x-1 mx-3 text-yellow-600 font-medium">
|
||||||
<a href="https://tvradio.polri.go.id/">
|
<a href="https://tvradio.polri.go.id/">
|
||||||
<img
|
<img src="/assets/polriTv.png" className="object-contain h-11 flex items-center" />
|
||||||
src="/assets/polriTv.png"
|
|
||||||
className="object-contain h-11 flex items-center"
|
|
||||||
/>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div className="relative inline-block mx-3 text-left">
|
<div className="relative inline-block mx-3 text-left">
|
||||||
{/* Tombol Utama Bahasa */}
|
{/* Tombol Utama Bahasa */}
|
||||||
<button
|
<button onClick={() => setIsOpen(!isOpen)} className="flex items-center space-x-2 p-2 text-gray-700 bg-slate-200 rounded-lg">
|
||||||
onClick={() => setIsOpen(!isOpen)}
|
|
||||||
className="flex items-center space-x-2 p-2 text-gray-700 bg-slate-200 rounded-lg"
|
|
||||||
>
|
|
||||||
<img
|
<img
|
||||||
src={
|
src={language === "id" ? "https://upload.wikimedia.org/wikipedia/commons/9/9f/Flag_of_Indonesia.svg" : "https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg"}
|
||||||
language === "id"
|
|
||||||
? "https://upload.wikimedia.org/wikipedia/commons/9/9f/Flag_of_Indonesia.svg"
|
|
||||||
: "https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg"
|
|
||||||
}
|
|
||||||
alt={language === "id" ? "Ind" : "Eng"}
|
alt={language === "id" ? "Ind" : "Eng"}
|
||||||
className="w-3 h-3"
|
className="w-3 h-3"
|
||||||
/>
|
/>
|
||||||
<span>{language === "id" ? "Ind" : "Eng"}</span>
|
<span>{language === "id" ? "Ind" : "Eng"}</span>
|
||||||
<span className="text-gray-500">
|
<span className="text-gray-500">
|
||||||
<svg
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 32 32">
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<path fill="currentColor" d="M8.037 11.166L14.5 22.36c.825 1.43 2.175 1.43 3 0l6.463-11.195c.826-1.43.15-2.598-1.5-2.598H9.537c-1.65 0-2.326 1.17-1.5 2.6z" />
|
||||||
width="15"
|
|
||||||
height="15"
|
|
||||||
viewBox="0 0 32 32"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fill="currentColor"
|
|
||||||
d="M8.037 11.166L14.5 22.36c.825 1.43 2.175 1.43 3 0l6.463-11.195c.826-1.43.15-2.598-1.5-2.598H9.537c-1.65 0-2.326 1.17-1.5 2.6z"
|
|
||||||
/>
|
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -749,30 +498,12 @@ const Navbar = () => {
|
||||||
{/* Dropdown Menu */}
|
{/* Dropdown Menu */}
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
<div className="absolute right-0 mt-2 w-auto bg-slate-200 border rounded-md shadow-lg z-10">
|
<div className="absolute right-0 mt-2 w-auto bg-slate-200 border rounded-md shadow-lg z-10">
|
||||||
<button
|
<button onClick={() => handleLanguageChange("id")} className={`flex items-center space-x-2 w-full px-4 py-2 ${language === "id" ? "font-medium" : ""}`}>
|
||||||
onClick={() => handleLanguageChange("id")}
|
<img src="https://upload.wikimedia.org/wikipedia/commons/9/9f/Flag_of_Indonesia.svg" alt="Indonesia" className="w-5 h-5" />
|
||||||
className={`flex items-center space-x-2 w-full px-4 py-2 ${
|
|
||||||
language === "id" ? "font-medium" : ""
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="https://upload.wikimedia.org/wikipedia/commons/9/9f/Flag_of_Indonesia.svg"
|
|
||||||
alt="Indonesia"
|
|
||||||
className="w-5 h-5"
|
|
||||||
/>
|
|
||||||
<span>Ind</span>
|
<span>Ind</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button onClick={() => handleLanguageChange("en")} className={`flex items-center space-x-2 w-full px-4 py-2 ${language === "en" ? "font-medium" : ""}`}>
|
||||||
onClick={() => handleLanguageChange("en")}
|
<img src="https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg" alt="English" className="w-5 h-5" />
|
||||||
className={`flex items-center space-x-2 w-full px-4 py-2 ${
|
|
||||||
language === "en" ? "font-medium" : ""
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg"
|
|
||||||
alt="English"
|
|
||||||
className="w-5 h-5"
|
|
||||||
/>
|
|
||||||
<span>Eng</span>
|
<span>Eng</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -781,22 +512,14 @@ const Navbar = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className=" py-1 flex items-center mx-3">
|
<div className=" py-1 flex items-center mx-3">
|
||||||
<input
|
<input type="text" placeholder="Pencarian" className="border rounded-full w-full text-sm text-center text-gray-600" />
|
||||||
type="text"
|
|
||||||
placeholder="Pencarian"
|
|
||||||
className="border rounded-full w-full text-sm text-center text-gray-600"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-center items-center mx-3 gap-5">
|
<div className="flex justify-center items-center mx-3 gap-5">
|
||||||
{fullName ? (
|
{fullName ? (
|
||||||
<>
|
<>
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger className="flex items-center gap-1">
|
<DropdownMenuTrigger className="flex items-center gap-1">
|
||||||
<img
|
<img className="h-12 w-12" src="/assets/avatar-profile.png" alt="avatar-profile" />
|
||||||
className="h-12 w-12"
|
|
||||||
src="/assets/avatar-profile.png"
|
|
||||||
alt="avatar-profile"
|
|
||||||
/>
|
|
||||||
<a className="gap-2">
|
<a className="gap-2">
|
||||||
<p className="text-xs font-semibold">{fullName}</p>
|
<p className="text-xs font-semibold">{fullName}</p>
|
||||||
<p className="text-xs">{`(${roleName})`}</p>
|
<p className="text-xs">{`(${roleName})`}</p>
|
||||||
|
|
@ -804,30 +527,23 @@ const Navbar = () => {
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent>
|
<DropdownMenuContent>
|
||||||
<DropdownMenuItem>
|
<DropdownMenuItem>
|
||||||
<Link
|
<Link href="/profile" className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg">
|
||||||
href="/profile"
|
|
||||||
className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg"
|
|
||||||
>
|
|
||||||
<Icon icon="iconamoon:profile-circle-fill" />
|
<Icon icon="iconamoon:profile-circle-fill" />
|
||||||
Profile
|
Profile
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem>
|
<DropdownMenuItem>
|
||||||
<Link
|
<Link href="/content-management/galery" className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg">
|
||||||
href="/content-management"
|
|
||||||
className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg"
|
|
||||||
>
|
|
||||||
<Icon icon="stash:save-ribbon-light" />
|
<Icon icon="stash:save-ribbon-light" />
|
||||||
Kelola Konten
|
Kelola Konten
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem>
|
<DropdownMenuItem>
|
||||||
<Link
|
<Link href={"/"} className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg">
|
||||||
href="#"
|
<button type="submit" className="w-full flex items-center gap-2" onClick={onLogout}>
|
||||||
className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg"
|
|
||||||
>
|
|
||||||
<Icon icon="iconamoon:exit-bold" />
|
<Icon icon="iconamoon:exit-bold" />
|
||||||
Keluar
|
Log Out
|
||||||
|
</button>
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
|
|
@ -835,16 +551,10 @@ const Navbar = () => {
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Link
|
<Link href="/auth" className="px-4 py-1 bg-[#bb3523] text-white font-semibold rounded-md hover:bg-[#bb3523]">
|
||||||
href="/auth"
|
|
||||||
className="px-4 py-1 bg-[#bb3523] text-white font-semibold rounded-md hover:bg-[#bb3523]"
|
|
||||||
>
|
|
||||||
Masuk
|
Masuk
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link href="#" className="px-4 py-1 border border-[#bb3523] text-[#bb3523] font-semibold rounded-md hover:bg-[#bb3523] hover:text-white">
|
||||||
href="#"
|
|
||||||
className="px-4 py-1 border border-[#bb3523] text-[#bb3523] font-semibold rounded-md hover:bg-[#bb3523] hover:text-white"
|
|
||||||
>
|
|
||||||
Daftar
|
Daftar
|
||||||
</Link>{" "}
|
</Link>{" "}
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,14 @@
|
||||||
"use-client";
|
"use client";
|
||||||
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel";
|
import {
|
||||||
|
Carousel,
|
||||||
|
CarouselContent,
|
||||||
|
CarouselItem,
|
||||||
|
CarouselNext,
|
||||||
|
CarouselPrevious,
|
||||||
|
} from "@/components/ui/carousel";
|
||||||
import { useParams, usePathname, useRouter } from "next/navigation";
|
import { useParams, usePathname, useRouter } from "next/navigation";
|
||||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
import { formatDateToIndonesian } from "@/utils/globals";
|
import { formatDateToIndonesian } from "@/utils/globals";
|
||||||
|
|
@ -26,7 +32,16 @@ const NewContent = (props: { type: string }) => {
|
||||||
page: 0,
|
page: 0,
|
||||||
size: 5,
|
size: 5,
|
||||||
sortBy: props.type == "popular" ? "clickCount" : "createdAt",
|
sortBy: props.type == "popular" ? "clickCount" : "createdAt",
|
||||||
contentTypeId: selectedTab == "image" ? "1" : selectedTab == "video" ? "2" : selectedTab == "text" ? "3" : selectedTab == "audio" ? "4" : "",
|
contentTypeId:
|
||||||
|
selectedTab == "image"
|
||||||
|
? "1"
|
||||||
|
: selectedTab == "video"
|
||||||
|
? "2"
|
||||||
|
: selectedTab == "text"
|
||||||
|
? "3"
|
||||||
|
: selectedTab == "audio"
|
||||||
|
? "4"
|
||||||
|
: "",
|
||||||
};
|
};
|
||||||
const response = await getListContent(request);
|
const response = await getListContent(request);
|
||||||
console.log("category", response);
|
console.log("category", response);
|
||||||
|
|
@ -40,7 +55,11 @@ const NewContent = (props: { type: string }) => {
|
||||||
<div className="mx-auto w-full max-w-7xl justify-start flex px-5 flex-col lg:flex-row gap-5 mb-4">
|
<div className="mx-auto w-full max-w-7xl justify-start flex px-5 flex-col lg:flex-row gap-5 mb-4">
|
||||||
<h2 className="flex items-center text-xl lg:text-2xl w-fit font-bold bg-[#bb3523] px-4 py-1 rounded-lg text-white">
|
<h2 className="flex items-center text-xl lg:text-2xl w-fit font-bold bg-[#bb3523] px-4 py-1 rounded-lg text-white">
|
||||||
<span className="text-black ">Konten </span>
|
<span className="text-black ">Konten </span>
|
||||||
{props.type == "popular" ? "Populer" : props.type == "latest" ? "Terbaru" : "Serupa"}
|
{props.type == "popular"
|
||||||
|
? "Populer"
|
||||||
|
: props.type == "latest"
|
||||||
|
? "Terbaru"
|
||||||
|
: "Serupa"}
|
||||||
</h2>
|
</h2>
|
||||||
<Tabs value={selectedTab} onValueChange={setSelectedTab}>
|
<Tabs value={selectedTab} onValueChange={setSelectedTab}>
|
||||||
<TabsList className="grid grid-cols-2 lg:flex lg:flex-row ">
|
<TabsList className="grid grid-cols-2 lg:flex lg:flex-row ">
|
||||||
|
|
@ -50,21 +69,27 @@ const NewContent = (props: { type: string }) => {
|
||||||
>
|
>
|
||||||
Audio Visual
|
Audio Visual
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">
|
||||||
|
|
|
||||||
|
</div>
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
value="audio"
|
value="audio"
|
||||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
>
|
>
|
||||||
Audio
|
Audio
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">
|
||||||
|
|
|
||||||
|
</div>
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
value="image"
|
value="image"
|
||||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
>
|
>
|
||||||
Foto
|
Foto
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">
|
||||||
|
|
|
||||||
|
</div>
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
value="text"
|
value="text"
|
||||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||||
|
|
@ -80,13 +105,29 @@ const NewContent = (props: { type: string }) => {
|
||||||
<Carousel className="w-full max-w-7xl mx-auto">
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{newContent?.map((video: any) => (
|
{newContent?.map((video: any) => (
|
||||||
<CarouselItem key={video?.id} className="md:basis-1/2 lg:basis-1/3">
|
<CarouselItem
|
||||||
<Link href={`/video/detail/${video?.slug}`} className="relative group overflow-hidden shadow-md hover:shadow-lg">
|
key={video?.id}
|
||||||
<img src={video?.thumbnailLink} className="w-full rounded-lg h-48 lg:h-60 object-cover group-hover:scale-100 transition-transform duration-300" />
|
className="md:basis-1/2 lg:basis-1/3"
|
||||||
|
>
|
||||||
|
<Link
|
||||||
|
href={`/video/detail/${video?.slug}`}
|
||||||
|
className="relative group overflow-hidden shadow-md hover:shadow-lg"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={video?.thumbnailLink}
|
||||||
|
className="w-full rounded-lg h-48 lg:h-60 object-cover group-hover:scale-100 transition-transform duration-300"
|
||||||
|
/>
|
||||||
<div className="absolute bottom-0 left-0 right-0 bg-gray-600 border-l-4 border-[#bb3523] rounded-lg backdrop-blur-sm text-white p-2">
|
<div className="absolute bottom-0 left-0 right-0 bg-gray-600 border-l-4 border-[#bb3523] rounded-lg backdrop-blur-sm text-white p-2">
|
||||||
<h1 className="text-sm lg:text-lg mb-2 font-semibold h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">{video?.title}</h1>
|
<h1 className="text-sm lg:text-lg mb-2 font-semibold h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||||
|
{video?.title}
|
||||||
|
</h1>
|
||||||
<p className="flex flex-row items-center text-[10px] gap-2">
|
<p className="flex flex-row items-center text-[10px] gap-2">
|
||||||
{formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"} | <Icon icon="formkit:eye" width="15" height="15" /> {video.clickCount}{" "}
|
{formatDateToIndonesian(
|
||||||
|
new Date(video?.createdAt)
|
||||||
|
)}{" "}
|
||||||
|
{video?.timezone ? video?.timezone : "WIB"} |{" "}
|
||||||
|
<Icon icon="formkit:eye" width="15" height="15" />{" "}
|
||||||
|
{video.clickCount}{" "}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -98,19 +139,35 @@ const NewContent = (props: { type: string }) => {
|
||||||
</Carousel>
|
</Carousel>
|
||||||
) : (
|
) : (
|
||||||
<p className="flex items-center justify-center">
|
<p className="flex items-center justify-center">
|
||||||
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
<img
|
||||||
|
src="/assets/empty-data.png"
|
||||||
|
alt="empty"
|
||||||
|
className="h-52 w-52 my-4"
|
||||||
|
/>
|
||||||
</p>
|
</p>
|
||||||
)
|
)
|
||||||
) : selectedTab == "audio" ? (
|
) : selectedTab == "audio" ? (
|
||||||
newContent?.length > 0 ? (
|
newContent?.length > 0 ? (
|
||||||
<Carousel>
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{newContent?.map((audio: any) => (
|
{newContent?.map((audio: any) => (
|
||||||
<CarouselItem key={audio?.id} className="md:basis-1/2 lg:basis-1/3">
|
<CarouselItem
|
||||||
|
key={audio?.id}
|
||||||
|
className="md:basis-1/2 lg:basis-1/3"
|
||||||
|
>
|
||||||
<div className="flex flex-row gap-6">
|
<div className="flex flex-row gap-6">
|
||||||
<Link href={`/audio/detail/${audio?.slug}`} className="flex flex-col sm:flex-row items-center bg-white dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full">
|
<Link
|
||||||
|
href={`/audio/detail/${audio?.slug}`}
|
||||||
|
className="flex flex-col sm:flex-row items-center bg-white dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4 w-full"
|
||||||
|
>
|
||||||
<div className="flex items-center justify-center bg-red-500 text-white rounded-lg w-16 h-8 lg:h-16">
|
<div className="flex items-center justify-center bg-red-500 text-white rounded-lg w-16 h-8 lg:h-16">
|
||||||
<svg width="32" height="34" viewBox="0 0 32 34" fill="null" xmlns="http://www.w3.org/2000/svg">
|
<svg
|
||||||
|
width="32"
|
||||||
|
height="34"
|
||||||
|
viewBox="0 0 32 34"
|
||||||
|
fill="null"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
<path
|
<path
|
||||||
d="M23.404 0.452014C23.7033 0.35857 24.0204 0.336816 24.3297 0.388509C24.639 0.440203 24.9318 0.563895 25.1845 0.749599C25.4371 0.935304 25.6426 1.17782 25.7843 1.45756C25.9259 1.73731 25.9998 2.04644 26 2.36001V14.414C25.3462 14.2296 24.6766 14.1064 24 14.046V8.36001L10 12.736V27C10 28.1264 9.6197 29.2197 8.92071 30.1029C8.22172 30.9861 7.24499 31.6075 6.14877 31.8663C5.05255 32.125 3.90107 32.0061 2.88089 31.5287C1.86071 31.0514 1.03159 30.2435 0.52787 29.2361C0.024152 28.2286 -0.124656 27.0806 0.105556 25.9781C0.335768 24.8755 0.931513 23.883 1.79627 23.1613C2.66102 22.4396 3.74413 22.031 4.87009 22.0017C5.99606 21.9724 7.09893 22.3242 8.00001 23V6.73601C7.99982 6.30956 8.13596 5.8942 8.38854 5.55059C8.64112 5.20698 8.99692 4.9531 9.40401 4.82601L23.404 0.452014ZM10 10.64L24 6.26601V2.36001L10 6.73601V10.64ZM5.00001 24C4.20436 24 3.44129 24.3161 2.87869 24.8787C2.31608 25.4413 2.00001 26.2044 2.00001 27C2.00001 27.7957 2.31608 28.5587 2.87869 29.1213C3.44129 29.6839 4.20436 30 5.00001 30C5.79566 30 6.55872 29.6839 7.12133 29.1213C7.68394 28.5587 8.00001 27.7957 8.00001 27C8.00001 26.2044 7.68394 25.4413 7.12133 24.8787C6.55872 24.3161 5.79566 24 5.00001 24ZM32 25C32 27.387 31.0518 29.6761 29.364 31.364C27.6761 33.0518 25.387 34 23 34C20.6131 34 18.3239 33.0518 16.636 31.364C14.9482 29.6761 14 27.387 14 25C14 22.6131 14.9482 20.3239 16.636 18.6361C18.3239 16.9482 20.6131 16 23 16C25.387 16 27.6761 16.9482 29.364 18.6361C31.0518 20.3239 32 22.6131 32 25ZM27.47 24.128L21.482 20.828C21.3298 20.7443 21.1583 20.7016 20.9846 20.7043C20.8108 20.707 20.6408 20.7549 20.4912 20.8433C20.3416 20.9317 20.2176 21.0576 20.1315 21.2086C20.0453 21.3595 20 21.5302 20 21.704V28.304C20 28.4778 20.0453 28.6486 20.1315 28.7995C20.2176 28.9504 20.3416 29.0763 20.4912 29.1647C20.6408 29.2531 20.8108 29.301 20.9846 29.3037C21.1583 29.3064 21.3298 29.2638 21.482 29.18L27.47 25.88C27.6268 25.7937 27.7575 25.6669 27.8486 25.5128C27.9397 25.3587 27.9877 25.183 27.9877 25.004C27.9877 24.825 27.9397 24.6493 27.8486 24.4952C27.7575 24.3412 27.6268 24.2143 27.47 24.128Z"
|
d="M23.404 0.452014C23.7033 0.35857 24.0204 0.336816 24.3297 0.388509C24.639 0.440203 24.9318 0.563895 25.1845 0.749599C25.4371 0.935304 25.6426 1.17782 25.7843 1.45756C25.9259 1.73731 25.9998 2.04644 26 2.36001V14.414C25.3462 14.2296 24.6766 14.1064 24 14.046V8.36001L10 12.736V27C10 28.1264 9.6197 29.2197 8.92071 30.1029C8.22172 30.9861 7.24499 31.6075 6.14877 31.8663C5.05255 32.125 3.90107 32.0061 2.88089 31.5287C1.86071 31.0514 1.03159 30.2435 0.52787 29.2361C0.024152 28.2286 -0.124656 27.0806 0.105556 25.9781C0.335768 24.8755 0.931513 23.883 1.79627 23.1613C2.66102 22.4396 3.74413 22.031 4.87009 22.0017C5.99606 21.9724 7.09893 22.3242 8.00001 23V6.73601C7.99982 6.30956 8.13596 5.8942 8.38854 5.55059C8.64112 5.20698 8.99692 4.9531 9.40401 4.82601L23.404 0.452014ZM10 10.64L24 6.26601V2.36001L10 6.73601V10.64ZM5.00001 24C4.20436 24 3.44129 24.3161 2.87869 24.8787C2.31608 25.4413 2.00001 26.2044 2.00001 27C2.00001 27.7957 2.31608 28.5587 2.87869 29.1213C3.44129 29.6839 4.20436 30 5.00001 30C5.79566 30 6.55872 29.6839 7.12133 29.1213C7.68394 28.5587 8.00001 27.7957 8.00001 27C8.00001 26.2044 7.68394 25.4413 7.12133 24.8787C6.55872 24.3161 5.79566 24 5.00001 24ZM32 25C32 27.387 31.0518 29.6761 29.364 31.364C27.6761 33.0518 25.387 34 23 34C20.6131 34 18.3239 33.0518 16.636 31.364C14.9482 29.6761 14 27.387 14 25C14 22.6131 14.9482 20.3239 16.636 18.6361C18.3239 16.9482 20.6131 16 23 16C25.387 16 27.6761 16.9482 29.364 18.6361C31.0518 20.3239 32 22.6131 32 25ZM27.47 24.128L21.482 20.828C21.3298 20.7443 21.1583 20.7016 20.9846 20.7043C20.8108 20.707 20.6408 20.7549 20.4912 20.8433C20.3416 20.9317 20.2176 21.0576 20.1315 21.2086C20.0453 21.3595 20 21.5302 20 21.704V28.304C20 28.4778 20.0453 28.6486 20.1315 28.7995C20.2176 28.9504 20.3416 29.0763 20.4912 29.1647C20.6408 29.2531 20.8108 29.301 20.9846 29.3037C21.1583 29.3064 21.3298 29.2638 21.482 29.18L27.47 25.88C27.6268 25.7937 27.7575 25.6669 27.8486 25.5128C27.9397 25.3587 27.9877 25.183 27.9877 25.004C27.9877 24.825 27.9397 24.6493 27.8486 24.4952C27.7575 24.3412 27.6268 24.2143 27.47 24.128Z"
|
||||||
fill="white"
|
fill="white"
|
||||||
|
|
@ -120,9 +177,20 @@ const NewContent = (props: { type: string }) => {
|
||||||
|
|
||||||
<div className="flex flex-col flex-1">
|
<div className="flex flex-col flex-1">
|
||||||
<div className="text-gray-500 dark:text-gray-400 flex flex-row text-sm">
|
<div className="text-gray-500 dark:text-gray-400 flex flex-row text-sm">
|
||||||
{formatDateToIndonesian(new Date(audio?.createdAt))} {audio?.timezone ? audio?.timezone : "WIB"} | <Icon icon="formkit:eye" width="15" height="15" /> {audio?.clickCount}{" "}
|
{formatDateToIndonesian(
|
||||||
|
new Date(audio?.createdAt)
|
||||||
|
)}{" "}
|
||||||
|
{audio?.timezone ? audio?.timezone : "WIB"} |{" "}
|
||||||
|
<Icon
|
||||||
|
icon="formkit:eye"
|
||||||
|
width="15"
|
||||||
|
height="15"
|
||||||
|
/>{" "}
|
||||||
|
{audio?.clickCount}{" "}
|
||||||
|
</div>
|
||||||
|
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||||
|
{audio?.title}
|
||||||
</div>
|
</div>
|
||||||
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">{audio?.title}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -134,21 +202,41 @@ const NewContent = (props: { type: string }) => {
|
||||||
</Carousel>
|
</Carousel>
|
||||||
) : (
|
) : (
|
||||||
<p className="flex items-center justify-center">
|
<p className="flex items-center justify-center">
|
||||||
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
<img
|
||||||
|
src="/assets/empty-data.png"
|
||||||
|
alt="empty"
|
||||||
|
className="h-52 w-52 my-4"
|
||||||
|
/>
|
||||||
</p>
|
</p>
|
||||||
)
|
)
|
||||||
) : selectedTab == "image" ? (
|
) : selectedTab == "image" ? (
|
||||||
newContent?.length > 0 ? (
|
newContent?.length > 0 ? (
|
||||||
<Carousel>
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{newContent?.map((image: any) => (
|
{newContent?.map((image: any) => (
|
||||||
<CarouselItem key={image?.id} className="md:basis-1/2 lg:basis-1/3">
|
<CarouselItem
|
||||||
<Link href={`/image/detail/${image?.slug}`} className="relative group rounded-md overflow-hidden shadow-md hover:shadow-lg">
|
key={image?.id}
|
||||||
<img src={image?.thumbnailLink} className="w-full h-40 lg:h-60 object-cover rounded-lg group-hover:scale-100 transition-transform duration-300" />
|
className="md:basis-1/2 lg:basis-1/3"
|
||||||
|
>
|
||||||
|
<Link
|
||||||
|
href={`/image/detail/${image?.slug}`}
|
||||||
|
className="relative group rounded-md overflow-hidden shadow-md hover:shadow-lg"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={image?.thumbnailLink}
|
||||||
|
className="w-full h-40 lg:h-60 object-cover rounded-lg group-hover:scale-100 transition-transform duration-300"
|
||||||
|
/>
|
||||||
<div className="absolute bottom-0 rounded-lg left-0 right-0 border-l-4 border-[#bb3523] bg-gray-600 text-white p-2">
|
<div className="absolute bottom-0 rounded-lg left-0 right-0 border-l-4 border-[#bb3523] bg-gray-600 text-white p-2">
|
||||||
<h1 className="text-sm font-semibold h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">{image?.title}</h1>
|
<h1 className="text-sm font-semibold h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||||
|
{image?.title}
|
||||||
|
</h1>
|
||||||
<p className="flex flex-row items-center text-sm gap-2">
|
<p className="flex flex-row items-center text-sm gap-2">
|
||||||
{formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| <Icon icon="formkit:eye" width="15" height="15" /> {image?.clickCount}{" "}
|
{formatDateToIndonesian(
|
||||||
|
new Date(image?.createdAt)
|
||||||
|
)}{" "}
|
||||||
|
{image?.timezone ? image?.timezone : "WIB"}|{" "}
|
||||||
|
<Icon icon="formkit:eye" width="15" height="15" />{" "}
|
||||||
|
{image?.clickCount}{" "}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -160,18 +248,34 @@ const NewContent = (props: { type: string }) => {
|
||||||
</Carousel>
|
</Carousel>
|
||||||
) : (
|
) : (
|
||||||
<p className="flex items-center justify-center">
|
<p className="flex items-center justify-center">
|
||||||
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
<img
|
||||||
|
src="/assets/empty-data.png"
|
||||||
|
alt="empty"
|
||||||
|
className="h-52 w-52 my-4"
|
||||||
|
/>
|
||||||
</p>
|
</p>
|
||||||
)
|
)
|
||||||
) : newContent.length > 0 ? (
|
) : newContent.length > 0 ? (
|
||||||
<Carousel>
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{newContent?.map((text: any) => (
|
{newContent?.map((text: any) => (
|
||||||
<CarouselItem key={text?.id} className="md:basis-1/2 lg:basis-1/3">
|
<CarouselItem
|
||||||
|
key={text?.id}
|
||||||
|
className="md:basis-1/2 lg:basis-1/3"
|
||||||
|
>
|
||||||
<div className="md:basis-1/2 lg:basis-1/3">
|
<div className="md:basis-1/2 lg:basis-1/3">
|
||||||
<Link href={`/document/detail/${text?.slug}`} className="flex flex-col bg-yellow-500 sm:flex-row items-center dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4">
|
<Link
|
||||||
|
href={`/document/detail/${text?.slug}`}
|
||||||
|
className="flex flex-col bg-yellow-500 sm:flex-row items-center dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4"
|
||||||
|
>
|
||||||
<div className="flex items-center justify-center rounded-lg w-16 h-2 lg:h-16">
|
<div className="flex items-center justify-center rounded-lg w-16 h-2 lg:h-16">
|
||||||
<svg width="28" height="34" viewBox="0 0 28 34" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg
|
||||||
|
width="28"
|
||||||
|
height="34"
|
||||||
|
viewBox="0 0 28 34"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
<path
|
<path
|
||||||
d="M5.6665 17.4167C5.6665 17.0851 5.7982 16.7672 6.03262 16.5328C6.26704 16.2984 6.58498 16.1667 6.9165 16.1667C7.24802 16.1667 7.56597 16.2984 7.80039 16.5328C8.03481 16.7672 8.1665 17.0851 8.1665 17.4167C8.1665 17.7482 8.03481 18.0661 7.80039 18.3005C7.56597 18.535 7.24802 18.6667 6.9165 18.6667C6.58498 18.6667 6.26704 18.535 6.03262 18.3005C5.7982 18.0661 5.6665 17.7482 5.6665 17.4167ZM6.9165 21.1667C6.58498 21.1667 6.26704 21.2984 6.03262 21.5328C5.7982 21.7672 5.6665 22.0851 5.6665 22.4167C5.6665 22.7482 5.7982 23.0661 6.03262 23.3005C6.26704 23.535 6.58498 23.6667 6.9165 23.6667C7.24802 23.6667 7.56597 23.535 7.80039 23.3005C8.03481 23.0661 8.1665 22.7482 8.1665 22.4167C8.1665 22.0851 8.03481 21.7672 7.80039 21.5328C7.56597 21.2984 7.24802 21.1667 6.9165 21.1667ZM5.6665 27.4167C5.6665 27.0851 5.7982 26.7672 6.03262 26.5328C6.26704 26.2984 6.58498 26.1667 6.9165 26.1667C7.24802 26.1667 7.56597 26.2984 7.80039 26.5328C8.03481 26.7672 8.1665 27.0851 8.1665 27.4167C8.1665 27.7482 8.03481 28.0661 7.80039 28.3005C7.56597 28.535 7.24802 28.6667 6.9165 28.6667C6.58498 28.6667 6.26704 28.535 6.03262 28.3005C5.7982 28.0661 5.6665 27.7482 5.6665 27.4167ZM11.9165 16.1667C11.585 16.1667 11.267 16.2984 11.0326 16.5328C10.7982 16.7672 10.6665 17.0851 10.6665 17.4167C10.6665 17.7482 10.7982 18.0661 11.0326 18.3005C11.267 18.535 11.585 18.6667 11.9165 18.6667H21.0832C21.4147 18.6667 21.7326 18.535 21.9671 18.3005C22.2015 18.0661 22.3332 17.7482 22.3332 17.4167C22.3332 17.0851 22.2015 16.7672 21.9671 16.5328C21.7326 16.2984 21.4147 16.1667 21.0832 16.1667H11.9165ZM10.6665 22.4167C10.6665 22.0851 10.7982 21.7672 11.0326 21.5328C11.267 21.2984 11.585 21.1667 11.9165 21.1667H21.0832C21.4147 21.1667 21.7326 21.2984 21.9671 21.5328C22.2015 21.7672 22.3332 22.0851 22.3332 22.4167C22.3332 22.7482 22.2015 23.0661 21.9671 23.3005C21.7326 23.535 21.4147 23.6667 21.0832 23.6667H11.9165C11.585 23.6667 11.267 23.535 11.0326 23.3005C10.7982 23.0661 10.6665 22.7482 10.6665 22.4167ZM11.9165 26.1667C11.585 26.1667 11.267 26.2984 11.0326 26.5328C10.7982 26.7672 10.6665 27.0851 10.6665 27.4167C10.6665 27.7482 10.7982 28.0661 11.0326 28.3005C11.267 28.535 11.585 28.6667 11.9165 28.6667H21.0832C21.4147 28.6667 21.7326 28.535 21.9671 28.3005C22.2015 28.0661 22.3332 27.7482 22.3332 27.4167C22.3332 27.0851 22.2015 26.7672 21.9671 26.5328C21.7326 26.2984 21.4147 26.1667 21.0832 26.1667H11.9165ZM26.3565 11.0233L16.6415 1.31C16.6157 1.28605 16.5885 1.26378 16.5598 1.24333C16.5392 1.22742 16.5192 1.21074 16.4998 1.19333C16.3852 1.08512 16.2632 0.984882 16.1348 0.893332C16.0922 0.865802 16.0476 0.841298 16.0015 0.819999L15.9215 0.779999L15.8382 0.731666C15.7482 0.679999 15.6565 0.626665 15.5615 0.586665C15.2296 0.454104 14.8783 0.376423 14.5215 0.356665C14.4885 0.354519 14.4557 0.350625 14.4232 0.344999C14.3779 0.338012 14.3323 0.334114 14.2865 0.333332H3.99984C3.11578 0.333332 2.26794 0.684521 1.64281 1.30964C1.01769 1.93476 0.666504 2.78261 0.666504 3.66667V30.3333C0.666504 31.2174 1.01769 32.0652 1.64281 32.6904C2.26794 33.3155 3.11578 33.6667 3.99984 33.6667H23.9998C24.8839 33.6667 25.7317 33.3155 26.3569 32.6904C26.982 32.0652 27.3332 31.2174 27.3332 30.3333V13.38C27.333 12.496 26.9817 11.6483 26.3565 11.0233ZM24.8332 30.3333C24.8332 30.5543 24.7454 30.7663 24.5891 30.9226C24.4328 31.0789 24.2208 31.1667 23.9998 31.1667H3.99984C3.77882 31.1667 3.56686 31.0789 3.41058 30.9226C3.2543 30.7663 3.1665 30.5543 3.1665 30.3333V3.66667C3.1665 3.44565 3.2543 3.23369 3.41058 3.07741C3.56686 2.92113 3.77882 2.83333 3.99984 2.83333H13.9998V10.3333C13.9998 11.2174 14.351 12.0652 14.9761 12.6904C15.6013 13.3155 16.4491 13.6667 17.3332 13.6667H24.8332V30.3333ZM16.4998 4.70166L22.9632 11.1667H17.3332C17.1122 11.1667 16.9002 11.0789 16.7439 10.9226C16.5876 10.7663 16.4998 10.5543 16.4998 10.3333V4.70166Z"
|
d="M5.6665 17.4167C5.6665 17.0851 5.7982 16.7672 6.03262 16.5328C6.26704 16.2984 6.58498 16.1667 6.9165 16.1667C7.24802 16.1667 7.56597 16.2984 7.80039 16.5328C8.03481 16.7672 8.1665 17.0851 8.1665 17.4167C8.1665 17.7482 8.03481 18.0661 7.80039 18.3005C7.56597 18.535 7.24802 18.6667 6.9165 18.6667C6.58498 18.6667 6.26704 18.535 6.03262 18.3005C5.7982 18.0661 5.6665 17.7482 5.6665 17.4167ZM6.9165 21.1667C6.58498 21.1667 6.26704 21.2984 6.03262 21.5328C5.7982 21.7672 5.6665 22.0851 5.6665 22.4167C5.6665 22.7482 5.7982 23.0661 6.03262 23.3005C6.26704 23.535 6.58498 23.6667 6.9165 23.6667C7.24802 23.6667 7.56597 23.535 7.80039 23.3005C8.03481 23.0661 8.1665 22.7482 8.1665 22.4167C8.1665 22.0851 8.03481 21.7672 7.80039 21.5328C7.56597 21.2984 7.24802 21.1667 6.9165 21.1667ZM5.6665 27.4167C5.6665 27.0851 5.7982 26.7672 6.03262 26.5328C6.26704 26.2984 6.58498 26.1667 6.9165 26.1667C7.24802 26.1667 7.56597 26.2984 7.80039 26.5328C8.03481 26.7672 8.1665 27.0851 8.1665 27.4167C8.1665 27.7482 8.03481 28.0661 7.80039 28.3005C7.56597 28.535 7.24802 28.6667 6.9165 28.6667C6.58498 28.6667 6.26704 28.535 6.03262 28.3005C5.7982 28.0661 5.6665 27.7482 5.6665 27.4167ZM11.9165 16.1667C11.585 16.1667 11.267 16.2984 11.0326 16.5328C10.7982 16.7672 10.6665 17.0851 10.6665 17.4167C10.6665 17.7482 10.7982 18.0661 11.0326 18.3005C11.267 18.535 11.585 18.6667 11.9165 18.6667H21.0832C21.4147 18.6667 21.7326 18.535 21.9671 18.3005C22.2015 18.0661 22.3332 17.7482 22.3332 17.4167C22.3332 17.0851 22.2015 16.7672 21.9671 16.5328C21.7326 16.2984 21.4147 16.1667 21.0832 16.1667H11.9165ZM10.6665 22.4167C10.6665 22.0851 10.7982 21.7672 11.0326 21.5328C11.267 21.2984 11.585 21.1667 11.9165 21.1667H21.0832C21.4147 21.1667 21.7326 21.2984 21.9671 21.5328C22.2015 21.7672 22.3332 22.0851 22.3332 22.4167C22.3332 22.7482 22.2015 23.0661 21.9671 23.3005C21.7326 23.535 21.4147 23.6667 21.0832 23.6667H11.9165C11.585 23.6667 11.267 23.535 11.0326 23.3005C10.7982 23.0661 10.6665 22.7482 10.6665 22.4167ZM11.9165 26.1667C11.585 26.1667 11.267 26.2984 11.0326 26.5328C10.7982 26.7672 10.6665 27.0851 10.6665 27.4167C10.6665 27.7482 10.7982 28.0661 11.0326 28.3005C11.267 28.535 11.585 28.6667 11.9165 28.6667H21.0832C21.4147 28.6667 21.7326 28.535 21.9671 28.3005C22.2015 28.0661 22.3332 27.7482 22.3332 27.4167C22.3332 27.0851 22.2015 26.7672 21.9671 26.5328C21.7326 26.2984 21.4147 26.1667 21.0832 26.1667H11.9165ZM26.3565 11.0233L16.6415 1.31C16.6157 1.28605 16.5885 1.26378 16.5598 1.24333C16.5392 1.22742 16.5192 1.21074 16.4998 1.19333C16.3852 1.08512 16.2632 0.984882 16.1348 0.893332C16.0922 0.865802 16.0476 0.841298 16.0015 0.819999L15.9215 0.779999L15.8382 0.731666C15.7482 0.679999 15.6565 0.626665 15.5615 0.586665C15.2296 0.454104 14.8783 0.376423 14.5215 0.356665C14.4885 0.354519 14.4557 0.350625 14.4232 0.344999C14.3779 0.338012 14.3323 0.334114 14.2865 0.333332H3.99984C3.11578 0.333332 2.26794 0.684521 1.64281 1.30964C1.01769 1.93476 0.666504 2.78261 0.666504 3.66667V30.3333C0.666504 31.2174 1.01769 32.0652 1.64281 32.6904C2.26794 33.3155 3.11578 33.6667 3.99984 33.6667H23.9998C24.8839 33.6667 25.7317 33.3155 26.3569 32.6904C26.982 32.0652 27.3332 31.2174 27.3332 30.3333V13.38C27.333 12.496 26.9817 11.6483 26.3565 11.0233ZM24.8332 30.3333C24.8332 30.5543 24.7454 30.7663 24.5891 30.9226C24.4328 31.0789 24.2208 31.1667 23.9998 31.1667H3.99984C3.77882 31.1667 3.56686 31.0789 3.41058 30.9226C3.2543 30.7663 3.1665 30.5543 3.1665 30.3333V3.66667C3.1665 3.44565 3.2543 3.23369 3.41058 3.07741C3.56686 2.92113 3.77882 2.83333 3.99984 2.83333H13.9998V10.3333C13.9998 11.2174 14.351 12.0652 14.9761 12.6904C15.6013 13.3155 16.4491 13.6667 17.3332 13.6667H24.8332V30.3333ZM16.4998 4.70166L22.9632 11.1667H17.3332C17.1122 11.1667 16.9002 11.0789 16.7439 10.9226C16.5876 10.7663 16.4998 10.5543 16.4998 10.3333V4.70166Z"
|
||||||
fill="black"
|
fill="black"
|
||||||
|
|
@ -181,14 +285,27 @@ const NewContent = (props: { type: string }) => {
|
||||||
|
|
||||||
<div className="flex w-full pr-10 flex-col flex-1">
|
<div className="flex w-full pr-10 flex-col flex-1">
|
||||||
<div className="text-gray-500 dark:text-gray-400 flex flex-row items-center text-xs gap-0 lg:gap-1 mt-1 lg:text-sm">
|
<div className="text-gray-500 dark:text-gray-400 flex flex-row items-center text-xs gap-0 lg:gap-1 mt-1 lg:text-sm">
|
||||||
{formatDateToIndonesian(new Date(text?.createdAt))}
|
{formatDateToIndonesian(
|
||||||
{text?.timezone ? text?.timezone : "WIB"}|<Icon icon="formkit:eye" width="15" height="15" />
|
new Date(text?.createdAt)
|
||||||
|
)}
|
||||||
|
{text?.timezone ? text?.timezone : "WIB"}|
|
||||||
|
<Icon icon="formkit:eye" width="15" height="15" />
|
||||||
{text?.clickCount}
|
{text?.clickCount}
|
||||||
</div>
|
</div>
|
||||||
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible ">{text?.title}</div>
|
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible ">
|
||||||
|
{text?.title}
|
||||||
|
</div>
|
||||||
<div className="flex gap-2 items-center text-sm text-red-500 dark:text-red-500">
|
<div className="flex gap-2 items-center text-sm text-red-500 dark:text-red-500">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512">
|
<svg
|
||||||
<path fill="#f00" d="M224 30v256h-64l96 128l96-128h-64V30zM32 434v48h448v-48z" />
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="1em"
|
||||||
|
height="1em"
|
||||||
|
viewBox="0 0 512 512"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill="#f00"
|
||||||
|
d="M224 30v256h-64l96 128l96-128h-64V30zM32 434v48h448v-48z"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
Download Dokumen
|
Download Dokumen
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -203,13 +320,20 @@ const NewContent = (props: { type: string }) => {
|
||||||
</Carousel>
|
</Carousel>
|
||||||
) : (
|
) : (
|
||||||
<p className="flex items-center justify-center">
|
<p className="flex items-center justify-center">
|
||||||
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
<img
|
||||||
|
src="/assets/empty-data.png"
|
||||||
|
alt="empty"
|
||||||
|
className="h-52 w-52 my-4"
|
||||||
|
/>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center flex-row justify-center">
|
<div className="flex items-center flex-row justify-center">
|
||||||
<Link href={`/${selectedTab}/filter?sortBy=${props.type}`} className="border text-[#bb3523] rounded-lg text-sm lg:text-md px-4 py-1 border-[#bb3523]">
|
<Link
|
||||||
|
href={`/${selectedTab}/filter?sortBy=${props.type}`}
|
||||||
|
className="border text-[#bb3523] rounded-lg text-sm lg:text-md px-4 py-1 border-[#bb3523]"
|
||||||
|
>
|
||||||
LIHAT SEMUA
|
LIHAT SEMUA
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,82 +1,91 @@
|
||||||
import React from "react";
|
import React, { useState } from "react";
|
||||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../ui/dropdown-menu";
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from "../ui/dropdown-menu";
|
||||||
import { FiFile, FiImage, FiMusic, FiYoutube } from "react-icons/fi";
|
import { FiFile, FiImage, FiMusic, FiYoutube } from "react-icons/fi";
|
||||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectGroup,
|
||||||
|
SelectItem,
|
||||||
|
SelectLabel,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from "@/components/ui/select";
|
||||||
|
import { useRouter } from "@/i18n/routing";
|
||||||
|
|
||||||
const SearchSection = () => {
|
const SearchSection = () => {
|
||||||
|
const [contentType, setContentType] = useState("all");
|
||||||
|
const [search, setSearch] = useState("");
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="w-full py-8 px-4 ">
|
<section className="w-full py-8 px-4 ">
|
||||||
<div className="max-w-screen-xl mx-auto text-center">
|
<div className="max-w-screen-xl mx-auto text-center">
|
||||||
{/* Heading */}
|
{/* Heading */}
|
||||||
<h1 className="text-2xl md:text-3xl font-bold text-gray-800 dark:text-white">
|
<h1 className="text-2xl md:text-3xl font-bold text-gray-800 dark:text-white">
|
||||||
<span className="text-[#bb3523] dark:text-white">Eksplorasi</span> dan <span className="text-[#bb3523] dark:text-white">Download</span> Liputan Resmi Kami
|
<span className="text-[#bb3523] dark:text-white">Eksplorasi</span> dan{" "}
|
||||||
|
<span className="text-[#bb3523] dark:text-white">Download</span>{" "}
|
||||||
|
Liputan Resmi Kami
|
||||||
</h1>
|
</h1>
|
||||||
<div className="w-[80%] h-1 bg-[#bb3523] mx-auto mt-2"></div>
|
<div className="w-[80%] h-1 bg-[#bb3523] mx-auto mt-2"></div>
|
||||||
<p className="text-sm md:text-base text-gray-500 dark:text-gray-100 mt-4">Liputan resmi yang bersumber dari kegiatan Polri di Mabes dan Polda seluruh Indonesia</p>
|
<p className="text-sm md:text-base text-gray-500 dark:text-gray-100 mt-4">
|
||||||
|
Liputan resmi yang bersumber dari kegiatan Polri di Mabes dan Polda
|
||||||
|
seluruh Indonesia
|
||||||
|
</p>
|
||||||
|
|
||||||
{/* Search Form */}
|
{/* Search Form */}
|
||||||
<div className="mt-6 flex flex-col md:flex-row justify-center gap-4">
|
<div className="mt-6 flex flex-col md:flex-row justify-center gap-4">
|
||||||
{/* Dropdown */}
|
{/* Dropdown */}
|
||||||
<div className="flex flex-row items-center w-full rounded-lg gap-2 overflow-hidden">
|
<div className="flex flex-row items-center w-full rounded-lg gap-2 overflow-hidden">
|
||||||
<DropdownMenu>
|
<Select value={contentType} onValueChange={setContentType}>
|
||||||
<DropdownMenuTrigger asChild>
|
<SelectTrigger className="w-[180px]">
|
||||||
<a className="text-black dark:text-white flex flex-row justify-center items-center ml-5 cursor-pointer">
|
<SelectValue />
|
||||||
<svg className="mx-2" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
</SelectTrigger>
|
||||||
<path
|
<SelectContent>
|
||||||
d="M20 7.5H5C4.6023 7.5004 4.221 7.65856 3.93978 7.93978C3.65856 8.221 3.5004 8.6023 3.5 9V19.5C3.5004 19.8977 3.65856 20.279 3.93978 20.5602C4.221 20.8414 4.6023 20.9996 5 21H20C20.3977 20.9996 20.779 20.8414 21.0602 20.5602C21.3414 20.279 21.4996 19.8977 21.5 19.5V9C21.4996 8.6023 21.3414 8.221 21.0602 7.93978C20.779 7.65856 20.3977 7.5004 20 7.5ZM10.25 17.25V11.25L15.5 14.25L10.25 17.25ZM5 4.5H20V6H5V4.5ZM6.5 1.5H18.5V3H6.5V1.5Z"
|
<SelectGroup>
|
||||||
fill="currentColor"
|
<SelectItem value="all">Semua Konten</SelectItem>
|
||||||
/>
|
<SelectItem value="image">Foto</SelectItem>
|
||||||
</svg>
|
<SelectItem value="video">Audio Visual</SelectItem>
|
||||||
Konten
|
<SelectItem value="document">Teks</SelectItem>
|
||||||
<svg className="flex items-center justify-center" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
<SelectItem value="audio">Audio</SelectItem>
|
||||||
<path fill="currentColor" fill-rule="evenodd" d="m6 7l6 6l6-6l2 2l-8 8l-8-8z" />
|
</SelectGroup>
|
||||||
</svg>
|
</SelectContent>
|
||||||
</a>
|
</Select>
|
||||||
</DropdownMenuTrigger>
|
|
||||||
<DropdownMenuContent align="end" className="p-0 rounded-md overflow-hidden">
|
|
||||||
<DropdownMenuItem className="flex items-center gap-1.5 p-2 border-b text-default-600 group focus:bg-default focus:text-primary-foreground rounded-none group">
|
|
||||||
<span className="text-default-700c flex flex-row justify-center items-center group-hover:text-primary-foreground">
|
|
||||||
<FiYoutube className="mr-2" />
|
|
||||||
Audio Visual
|
|
||||||
</span>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem className="flex items-center gap-1.5 p-2 border-b text-default-600 group focus:bg-default focus:text-primary-foreground rounded-none group">
|
|
||||||
<span className="text-default-700 flex flex-row justify-center items-center group-hover:text-primary-foreground">
|
|
||||||
<FiMusic className="mr-2" />
|
|
||||||
Audio
|
|
||||||
</span>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem className="flex items-center gap-1.5 p-2 border-b text-default-600 group focus:bg-default focus:text-primary-foreground rounded-none group">
|
|
||||||
<span className="text-default-700 flex flex-row justify-center items-center group-hover:text-primary-foreground">
|
|
||||||
<FiImage className="mr-2" />
|
|
||||||
Foto
|
|
||||||
</span>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem className="flex items-center gap-1.5 p-2 border-b text-default-600 group focus:bg-default focus:text-primary-foreground rounded-none group">
|
|
||||||
<span className="text-default-700 flex flex-row justify-center items-center group-hover:text-primary-foreground">
|
|
||||||
<FiFile className="mr-2" />
|
|
||||||
Teks
|
|
||||||
</span>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
<div className="flex items-center flex-1 border border-gray-300 rounded-lg overflow-hidden">
|
<div className="flex items-center flex-1 border border-gray-300 rounded-lg overflow-hidden">
|
||||||
<span className="material-icons text-black dark:text-white px-4">
|
<span className="material-icons text-black dark:text-white px-4">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="1em"
|
||||||
|
height="1em"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
d="m19.6 21l-6.3-6.3q-.75.6-1.725.95T9.5 16q-2.725 0-4.612-1.888T3 9.5t1.888-4.612T9.5 3t4.613 1.888T16 9.5q0 1.1-.35 2.075T14.7 13.3l6.3 6.3zM9.5 14q1.875 0 3.188-1.312T14 9.5t-1.312-3.187T9.5 5T6.313 6.313T5 9.5t1.313 3.188T9.5 14"
|
d="m19.6 21l-6.3-6.3q-.75.6-1.725.95T9.5 16q-2.725 0-4.612-1.888T3 9.5t1.888-4.612T9.5 3t4.613 1.888T16 9.5q0 1.1-.35 2.075T14.7 13.3l6.3 6.3zM9.5 14q1.875 0 3.188-1.312T14 9.5t-1.312-3.187T9.5 5T6.313 6.313T5 9.5t1.313 3.188T9.5 14"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
<input type="text" placeholder="Pencarian" className="w-full py-2 px-2 text-sm text-gray-700 dark:text-gray-100 focus:outline-none" />
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Pencarian"
|
||||||
|
className="w-full py-2 px-2 text-sm text-gray-700 dark:text-gray-100 focus:outline-none"
|
||||||
|
onChange={(e) => setSearch(e.target.value)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Search Input */}
|
{/* Search Input */}
|
||||||
|
<button
|
||||||
{/* Button */}
|
onClick={() =>
|
||||||
<button className="flex justify-center items-center px-6 w-full lg:w-[20%] py-2 bg-[#bb3523] gap-2 text-white rounded-lg hover:bg-red-700">
|
router.push(`/${contentType}/filter?title=${search}`)
|
||||||
|
}
|
||||||
|
className="flex justify-center items-center px-6 w-full lg:w-[20%] py-2 bg-[#bb3523] gap-2 text-white rounded-lg hover:bg-red-700"
|
||||||
|
>
|
||||||
Cari Liputan <Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
Cari Liputan <Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,147 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Link, usePathname } from "@/i18n/routing";
|
||||||
|
import { getInfoProfile, getListPorvinces, getUsersTeams } from "@/service/landing/landing";
|
||||||
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
|
||||||
|
const SidebarManagement = () => {
|
||||||
|
const [profile, setProfile] = useState<any>();
|
||||||
|
const [province, setProvince] = useState([]);
|
||||||
|
const [, setUser] = useState();
|
||||||
|
const [selectedTab, setSelectedTab] = useState("video");
|
||||||
|
const params = useParams();
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
// const currentRoute = router.pathname;
|
||||||
|
// const profilePicture = Cookies.get("profile_picture");
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
const response = await getInfoProfile();
|
||||||
|
setProfile(response?.data?.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getProvinces() {
|
||||||
|
const response = await getListPorvinces();
|
||||||
|
|
||||||
|
// console.log(response?.data.data);
|
||||||
|
setProvince(response?.data?.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// async function getDisticts() {
|
||||||
|
// const response = await getListDistricts();
|
||||||
|
// console.log(response?.data.data);
|
||||||
|
// setDistrict(response?.data.data);
|
||||||
|
// }
|
||||||
|
initState();
|
||||||
|
getProvinces(); // getDisticts();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function initState() {
|
||||||
|
if (profile != undefined) {
|
||||||
|
const response = await getUsersTeams(profile?.instituteId);
|
||||||
|
|
||||||
|
// console.log(response?.data?.data);
|
||||||
|
setUser(response?.data?.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initState();
|
||||||
|
}, [profile]);
|
||||||
|
|
||||||
|
function addDefaultProfile(ev: any) {
|
||||||
|
ev.target.src = "/assets/avatar-profile.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
const [hasMounted, setHasMounted] = useState(false);
|
||||||
|
// Hooks
|
||||||
|
useEffect(() => {
|
||||||
|
setHasMounted(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Render
|
||||||
|
if (!hasMounted) return null;
|
||||||
|
return (
|
||||||
|
<div className="p-12 w-1/3">
|
||||||
|
<div className="border rounded-2xl border-black m-4">
|
||||||
|
<h1 className="text-xl p-5">Tentang Saya</h1>
|
||||||
|
<div>
|
||||||
|
<ul className="px-10 mb-4">
|
||||||
|
<li className="mb-5 font-light">
|
||||||
|
<p className="font-semibold">Email :</p>
|
||||||
|
<p>{profile?.email}</p>
|
||||||
|
</li>
|
||||||
|
<li className="mb-5 font-light">
|
||||||
|
<p className="font-semibold">No Handphone :</p>
|
||||||
|
<p>{profile?.phoneNumber}</p>
|
||||||
|
</li>
|
||||||
|
<li className="mb-5 font-light">
|
||||||
|
<p className="font-semibold">Alamat :</p>
|
||||||
|
<p>{profile?.address}</p>
|
||||||
|
</li>
|
||||||
|
<li className="mb-5 font-light">
|
||||||
|
<p className="font-semibold">Kategori :</p>
|
||||||
|
<p>{profile?.institute?.categoryRole?.name}</p>
|
||||||
|
</li>
|
||||||
|
<li className="mb-5 font-light">
|
||||||
|
<p className="font-semibold">Instansi/Perusahaan :</p>
|
||||||
|
<p>{profile?.institute?.name}</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="p-4">
|
||||||
|
<Link href="/content-management/galery" className="mb-3">
|
||||||
|
<div className={`${pathname?.includes("/content-management/galery") ? "bg-slate-500 text-white" : ""} hover:bg-slate-600 cursor-pointer p-4 rounded-lg flex justify-between`}>
|
||||||
|
<div className="flex items-center gap-2 text-lg">
|
||||||
|
<Icon icon="material-symbols-light:perm-media-rounded" />
|
||||||
|
<p className="text-sm">Galeri {profile?.institute?.name}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
<Link href="/content-management/download" className="mb-3">
|
||||||
|
<div className={`${pathname?.includes("/content-management/download") ? "bg-slate-500 text-white" : ""} hover:bg-slate-600 cursor-pointer p-4 rounded-lg flex justify-between`}>
|
||||||
|
<div className="flex items-center gap-2 text-lg">
|
||||||
|
<Icon icon="heroicons:photo-solid" />
|
||||||
|
<p className="text-sm">Galeri Saya</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
<Link href="/content-management/rewrite" className="mb-3">
|
||||||
|
<div className={`${pathname?.includes("/content-management/rewrite") ? "bg-slate-500 text-white" : ""} hover:bg-slate-600 cursor-pointer p-4 rounded-lg flex justify-between`}>
|
||||||
|
<div className="flex items-center gap-2 text-lg">
|
||||||
|
<Icon icon="material-symbols-light:perm-media-rounded" />
|
||||||
|
<p className="text-sm">Galeri Rewrite</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
<Link href="/content-management/users" className="mb-3">
|
||||||
|
<div className={`${pathname?.includes("/content-management/users") ? "bg-slate-500 text-white" : ""} hover:bg-slate-600 cursor-pointer p-4 rounded-lg flex justify-between`}>
|
||||||
|
<div className="flex items-center gap-2 text-lg">
|
||||||
|
<Icon icon="mdi:users-group" />
|
||||||
|
<p className="text-sm">Tim Pengguna</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SidebarManagement;
|
||||||
|
|
@ -109,3 +109,5 @@ export async function detailMediaNulis(id: any) {
|
||||||
const url = `media/nulis-ai?id=${id}`;
|
const url = `media/nulis-ai?id=${id}`;
|
||||||
return httpGetInterceptor({ url });
|
return httpGetInterceptor({ url });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
import {
|
import { httpGetInterceptor, httpPostInterceptor } from "../http-config/http-interceptor-service";
|
||||||
httpGetInterceptor,
|
|
||||||
httpPostInterceptor,
|
|
||||||
} from "../http-config/http-interceptor-service";
|
|
||||||
|
|
||||||
// export async function listDataAll(
|
// export async function listDataAll(
|
||||||
// isForSelf,
|
// isForSelf,
|
||||||
|
|
@ -44,103 +41,40 @@ export async function listDataAll(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listDataImage(
|
export async function listDataImage(limit: any, page: any, isForSelf: any, isApproval: any, categoryFilter: any, statusFilter: any, needApprovalFromLevel: any, creator: any, source: any, startDate: any, endDate: any, title: string = "") {
|
||||||
limit: any,
|
|
||||||
page: any,
|
|
||||||
isForSelf: any,
|
|
||||||
isApproval: any,
|
|
||||||
categoryFilter: any,
|
|
||||||
statusFilter: any,
|
|
||||||
needApprovalFromLevel: any,
|
|
||||||
creator: any,
|
|
||||||
source: any,
|
|
||||||
startDate: any,
|
|
||||||
endDate: any,
|
|
||||||
title: string = ""
|
|
||||||
) {
|
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(
|
||||||
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=1&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}`
|
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=1&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listDataVideo(
|
export async function listDataVideo(limit: any, page: any, isForSelf: any, isApproval: any, categoryFilter: any, statusFilter: any, needApprovalFromLevel: any, creator: any, source: any, startDate: any, endDate: any, title: string = "") {
|
||||||
limit: any,
|
|
||||||
page: any,
|
|
||||||
isForSelf: any,
|
|
||||||
isApproval: any,
|
|
||||||
categoryFilter: any,
|
|
||||||
statusFilter: any,
|
|
||||||
needApprovalFromLevel: any,
|
|
||||||
creator: any,
|
|
||||||
source: any,
|
|
||||||
startDate: any,
|
|
||||||
endDate: any,
|
|
||||||
title: string = ""
|
|
||||||
) {
|
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(
|
||||||
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=2&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}`
|
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=2&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listDataTeks(
|
export async function listDataTeks(limit: any, page: any, isForSelf: any, isApproval: any, categoryFilter: any, statusFilter: any, needApprovalFromLevel: any, creator: any, source: any, startDate: any, endDate: any, title: string = "") {
|
||||||
limit: any,
|
|
||||||
page: any,
|
|
||||||
isForSelf: any,
|
|
||||||
isApproval: any,
|
|
||||||
categoryFilter: any,
|
|
||||||
statusFilter: any,
|
|
||||||
needApprovalFromLevel: any,
|
|
||||||
creator: any,
|
|
||||||
source: any,
|
|
||||||
startDate: any,
|
|
||||||
endDate: any,
|
|
||||||
title: string = ""
|
|
||||||
) {
|
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(
|
||||||
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=3&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}`
|
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=3&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listDataAudio(
|
export async function listDataAudio(page: any, limit: any, isForSelf: any, isApproval: any, categoryFilter: any, statusFilter: any, needApprovalFromLevel: any, creator: any, source: any, startDate: any, endDate: any, title: string = "") {
|
||||||
page: any,
|
|
||||||
limit: any,
|
|
||||||
isForSelf: any,
|
|
||||||
isApproval: any,
|
|
||||||
categoryFilter: any,
|
|
||||||
statusFilter: any,
|
|
||||||
needApprovalFromLevel: any,
|
|
||||||
creator: any,
|
|
||||||
source: any,
|
|
||||||
startDate: any,
|
|
||||||
endDate: any,
|
|
||||||
title: string = ""
|
|
||||||
) {
|
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(
|
||||||
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=4&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}`
|
`media/list?enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=4&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}&title=${title}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listSPIT(
|
export async function listSPIT(page: any, limit: any, title = "", isPublish: any) {
|
||||||
page: any,
|
return await httpGetInterceptor(`media/spit/pagination?enablePage=1&page=${page}&size=${limit}&sort=desc&sortBy=contentTitleId&title=${title}&isPublish=${isPublish}`);
|
||||||
limit: any,
|
|
||||||
title = "",
|
|
||||||
isPublish: any
|
|
||||||
) {
|
|
||||||
return await httpGetInterceptor(
|
|
||||||
`media/spit/pagination?enablePage=1&page=${page}&size=${limit}&sort=desc&sortBy=contentTitleId&title=${title}&isPublish=${isPublish}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listNulisAI(limit: any, page: any, title: string = "") {
|
export async function listNulisAI(limit: any, page: any, title: string = "") {
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(`media/nulis-ai/pagination?enablePage=1&page=${page}&size=${limit}&title=${title}`);
|
||||||
`media/nulis-ai/pagination?enablePage=1&page=${page}&size=${limit}&title=${title}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getTagsBySubCategoryId(subCategory: any) {
|
export async function getTagsBySubCategoryId(subCategory: any) {
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(`media/tags/list?subCategoryId=${subCategory}`);
|
||||||
`media/tags/list?subCategoryId=${subCategory}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listEnableCategory(type: any) {
|
export async function listEnableCategory(type: any) {
|
||||||
|
|
@ -190,3 +124,12 @@ export async function rejectFiles(data: any) {
|
||||||
const url = "media/file/rejects";
|
const url = "media/file/rejects";
|
||||||
return httpPostInterceptor(url, data);
|
return httpPostInterceptor(url, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function saveContentRewrite(data: any) {
|
||||||
|
const url = "media/rewrite";
|
||||||
|
return httpPostInterceptor(url, data);
|
||||||
|
}
|
||||||
|
export async function saveUserReports(data: any) {
|
||||||
|
const url = 'public/users/reports';
|
||||||
|
return httpPostInterceptor( url, data );
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,26 @@
|
||||||
import { httpGetInterceptor } from "../http-config/http-interceptor-service";
|
import {
|
||||||
|
httpDeleteInterceptor,
|
||||||
|
httpGetInterceptor,
|
||||||
|
httpPostInterceptor,
|
||||||
|
} from "../http-config/http-interceptor-service";
|
||||||
|
|
||||||
export async function getHeroData() {
|
export async function getHeroData() {
|
||||||
return await httpGetInterceptor(`media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`);
|
return await httpGetInterceptor(
|
||||||
|
`media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getCategoryData() {
|
export async function getCategoryData() {
|
||||||
return await httpGetInterceptor(`media/categories/list/publish?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=`);
|
return await httpGetInterceptor(
|
||||||
|
`media/categories/list/publish?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getListContent(props: any) {
|
export async function getListContent(props: any) {
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(
|
||||||
`media/public/list?enablePage=1&sort=desc&sortBy=${props.sortBy}&size=${props.size}&page=${props.page}&typeId=${props.contentTypeId}&title=${
|
`media/public/list?enablePage=1&sort=desc&sortBy=${props.sortBy}&size=${
|
||||||
|
props.size
|
||||||
|
}&page=${props.page}&typeId=${props.contentTypeId}&title=${
|
||||||
props.title ? props.title : ""
|
props.title ? props.title : ""
|
||||||
}&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`
|
}&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`
|
||||||
);
|
);
|
||||||
|
|
@ -21,7 +31,9 @@ export async function getPrivacy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getIndeksData() {
|
export async function getIndeksData() {
|
||||||
return await httpGetInterceptor(`blog/public/pagination?enablePage=1&page=0&size=20`);
|
return await httpGetInterceptor(
|
||||||
|
`blog/public/pagination?enablePage=1&page=0&size=20`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getDetail(slug: string) {
|
export async function getDetail(slug: string) {
|
||||||
|
|
@ -29,7 +41,9 @@ export async function getDetail(slug: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getDetailIndeks() {
|
export async function getDetailIndeks() {
|
||||||
return await httpGetInterceptor(`blog/public/pagination?enablePage=1&page=0&size=6`);
|
return await httpGetInterceptor(
|
||||||
|
`blog/public/pagination?enablePage=1&page=0&size=6`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getFeedback() {
|
export async function getFeedback() {
|
||||||
|
|
@ -41,20 +55,49 @@ export async function postUserFeedback() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listCategory(type = "") {
|
export async function listCategory(type = "") {
|
||||||
return await httpGetInterceptor(`media/categories/list/enable?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=${type}`);
|
return await httpGetInterceptor(
|
||||||
|
`media/categories/list/enable?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=${type}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function publicDetailBlog(slug: any) {
|
export async function publicDetailBlog(slug: any) {
|
||||||
return await httpGetInterceptor(`blog/public/read/${slug}`);
|
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 = ""
|
||||||
|
) {
|
||||||
return await httpGetInterceptor(
|
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}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listDataRegional(type: string, search: string, category: string, format = "", tag = "", startDate = "", endDate = "", month = "", year = "", size = 10, page = 0, sortBy = "createdAt") {
|
export async function listDataRegional(
|
||||||
|
type: string,
|
||||||
|
search: string,
|
||||||
|
category: string,
|
||||||
|
format = "",
|
||||||
|
tag = "",
|
||||||
|
startDate = "",
|
||||||
|
endDate = "",
|
||||||
|
month = "",
|
||||||
|
year = "",
|
||||||
|
size = 10,
|
||||||
|
page = 0,
|
||||||
|
sortBy = "createdAt"
|
||||||
|
) {
|
||||||
return await httpGetInterceptor(
|
return await httpGetInterceptor(
|
||||||
`media/public/regional-list?enablePage=1&size=${size}&page=${page}&sort=desc&sortBy=${sortBy}&typeId=${type}&title=${search}&categoryId=${category}&fileFormats=${format}&tags=${tag}&startDate=${startDate}&endDate=${endDate}&month=${month}&year=${year}`
|
`media/public/regional-list?enablePage=1&size=${size}&page=${page}&sort=desc&sortBy=${sortBy}&typeId=${type}&title=${search}&categoryId=${category}&fileFormats=${format}&tags=${tag}&startDate=${startDate}&endDate=${endDate}&month=${month}&year=${year}`
|
||||||
);
|
);
|
||||||
|
|
@ -69,9 +112,63 @@ export async function getInfoProfile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getListPorvinces() {
|
export async function getListPorvinces() {
|
||||||
return await httpGetInterceptor(`public/users/provinces`)
|
return await httpGetInterceptor(`public/users/provinces`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getUsersTeams(id: any) {
|
export async function getUsersTeams(id: any) {
|
||||||
return await httpGetInterceptor(`users?instituteId=${id}`)
|
return await httpGetInterceptor(`users?instituteId=${id}`);
|
||||||
|
}
|
||||||
|
export async function mediaWishlist(
|
||||||
|
type: any,
|
||||||
|
instituteId: any,
|
||||||
|
search: any,
|
||||||
|
category: any,
|
||||||
|
size: string,
|
||||||
|
page: number,
|
||||||
|
sortBy: undefined,
|
||||||
|
format: string
|
||||||
|
) {
|
||||||
|
return await httpGetInterceptor(
|
||||||
|
`/media/wishlist/list?enablePage=1&size=${size}&page=${page}&typeId=${type}&instituteId=${instituteId}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function checkWishlistStatus(mediaId: any) {
|
||||||
|
return await httpGetInterceptor(`/media/wishlist/status?mediaId=${mediaId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteWishlist(id: any) {
|
||||||
|
return await httpDeleteInterceptor(`media/wishlist?id=${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getContentRewritePagination(page = 0, size = 10) {
|
||||||
|
return await httpGetInterceptor(
|
||||||
|
`media/rewrite/pagination?size=${size}&page=${page}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getContentRewrite(id: any) {
|
||||||
|
return await httpGetInterceptor(`media/rewrite?id=${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function listDataAll(
|
||||||
|
type: any,
|
||||||
|
search: any,
|
||||||
|
category: any,
|
||||||
|
format = "",
|
||||||
|
tag = "",
|
||||||
|
group = "",
|
||||||
|
startDate = "",
|
||||||
|
endDate = "",
|
||||||
|
month = "",
|
||||||
|
year = ""
|
||||||
|
) {
|
||||||
|
return await httpGetInterceptor(
|
||||||
|
`media/public/list?enablePage=1&size=20&sort=desc&typeId=${type}&title=${search}&categoryId=${category}&fileFormats=${format}&tags=${tag}&group=${group}&startDate=${startDate}&endDate=${endDate}&month=${month}&year=${year}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function saveWishlist(data: { mediaUploadId: string }) {
|
||||||
|
const url = "/media/wishlist";
|
||||||
|
return httpPostInterceptor(url, data);
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue