Compare commits
2 Commits
fix-bug/3-
...
fix-bug/5-
| Author | SHA1 | Date | |
|---|---|---|---|
| 836ef709d2 | |||
| 3bbee15c3a |
@@ -12,23 +12,26 @@ import Home_ImageSection from "@/screens/Home/imageSection";
|
|||||||
import TabSection from "@/screens/Home/tabSection";
|
import TabSection from "@/screens/Home/tabSection";
|
||||||
import { tabsHome } from "@/screens/Home/tabsList";
|
import { tabsHome } from "@/screens/Home/tabsList";
|
||||||
import Home_FeatureSection from "@/screens/Home/topFeatureSection";
|
import Home_FeatureSection from "@/screens/Home/topFeatureSection";
|
||||||
|
import { apiJobGetAll } from "@/service/api-client/api-job";
|
||||||
import { apiUser } from "@/service/api-client/api-user";
|
import { apiUser } from "@/service/api-client/api-user";
|
||||||
import { apiVersion } from "@/service/api-config";
|
import { apiVersion } from "@/service/api-config";
|
||||||
import { GStyles } from "@/styles/global-styles";
|
import { GStyles } from "@/styles/global-styles";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { Redirect, router, Stack, useFocusEffect } from "expo-router";
|
import { Redirect, router, Stack, useFocusEffect } from "expo-router";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { RefreshControl, TouchableOpacity, View } from "react-native";
|
import { RefreshControl, View } from "react-native";
|
||||||
|
|
||||||
export default function Application() {
|
export default function Application() {
|
||||||
const { token, user, userData } = useAuth();
|
const { token, user, userData } = useAuth();
|
||||||
const [data, setData] = useState<any>();
|
const [data, setData] = useState<any>();
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
const { syncUnreadCount } = useNotificationStore();
|
const { syncUnreadCount } = useNotificationStore();
|
||||||
|
const [listData, setListData] = useState<any[] | null>(null);
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadData();
|
onLoadData();
|
||||||
|
onLoadDataJob();
|
||||||
checkVersion();
|
checkVersion();
|
||||||
userData(token as string).catch((error) => {
|
userData(token as string).catch((error) => {
|
||||||
console.log("[ERROR userData]", error?.message);
|
console.log("[ERROR userData]", error?.message);
|
||||||
@@ -50,6 +53,22 @@ export default function Application() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onLoadDataJob = async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiJobGetAll({
|
||||||
|
category: "beranda",
|
||||||
|
});
|
||||||
|
const result = response.data
|
||||||
|
.sort(
|
||||||
|
(a: any, b: any) =>
|
||||||
|
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),
|
||||||
|
)
|
||||||
|
.slice(0, 2);
|
||||||
|
setListData(result);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
const checkVersion = async () => {
|
const checkVersion = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await apiVersion();
|
const response = await apiVersion();
|
||||||
@@ -62,12 +81,13 @@ export default function Application() {
|
|||||||
const onRefresh = useCallback(() => {
|
const onRefresh = useCallback(() => {
|
||||||
setRefreshing(true);
|
setRefreshing(true);
|
||||||
onLoadData();
|
onLoadData();
|
||||||
|
onLoadDataJob();
|
||||||
checkVersion();
|
checkVersion();
|
||||||
setRefreshing(false);
|
setRefreshing(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (data && data?.active === false) {
|
if (data && data?.active === false) {
|
||||||
console.log("User is not active");
|
console.warn("User is not active");
|
||||||
return (
|
return (
|
||||||
<BasicWrapper>
|
<BasicWrapper>
|
||||||
<Redirect href={`/waiting-room`} />
|
<Redirect href={`/waiting-room`} />
|
||||||
@@ -76,7 +96,7 @@ export default function Application() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data && data?.Profile === null) {
|
if (data && data?.Profile === null) {
|
||||||
console.log("Profile is null");
|
console.warn("Profile is null");
|
||||||
return (
|
return (
|
||||||
<BasicWrapper>
|
<BasicWrapper>
|
||||||
<Redirect href={`/profile/create`} />
|
<Redirect href={`/profile/create`} />
|
||||||
@@ -170,7 +190,7 @@ export default function Application() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{data ? (
|
{data ? (
|
||||||
<Home_BottomFeatureSection />
|
<Home_BottomFeatureSection listData={listData} />
|
||||||
) : (
|
) : (
|
||||||
<CustomSkeleton height={200} />
|
<CustomSkeleton height={200} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import { LoaderCustom, StackCustom } from "@/components";
|
import { NewWrapper, StackCustom } from "@/components";
|
||||||
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
||||||
import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
|
|
||||||
import LeftButtonCustom from "@/components/Button/BackButton";
|
import LeftButtonCustom from "@/components/Button/BackButton";
|
||||||
import DrawerCustom from "@/components/Drawer/DrawerCustom";
|
import DrawerCustom from "@/components/Drawer/DrawerCustom";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
@@ -17,8 +16,8 @@ import { GStyles } from "@/styles/global-styles";
|
|||||||
import { IProfile } from "@/types/Type-Profile";
|
import { IProfile } from "@/types/Type-Profile";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { Stack, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { Stack, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import React, { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { TouchableOpacity } from "react-native";
|
import { RefreshControl, TouchableOpacity } from "react-native";
|
||||||
|
|
||||||
export default function Profile() {
|
export default function Profile() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
@@ -26,6 +25,7 @@ export default function Profile() {
|
|||||||
const [data, setData] = useState<IProfile>();
|
const [data, setData] = useState<IProfile>();
|
||||||
const [dataToken, setDataToken] = useState<IProfile>();
|
const [dataToken, setDataToken] = useState<IProfile>();
|
||||||
const [listPortofolio, setListPortofolio] = useState<any[]>();
|
const [listPortofolio, setListPortofolio] = useState<any[]>();
|
||||||
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
|
|
||||||
const { token, logout, isAdmin, user, userData } = useAuth();
|
const { token, logout, isAdmin, user, userData } = useAuth();
|
||||||
|
|
||||||
@@ -55,13 +55,21 @@ export default function Profile() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onLoadData = async (id: string) => {
|
const onLoadData = async (id: string) => {
|
||||||
const response = await apiProfile({ id: id });
|
try {
|
||||||
setData(response.data);
|
const response = await apiProfile({ id: id });
|
||||||
|
setData(response.data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR onLoadData]", error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onLoadUserByToken = async () => {
|
const onLoadUserByToken = async () => {
|
||||||
const response = await apiUser(user?.id as string);
|
try {
|
||||||
setDataToken(response?.data?.Profile);
|
const response = await apiUser(user?.id as string);
|
||||||
|
setDataToken(response?.data?.Profile);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR onLoadUserByToken]", error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onLoadPortofolio = async (id: string) => {
|
const onLoadPortofolio = async (id: string) => {
|
||||||
@@ -75,10 +83,20 @@ export default function Profile() {
|
|||||||
.slice(0, 2);
|
.slice(0, 2);
|
||||||
setListPortofolio(lastTwoByDate);
|
setListPortofolio(lastTwoByDate);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR onLoadPortofolio]", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onRefresh = useCallback(() => {
|
||||||
|
setRefreshing(true);
|
||||||
|
onLoadData(id as string);
|
||||||
|
onLoadPortofolio(id as string);
|
||||||
|
onLoadUserByToken();
|
||||||
|
isUserCheck();
|
||||||
|
userData(token as string);
|
||||||
|
setRefreshing(false);
|
||||||
|
}, [id, token]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
@@ -98,7 +116,16 @@ export default function Profile() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/* Main View */}
|
{/* Main View */}
|
||||||
<ViewWrapper>
|
<NewWrapper
|
||||||
|
refreshControl={
|
||||||
|
<RefreshControl
|
||||||
|
refreshing={refreshing}
|
||||||
|
onRefresh={onRefresh}
|
||||||
|
tintColor={MainColor.yellow}
|
||||||
|
colors={[MainColor.yellow]}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
{!data || !dataToken ? (
|
{!data || !dataToken ? (
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
<CustomSkeleton height={400} />
|
<CustomSkeleton height={400} />
|
||||||
@@ -114,7 +141,7 @@ export default function Profile() {
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</ViewWrapper>
|
</NewWrapper>
|
||||||
|
|
||||||
{/* Drawer Komponen Eksternal */}
|
{/* Drawer Komponen Eksternal */}
|
||||||
<DrawerCustom
|
<DrawerCustom
|
||||||
|
|||||||
@@ -9,32 +9,14 @@ import {
|
|||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import GridTwoView from "@/components/_ShareComponent/GridTwoView";
|
import GridTwoView from "@/components/_ShareComponent/GridTwoView";
|
||||||
import API_IMAGE from "@/constants/api-storage";
|
import { MapMarker, MapsV2Custom } from "@/components/Map/MapsV2Custom";
|
||||||
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
||||||
import { apiMapsGetAll } from "@/service/api-client/api-maps";
|
import { apiMapsGetAll } from "@/service/api-client/api-maps";
|
||||||
import { openInDeviceMaps } from "@/utils/openInDeviceMaps";
|
import { openInDeviceMaps } from "@/utils/openInDeviceMaps";
|
||||||
import { FontAwesome, Ionicons } from "@expo/vector-icons";
|
import { FontAwesome, Ionicons } from "@expo/vector-icons";
|
||||||
import { Image } from "expo-image";
|
|
||||||
import { router, useFocusEffect } from "expo-router";
|
import { router, useFocusEffect } from "expo-router";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { View } from "react-native";
|
|
||||||
import MapView, { Marker } from "react-native-maps";
|
|
||||||
|
|
||||||
const defaultRegion = {
|
|
||||||
latitude: -8.737109,
|
|
||||||
longitude: 115.1756897,
|
|
||||||
latitudeDelta: 0.1,
|
|
||||||
longitudeDelta: 0.1,
|
|
||||||
height: 300,
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface LocationItem {
|
|
||||||
id: string | number;
|
|
||||||
latitude: number;
|
|
||||||
longitude: number;
|
|
||||||
name: string;
|
|
||||||
imageId?: string;
|
|
||||||
}
|
|
||||||
export default function AdminMaps() {
|
export default function AdminMaps() {
|
||||||
const [list, setList] = useState<any[] | null>(null);
|
const [list, setList] = useState<any[] | null>(null);
|
||||||
const [loadList, setLoadList] = useState(false);
|
const [loadList, setLoadList] = useState(false);
|
||||||
@@ -72,74 +54,30 @@ export default function AdminMaps() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const markers: MapMarker[] = list?.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
coordinate: [item.longitude, item.latitude] as [number, number],
|
||||||
|
imageId: item.Portofolio?.logoId,
|
||||||
|
onSelected: () => {
|
||||||
|
setOpenDrawer(true);
|
||||||
|
setSelected({
|
||||||
|
id: item?.id,
|
||||||
|
bidangBisnis: item?.Portofolio?.MasterBidangBisnis?.name,
|
||||||
|
nomorTelepon: item?.Portofolio?.tlpn,
|
||||||
|
alamatBisnis: item?.Portofolio?.alamatKantor,
|
||||||
|
namePin: item?.namePin,
|
||||||
|
imageId: item?.imageId,
|
||||||
|
portofolioId: item?.Portofolio?.id,
|
||||||
|
latitude: item?.latitude,
|
||||||
|
longitude: item?.longitude,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})) || [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper style={{ paddingInline: 0, paddingBlock: 0 }}>
|
<ViewWrapper style={{ paddingInline: 0, paddingBlock: 0 }}>
|
||||||
{/* <MapCustom height={"100%"} /> */}
|
<MapsV2Custom markers={markers} />
|
||||||
<View style={{ flex: 1 }}>
|
|
||||||
{loadList ? (
|
|
||||||
<MapView
|
|
||||||
initialRegion={defaultRegion}
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
height: "100%",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<MapView
|
|
||||||
initialRegion={defaultRegion}
|
|
||||||
style={{
|
|
||||||
width: "100%",
|
|
||||||
height: "100%",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{list?.map((item: any, index: number) => {
|
|
||||||
return (
|
|
||||||
<Marker
|
|
||||||
key={item?.id}
|
|
||||||
coordinate={{
|
|
||||||
latitude: item?.latitude,
|
|
||||||
longitude: item?.longitude,
|
|
||||||
}}
|
|
||||||
title={item?.namePin}
|
|
||||||
onPress={() => {
|
|
||||||
setOpenDrawer(true);
|
|
||||||
setSelected({
|
|
||||||
id: item?.id,
|
|
||||||
bidangBisnis:
|
|
||||||
item?.Portofolio?.MasterBidangBisnis?.name,
|
|
||||||
nomorTelepon: item?.Portofolio?.tlpn,
|
|
||||||
alamatBisnis: item?.Portofolio?.alamatKantor,
|
|
||||||
namePin: item?.namePin,
|
|
||||||
imageId: item?.imageId,
|
|
||||||
portofolioId: item?.Portofolio?.id,
|
|
||||||
latitude: item?.latitude,
|
|
||||||
longitude: item?.longitude,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
// Gunakan gambar kustom jika tersedia
|
|
||||||
>
|
|
||||||
<View>
|
|
||||||
<Image
|
|
||||||
source={{
|
|
||||||
uri: API_IMAGE.GET({
|
|
||||||
fileId: item?.Portofolio?.logoId,
|
|
||||||
}),
|
|
||||||
}}
|
|
||||||
style={{
|
|
||||||
width: 30,
|
|
||||||
height: 30,
|
|
||||||
borderRadius: 100,
|
|
||||||
borderWidth: 1,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</Marker>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</MapView>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
|
|
||||||
<DrawerCustom
|
<DrawerCustom
|
||||||
@@ -147,7 +85,9 @@ export default function AdminMaps() {
|
|||||||
closeDrawer={() => setOpenDrawer(false)}
|
closeDrawer={() => setOpenDrawer(false)}
|
||||||
height={"auto"}
|
height={"auto"}
|
||||||
>
|
>
|
||||||
<DummyLandscapeImage height={200} imageId={selected.imageId} />
|
{selected.imageId && (
|
||||||
|
<DummyLandscapeImage height={200} imageId={selected.imageId} />
|
||||||
|
)}
|
||||||
<Spacing />
|
<Spacing />
|
||||||
<StackCustom gap={"xs"}>
|
<StackCustom gap={"xs"}>
|
||||||
<GridTwoView
|
<GridTwoView
|
||||||
|
|||||||
@@ -176,6 +176,10 @@
|
|||||||
9B007D2599C64C7F8F525B86 /* Remove signature files (Xcode workaround) */,
|
9B007D2599C64C7F8F525B86 /* Remove signature files (Xcode workaround) */,
|
||||||
1393AE9C86924FA8B1F8D11E /* Remove signature files (Xcode workaround) */,
|
1393AE9C86924FA8B1F8D11E /* Remove signature files (Xcode workaround) */,
|
||||||
E1F9AE3DCABE4A088A05E180 /* Remove signature files (Xcode workaround) */,
|
E1F9AE3DCABE4A088A05E180 /* Remove signature files (Xcode workaround) */,
|
||||||
|
211F6E22A1B24524B67693F8 /* Remove signature files (Xcode workaround) */,
|
||||||
|
469F2CAA8928481CA86EB0F4 /* Remove signature files (Xcode workaround) */,
|
||||||
|
0F9297956F4F4FC9881920F8 /* Remove signature files (Xcode workaround) */,
|
||||||
|
058D2457CFA64FD9AC31C74F /* Remove signature files (Xcode workaround) */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -869,6 +873,74 @@
|
|||||||
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
211F6E22A1B24524B67693F8 /* Remove signature files (Xcode workaround) */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
name = "Remove signature files (Xcode workaround)";
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "
|
||||||
|
echo \"Remove signature files (Xcode workaround)\";
|
||||||
|
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||||
|
";
|
||||||
|
};
|
||||||
|
469F2CAA8928481CA86EB0F4 /* Remove signature files (Xcode workaround) */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
name = "Remove signature files (Xcode workaround)";
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "
|
||||||
|
echo \"Remove signature files (Xcode workaround)\";
|
||||||
|
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||||
|
";
|
||||||
|
};
|
||||||
|
0F9297956F4F4FC9881920F8 /* Remove signature files (Xcode workaround) */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
name = "Remove signature files (Xcode workaround)";
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "
|
||||||
|
echo \"Remove signature files (Xcode workaround)\";
|
||||||
|
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||||
|
";
|
||||||
|
};
|
||||||
|
058D2457CFA64FD9AC31C74F /* Remove signature files (Xcode workaround) */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
name = "Remove signature files (Xcode workaround)";
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "
|
||||||
|
echo \"Remove signature files (Xcode workaround)\";
|
||||||
|
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||||
|
";
|
||||||
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
|||||||
@@ -1,41 +1,15 @@
|
|||||||
import { ClickableCustom, TextCustom } from "@/components";
|
import { ClickableCustom, TextCustom } from "@/components";
|
||||||
import Spacing from "@/components/_ShareComponent/Spacing";
|
import Spacing from "@/components/_ShareComponent/Spacing";
|
||||||
import React, { useCallback, useState } from "react";
|
import { router } from "expo-router";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
import Icon from "react-native-vector-icons/FontAwesome";
|
import Icon from "react-native-vector-icons/FontAwesome";
|
||||||
import { stylesHome } from "./homeViewStyle";
|
import { stylesHome } from "./homeViewStyle";
|
||||||
import { router, useFocusEffect } from "expo-router";
|
|
||||||
import { apiJobGetAll } from "@/service/api-client/api-job";
|
|
||||||
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
|
||||||
|
|
||||||
export default function Home_BottomFeatureSection() {
|
|
||||||
const [listData, setListData] = useState<any[] | null>(null);
|
|
||||||
|
|
||||||
const onLoadData = async () => {
|
|
||||||
try {
|
|
||||||
const response = await apiJobGetAll({
|
|
||||||
category: "beranda",
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log("[DATA JOB]", JSON.stringify(response.data, null, 2));
|
|
||||||
const result = response.data
|
|
||||||
.sort(
|
|
||||||
(a: any, b: any) =>
|
|
||||||
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
||||||
)
|
|
||||||
.slice(0, 2);
|
|
||||||
setListData(result);
|
|
||||||
} catch (error) {
|
|
||||||
console.log("[ERROR]", error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useFocusEffect(
|
|
||||||
useCallback(() => {
|
|
||||||
onLoadData();
|
|
||||||
}, [])
|
|
||||||
);
|
|
||||||
|
|
||||||
|
export default function Home_BottomFeatureSection({
|
||||||
|
listData,
|
||||||
|
}: {
|
||||||
|
listData: any[] | null;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ClickableCustom onPress={() => router.push("/job")}>
|
<ClickableCustom onPress={() => router.push("/job")}>
|
||||||
|
|||||||
@@ -139,8 +139,8 @@ export default function UserSearchMainView_V2() {
|
|||||||
searchQuery: search,
|
searchQuery: search,
|
||||||
emptyMessage: "Tidak ada pengguna ditemukan",
|
emptyMessage: "Tidak ada pengguna ditemukan",
|
||||||
emptySearchMessage: "Tidak ada hasil pencarian",
|
emptySearchMessage: "Tidak ada hasil pencarian",
|
||||||
skeletonCount: 5,
|
skeletonCount: PAGINATION_DEFAULT_TAKE,
|
||||||
skeletonHeight: 150,
|
skeletonHeight: 100,
|
||||||
loadingFooterText: "Memuat lebih banyak pengguna...",
|
loadingFooterText: "Memuat lebih banyak pengguna...",
|
||||||
isInitialLoad,
|
isInitialLoad,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user