From befbd1a47d8d2faa96a0b8ccb3d82f4c3f382109 Mon Sep 17 00:00:00 2001 From: Bagasbanuna02 Date: Tue, 29 Jul 2025 10:50:24 +0800 Subject: [PATCH] Voting: Add: - ComponentDetailDataSection : Tampilan judul, deskripsi, batas waktu - BoxDetailHistorySection - (user)/voting/[id]/history Fix: Perbaikan component detail data pada: - screens/Voting/BoxDetailSection.tsx - screens/Voting/BoxDetailPublishSection.tsx - screens/Voting/BoxDetailContribution.tsx # No Issue --- .../(user)/voting/(tabs)/history.tsx | 6 +- .../(user)/voting/[id]/history.tsx | 64 +++++++++++++++++++ screens/Voting/BoxDetailContribution.tsx | 35 ++-------- screens/Voting/BoxDetailHistorySection.tsx | 23 +++++++ screens/Voting/BoxDetailPublishSection.tsx | 40 +++--------- screens/Voting/BoxDetailSection.tsx | 35 ++-------- screens/Voting/ComponentDetailDataSection.tsx | 32 ++++++++++ 7 files changed, 146 insertions(+), 89 deletions(-) create mode 100644 app/(application)/(user)/voting/[id]/history.tsx create mode 100644 screens/Voting/BoxDetailHistorySection.tsx create mode 100644 screens/Voting/ComponentDetailDataSection.tsx diff --git a/app/(application)/(user)/voting/(tabs)/history.tsx b/app/(application)/(user)/voting/(tabs)/history.tsx index 23a7387..a55c2e6 100644 --- a/app/(application)/(user)/voting/(tabs)/history.tsx +++ b/app/(application)/(user)/voting/(tabs)/history.tsx @@ -26,7 +26,11 @@ export default function VotingHistory() { } > {Array.from({ length: 10 }).map((_, index) => ( - + ))} ); diff --git a/app/(application)/(user)/voting/[id]/history.tsx b/app/(application)/(user)/voting/[id]/history.tsx new file mode 100644 index 0000000..678bc7c --- /dev/null +++ b/app/(application)/(user)/voting/[id]/history.tsx @@ -0,0 +1,64 @@ +import { + AvatarUsernameAndOtherComponent, + BackButton, + DotButton, + DrawerCustom, + MenuDrawerDynamicGrid, + Spacing, + ViewWrapper, +} from "@/components"; +import { IconContribution } from "@/components/_Icon"; +import { IMenuDrawerItem } from "@/components/_Interface/types"; +import Voting_BoxDetailHasilVotingSection from "@/screens/Voting/BoxDetailHasilVotingSection"; +import { Voting_BoxDetailHistorySection } from "@/screens/Voting/BoxDetailHistorySection"; +import { router, Stack, useLocalSearchParams } from "expo-router"; +import { useState } from "react"; + +export default function VotingDetailHistory() { + const { id } = useLocalSearchParams(); + const [openDrawerPublish, setOpenDrawerPublish] = useState(false); + + const handlePressPublish = (item: IMenuDrawerItem) => { + router.navigate(item.path as any); + setOpenDrawerPublish(false); + }; + + return ( + <> + , + headerRight: () => ( + setOpenDrawerPublish(true)} /> + ), + }} + /> + + } + /> + + + + + {/* ========= Publish Drawer ========= */} + setOpenDrawerPublish(false)} + height={"auto"} + > + , + label: "Daftar Kontributor", + path: `/voting/${id}/list-of-contributor`, + }, + ]} + onPressItem={handlePressPublish as any} + /> + + + ); +} diff --git a/screens/Voting/BoxDetailContribution.tsx b/screens/Voting/BoxDetailContribution.tsx index d92165d..a6d4bfa 100644 --- a/screens/Voting/BoxDetailContribution.tsx +++ b/screens/Voting/BoxDetailContribution.tsx @@ -1,13 +1,12 @@ import { - BadgeCustom, - BoxWithHeaderSection, - Spacing, - StackCustom, - TextCustom, + BadgeCustom, + BoxWithHeaderSection, + Spacing, + StackCustom, + TextCustom, } from "@/components"; import { GStyles } from "@/styles/global-styles"; -import dayjs from "dayjs"; -import { View } from "react-native"; +import { Voting_ComponentDetailDataSection } from "./ComponentDetailDataSection"; export function Voting_BoxDetailContributionSection({ headerAvatar, @@ -19,27 +18,7 @@ export function Voting_BoxDetailContributionSection({ {headerAvatar ? headerAvatar : } - - Title of Voting Here - - - Lorem ipsum dolor sit amet consectetur adipisicing elit. - Perspiciatis corporis blanditiis est provident corrupti facilis iste - cum voluptate. Natus eum aut quos consequatur doloribus fugiat sit - ullam minima non enim? - - - - Batas Voting - - - {dayjs().format("DD/MM/YYYY")} -{" "} - {dayjs().add(1, "day").format("DD/MM/YYYY")} - - + diff --git a/screens/Voting/BoxDetailHistorySection.tsx b/screens/Voting/BoxDetailHistorySection.tsx new file mode 100644 index 0000000..87fab2a --- /dev/null +++ b/screens/Voting/BoxDetailHistorySection.tsx @@ -0,0 +1,23 @@ +import { + BoxWithHeaderSection, + Spacing, + StackCustom +} from "@/components"; +import { Voting_ComponentDetailDataSection } from "./ComponentDetailDataSection"; + +export function Voting_BoxDetailHistorySection({ + headerAvatar, +}: { + headerAvatar?: React.ReactNode; +}) { + return ( + <> + + {headerAvatar ? headerAvatar : } + + + + + + ); +} diff --git a/screens/Voting/BoxDetailPublishSection.tsx b/screens/Voting/BoxDetailPublishSection.tsx index 132105f..c4addf5 100644 --- a/screens/Voting/BoxDetailPublishSection.tsx +++ b/screens/Voting/BoxDetailPublishSection.tsx @@ -1,16 +1,14 @@ import { - BadgeCustom, - BoxWithHeaderSection, - ButtonCustom, - Spacing, - StackCustom, - TextCustom, + BoxWithHeaderSection, + ButtonCustom, + Spacing, + StackCustom, + TextCustom } from "@/components"; import { RadioCustom, RadioGroup } from "@/components/Radio/RadioCustom"; -import { GStyles } from "@/styles/global-styles"; -import dayjs from "dayjs"; import { useState } from "react"; import { View } from "react-native"; +import { Voting_ComponentDetailDataSection } from "./ComponentDetailDataSection"; export function Voting_BoxDetailPublishSection({ headerAvatar, @@ -23,27 +21,7 @@ export function Voting_BoxDetailPublishSection({ {headerAvatar ? headerAvatar : } - - Title of Voting Here - - - Lorem ipsum dolor sit amet consectetur adipisicing elit. - Perspiciatis corporis blanditiis est provident corrupti facilis iste - cum voluptate. Natus eum aut quos consequatur doloribus fugiat sit - ullam minima non enim? - - - - Batas Voting - - - {dayjs().format("DD/MM/YYYY")} -{" "} - {dayjs().add(1, "day").format("DD/MM/YYYY")} - - + @@ -61,9 +39,7 @@ export function Voting_BoxDetailPublishSection({ - console.log("vote")}> - Vote - + console.log("vote")}>Vote diff --git a/screens/Voting/BoxDetailSection.tsx b/screens/Voting/BoxDetailSection.tsx index e385db0..1e24e38 100644 --- a/screens/Voting/BoxDetailSection.tsx +++ b/screens/Voting/BoxDetailSection.tsx @@ -1,13 +1,11 @@ import { - BadgeCustom, - BoxWithHeaderSection, - Spacing, - StackCustom, - TextCustom, + BoxWithHeaderSection, + Spacing, + StackCustom, + TextCustom } from "@/components"; -import { GStyles } from "@/styles/global-styles"; -import dayjs from "dayjs"; import { View } from "react-native"; +import { Voting_ComponentDetailDataSection } from "./ComponentDetailDataSection"; export function Voting_BoxDetailSection({ headerAvatar, @@ -19,27 +17,8 @@ export function Voting_BoxDetailSection({ {headerAvatar ? headerAvatar : } - - Title of Voting Here - - - Lorem ipsum dolor sit amet consectetur adipisicing elit. - Perspiciatis corporis blanditiis est provident corrupti facilis iste - cum voluptate. Natus eum aut quos consequatur doloribus fugiat sit - ullam minima non enim? - - - - Batas Voting - - - {dayjs().format("DD/MM/YYYY")} -{" "} - {dayjs().add(1, "day").format("DD/MM/YYYY")} - - + + diff --git a/screens/Voting/ComponentDetailDataSection.tsx b/screens/Voting/ComponentDetailDataSection.tsx new file mode 100644 index 0000000..9b88394 --- /dev/null +++ b/screens/Voting/ComponentDetailDataSection.tsx @@ -0,0 +1,32 @@ +import { BadgeCustom, TextCustom } from "@/components"; +import { GStyles } from "@/styles/global-styles"; +import dayjs from "dayjs"; +import { View } from "react-native"; + +export function Voting_ComponentDetailDataSection() { + return ( + <> + + Title of Voting Here + + + Lorem ipsum dolor sit amet consectetur adipisicing elit. Perspiciatis + corporis blanditiis est provident corrupti facilis iste cum voluptate. + Natus eum aut quos consequatur doloribus fugiat sit ullam minima non + enim? + + + + Batas Voting + + + {dayjs().format("DD/MM/YYYY")} -{" "} + {dayjs().add(1, "day").format("DD/MM/YYYY")} + + + + ); +}