Add: - hipmi-note.md Fix: - app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/failed.tsx - app/(application)/(user)/donation/[id]/(transaction-flow)/[invoiceId]/success.tsx - app/(application)/(user)/event/[id]/confirmation.tsx - app/(application)/(user)/investment/(tabs)/index.tsx - app/(application)/(user)/investment/(tabs)/my-holding.tsx - app/(application)/(user)/investment/[id]/(my-holding)/[id].tsx - app/(application)/(user)/investment/[id]/(transaction-flow)/failed.tsx - app/(application)/(user)/investment/[id]/(transaction-flow)/index.tsx - app/(application)/(user)/investment/[id]/(transaction-flow)/success.tsx - app/(application)/(user)/investment/[id]/investor.tsx - app/(application)/admin/investment/[id]/[status]/index.tsx - app/(application)/admin/investment/[id]/[status]/transaction-detail.tsx - app/(application)/admin/investment/[id]/list-of-investor.tsx - lib/dummy-data/investment/dummy-data-not-publish.ts - screens/Authentication/VerificationView.tsx - screens/Home/bottomFeatureSection.tsx - service/api-client/api-investment.ts ### No Issue
68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
/* eslint-disable react-hooks/exhaustive-deps */
|
|
import {
|
|
AvatarUsernameAndOtherComponent,
|
|
BoxWithHeaderSection,
|
|
LoaderCustom,
|
|
TextCustom,
|
|
ViewWrapper,
|
|
} from "@/components";
|
|
import NoDataText from "@/components/_ShareComponent/NoDataText";
|
|
import { apiInvestmentGetInvestorById } from "@/service/api-client/api-investment";
|
|
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
|
import _ from "lodash";
|
|
import { useCallback, useState } from "react";
|
|
|
|
export default function InvestmentInvestor() {
|
|
const { id } = useLocalSearchParams();
|
|
const [list, setList] = useState<any[] | null>(null);
|
|
const [loadingList, setLoadingList] = useState(false);
|
|
|
|
useFocusEffect(
|
|
useCallback(() => {
|
|
onLoadList();
|
|
}, [id])
|
|
);
|
|
|
|
const onLoadList = async () => {
|
|
try {
|
|
setLoadingList(true);
|
|
const response = await apiInvestmentGetInvestorById({
|
|
id: id as string,
|
|
})
|
|
console.log("[DATA LIST]", JSON.stringify(response.data, null, 2));
|
|
setList(response.data);
|
|
} catch (error) {
|
|
console.log("[ERROR]", error);
|
|
} finally {
|
|
setLoadingList(false);
|
|
}
|
|
}
|
|
|
|
|
|
return (
|
|
<>
|
|
<ViewWrapper>
|
|
{loadingList ? (
|
|
<LoaderCustom />
|
|
) : _.isEmpty(list) ? (
|
|
<NoDataText />
|
|
) : (
|
|
list?.map((item: any, index: number) => (
|
|
<BoxWithHeaderSection key={index}>
|
|
<AvatarUsernameAndOtherComponent
|
|
avatar={item?.Author?.Profile?.imageId}
|
|
name={item?.Author?.username}
|
|
avatarHref={`/profile/${item?.Author?.Profile?.id}`}
|
|
/>
|
|
<TextCustom bold>
|
|
Rp. {formatCurrencyDisplay(item?.nominal)}
|
|
</TextCustom>
|
|
</BoxWithHeaderSection>
|
|
))
|
|
)}
|
|
</ViewWrapper>
|
|
</>
|
|
);
|
|
}
|