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
114 lines
2.9 KiB
TypeScript
114 lines
2.9 KiB
TypeScript
import {
|
|
BackButton,
|
|
AvatarComp,
|
|
ViewWrapper,
|
|
SearchInput,
|
|
FloatingButton,
|
|
LoaderCustom,
|
|
TextCustom,
|
|
} from "@/components";
|
|
import AppHeader from "@/components/_ShareComponent/AppHeader";
|
|
import { useAuth } from "@/hooks/use-auth";
|
|
import { apiForumGetAll } from "@/service/api-client/api-forum";
|
|
import { apiUser } from "@/service/api-client/api-user";
|
|
import { Stack, router } from "expo-router";
|
|
import _ from "lodash";
|
|
import { useState, useEffect } from "react";
|
|
import { RefreshControl } from "react-native";
|
|
import Forum_BoxDetailSection from "./DiscussionBoxSection";
|
|
|
|
export default function Forum_ViewBeranda() {
|
|
const { user } = useAuth();
|
|
const [dataUser, setDataUser] = useState<any>();
|
|
const [listData, setListData] = useState<any[]>();
|
|
const [loadingGetList, setLoadingGetList] = useState(false);
|
|
const [search, setSearch] = useState("");
|
|
|
|
useEffect(() => {
|
|
onLoadData();
|
|
onLoadDataProfile(user?.id as string);
|
|
}, [user?.id, search]);
|
|
|
|
const onLoadDataProfile = async (id: string) => {
|
|
const response = await apiUser(id);
|
|
setDataUser(response.data);
|
|
};
|
|
|
|
const onLoadData = async () => {
|
|
try {
|
|
setLoadingGetList(true);
|
|
const response = await apiForumGetAll({
|
|
category: "beranda",
|
|
search: search,
|
|
userLoginId: user?.id,
|
|
});
|
|
|
|
setListData(response.data);
|
|
} catch (error) {
|
|
console.log("[ERROR]", error);
|
|
} finally {
|
|
setLoadingGetList(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Stack.Screen
|
|
options={{
|
|
header: () => (
|
|
<AppHeader
|
|
title="Forum"
|
|
left={<BackButton />}
|
|
right={
|
|
<AvatarComp
|
|
fileId={dataUser?.Profile?.imageId}
|
|
size="base"
|
|
href={`/forum/${user?.id}/forumku`}
|
|
/>
|
|
}
|
|
/>
|
|
),
|
|
}}
|
|
/>
|
|
|
|
<ViewWrapper
|
|
headerComponent={
|
|
<SearchInput
|
|
placeholder="Cari topik diskusi"
|
|
onChangeText={(e) => setSearch(e)}
|
|
/>
|
|
}
|
|
floatingButton={
|
|
<FloatingButton
|
|
onPress={() =>
|
|
router.navigate("/(application)/(user)/forum/create")
|
|
}
|
|
/>
|
|
}
|
|
refreshControl={
|
|
<RefreshControl refreshing={loadingGetList} onRefresh={onLoadData} />
|
|
}
|
|
>
|
|
{loadingGetList ? (
|
|
<LoaderCustom />
|
|
) : _.isEmpty(listData) ? (
|
|
<TextCustom align="center" color="gray">
|
|
Tidak ada diskusi
|
|
</TextCustom>
|
|
) : (
|
|
listData?.map((e: any, i: number) => (
|
|
<Forum_BoxDetailSection
|
|
key={i}
|
|
data={e}
|
|
onSetData={() => {}}
|
|
isTruncate={true}
|
|
href={`/forum/${e.id}`}
|
|
isRightComponent={false}
|
|
/>
|
|
))
|
|
)}
|
|
</ViewWrapper>
|
|
</>
|
|
);
|
|
}
|