Fakultas Ilmu Komputer UI

Commit 5af06442 authored by angelin depthios's avatar angelin depthios
Browse files

Merge branch 'master' into 'business-Eco-Screen'

# Conflicts:
#   src/navigation/RootNavigator.tsx
#   src/screens/ecosystem/BusinessEcosystemScreen.tsx
parents 88cafcdb 66bb9b6f
Pipeline #86158 passed with stage
in 10 minutes and 36 seconds
...@@ -19,11 +19,11 @@ const PlainButton = ({ text, desc, onPress, descText }: props) => { ...@@ -19,11 +19,11 @@ const PlainButton = ({ text, desc, onPress, descText }: props) => {
<View style={{ marginRight: 3 }}> <View style={{ marginRight: 3 }}>
<MaterialIcons <MaterialIcons
name="group" name="group"
size={15} size={18}
color={Colors.icon.tab.inactive} color={Colors.icon.tab.inactive}
/> />
</View> </View>
<View style={{ flex: 1, paddingRight: 7 }}> <View style={{ flex: 1, paddingRight: 8 }}>
<Text style={styles.descText}>{descText}</Text> <Text style={styles.descText}>{descText}</Text>
</View> </View>
</View> </View>
...@@ -36,7 +36,7 @@ const PlainButton = ({ text, desc, onPress, descText }: props) => { ...@@ -36,7 +36,7 @@ const PlainButton = ({ text, desc, onPress, descText }: props) => {
}} }}
name="keyboard-arrow-right" name="keyboard-arrow-right"
size={24} size={24}
color="#666666" color={Colors.text.body}
/> />
</View> </View>
</TouchableOpacity> </TouchableOpacity>
...@@ -67,7 +67,7 @@ const styles = StyleSheet.create({ ...@@ -67,7 +67,7 @@ const styles = StyleSheet.create({
}, },
texts: { texts: {
fontWeight: "300", fontWeight: "300",
width: 307, width: "100%",
fontSize: 16, fontSize: 16,
textAlign: "left", textAlign: "left",
textAlignVertical: "center", textAlignVertical: "center",
......
import { IData } from "react-native-section-alphabet-list";
import { getCategories } from "../service/firestore/categories";
export const iDataConverter = <T>(
key: string,
value: string,
list: T[]
): IData[] => {
const newIdata: IData[] = [];
list.forEach((e) => {
newIdata.push({
key: e[key],
value: e[value],
});
});
return newIdata;
};
export const getCategoriesAsIData = async (): Promise<IData[]> => {
const categories = await getCategories();
return iDataConverter("id", "name", categories);
};
import { getCategories } from "../service/firestore/categories";
import { IDD } from "../types/firestore"; import { IDD } from "../types/firestore";
export const ddConverter = <T,>( export const ddConverter = <T,>(
...@@ -16,3 +17,8 @@ export const ddConverter = <T,>( ...@@ -16,3 +17,8 @@ export const ddConverter = <T,>(
return newIdd; return newIdd;
}; };
export const getCategoriesAsDdFormat = async (): Promise<IDD[]> => {
const categories = await getCategories();
return ddConverter("name", "id", categories);
};
...@@ -2,18 +2,13 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack"; ...@@ -2,18 +2,13 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack";
import React from "react"; import React from "react";
import BusinessEcosystemScreen from "../screens/ecosystem/BusinessEcosystemScreen"; import BusinessEcosystemScreen from "../screens/ecosystem/BusinessEcosystemScreen";
import { EcosystemStackParamList } from "../types/navigation/EcosystemStack"; import { EcosystemStackParamList } from "../types/navigation/EcosystemStack";
import {
PopularEcosystemScreen,
JoinedEcosystemScreen,
MyEcosystemScreen,
LatestEcosystemScreen,
} from "../screens/ecosystem/recomendation";
import { import {
BusinessCategoryScreen, BusinessCategoryScreen,
BusinessListScreen, BusinessListScreen,
EcosystemDetailScreen, EcosystemDetailScreen,
EcosystemListScreen, EcosystemListScreen,
EcosystemMapScreen, EcosystemMapScreen,
RecommendedEcosystemScreen,
} from "../screens/ecosystem"; } from "../screens/ecosystem";
const EcosystemStack = createNativeStackNavigator<EcosystemStackParamList>(); const EcosystemStack = createNativeStackNavigator<EcosystemStackParamList>();
...@@ -27,24 +22,12 @@ const EcosystemStackNavigator = () => { ...@@ -27,24 +22,12 @@ const EcosystemStackNavigator = () => {
options={{ headerShown: false }} options={{ headerShown: false }}
/> />
<EcosystemStack.Screen <EcosystemStack.Screen
name="MyEcosystem" name="Recommended"
component={MyEcosystemScreen} component={RecommendedEcosystemScreen}
options={{ title: "Ekosistem Saya" }} initialParams={{
/> headerTitle: "",
<EcosystemStack.Screen }}
name="Joined" options={({ route }) => ({ title: route.params.headerTitle })}
component={JoinedEcosystemScreen}
options={{ title: "Sudah Bergabung" }}
/>
<EcosystemStack.Screen
name="Popular"
component={PopularEcosystemScreen}
options={{ title: "Paling Populer" }}
/>
<EcosystemStack.Screen
name="Latest"
component={LatestEcosystemScreen}
options={{ title: "Terbaru Minggu Ini" }}
/> />
<EcosystemStack.Screen <EcosystemStack.Screen
name="BusinessCategory" name="BusinessCategory"
......
...@@ -73,11 +73,6 @@ const RootNavigator = () => { ...@@ -73,11 +73,6 @@ const RootNavigator = () => {
component={SuccessChangePasswordScreen} component={SuccessChangePasswordScreen}
options={{ headerShown: false }} options={{ headerShown: false }}
/> />
{/* <RootStack.Screen
name="CreateBusinessEcosystem"
component={CreateBusinessEcosystemScreen}
options={{ title: "" }}
/> */}
</RootStack.Navigator> </RootStack.Navigator>
) : ( ) : (
<RootStack.Navigator> <RootStack.Navigator>
......
import { Text, View } from "../../components/Themed"; import { Text, View } from "../../components/Themed";
import * as React from "react"; import * as React from "react";
import { useState } from "react"; import { useState, useEffect } from "react";
import { ScrollView, StyleSheet } from "react-native"; import { ScrollView, StyleSheet } from "react-native";
import PlainForm from "../../components/Forms/PlainForm"; import PlainForm from "../../components/Forms/PlainForm";
import Spacer from "../../components/Spacer/Spacer"; import Spacer from "../../components/Spacer/Spacer";
...@@ -8,6 +8,8 @@ import MainButton from "../../components/button/MainButton"; ...@@ -8,6 +8,8 @@ import MainButton from "../../components/button/MainButton";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
import DropdownForm from "../../components/Forms/DropdownForm"; import DropdownForm from "../../components/Forms/DropdownForm";
import { RootTabScreenProps } from "../../types/navigation"; import { RootTabScreenProps } from "../../types/navigation";
import { getCategoriesAsDdFormat } from "../../helpers/ddConverter";
import { IDD } from "../../types/firestore";
const RegisterGoogleFacebookScreen = ({ const RegisterGoogleFacebookScreen = ({
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
...@@ -17,26 +19,10 @@ const RegisterGoogleFacebookScreen = ({ ...@@ -17,26 +19,10 @@ const RegisterGoogleFacebookScreen = ({
const [lastName, setLastName] = useState(""); const [lastName, setLastName] = useState("");
const [phoneNo, setPhoneNo] = useState(""); const [phoneNo, setPhoneNo] = useState("");
const [picked, setPicked] = useState(""); const [picked, setPicked] = useState("");
const [categories, setCategories] = useState([ const [categories, setCategories] = useState<IDD[]>([]);
{ label: "Agrikultur", value: "B" }, useEffect(() => {
{ label: "Pertanian", value: "D" }, getCategoriesAsDdFormat().then((res) => setCategories(res));
{ label: "Pertambangan", value: "E" }, });
{ label: "Perikanan", value: "F" },
{ label: "Real Estat", value: "G" },
{ label: "Makanan dan Minuman", value: "H" },
{ label: "Otomotif", value: "I" },
{ label: "Industri Berat", value: "J" },
{ label: "Pengolahan Bahan Mentah", value: "K" },
{ label: "Distributor", value: "L" },
{ label: "Pasar Modal", value: "M" },
]);
// const [categories, setCategories] = useState<IDD[]>();
//
// useEffect(() => {
// getCategories().then((res) =>
// setCategories(ddConverter<ICategory>("name", "id", res))
// );
// }, []);
return ( return (
<View style={styles.container}> <View style={styles.container}>
......
import { Text, View } from "../../components/Themed"; import { Text, View } from "../../components/Themed";
import * as React from "react"; import * as React from "react";
import { useState } from "react"; import { useState, useEffect } from "react";
import { ScrollView, StyleSheet, Alert } from "react-native"; import { ScrollView, StyleSheet, Alert } from "react-native";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
import PlainForm from "../../components/Forms/PlainForm"; import PlainForm from "../../components/Forms/PlainForm";
...@@ -13,6 +13,8 @@ import { useNavigation } from "@react-navigation/core"; ...@@ -13,6 +13,8 @@ import { useNavigation } from "@react-navigation/core";
import { validateEmail, validateEmpty } from "../../helpers/Validators"; import { validateEmail, validateEmpty } from "../../helpers/Validators";
import { useAppDispatch } from "../../hooks/reduxHooks"; import { useAppDispatch } from "../../hooks/reduxHooks";
import { signupUser } from "../../redux/user/actions"; import { signupUser } from "../../redux/user/actions";
import { IDD } from "../../types/firestore";
import { getCategoriesAsDdFormat } from "../../helpers/ddConverter";
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => { const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
...@@ -24,26 +26,12 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => { ...@@ -24,26 +26,12 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
const [phoneNo, setPhoneNo] = useState(""); const [phoneNo, setPhoneNo] = useState("");
const [picked, setPicked] = useState(""); const [picked, setPicked] = useState("");
// TODO: Use getCategories firestore function to fetch categories const [categories, setCategories] = useState<IDD[]>([]);
const [categories, setCategories] = useState([ useEffect(() => {
{ label: "Agrikultur", value: "B" }, getCategoriesAsDdFormat().then((res) => setCategories(res));
{ label: "Pertanian", value: "D" }, });
{ label: "Pertambangan", value: "E" },
{ label: "Perikanan", value: "F" },
{ label: "Real Estat", value: "G" },
{ label: "Makanan dan Minuman", value: "H" },
{ label: "Otomotif", value: "I" },
{ label: "Industri Berat", value: "J" },
{ label: "Pengolahan Bahan Mentah", value: "K" },
{ label: "Distributor", value: "L" },
{ label: "Pasar Modal", value: "M" },
]);
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
// useEffect(() => {
// getCategories().then((res) =>
// setCategories(ddConverter<ICategory>("name", "id", res))
// );
// }, []);
const handleSubmit = () => { const handleSubmit = () => {
if ( if (
......
...@@ -3,34 +3,15 @@ import { StyleSheet } from "react-native"; ...@@ -3,34 +3,15 @@ import { StyleSheet } from "react-native";
import { View } from "../../components/Themed"; import { View } from "../../components/Themed";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
import AlphabetGroupList from "../../components/GroupList/AlphabetGroupList"; import AlphabetGroupList from "../../components/GroupList/AlphabetGroupList";
import { useState, useEffect } from "react";
import { getCategoriesAsIData } from "../../helpers/alphabetConverter";
import { IData } from "react-native-section-alphabet-list";
const BusinessCategoryScreen = () => { const BusinessCategoryScreen = () => {
const data = [ const [data, setData] = useState<IData[]>([]);
{ value: "Accomodation and Food Services", key: "1" }, useEffect(() => {
{ getCategoriesAsIData().then((res) => setData(res));
value: });
"Administrative and Support and Waste Management and Remediation Services",
key: "2",
},
{ value: "Agriculture, Forestry, Fishing, and Hunting", key: "3" },
{ value: "Arts, Entertainment, and Recreation", key: "4" },
{ value: "Construction", key: "5" },
{ value: "Educational Services", key: "6" },
{ value: "Finance and Insurance", key: "7" },
{ value: "Health Care and Social Assistance", key: "8" },
{ value: "Management of Companies and Enterprises", key: "9" },
{ value: "Manufacturing", key: "10" },
{ value: "Mining, Quarrying, and Oil and Gas Extraction ", key: "11" },
{ value: "Other Services (Except Public Administration)", key: "12" },
{ value: "Professional, Scientific, and Technical Services", key: "13" },
{ value: "Public Administration", key: "14" },
{ value: "Real Estate and Rental and Leasing", key: "15" },
{ value: "Retail Trade", key: "16" },
{ value: "Transportation and Warehousing", key: "17" },
{ value: "Utilities", key: "18" },
{ value: "Umum", key: "19" },
{ value: "Wholesale Trade", key: "20" },
];
return ( return (
<View style={styles.container}> <View style={styles.container}>
......
...@@ -45,7 +45,19 @@ const BusinessEcosystemScreen = () => { ...@@ -45,7 +45,19 @@ const BusinessEcosystemScreen = () => {
</View> </View>
<Spacer variant="xl" /> <Spacer variant="xl" />
<View> <View>
<Text style={styles.text}>Ekosistem Bisnis</Text> <TouchableOpacity
onPress={() => {
nav.navigate("Ecosystem", {
screen: "Recommended",
params: {
headerTitle: "Ekosistem Saya",
toFetch: "MyEcosystem",
},
});
}}
>
<Text style={styles.link}>Ekosistem Saya</Text>
</TouchableOpacity>
</View> </View>
<Spacer variant="xl" /> <Spacer variant="xl" />
<View> <View>
......
import * as React from "react"; import * as React from "react";
import { StyleSheet } from "react-native"; import { Alert, StyleSheet } from "react-native";
import { Text, View } from "../../../components/Themed"; import { Text, View } from "../../components/Themed";
import Colors from "../../../constants/Colors"; import Colors from "../../constants/Colors";
import { EcosystemStackScreenProps } from "../../types/navigation";
const RecommendedEcosystemScreen = ({
route,
}: EcosystemStackScreenProps<"Recommended">) => {
const { toFetch } = route.params;
const JoinedEcosystemScreen = () => {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View> <View>
<Text>Layar Ekosistem Sudah Bergabung</Text> <Text onPress={() => Alert.alert(toFetch)}>
Layar Rekomendasi Ekosistem
</Text>
</View> </View>
</View> </View>
); );
...@@ -22,4 +29,4 @@ const styles = StyleSheet.create({ ...@@ -22,4 +29,4 @@ const styles = StyleSheet.create({
}, },
}); });
export default JoinedEcosystemScreen; export default RecommendedEcosystemScreen;
...@@ -3,6 +3,7 @@ import BusinessListScreen from "./BusinessListScreen"; ...@@ -3,6 +3,7 @@ import BusinessListScreen from "./BusinessListScreen";
import EcosystemDetailScreen from "./EcosystemDetailScreen"; import EcosystemDetailScreen from "./EcosystemDetailScreen";
import EcosystemListScreen from "./EcosystemListScreen"; import EcosystemListScreen from "./EcosystemListScreen";
import EcosystemMapScreen from "./EcosystemMapScreen"; import EcosystemMapScreen from "./EcosystemMapScreen";
import RecommendedEcosystemScreen from "./RecommendedEcosystemScreen";
export { export {
BusinessCategoryScreen, BusinessCategoryScreen,
...@@ -10,4 +11,5 @@ export { ...@@ -10,4 +11,5 @@ export {
EcosystemDetailScreen, EcosystemDetailScreen,
EcosystemListScreen, EcosystemListScreen,
EcosystemMapScreen, EcosystemMapScreen,
RecommendedEcosystemScreen,
}; };
import * as React from "react";
import { StyleSheet } from "react-native";
import { Text, View } from "../../../components/Themed";
import Colors from "../../../constants/Colors";
const LatestEcosystemScreen = () => {
return (
<View style={styles.container}>
<View>
<Text>Layar Ekosistem Terbaru</Text>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.background,
paddingHorizontal: 24,
justifyContent: "center",
},
});
export default LatestEcosystemScreen;
import * as React from "react";
import { StyleSheet } from "react-native";
import { Text, View } from "../../../components/Themed";
import Colors from "../../../constants/Colors";
const MyEcosystemScreen = () => {
return (
<View style={styles.container}>
<View>
<Text>Layar Ekosistem Saya</Text>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.background,
paddingHorizontal: 24,
justifyContent: "center",
},
});
export default MyEcosystemScreen;
import * as React from "react";
import { StyleSheet } from "react-native";
import { Text, View } from "../../../components/Themed";
import Colors from "../../../constants/Colors";
const PopularEcosystemScreen = () => {
return (
<View style={styles.container}>
<View>
<Text>Layar Ekosistem Populer</Text>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.background,
paddingHorizontal: 24,
justifyContent: "center",
},
});
export default PopularEcosystemScreen;
import JoinedEcosystemScreen from "./JoinedEcosystemScreen";
import MyEcosystemScreen from "./MyEcosystemScreen";
import PopularEcosystemScreen from "./PopularEcosystemScreen";
import LatestEcosystemScreen from "./LatestEcosystemScreen";
export {
PopularEcosystemScreen,
JoinedEcosystemScreen,
MyEcosystemScreen,
LatestEcosystemScreen,
};
...@@ -6,16 +6,13 @@ import { NativeStackScreenProps } from "@react-navigation/native-stack"; ...@@ -6,16 +6,13 @@ import { NativeStackScreenProps } from "@react-navigation/native-stack";
export type EcosystemStackParamList = { export type EcosystemStackParamList = {
BusinessEcosystem: undefined; BusinessEcosystem: undefined;
Joined: undefined;
Popular: undefined;
Latest: undefined;
MyEcosystem: undefined;
CreateEcosystem: undefined; CreateEcosystem: undefined;
BusinessCategory: undefined; BusinessCategory: undefined;
EcosystemList: { headerTitle: string }; EcosystemList: { headerTitle: string };
EcosystemMap: undefined; EcosystemMap: undefined;
BusinessList: { headerTitle: string }; BusinessList: { headerTitle: string };
EcosystemDetails: { headerTitle: string }; EcosystemDetails: { headerTitle: string };
Recommended: { headerTitle: string; toFetch: string };
}; };
export type EcosystemStackScreenProps< export type EcosystemStackScreenProps<
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment