+
-
+
>
);
diff --git a/src/app_modules/vote/detail/semua_riwayat/layout.tsx b/src/app_modules/vote/detail/semua_riwayat/layout.tsx
index 0ca2e154..ae50be53 100644
--- a/src/app_modules/vote/detail/semua_riwayat/layout.tsx
+++ b/src/app_modules/vote/detail/semua_riwayat/layout.tsx
@@ -1,9 +1,8 @@
"use client";
-import { AppShell } from "@mantine/core";
+import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
+import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
import React from "react";
-import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
-import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
export default function LayoutVote_DetailSemuaRiwayat({
children,
@@ -12,11 +11,11 @@ export default function LayoutVote_DetailSemuaRiwayat({
}) {
return (
<>
- }
+ }
>
{children}
-
+
>
);
}
diff --git a/src/app_modules/vote/fun/get/get_all_list_riwayat.ts b/src/app_modules/vote/fun/get/get_all_list_riwayat.ts
index b92fa6f5..ca69b3c7 100644
--- a/src/app_modules/vote/fun/get/get_all_list_riwayat.ts
+++ b/src/app_modules/vote/fun/get/get_all_list_riwayat.ts
@@ -2,45 +2,51 @@
import prisma from "@/app/lib/prisma"
-export async function Vote_getAllListRiwayat() {
- const data = await prisma.voting.findMany({
- orderBy: {
- createdAt: "asc",
- },
- where: {
- voting_StatusId: "1",
- isActive: true,
- akhirVote: {
- lte: new Date(),
- },
- },
- select: {
- id: true,
- title: true,
- isActive: true,
- createdAt: true,
- updatedAt: true,
- deskripsi: true,
- awalVote: true,
- akhirVote: true,
- catatan: true,
- authorId: true,
- voting_StatusId: true,
- Voting_DaftarNamaVote: {
- orderBy: {
- createdAt: "asc",
- },
- },
- Author: {
- select: {
- id: true,
- username: true,
- nomor: true,
- Profile: true,
- },
- },
- },
- });
+export async function vote_getAllListRiwayat({ page }: { page: number }) {
+ const takeData = 5;
+ const skipData = page * takeData - takeData;
- return data
+ const data = await prisma.voting.findMany({
+ take: takeData,
+ skip: skipData,
+
+ orderBy: {
+ createdAt: "asc",
+ },
+ where: {
+ voting_StatusId: "1",
+ isActive: true,
+ akhirVote: {
+ lte: new Date(),
+ },
+ },
+ select: {
+ id: true,
+ title: true,
+ isActive: true,
+ createdAt: true,
+ updatedAt: true,
+ deskripsi: true,
+ awalVote: true,
+ akhirVote: true,
+ catatan: true,
+ authorId: true,
+ voting_StatusId: true,
+ Voting_DaftarNamaVote: {
+ orderBy: {
+ createdAt: "asc",
+ },
+ },
+ Author: {
+ select: {
+ id: true,
+ username: true,
+ nomor: true,
+ Profile: true,
+ },
+ },
+ },
+ });
+
+ return data;
}
\ No newline at end of file
diff --git a/src/app_modules/vote/fun/get/get_all_list_riwayat_saya.ts b/src/app_modules/vote/fun/get/get_all_list_riwayat_saya.ts
index 792e81db..7a06720c 100644
--- a/src/app_modules/vote/fun/get/get_all_list_riwayat_saya.ts
+++ b/src/app_modules/vote/fun/get/get_all_list_riwayat_saya.ts
@@ -3,9 +3,16 @@
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
import prisma from "@/app/lib/prisma";
-export async function Vote_getAllListRiwayatSaya() {
+export async function Vote_getAllListRiwayatSaya({ page }: { page: number }) {
const authorId = await user_getOneUserId();
+ const takeData = 5;
+ const skipData = page * takeData - takeData;
+
+
const data = await prisma.voting.findMany({
+ take: takeData,
+ skip: skipData,
+
orderBy: {
createdAt: "asc",
},
diff --git a/src/app_modules/vote/fun/get/get_list_kontribusi_by_author_id.ts b/src/app_modules/vote/fun/get/get_list_kontribusi_by_author_id.ts
index 05110f60..ce4dc19a 100644
--- a/src/app_modules/vote/fun/get/get_list_kontribusi_by_author_id.ts
+++ b/src/app_modules/vote/fun/get/get_list_kontribusi_by_author_id.ts
@@ -3,9 +3,18 @@
import prisma from "@/app/lib/prisma";
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
-export async function Vote_getAllListKontribusiByAuthorId() {
+export async function vote_getAllListKontribusiByAuthorId({
+ page,
+}: {
+ page: number;
+}) {
+ const takeData = 5;
+ const skipData = page * takeData - takeData;
+
const authorId = await user_getOneUserId();
const data = await prisma.voting_Kontributor.findMany({
+ take: takeData,
+ skip: skipData,
orderBy: {
createdAt: "asc",
},
diff --git a/src/app_modules/vote/main/beranda.tsx b/src/app_modules/vote/main/beranda.tsx
index 96425afe..db7bf23d 100644
--- a/src/app_modules/vote/main/beranda.tsx
+++ b/src/app_modules/vote/main/beranda.tsx
@@ -53,7 +53,7 @@ export default function Vote_Beranda({
) : (
// --- Main component --- //
(
diff --git a/src/app_modules/vote/main/kontribusi.tsx b/src/app_modules/vote/main/kontribusi.tsx
index 44d9850f..dadbae4d 100644
--- a/src/app_modules/vote/main/kontribusi.tsx
+++ b/src/app_modules/vote/main/kontribusi.tsx
@@ -1,51 +1,62 @@
"use client";
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
-import {
- Avatar,
- Badge,
- Box,
- Card,
- Center,
- Divider,
- Grid,
- Group,
- Radio,
- Stack,
- Text,
- Title,
-} from "@mantine/core";
-import moment from "moment";
-import { useRouter } from "next/navigation";
-import ComponentVote_CardViewPublish from "../component/card_view_publish";
-import { MODEL_VOTE_KONTRIBUTOR } from "../model/interface";
+import { Box, Center, Loader, Stack } from "@mantine/core";
import _ from "lodash";
+import ComponentVote_CardViewPublish from "../component/card_view_publish";
import ComponentVote_IsEmptyData from "../component/is_empty_data";
+import { MODEL_VOTE_KONTRIBUTOR } from "../model/interface";
+import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
+import { data } from "autoprefixer";
+import { ScrollOnly } from "next-scroll-loader";
+import { vote_getAllListPublish } from "../fun/get/get_all_list_publish";
+import { useState } from "react";
+import { vote_getAllListKontribusiByAuthorId } from "../fun/get/get_list_kontribusi_by_author_id";
export default function Vote_Kontribusi({
dataKontribusi,
}: {
dataKontribusi: MODEL_VOTE_KONTRIBUTOR[];
}) {
- const router = useRouter();
+ const [data, setData] = useState(dataKontribusi);
+ const [activePage, setActivePage] = useState(1);
+
return (
<>
{_.isEmpty(dataKontribusi) ? (
-
+
) : (
-
- {dataKontribusi.map((e, i) => (
-
+
+ (
+
+
+
+ )}
+ data={data}
+ setData={setData}
+ moreData={async () => {
+ const loadData = await vote_getAllListKontribusiByAuthorId({
+ page: activePage + 1,
+ });
+
+ setActivePage((val) => val + 1);
+
+ return loadData;
+ }}
+ >
+ {(item) => (
-
- ))}
-
+ )}
+
+
)}
{/* {JSON.stringify(dataKontribusi, null, 2)} */}
>
diff --git a/src/app_modules/vote/main/riwayat/index.tsx b/src/app_modules/vote/main/riwayat/index.tsx
index 0efbb358..e8c4e1ac 100644
--- a/src/app_modules/vote/main/riwayat/index.tsx
+++ b/src/app_modules/vote/main/riwayat/index.tsx
@@ -7,13 +7,14 @@ import Vote_RiwayatSaya from "./saya";
import { useAtom } from "jotai";
import { gs_vote_riwayat } from "../../global_state";
import { MODEL_VOTING } from "../../model/interface";
+import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
export default function Vote_Riwayat({
listRiwayat,
listRiwayatSaya,
}: {
listRiwayat: MODEL_VOTING[];
- listRiwayatSaya: MODEL_VOTING[]
+ listRiwayatSaya: MODEL_VOTING[];
}) {
const [tabsRiwayat, setTabsRiwayat] = useAtom(gs_vote_riwayat);
const listTabs = [
@@ -34,12 +35,23 @@ export default function Vote_Riwayat({
return (
<>
@@ -47,8 +59,17 @@ export default function Vote_Riwayat({
{e.label}
diff --git a/src/app_modules/vote/main/riwayat/saya.tsx b/src/app_modules/vote/main/riwayat/saya.tsx
index 6f9e46d1..c1f46d43 100644
--- a/src/app_modules/vote/main/riwayat/saya.tsx
+++ b/src/app_modules/vote/main/riwayat/saya.tsx
@@ -1,49 +1,59 @@
"use client";
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
-import {
- Stack,
- Card,
- Grid,
- Avatar,
- Divider,
- Title,
- Badge,
- Group,
- Radio,
- Center,
- Text,
- Box,
-} from "@mantine/core";
-import moment from "moment";
+import { Box, Center, Loader, Stack } from "@mantine/core";
+import _ from "lodash";
import { useRouter } from "next/navigation";
import ComponentVote_CardViewPublish from "../../component/card_view_publish";
-import { MODEL_VOTING } from "../../model/interface";
-import _ from "lodash";
import ComponentVote_IsEmptyData from "../../component/is_empty_data";
+import { MODEL_VOTING } from "../../model/interface";
+import { useState } from "react";
+import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
+import { ScrollOnly } from "next-scroll-loader";
+import { Vote_getAllListRiwayatSaya } from "../../fun/get/get_all_list_riwayat_saya";
export default function Vote_RiwayatSaya({
listRiwayatSaya,
}: {
listRiwayatSaya: MODEL_VOTING[];
}) {
- const router = useRouter();
+ const [data, setData] = useState(listRiwayatSaya);
+ const [activePage, setActivePage] = useState(1);
+
return (
<>
- {_.isEmpty(listRiwayatSaya) ? (
-
+ {_.isEmpty(data) ? (
+
) : (
-
- {listRiwayatSaya.map((e, i) => (
-
-
-
- ))}
-
+ // --- Main component --- //
+
+ (
+
+
+
+ )}
+ data={data}
+ setData={setData}
+ moreData={async () => {
+ const loadData = await Vote_getAllListRiwayatSaya({
+ page: activePage + 1,
+ });
+ setActivePage((val) => val + 1);
+
+ return loadData;
+ }}
+ >
+ {(item) => (
+
+ )}
+
+
)}
>
);
diff --git a/src/app_modules/vote/main/riwayat/semua.tsx b/src/app_modules/vote/main/riwayat/semua.tsx
index 537980e2..6e3a027d 100644
--- a/src/app_modules/vote/main/riwayat/semua.tsx
+++ b/src/app_modules/vote/main/riwayat/semua.tsx
@@ -1,49 +1,57 @@
"use client";
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
-import {
- Stack,
- Card,
- Grid,
- Avatar,
- Divider,
- Title,
- Badge,
- Group,
- Radio,
- Center,
- Text,
- Box,
-} from "@mantine/core";
-import moment from "moment";
-import { useRouter } from "next/navigation";
-import ComponentVote_CardViewPublish from "../../component/card_view_publish";
-import { MODEL_VOTING } from "../../model/interface";
+import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
+import { Box, Center, Loader } from "@mantine/core";
import _ from "lodash";
-import ComponentVote_IsEmptyData from "../../component/is_empty_data";
+import { ScrollOnly } from "next-scroll-loader";
+import { useState } from "react";
+import ComponentVote_CardViewPublish from "../../component/card_view_publish";
+import { vote_getAllListRiwayat } from "../../fun/get/get_all_list_riwayat";
+import { MODEL_VOTING } from "../../model/interface";
export default function Vote_SemuaRiwayat({
listRiwayat,
}: {
listRiwayat: MODEL_VOTING[];
}) {
- const router = useRouter();
+ const [data, setData] = useState(listRiwayat);
+ const [activePage, setActivePage] = useState(1);
+
return (
<>
- {_.isEmpty(listRiwayat) ? (
-
+ {_.isEmpty(data) ? (
+
) : (
-
- {listRiwayat.map((e, i) => (
-
+ // --- Main component --- //
+
+ (
+
+
+
+ )}
+ data={data}
+ setData={setData}
+ moreData={async () => {
+ const loadData = await vote_getAllListRiwayat({
+ page: activePage + 1,
+ });
+ setActivePage((val) => val + 1);
+
+ return loadData;
+ }}
+ >
+ {(item) => (
-
- ))}
-
+ )}
+
+
)}
>
);
diff --git a/src/app_modules/vote/main/status/publish.tsx b/src/app_modules/vote/main/status/publish.tsx
index ea2f9f42..9c82b6f3 100644
--- a/src/app_modules/vote/main/status/publish.tsx
+++ b/src/app_modules/vote/main/status/publish.tsx
@@ -1,18 +1,14 @@
"use client";
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
-import { Box, Center, Loader, Stack } from "@mantine/core";
-import _ from "lodash";
-import { useRouter } from "next/navigation";
-import ComponentVote_CardViewPublish from "../../component/card_view_publish";
-import ComponentVote_IsEmptyData from "../../component/is_empty_data";
-import { MODEL_VOTING } from "../../model/interface";
-import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
-import ComponentJob_CardStatus from "@/app_modules/job/component/card/card_view";
import job_getAllStatusPublish from "@/app_modules/job/fun/get/status/get_list_publish";
+import { Center, Loader } from "@mantine/core";
+import _ from "lodash";
import { ScrollOnly } from "next-scroll-loader";
import { useState } from "react";
+import ComponentVote_CardViewPublish from "../../component/card_view_publish";
+import { MODEL_VOTING } from "../../model/interface";
export default function Vote_StatusPublish({
listPublish,