feat: add api

This commit is contained in:
sabdayagra 2024-12-31 17:32:09 +07:00
parent ef57c42210
commit 5183ce8374
2 changed files with 75 additions and 50 deletions

View File

@ -85,16 +85,18 @@ const ContentManagement = (props: { type: string }) => {
<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" />
<p className="text-white">{profile?.fullname}</p>
<p className="text-white">{profile?.username}</p>
<p className="text-white">
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 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&nbsp;
{`${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="#" className="flex items-center text-white gap-2">
<Link href="/profile" className="flex items-center text-white gap-2">
<Icon icon="tdesign:setting-1-filled" />
Pengaturan
</Link>
@ -110,29 +112,29 @@ const ContentManagement = (props: { type: string }) => {
<div>
<ul className="px-10 mb-4">
<li className="mb-5 font-light">
<p>Email</p>
<p>msabdayagra@gmail.com</p>
{/* <p>{profile?.email}</p> */}
<p className="font-semibold">Email :</p>
{/* <p>msabdayagra@gmail.com</p> */}
<p>{profile?.email}</p>
</li>
<li className="mb-5 font-light">
<p>No Handphone</p>
<p>0812-7561-7204</p>
{/* <p>{profile?.phoneNumber}</p> */}
<p className="font-semibold">No Handphone :</p>
{/* <p>0812-7561-7204</p> */}
<p>{profile?.phoneNumber}</p>
</li>
<li className="mb-5 font-light">
<p>Alamat</p>
<p>Jl. Besar Tembung no.12</p>
{/* <p>{profile?.address}</p> */}
<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>Kategori</p>
<p>POLRI</p>
{/* <p>{profile?.institute?.categoryRole?.name}</p> */}
<p className="font-semibold">Kategori :</p>
{/* <p>POLRI</p> */}
<p>{profile?.institute?.categoryRole?.name}</p>
</li>
<li className="mb-5 font-light">
<p>Instansi/Perusahaan</p>
<p>Div Humas Polri</p>
{/* <p>{profile?.institute?.name}</p> */}
<p className="font-semibold">Instansi/Perusahaan :</p>
{/* <p>Div Humas Polri</p> */}
<p>{profile?.institute?.name}</p>
</li>
</ul>
</div>
@ -143,7 +145,7 @@ const ContentManagement = (props: { type: string }) => {
<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 Div Humas</p>
<p className="text-sm">Galeri {profile?.institute?.name}</p>
</div>
<div>
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
@ -189,7 +191,7 @@ const ContentManagement = (props: { type: string }) => {
{/* Kontent Kanan */}
<div className="w-2/3 p-12">
<div>
<h1 className="text-2xl font-semibold">Galeri Div Humas</h1>
<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">
@ -228,9 +230,9 @@ const ContentManagement = (props: { type: string }) => {
</div>
<div className="px-0 lg:px-10">
{selectedTab == "video" ? (
dummyContent?.length > 0 ? (
profile?.length > 0 ? (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
{dummyContent?.map((video: any) => (
{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}`}>
@ -257,9 +259,9 @@ const ContentManagement = (props: { type: string }) => {
</p>
)
) : selectedTab == "audio" ? (
dummyContent?.length > 0 ? (
profile?.length > 0 ? (
<div className=" grid grid-cols-1 gap-6 ">
{dummyContent?.map((audio: any) => (
{profile?.map((audio: any) => (
<Link
href={`/audio/detail/${audio?.slug}`}
key={audio?.id}
@ -304,16 +306,16 @@ const ContentManagement = (props: { type: string }) => {
</p>
)
) : selectedTab == "image" ? (
dummyContent?.length > 0 ? (
profile?.length > 0 ? (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
{dummyContent?.map((video: any) => (
<Card key={video?.id} className="hover:scale-110 transition-transform duration-300">
{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={`/video/detail/${video?.slug}`}>
<img src={video?.thumbnail} className="h-60 object-cover items-center justify-center cursor-pointer rounded-lg place-self-center" />
<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(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| <Icon icon="formkit:eye" width="15" height="15" />
{video?.clickCount}{" "}
{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"
@ -321,7 +323,7 @@ const ContentManagement = (props: { type: string }) => {
/>
</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>
<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>
@ -332,9 +334,9 @@ const ContentManagement = (props: { type: string }) => {
<img src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
</p>
)
) : dummyContent.length > 0 ? (
) : profile.length > 0 ? (
<div className=" grid grid-cols-1 md:grid-cols-2 gap-6">
{dummyContent?.map((document: any) => (
{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">

View File

@ -56,7 +56,7 @@ const Navbar = () => {
setLanguage(lang);
setIsOpen(false);
};
useEffect(() => {
async function initState() {
const response = await getInfoProfile();
@ -68,7 +68,6 @@ const Navbar = () => {
initState();
}, []);
return (
<div className="bg-[#f7f7f7] dark:bg-black shadow-md sticky top-0 z-50">
@ -237,7 +236,7 @@ const Navbar = () => {
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem>
<Link href="#" className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg">
<Link href="/profile" className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg">
<Icon icon="iconamoon:profile-circle-fill" />
Profile
</Link>
@ -515,7 +514,37 @@ const Navbar = () => {
</div>
<div className="flex justify-center items-center mx-3 gap-5">
{fullName ? (
<p>{fullName}</p>
<>
<DropdownMenu>
<DropdownMenuTrigger className="flex items-center gap-1">
<img className="h-12 w-12" src="/assets/avatar-profile.png" alt="avatar-profile" />
<a className="gap-2">
<p className="text-xs font-semibold">{fullName}</p>
<p className="text-xs">{`(${roleName})`}</p>
</a>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem>
<Link href="/profile" className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg">
<Icon icon="iconamoon:profile-circle-fill" />
Profile
</Link>
</DropdownMenuItem>
<DropdownMenuItem>
<Link href="/content-management" className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg">
<Icon icon="stash:save-ribbon-light" />
Kelola Konten
</Link>
</DropdownMenuItem>
<DropdownMenuItem>
<Link href="#" className="flex items-center gap-1 hover:bg-slate-600 w-full rounded-lg">
<Icon icon="iconamoon:exit-bold" />
Keluar
</Link>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</>
) : (
<>
<Link href="/auth" className="px-4 py-1 bg-[#bb3523] text-white font-semibold rounded-md hover:bg-[#bb3523]">
@ -526,12 +555,6 @@ const Navbar = () => {
</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">
Masuk
</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">
Daftar
</Link>
</div>
</div>
)}