upd: donasi
Deskripsi: - api detail donasi No Issues
This commit is contained in:
17
src/app_modules/donasi/detail/detail_main/index_new.tsx
Normal file
17
src/app_modules/donasi/detail/detail_main/index_new.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
"use client";
|
||||
import { Stack } from "@mantine/core";
|
||||
import ComponentDonasi_CeritaPenggalangMainNew from "../../component/detail_main/cerita_penggalang_new";
|
||||
import { ComponentDonasi_DetailDataMainNew } from "../../component/detail_main/detail_dana_donasi_new";
|
||||
import ComponentDonasi_InformasiPenggalangMainNew from "../../component/detail_main/informasi_penggalang_new";
|
||||
|
||||
export default function DetailMainDonasiNew() {
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={40} py={"md"}>
|
||||
<ComponentDonasi_DetailDataMainNew />
|
||||
<ComponentDonasi_InformasiPenggalangMainNew />
|
||||
<ComponentDonasi_CeritaPenggalangMainNew />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
85
src/app_modules/donasi/detail/detail_main/layout_new.tsx
Normal file
85
src/app_modules/donasi/detail/detail_main/layout_new.tsx
Normal file
@@ -0,0 +1,85 @@
|
||||
"use client";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import React, { useState } from "react";
|
||||
import ButtonDonasi from "../../component/footer_button_donasi";
|
||||
import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
|
||||
import { IconDotsVertical, IconMessageShare } from "@tabler/icons-react";
|
||||
import { UIGlobal_Drawer } from "@/app_modules/_global/ui";
|
||||
import { ActionIcon } from "@mantine/core";
|
||||
import { useParams } from "next/navigation";
|
||||
import { apiGetOneDonasiById } from "../../lib/api_donasi";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
|
||||
export default function LayoutDetailMainDonasiNew({ children, }: { children: React.ReactNode; }) {
|
||||
const [openDrawer, setOpenDrawer] = useState(false);
|
||||
const param = useParams<{ id: string }>();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [authorId, setAuthorId] = useState("");
|
||||
const [userLogin, setUserLogin] = useState("");
|
||||
|
||||
const listPage = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Rekap Kabar",
|
||||
icon: <IconMessageShare />,
|
||||
path: RouterDonasi.rekap_kabar({ id: param.id }),
|
||||
},
|
||||
];
|
||||
|
||||
async function getDataDonasi() {
|
||||
try {
|
||||
setLoading(true)
|
||||
const response = await apiGetOneDonasiById(param.id, "author")
|
||||
const response2 = await funGetUserIdByToken()
|
||||
if (response.success) {
|
||||
setAuthorId(response.data.authorId)
|
||||
setUserLogin(response2)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
useShallowEffect(() => {
|
||||
getDataDonasi()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title="Detail Donasi"
|
||||
customButtonRight={
|
||||
loading ? ""
|
||||
:
|
||||
userLogin !== authorId ? (
|
||||
""
|
||||
) : (
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => setOpenDrawer(true)}
|
||||
>
|
||||
<IconDotsVertical color="white" />
|
||||
</ActionIcon>
|
||||
)
|
||||
}
|
||||
/>
|
||||
}
|
||||
footer={<ButtonDonasi donasiId={param.id} />}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate>
|
||||
|
||||
<UIGlobal_Drawer
|
||||
opened={openDrawer}
|
||||
close={() => setOpenDrawer(false)}
|
||||
component={listPage}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user