-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flexibleidealist/applicants screen styling #72
base: native-development
Are you sure you want to change the base?
Changes from 2 commits
c7bf2b8
c0adabf
58a997f
88b7c67
15b25ba
375220c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<ScrollView> | ||
<Text>Applications</Text> | ||
<RoleList | ||
applicants={engineers} | ||
navigation={navigation} | ||
role={'Software Developers'} | ||
role={'Software Engineers'} | ||
currProject={currProject} | ||
/> | ||
<Text>{'\nJUST A DIVIDER \n DONT MIND ME \n DELETE ME AFTER \n'}</Text> | ||
<RoleList | ||
applicants={designers} | ||
navigation={navigation} | ||
|
@@ -74,7 +68,7 @@ const RoleList = ({ applicants, navigation, role, currProject }) => { | |
return ( | ||
<View> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The container for each RoleList should have at least a 40px between each RoleList component, drew a line on figma to measure the distance |
||
{loadMore && <Button title="Show less" onPress={() => handleToggle(toggleLoadMore)} />} | ||
<Text>{role}</Text> | ||
<Text style={styles.largerText}>{role}</Text> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The styling for this text box is not the same color (#505050) , size (18), or margin (centered with 15px on the left + right) as depicted on the figma |
||
{visibleList.map((applicant) => ( | ||
<TouchableOpacity | ||
key={uuid.v4()} | ||
|
@@ -87,21 +81,56 @@ const RoleList = ({ applicants, navigation, role, currProject }) => { | |
}} | ||
> | ||
<View> | ||
<View> | ||
<View style={styles.applicantInfo}> | ||
<Text>IMAGE</Text> | ||
flexibleidealist marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Text | ||
style={styles.boldText} | ||
>{`${applicant.first_name} ${applicant.last_name}`}</Text> | ||
<Text style={styles.boldText}>{`${applicant.role}`}</Text> | ||
</View> | ||
<Text>{`${applicant.first_name} ${applicant.last_name}`}</Text> | ||
<Text>{applicant.role}</Text> | ||
<Text>PERSONAL MESSAGE FROM APPLICANT</Text> | ||
<Text | ||
style={styles.applicantMessage} | ||
>{`here is a personal message from ${applicant.first_name} about their application for this project and expressing their interest`}</Text> | ||
</View> | ||
</TouchableOpacity> | ||
))} | ||
{!loadMore && applicants.length > 3 && ( | ||
<Button title="Load more..." onPress={() => handleToggle(toggleLoadMore)} /> | ||
<View style={styles.buttonContainer}> | ||
<Button title="Load more..." onPress={() => handleToggle(toggleLoadMore)} /> | ||
</View> | ||
)} | ||
</View> | ||
); | ||
} else { | ||
return <Text>Loading or no applicants.</Text>; | ||
} | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
applicantInfo: { | ||
display: 'flex', | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
marginTop: 10, | ||
marginBottom: 10, | ||
paddingLeft: 15, | ||
paddingRight: 15, | ||
}, | ||
applicantMessage: { | ||
textAlign: 'justify', | ||
paddingRight: 25, | ||
paddingLeft: 30, | ||
}, | ||
boldText: { | ||
fontWeight: 'bold', | ||
}, | ||
buttonContainer: { | ||
display: 'flex', | ||
flexDirection: 'row', | ||
justifyContent: 'flex-start', | ||
paddingLeft: 10, | ||
}, | ||
largerText: { | ||
fontSize: 16, | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed over stand-up; decided on reolcating applicant logic to backend instead
New flow would look like:
Owner views their project ->
Clicks on "all applicants" ->
On navigation to
Applicants
, projectID is passed in as a prop ->Applicants
screen uses the project ID to call an "applicants only" endpoint ->backend will fetch the applicants list from DB then fetch each individual user's object mainly for their name, image, and role ->
then filter through these users to separate them by role ->
package the response as an object with a property for each role (each role will have an array as a value full of those role-specific users) ->
Frontend will use this response to generate the lists again