fix ( event )

deskripsi:
- fix list peserta
This commit is contained in:
2025-01-21 11:00:17 +08:00
parent b0243977ab
commit 6bc2d3f628
4 changed files with 139 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
"use client";
import { Stack } from "@mantine/core";
import { Stack, Loader, Center } from "@mantine/core";
import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
import { MODEL_EVENT_PESERTA } from "../../model/interface";
import { useParams } from "next/navigation";
@@ -9,6 +9,10 @@ import { useShallowEffect } from "@mantine/hooks";
import { apiGetEventPesertaById } from "../../_lib/api_event";
import { useState } from "react";
import { clientLogger } from "@/util/clientLogger";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
import { ScrollOnly } from "next-scroll-loader";
import ComponentEvent_AvatarAndUsername from "../../component/detail/comp_avatar_and_username_event";
import { ComponentGlobal_AvatarAndUsername } from "@/app_modules/_global/component";
// function Event_DaftarPeserta({ totalPeserta, eventId, isNewPeserta }: {
// totalPeserta?: number;
@@ -33,7 +37,6 @@ function Event_DaftarPeserta() {
});
if (respone) {
console.log(respone.data);
setData(respone.data);
}
} catch (error) {
@@ -41,10 +44,58 @@ function Event_DaftarPeserta() {
}
}
if (!data) {
return (
<>
<Stack>
<CustomSkeleton height={70} width={"100%"} />
<CustomSkeleton height={70} width={"100%"} />
</Stack>
</>
);
}
return (
<>
<Stack>
<ComponentEvent_ListPesertaNew />
<ScrollOnly
height="90vh"
renderLoading={() => (
<Center mt={"lg"}>
<Loader color={"yellow"} />
</Center>
)}
data={data}
setData={setData as any}
moreData={async () => {
try {
const respone = await apiGetEventPesertaById({
id: params.id,
page: `${activePage + 1}`,
});
if (respone) {
setActivePage((val) => val + 1);
return respone.data;
}
} catch (error) {
clientLogger.error("Error get data peserta:", error);
}
}}
>
{(item) => (
<ComponentEvent_AvatarAndUsername
profile={item?.User?.Profile as any}
sizeAvatar={30}
fontSize={"sm"}
tanggalMulai={item?.Event?.tanggal}
tanggalSelesai={item?.Event?.tanggalSelesai}
isPresent={item?.isPresent}
/>
)}
</ScrollOnly>
{/* <ComponentEvent_ListPeserta eventId={params.id} total={totalPeserta as any} isNewPeserta={isNewPeserta} /> */}
</Stack>
</>