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
229 lines
6.8 KiB
TypeScript
229 lines
6.8 KiB
TypeScript
/* eslint-disable react-hooks/exhaustive-deps */
|
|
import {
|
|
ButtonCustom,
|
|
DrawerCustom,
|
|
DummyLandscapeImage,
|
|
LoaderCustom,
|
|
Spacing,
|
|
StackCustom,
|
|
TextCustom,
|
|
} from "@/components";
|
|
import AppHeader from "@/components/_ShareComponent/AppHeader";
|
|
import LeftButtonCustom from "@/components/Button/BackButton";
|
|
import GridTwoView from "@/components/_ShareComponent/GridTwoView";
|
|
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
|
import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
|
|
import { MainColor } from "@/constants/color-palet";
|
|
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
|
import { useAuth } from "@/hooks/use-auth";
|
|
import Portofolio_BusinessLocation from "@/screens/Portofolio/BusinessLocationSection";
|
|
import Portofolio_ButtonDelete from "@/screens/Portofolio/ButtonDelete";
|
|
import Portofolio_Data from "@/screens/Portofolio/DataPortofolio";
|
|
import { drawerItemsPortofolio } from "@/screens/Portofolio/ListPage";
|
|
import Portofolio_MenuDrawerSection from "@/screens/Portofolio/MenuDrawer";
|
|
import Portofolio_SocialMediaSection from "@/screens/Portofolio/SocialMediaSection";
|
|
import { apiGetOnePortofolio } from "@/service/api-client/api-portofolio";
|
|
import { apiUser } from "@/service/api-client/api-user";
|
|
import { GStyles } from "@/styles/global-styles";
|
|
import { openInDeviceMaps } from "@/utils/openInDeviceMaps";
|
|
import { FontAwesome, Ionicons } from "@expo/vector-icons";
|
|
import { Stack, useFocusEffect, useLocalSearchParams } from "expo-router";
|
|
import { useCallback, useState } from "react";
|
|
import { TouchableOpacity } from "react-native";
|
|
|
|
export default function Portofolio() {
|
|
const { user } = useAuth();
|
|
const { id } = useLocalSearchParams();
|
|
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
|
const [isLoadingDelete, setIsLoadingDelete] = useState(false);
|
|
const [data, setData] = useState<any>();
|
|
const [profileId, setProfileId] = useState<any>();
|
|
const [openDrawerLocation, setOpenDrawerLocation] = useState(false);
|
|
|
|
const openDrawer = () => {
|
|
setIsDrawerOpen(true);
|
|
};
|
|
const closeDrawer = () => {
|
|
setIsDrawerOpen(false);
|
|
};
|
|
|
|
useFocusEffect(
|
|
useCallback(() => {
|
|
onLoadData(id as string);
|
|
onLoadUserByToken();
|
|
}, [id]),
|
|
);
|
|
|
|
async function onLoadData(id: string) {
|
|
const response = await apiGetOnePortofolio({ id: id });
|
|
|
|
setData(response.data);
|
|
}
|
|
|
|
const onLoadUserByToken = async () => {
|
|
const response = await apiUser(user?.id as string);
|
|
|
|
setProfileId(response?.data?.Profile?.id);
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
<>
|
|
{/* Header */}
|
|
<Stack.Screen
|
|
options={{
|
|
header: () => (
|
|
<AppHeader
|
|
title="Portofolio"
|
|
left={<LeftButtonCustom />}
|
|
right={
|
|
data?.Profile?.id !== profileId ? null : (
|
|
<TouchableOpacity onPress={openDrawer}>
|
|
<Ionicons
|
|
name="ellipsis-vertical"
|
|
size={20}
|
|
color={MainColor.yellow}
|
|
/>
|
|
</TouchableOpacity>
|
|
)
|
|
}
|
|
/>
|
|
),
|
|
}}
|
|
/>
|
|
<ViewWrapper>
|
|
{!data || !profileId ? (
|
|
<StackCustom>
|
|
<CustomSkeleton height={400} />
|
|
<CustomSkeleton height={300} />
|
|
</StackCustom>
|
|
) : (
|
|
<StackCustom>
|
|
<Portofolio_Data
|
|
data={data}
|
|
listSubBidang={data?.Portofolio_BidangDanSubBidangBisnis as any[]}
|
|
/>
|
|
{data?.BusinessMaps && (
|
|
<Portofolio_BusinessLocation
|
|
data={data?.BusinessMaps}
|
|
imageId={data?.logoId}
|
|
setOpenDrawerLocation={setOpenDrawerLocation}
|
|
/>
|
|
)}
|
|
|
|
<Portofolio_SocialMediaSection
|
|
data={data?.Portofolio_MediaSosial}
|
|
/>
|
|
{data?.Profile?.id !== profileId ? null : (
|
|
<Portofolio_ButtonDelete
|
|
id={id as string}
|
|
isLoadingDelete={isLoadingDelete}
|
|
setIsLoadingDelete={setIsLoadingDelete}
|
|
/>
|
|
)}
|
|
<Spacing />
|
|
</StackCustom>
|
|
)}
|
|
</ViewWrapper>
|
|
|
|
{/* Drawer Komponen Eksternal */}
|
|
<DrawerCustom
|
|
isVisible={isDrawerOpen}
|
|
closeDrawer={closeDrawer}
|
|
height={"auto"}
|
|
>
|
|
<Portofolio_MenuDrawerSection
|
|
drawerItems={drawerItemsPortofolio({
|
|
id: id as string,
|
|
maps: data?.BusinessMaps,
|
|
})}
|
|
setIsDrawerOpen={setIsDrawerOpen}
|
|
/>
|
|
</DrawerCustom>
|
|
|
|
{/* Drawer Lokasi */}
|
|
<DrawerCustom
|
|
isVisible={openDrawerLocation}
|
|
closeDrawer={() => setOpenDrawerLocation(false)}
|
|
height={"auto"}
|
|
>
|
|
{data?.BusinessMaps?.imageId && (
|
|
<DummyLandscapeImage
|
|
height={200}
|
|
imageId={data?.BusinessMaps?.imageId}
|
|
/>
|
|
)}
|
|
<Spacing />
|
|
<StackCustom gap={"xs"}>
|
|
<GridTwoView
|
|
spanLeft={2}
|
|
spanRight={10}
|
|
leftItem={
|
|
<FontAwesome
|
|
name="building-o"
|
|
size={ICON_SIZE_SMALL}
|
|
color="white"
|
|
/>
|
|
}
|
|
rightItem={<TextCustom>{data?.BusinessMaps?.namePin}</TextCustom>}
|
|
/>
|
|
|
|
<GridTwoView
|
|
spanLeft={2}
|
|
spanRight={10}
|
|
leftItem={
|
|
<Ionicons
|
|
name="list-outline"
|
|
size={ICON_SIZE_SMALL}
|
|
color="white"
|
|
/>
|
|
}
|
|
rightItem={
|
|
<TextCustom>{data?.MasterBidangBisnis?.name}</TextCustom>
|
|
}
|
|
/>
|
|
|
|
<GridTwoView
|
|
spanLeft={2}
|
|
spanRight={10}
|
|
leftItem={
|
|
<Ionicons
|
|
name="call-outline"
|
|
size={ICON_SIZE_SMALL}
|
|
color="white"
|
|
/>
|
|
}
|
|
rightItem={<TextCustom>{data?.tlpn}</TextCustom>}
|
|
/>
|
|
<GridTwoView
|
|
spanLeft={2}
|
|
spanRight={10}
|
|
leftItem={
|
|
<Ionicons
|
|
name="location-outline"
|
|
size={ICON_SIZE_SMALL}
|
|
color="white"
|
|
/>
|
|
}
|
|
rightItem={<TextCustom>{data?.alamatKantor}</TextCustom>}
|
|
/>
|
|
|
|
<Spacing />
|
|
<ButtonCustom
|
|
onPress={() => {
|
|
openInDeviceMaps({
|
|
latitude: data?.BusinessMaps?.latitude,
|
|
longitude: data?.BusinessMaps?.longitude,
|
|
title: data?.BusinessMaps?.namePin,
|
|
});
|
|
}}
|
|
>
|
|
Buka Maps
|
|
</ButtonCustom>
|
|
</StackCustom>
|
|
</DrawerCustom>
|
|
</>
|
|
);
|
|
}
|