Fakultas Ilmu Komputer UI

Commit fae1a2bc authored by Faraz's avatar Faraz
Browse files

refactor: fix lint

parent 15734e32
Pipeline #86250 passed with stage
in 15 minutes and 43 seconds
// import { useNavigation } from "@react-navigation/core";
// import React from "react";
// import { StyleSheet } from "react-native";
// import { TouchableOpacity } from "react-native-gesture-handler";
// import SmallButton from "../../components/button/SmallButton";
// import Spacer from "../../components/Spacer/Spacer";
// import { Text, View } from "../../components/Themed";
// import Colors from "../../constants/Colors";
// import { useUser } from "../../hooks/reduxHooks";
// import ecosystemService from "../../service/firestore/ecosystem";
// import { createEcosystem } from "../../service/functions/createEcosystem";
//
// const BusinessEcosystemScreen = () => {
// const nav = useNavigation();
// const user = useUser();
//
// return (
// <View style={styles.container}>
// <View>
// <Text>Ekosistem Bisnis</Text>
// </View>
// <Spacer variant="xl" />
// <SmallButton
// colors="primary"
// text="Buat Ekosistem Bisnis"
// onPress={() => {
// nav.navigate("CreateEcosystem", {
// screen: "CreateEcosystem",
// });
// }}
// />
// <Spacer variant="xl" />
// <View>
// <TouchableOpacity
// onPress={() => {
// nav.navigate("Ecosystem", {
// screen: "Recommended",
// params: {
// headerTitle: "Ekosistem Saya",
// toFetch: "myEcosystem",
// },
// });
// }}
// >
// <Text style={styles.link}>Ekosistem Saya</Text>
// </TouchableOpacity>
// </View>
// <Spacer variant="xl" />
// <View>
// <TouchableOpacity
// onPress={() => {
// nav.navigate("Ecosystem", { screen: "EcosystemDetails" });
// }}
// >
// <Text style={styles.link}>Sudah Bergabung</Text>
// </TouchableOpacity>
// </View>
// <Spacer variant="xl" />
// <View>
// <TouchableOpacity
// onPress={() => {
// nav.navigate("Ecosystem", {
// screen: "BusinessCategory",
// });
// }}
// >
// <Text style={styles.link}>Kategori Bisnis</Text>
// </TouchableOpacity>
// </View>
// <Spacer variant="xl" />
// <View>
// <TouchableOpacity
// onPress={() => {
// nav.navigate("Ecosystem", {
// screen: "Recommended",
// params: {
// headerTitle: "Paling Populer",
// toFetch: "popular",
// },
// });
// }}
// >
// <Text style={styles.link}>Paling Populer</Text>
// </TouchableOpacity>
// </View>
// <Spacer variant="xl" />
// <View>
// <TouchableOpacity
// onPress={() => {
// nav.navigate("Ecosystem", {
// screen: "Recommended",
// params: {
// headerTitle: "Terbaru Minggu Ini",
// toFetch: "mostRecent",
// },
// });
// }}
// >
// <Text style={styles.link}>Terbaru Minggu Ini</Text>
// </TouchableOpacity>
// </View>
// <Spacer variant="xl" />
// <View>
// <TouchableOpacity
// onPress={() => {
// nav.navigate("Ecosystem", { screen: "EcosystemMap" });
// }}
// >
// <Text style={styles.link}>Peta Ekosistem</Text>
// </TouchableOpacity>
// </View>
// <View>
// <TouchableOpacity
// onPress={() => {
// createEcosystem({
// ecosystem: {
// creatorId: "abc",
// name: "cebetEco",
// description: "abc",
// categoryId: "A",
// pic: "",
// rating: 0,
// raters: 0,
// followerCount: 0,
// visibility: "public",
// },
// ecosystemCategoryMembers: [
// {
// categoryMember: {
// categoryId: "B",
// type: "supplier",
// },
// ecosystemMemberships: [
// {
// userId: "7n8uc62bS6UGUl29fODxIp7PAdn2",
// },
// ],
// },
// {
// categoryMember: {
// categoryId: "D",
// type: "supplier",
// },
// ecosystemMemberships: [
// {
// userId: "abciuh3789489ho340hdf",
// },
// {
// userId: "sdfbubsdyuibabciuh3789489ho340h df",
// },
// {
// userId: "uihgybubsdyuibabciuh3789489ho340h df",
// },
// ],
// },
// ],
// });
// }}
// >
// <Text style={styles.link}>Create</Text>
// </TouchableOpacity>
// </View>
// <View>
// <TouchableOpacity
// onPress={() => {
// ecosystemService.followEcosystem("FmclOe2dvRbIi7B2Ja5k", user.id);
// }}
// >
// <Text style={styles.link}>Follow</Text>
// </TouchableOpacity>
// </View>
// <View>
// <TouchableOpacity
// onPress={() => {
// ecosystemService.unfollowEcosystem("FmclOe2dvRbIi7B2Ja5k", user.id);
// }}
// >
// <Text style={styles.link}>Unfollow</Text>
// </TouchableOpacity>
// </View>
// </View>
// );
// };
//
// const styles = StyleSheet.create({
// container: {
// flex: 1,
// backgroundColor: Colors.background,
// paddingHorizontal: 24,
// justifyContent: "center",
// },
// link: {
// color: Colors.text.link,
// fontStyle: "normal",
// fontSize: 14,
// fontWeight: "400",
// },
// });
//
// export default BusinessEcosystemScreen;
import { useNavigation } from "@react-navigation/core";
import React from "react";
import { StyleSheet } from "react-native";
import { TouchableOpacity } from "react-native-gesture-handler";
import SmallButton from "../../components/button/SmallButton";
import Spacer from "../../components/Spacer/Spacer";
import { Text, View } from "../../components/Themed";
import Colors from "../../constants/Colors";
import { useUser } from "../../hooks/reduxHooks";
import ecosystemService from "../../service/firestore/ecosystem";
import { createEcosystem } from "../../service/functions/createEcosystem";
const BusinessEcosystemScreen = () => {
const nav = useNavigation();
const user = useUser();
return (
<View style={styles.container}>
<View>
<Text>Ekosistem Bisnis</Text>
</View>
<Spacer variant="xl" />
<SmallButton
colors="primary"
text="Buat Ekosistem Bisnis"
onPress={() => {
nav.navigate("CreateEcosystem", {
screen: "CreateEcosystem",
});
}}
/>
<Spacer variant="xl" />
<View>
<TouchableOpacity
onPress={() => {
nav.navigate("Ecosystem", {
screen: "Recommended",
params: {
headerTitle: "Ekosistem Saya",
toFetch: "myEcosystem",
},
});
}}
>
<Text style={styles.link}>Ekosistem Saya</Text>
</TouchableOpacity>
</View>
<Spacer variant="xl" />
<View>
<TouchableOpacity
onPress={() => {
nav.navigate("Ecosystem", { screen: "EcosystemDetails" });
}}
>
<Text style={styles.link}>Sudah Bergabung</Text>
</TouchableOpacity>
</View>
<Spacer variant="xl" />
<View>
<TouchableOpacity
onPress={() => {
nav.navigate("Ecosystem", {
screen: "BusinessCategory",
params: {
fromScreen: "BusinessEcosystem",
},
});
}}
>
<Text style={styles.link}>Kategori Bisnis</Text>
</TouchableOpacity>
</View>
<Spacer variant="xl" />
<View>
<TouchableOpacity
onPress={() => {
nav.navigate("Ecosystem", {
screen: "Recommended",
params: {
headerTitle: "Paling Populer",
toFetch: "popular",
},
});
}}
>
<Text style={styles.link}>Paling Populer</Text>
</TouchableOpacity>
</View>
<Spacer variant="xl" />
<View>
<TouchableOpacity
onPress={() => {
nav.navigate("Ecosystem", {
screen: "Recommended",
params: {
headerTitle: "Terbaru Minggu Ini",
toFetch: "mostRecent",
},
});
}}
>
<Text style={styles.link}>Terbaru Minggu Ini</Text>
</TouchableOpacity>
</View>
<Spacer variant="xl" />
<View>
<TouchableOpacity
onPress={() => {
nav.navigate("Ecosystem", { screen: "EcosystemMap" });
}}
>
<Text style={styles.link}>Peta Ekosistem</Text>
</TouchableOpacity>
</View>
<View>
<TouchableOpacity
onPress={() => {
createEcosystem({
ecosystem: {
creatorId: "abc",
name: "cebetEco",
description: "abc",
categoryId: "A",
pic: "",
rating: 0,
raters: 0,
followerCount: 0,
visibility: "public",
},
ecosystemCategoryMembers: [
{
categoryMember: {
categoryId: "B",
type: "supplier",
},
ecosystemMemberships: [
{
userId: "7n8uc62bS6UGUl29fODxIp7PAdn2",
},
],
},
{
categoryMember: {
categoryId: "D",
type: "supplier",
},
ecosystemMemberships: [
{
userId: "abciuh3789489ho340hdf",
},
{
userId: "sdfbubsdyuibabciuh3789489ho340h df",
},
{
userId: "uihgybubsdyuibabciuh3789489ho340h df",
},
],
},
],
});
}}
>
<Text style={styles.link}>Create</Text>
</TouchableOpacity>
</View>
<View>
<TouchableOpacity
onPress={() => {
ecosystemService.followEcosystem("FmclOe2dvRbIi7B2Ja5k", user.id);
}}
>
<Text style={styles.link}>Follow</Text>
</TouchableOpacity>
</View>
<View>
<TouchableOpacity
onPress={() => {
ecosystemService.unfollowEcosystem("FmclOe2dvRbIi7B2Ja5k", user.id);
}}
>
<Text style={styles.link}>Unfollow</Text>
</TouchableOpacity>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.background,
paddingHorizontal: 24,
justifyContent: "center",
},
link: {
color: Colors.text.link,
fontStyle: "normal",
fontSize: 14,
fontWeight: "400",
},
});
export default BusinessEcosystemScreen;
// import axios from "axios";
// import { CLOUD_FUNCTIONS_URL } from "../../constants/urls";
// import { getEnv } from "../../helpers/getEnv";
// import { IEcosystemCategoryMember } from "../../types/firestore/ecosystemCategoryMember";
// import { IEcosystemMembership } from "../../types/firestore/ecosystemMembership";
// import { IEcosystem } from "../../types/firestore/ecosystems";
//
// export type createEcosystemParams = {
// ecosystem: IEcosystem;
// ecosystemCategoryMembers: {
// categoryMember: IEcosystemCategoryMember;
// ecosystemMemberships: IEcosystemMembership[];
// }[];
// };
//
// export const createEcosystem = async ({
// ecosystem,
// ecosystemCategoryMembers,
// }: createEcosystemParams) => {
// const res = await axios.post(
// `${CLOUD_FUNCTIONS_URL}/createEcosystem`,
// {
// ecosystem: ecosystem,
// ecosystemCategoryMembers: ecosystemCategoryMembers,
// env: getEnv(),
// },
// {
// headers: {
// "Content-Type": "application/json",
// },
// }
// );
// console.log(res);
// return res;
// };
import axios from "axios";
import { CLOUD_FUNCTIONS_URL } from "../../constants/urls";
import { getEnv } from "../../helpers/getEnv";
import { IEcosystemCategoryMember } from "../../types/firestore/ecosystemCategoryMember";
import { IEcosystemMembership } from "../../types/firestore/ecosystemMembership";
import { IEcosystem } from "../../types/firestore/ecosystems";
export type createEcosystemParams = {
ecosystem: IEcosystem;
ecosystemCategoryMembers: {
categoryMember: IEcosystemCategoryMember;
ecosystemMemberships: IEcosystemMembership[];
}[];
};
export const createEcosystem = async ({
ecosystem,
ecosystemCategoryMembers,
}: createEcosystemParams) => {
const res = await axios.post(
`${CLOUD_FUNCTIONS_URL}/createEcosystem`,
{
ecosystem: ecosystem,
ecosystemCategoryMembers: ecosystemCategoryMembers,
env: getEnv(),
},
{
headers: {
"Content-Type": "application/json",
},
}
);
console.log(res);
return res;
};
Markdown is supported
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