Fix: Tampilan yang terintegrasi API - app/(application)/(user)/collaboration/[id]/edit.tsx - app/(application)/admin/collaboration/[id]/[status].tsx - app/(application)/admin/collaboration/[id]/group.tsx - app/(application)/admin/collaboration/[id]/reject-input.tsx - app/(application)/admin/collaboration/group.tsx - app/(application)/admin/collaboration/index.tsx - app/(application)/admin/collaboration/publish.tsx - app/(application)/admin/collaboration/reject.tsx - components/_ShareComponent/Admin/TableValue.tsx - screens/Collaboration/BoxPublishSection.tsx - service/api-admin/api-admin-collaboration.ts ### No Issue
68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
import { StackCustom, ViewWrapper } from "@/components";
|
|
import AdminComp_BoxDashboard from "@/components/_ShareComponent/Admin/BoxDashboard";
|
|
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
|
import { MainColor } from "@/constants/color-palet";
|
|
import { apiAdminCollaboration } from "@/service/api-admin/api-admin-collaboration";
|
|
import { Entypo, FontAwesome } from "@expo/vector-icons";
|
|
import { useFocusEffect } from "expo-router";
|
|
import { useCallback, useState } from "react";
|
|
|
|
export default function AdminCollaboration() {
|
|
const [list, setList] = useState<any | null>(null);
|
|
|
|
useFocusEffect(
|
|
useCallback(() => {
|
|
handlerLoadList();
|
|
}, [])
|
|
);
|
|
|
|
const handlerLoadList = async () => {
|
|
try {
|
|
const response = await apiAdminCollaboration({
|
|
category: "dashboard",
|
|
});
|
|
|
|
console.log("[RESPONSE]", JSON.stringify(response, null, 2));
|
|
|
|
if (response.success) {
|
|
setList(response.data);
|
|
}
|
|
} catch (error) {
|
|
console.log("[ERROR]", error);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<ViewWrapper headerComponent={<AdminTitlePage title="Collaboration" />}>
|
|
<StackCustom gap={"xs"}>
|
|
{listData(list as any).map((item, i) => (
|
|
<AdminComp_BoxDashboard key={i} item={item} />
|
|
))}
|
|
</StackCustom>
|
|
</ViewWrapper>
|
|
</>
|
|
);
|
|
}
|
|
|
|
const listData = (list: any) => {
|
|
console.log("[LIST masuk]", JSON.stringify(list, null, 2));
|
|
return [
|
|
{
|
|
label: "Publish",
|
|
value: (list && list?.publish) || "0",
|
|
icon: <Entypo name="publish" size={25} color={MainColor.green} />,
|
|
},
|
|
{
|
|
label: "Group",
|
|
value: (list && list?.group) || "0",
|
|
icon: <FontAwesome name="group" size={25} color={MainColor.yellow} />,
|
|
},
|
|
{
|
|
label: "Reject",
|
|
value: (list && list?.reject) || "0",
|
|
icon: <FontAwesome name="warning" size={25} color={MainColor.red} />,
|
|
},
|
|
];
|
|
};
|