diff --git a/native/components/OwnerView/OwnerView.jsx b/native/components/OwnerView/OwnerView.jsx index 8e809d1a4..1567f0cc5 100644 --- a/native/components/OwnerView/OwnerView.jsx +++ b/native/components/OwnerView/OwnerView.jsx @@ -13,9 +13,10 @@ export function OwnerView({ project }) { }); }; - const showApplicants = (id) => { + const showApplicants = (project, applicants) => { navigation.navigate('Applicants', { - projectID: id, + project: project, + applicants: applicants, }); }; useEffect(() => { @@ -43,7 +44,7 @@ export function OwnerView({ project }) { ))} {project.interested_applicants.length > 3 ? ( - showApplicants(project._id)}> + showApplicants(project, applicants)}> {`See all ${project.interested_applicants.length} applicants`} ) : null} diff --git a/native/screens/Applicants/Applicants.jsx b/native/screens/Applicants/Applicants.jsx index 34d87e8b9..2f83ec966 100644 --- a/native/screens/Applicants/Applicants.jsx +++ b/native/screens/Applicants/Applicants.jsx @@ -1,9 +1,8 @@ -import { Button, Text, TouchableOpacity, ScrollView, View } from 'react-native'; +import { Button, Text, TouchableOpacity, ScrollView, StyleSheet, View } from 'react-native'; import { useEffect, useState } from 'react'; import { useSelector } from 'react-redux'; import uuid from 'react-native-uuid'; import { handleToggle } from '../../services/utils/handlers'; -import { getOneProject } from '../../services/api/projects'; export const Applicants = ({ navigation, route }) => { const soloProject = useSelector((state) => state.projects.allProjects[0]); @@ -13,19 +12,16 @@ export const Applicants = ({ navigation, route }) => { useEffect(() => { const setProject = async () => { - let fetchedProject; - if (!route.params) { - fetchedProject = soloProject; + setCurrProject(soloProject); // ultimately we shouldn't need this, since this screen only comes from SingleProject screen } else { - fetchedProject = await getOneProject(route.params.projectID); // must be tested + setCurrProject(route.params.project); } const filterRoles = (role) => { - return fetchedProject.interested_applicants?.filter((applicant) => applicant.role === role); + return route.params.applicants.filter((applicant) => applicant.role === role); }; - setCurrProject(fetchedProject); setEngineers(() => filterRoles('Software Engineer')); setDesigners(() => filterRoles('UX Designer')); }; @@ -35,14 +31,12 @@ export const Applicants = ({ navigation, route }) => { if (currProject) { return ( - Applications - {'\nJUST A DIVIDER \n DONT MIND ME \n DELETE ME AFTER \n'} { return ( {loadMore &&