Fix: User – Forum (Reporting & Preview) app/(application)/(user)/forum/[id]/other-report-commentar.tsx app/(application)/(user)/forum/[id]/other-report-posting.tsx app/(application)/(user)/forum/[id]/preview-report-posting.tsx app/(application)/(user)/forum/[id]/report-commentar.tsx app/(application)/(user)/forum/[id]/report-posting.tsx Admin – Forum Moderation app/(application)/admin/forum/[id]/list-report-comment.tsx app/(application)/admin/forum/report-posting.tsx Layout app/(application)/(user)/_layout.tsx API Client & Admin service/api-admin/api-admin-forum.ts service/api-client/api-forum.ts service/api-client/api-master.ts Utils utils/badWordsIndonesia.ts ### No Issue
92 lines
2.7 KiB
TypeScript
92 lines
2.7 KiB
TypeScript
import {
|
|
BaseBox,
|
|
NewWrapper,
|
|
Spacing,
|
|
StackCustom,
|
|
TextCustom,
|
|
} from "@/components";
|
|
import ListSkeletonComponent from "@/components/_ShareComponent/ListSkeletonComponent";
|
|
import NoDataText from "@/components/_ShareComponent/NoDataText";
|
|
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
|
import { apiForumGetReportPosting } from "@/service/api-client/api-forum";
|
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
|
import _ from "lodash";
|
|
import { useCallback, useState } from "react";
|
|
|
|
export default function ForumPreviewReportPosting() {
|
|
const { id } = useLocalSearchParams();
|
|
const [data, setData] = useState<any | null>(null);
|
|
const [listData, setListData] = useState<any | null>(null);
|
|
const [loading, setLoading] = useState<boolean>(false);
|
|
// Status
|
|
|
|
useFocusEffect(
|
|
useCallback(() => {
|
|
onLoadData(id as string);
|
|
}, [id])
|
|
);
|
|
|
|
const onLoadData = async (id: string) => {
|
|
try {
|
|
setLoading(true);
|
|
const response = await apiForumGetReportPosting({ id });
|
|
setData(response.data);
|
|
setListData(response?.data?.Forum_ReportPosting);
|
|
} catch (error) {
|
|
console.log("[ERROR]", error);
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<NewWrapper>
|
|
<StackCustom>
|
|
<TextCustom color="red" bold>
|
|
Postingan anda telah melanggar aturan forum ! Admin mengambil
|
|
tindakan untuk menghapus komentar anda!
|
|
</TextCustom>
|
|
{loading ? (
|
|
<CustomSkeleton height={100} />
|
|
) : (
|
|
<BaseBox>
|
|
<TextCustom>"{data?.diskusi ? data?.diskusi : "-"}"</TextCustom>
|
|
</BaseBox>
|
|
)}
|
|
</StackCustom>
|
|
|
|
<Spacing height={10} />
|
|
<TextCustom bold>Beberapa laporan yang telah diterima</TextCustom>
|
|
<Spacing height={10} />
|
|
|
|
{loading ? (
|
|
<ListSkeletonComponent />
|
|
) : _.isEmpty(listData) ? (
|
|
<NoDataText />
|
|
) : (
|
|
listData?.map((e: any) => (
|
|
<BaseBox key={e?.id}>
|
|
{e?.deskripsi ? (
|
|
<StackCustom gap={"sm"}>
|
|
<TextCustom bold>Laporan Lainnya</TextCustom>
|
|
<TextCustom>{e?.deskripsi}</TextCustom>
|
|
</StackCustom>
|
|
) : (
|
|
<StackCustom gap={"sm"}>
|
|
<TextCustom bold>
|
|
{e?.ForumMaster_KategoriReport?.title}
|
|
</TextCustom>
|
|
<TextCustom>
|
|
{e?.ForumMaster_KategoriReport?.deskripsi}
|
|
</TextCustom>
|
|
</StackCustom>
|
|
)}
|
|
</BaseBox>
|
|
))
|
|
)}
|
|
</NewWrapper>
|
|
</>
|
|
);
|
|
}
|