Layouts & Navigation - app/(application)/_layout.tsx - app/(application)/(user)/_layout.tsx - app/(application)/(user)/event/(tabs)/_layout.tsx - app/(application)/(user)/job/(tabs)/_layout.tsx - app/(application)/(user)/voting/(tabs)/_layout.tsx - app/(application)/(user)/portofolio/_layout.tsx - app/(application)/(user)/profile/_layout.tsx - app/(application)/admin/_layout.tsx - app/+not-found.tsx User – File - app/(application)/(file)/[id].tsx User – Collaboration - app/(application)/(user)/collaboration/[id]/index.tsx - app/(application)/(user)/collaboration/[id]/detail-project-main.tsx - app/(application)/(user)/collaboration/[id]/detail-participant.tsx - app/(application)/(user)/collaboration/[id]/[detail]/info.tsx - app/(application)/(user)/collaboration/[id]/[detail]/room-chat.tsx User – Donation - app/(application)/(user)/donation/[id]/index.tsx - app/(application)/(user)/donation/[id]/[status]/detail.tsx - app/(application)/(user)/donation/[id]/(news)/[news]/index.tsx User – Event - app/(application)/(user)/event/[id]/[status]/detail-event.tsx - app/(application)/(user)/event/[id]/confirmation.tsx - app/(application)/(user)/event/[id]/contribution.tsx - app/(application)/(user)/event/[id]/history.tsx - app/(application)/(user)/event/[id]/publish.tsx User – Investment - app/(application)/(user)/investment/[id]/index.tsx - app/(application)/(user)/investment/[id]/[status]/detail.tsx - app/(application)/(user)/investment/[id]/(my-holding)/[id].tsx - app/(application)/(user)/investment/[id]/(news)/[news]/index.tsx User – Job - app/(application)/(user)/job/[id]/[status]/detail.tsx User – Portofolio - app/(application)/(user)/portofolio/[id]/index.tsx User – Profile - app/(application)/(user)/profile/[id]/index.tsx User – Voting - app/(application)/(user)/voting/[id]/index.tsx - app/(application)/(user)/voting/[id]/[status]/detail.tsx - app/(application)/(user)/voting/[id]/contribution.tsx - app/(application)/(user)/voting/[id]/history.tsx Components - components/Button/BackButtonFromNotification.tsx - components/_ShareComponent/AppHeader.tsx Admin Screens - screens/Admin/Notification-Admin/ScreenNotificationAdmin.tsx - screens/Admin/Notification-Admin/ScreenNotificationAdmin2.tsx Screens – Donation - screens/Donation/ScreenListOfNews.tsx - screens/Donation/ScreenRecapOfNews.tsx Screens – Forum - screens/Forum/ViewBeranda.tsx - screens/Forum/ViewBeranda2.tsx - screens/Forum/ViewBeranda3.tsx Screens – Investment - screens/Invesment/Document/ScreenRecapOfDocument.tsx - screens/Invesment/News/ScreenListOfNews.tsx - screens/Invesment/News/ScreenRecapOfNews.tsx Screens – Notification - screens/Notification/ScreenNotification_V1.tsx - screens/Notification/ScreenNotification_V2.tsx iOS - ios/HIPMIBadungConnect.xcodeproj/project.pbxproj Docs - QWEN.md ### Issue: Tabs can't clicked
155 lines
4.1 KiB
TypeScript
155 lines
4.1 KiB
TypeScript
/* eslint-disable react-hooks/exhaustive-deps */
|
|
import {
|
|
BackButton,
|
|
BoxButtonOnFooter,
|
|
ButtonCustom,
|
|
DotButton,
|
|
DrawerCustom,
|
|
MenuDrawerDynamicGrid,
|
|
NewWrapper,
|
|
StackCustom,
|
|
ViewWrapper,
|
|
} from "@/components";
|
|
import AppHeader from "@/components/_ShareComponent/AppHeader";
|
|
import { IconNews } from "@/components/_Icon";
|
|
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
|
import { useAuth } from "@/hooks/use-auth";
|
|
import Donation_ComponentBoxDetailData from "@/screens/Donation/ComponentBoxDetailData";
|
|
import Donation_ComponentInfoFundrising from "@/screens/Donation/ComponentInfoFundrising";
|
|
import Donation_ComponentStoryFunrising from "@/screens/Donation/ComponentStoryFunrising";
|
|
import Donation_ProgressSection from "@/screens/Donation/ProgressSection";
|
|
import { apiDonationGetOne } from "@/service/api-client/api-donation";
|
|
import { countDownAndCondition } from "@/utils/countDownAndCondition";
|
|
import {
|
|
router,
|
|
Stack,
|
|
useFocusEffect,
|
|
useLocalSearchParams,
|
|
} from "expo-router";
|
|
import { useCallback, useEffect, useState } from "react";
|
|
|
|
export default function DonasiDetailBeranda() {
|
|
const { user } = useAuth();
|
|
const { id } = useLocalSearchParams();
|
|
const [openDrawer, setOpenDrawer] = useState(false);
|
|
const [data, setData] = useState<any>();
|
|
|
|
useFocusEffect(
|
|
useCallback(() => {
|
|
onLoadData();
|
|
}, [id]),
|
|
);
|
|
|
|
const onLoadData = async () => {
|
|
try {
|
|
const response = await apiDonationGetOne({
|
|
id: id as string,
|
|
category: "permanent",
|
|
});
|
|
|
|
setData(response.data);
|
|
} catch (error) {
|
|
console.log("[ERROR]", error);
|
|
}
|
|
};
|
|
|
|
const [value, setValue] = useState({
|
|
sisa: 0,
|
|
reminder: false,
|
|
});
|
|
|
|
useEffect(() => {
|
|
updateCountDown();
|
|
}, [data]);
|
|
|
|
const updateCountDown = () => {
|
|
const countDown = countDownAndCondition({
|
|
duration: data?.DonasiMaster_Durasi?.name,
|
|
publishTime: data?.publishTime,
|
|
});
|
|
|
|
setValue({
|
|
sisa: countDown.durationDay,
|
|
reminder: countDown.reminder,
|
|
});
|
|
};
|
|
|
|
const buttonSection = (
|
|
<>
|
|
<BoxButtonOnFooter>
|
|
<ButtonCustom
|
|
disabled={value?.reminder || !data}
|
|
onPress={() => router.navigate(`/donation/${id}/(transaction-flow)`)}
|
|
>
|
|
{!data ? "Loading..." : value?.reminder ? "Waktu berakhir" : "Donasi"}
|
|
</ButtonCustom>
|
|
</BoxButtonOnFooter>
|
|
</>
|
|
);
|
|
|
|
return (
|
|
<>
|
|
<Stack.Screen
|
|
options={{
|
|
header: () => (
|
|
<AppHeader
|
|
title="Detail Donasi"
|
|
left={<BackButton />}
|
|
right={
|
|
user?.id === data?.Author?.id ? (
|
|
<DotButton onPress={() => setOpenDrawer(true)} />
|
|
) : null
|
|
}
|
|
/>
|
|
),
|
|
}}
|
|
/>
|
|
<NewWrapper footerComponent={buttonSection}>
|
|
{!data ? (
|
|
<CustomSkeleton height={400} />
|
|
) : (
|
|
<StackCustom>
|
|
<Donation_ComponentBoxDetailData
|
|
sisaHari={value.sisa}
|
|
reminder={value.reminder}
|
|
data={data}
|
|
bottomSection={
|
|
<Donation_ProgressSection
|
|
id={id as string}
|
|
progres={Number(data?.progres) || 0}
|
|
/>
|
|
}
|
|
/>
|
|
<Donation_ComponentInfoFundrising dataAuthor={data?.Author} />
|
|
<Donation_ComponentStoryFunrising
|
|
id={id as string}
|
|
dataStory={data?.CeritaDonasi}
|
|
/>
|
|
</StackCustom>
|
|
)}
|
|
</NewWrapper>
|
|
|
|
<DrawerCustom
|
|
isVisible={openDrawer}
|
|
closeDrawer={() => setOpenDrawer(false)}
|
|
height={"auto"}
|
|
>
|
|
<MenuDrawerDynamicGrid
|
|
data={[
|
|
{
|
|
icon: <IconNews />,
|
|
label: "Rekap Kabar",
|
|
path: `/donation/${id}/(news)/recap-of-news`,
|
|
},
|
|
]}
|
|
onPressItem={(item) => {
|
|
console.log("PATH ", item.path);
|
|
router.navigate(item.path as any);
|
|
setOpenDrawer(false);
|
|
}}
|
|
/>
|
|
</DrawerCustom>
|
|
</>
|
|
);
|
|
}
|