-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
288 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,66 @@ | ||
import React from 'react' | ||
import { StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native' | ||
import Feed from './Feed' | ||
import { useQuery, gql } from '@apollo/client'; | ||
import React from 'react'; | ||
import {StyleSheet} from 'react-native'; | ||
import {FontAwesome} from '@expo/vector-icons'; | ||
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; | ||
|
||
// const GET_TEST = gql` | ||
// query helpers { | ||
// tasks { | ||
// taskType | ||
// taskDescription | ||
// } | ||
// }` | ||
import JuniorFeed from './JuniorFeed'; | ||
import JuniorTickets from './JuniorTickets'; | ||
import JuniorProfile from './JuniorProfile'; | ||
|
||
const Tab = createBottomTabNavigator(); | ||
|
||
export default function JuniorDash() { | ||
// const { loading, error, data } = useQuery(GET_TEST); | ||
// if (loading) return <Text>Loading...</Text>; | ||
// if (error) return <Text>Error :( </Text>; | ||
|
||
// console.log('data', data) | ||
return ( | ||
<View style={styles.container}> | ||
<Text>Dashboard</Text> | ||
<Feed/> | ||
<View | ||
style={styles.buttonView} | ||
> | ||
<TouchableOpacity | ||
style={styles.tabs} | ||
> | ||
<Text>Open</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity | ||
style={styles.tabs} | ||
> | ||
<Text>Closed</Text> | ||
</TouchableOpacity> | ||
</View> | ||
</View> | ||
) | ||
<Tab.Navigator | ||
screenOptions={({route}) => ({ | ||
tabBarIcon: ({focused, color, size}) => { | ||
let iconName; | ||
|
||
if (route.name === 'Feed') { | ||
iconName = 'feed'; | ||
color = focused ? 'red' : 'black'; | ||
} else if (route.name === 'JuniorTickets') { | ||
iconName = 'ticket'; | ||
color = focused ? 'red' : 'black'; | ||
} else if (route.name === 'JuniorProfile') { | ||
iconName = 'user'; | ||
color = focused ? 'red' : 'black'; | ||
} | ||
|
||
// You can return any component that you like here! | ||
return <FontAwesome name={iconName} size={size} color={color} />; | ||
}, | ||
})} | ||
tabBarOptions={{ | ||
activeTintColor: 'tomato', | ||
inactiveTintColor: 'gray', | ||
showLabel: false, | ||
}}> | ||
<Tab.Screen name="Feed" component={JuniorFeed} /> | ||
<Tab.Screen name="JuniorTickets" component={JuniorTickets} /> | ||
<Tab.Screen name="JuniorProfile" component={JuniorProfile} /> | ||
</Tab.Navigator> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
alignItems: 'center' | ||
alignItems: 'center', | ||
}, | ||
submit: { | ||
width: '80%', | ||
backgroundColor: 'lightgreen' | ||
backgroundColor: 'lightgreen', | ||
}, | ||
tabs: { | ||
flex: 1, | ||
alignSelf: 'flex-end', | ||
width: '40%', | ||
backgroundColor: 'red', | ||
height: 20 | ||
height: 20, | ||
}, | ||
buttonView: { | ||
flexDirection: 'row', | ||
justifyContent: 'space-around', | ||
} | ||
}) | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import {StyleSheet, Text, ScrollView} from 'react-native'; | ||
import Ticket from './Ticket'; | ||
import {useQuery, gql, useApolloClient} from '@apollo/client'; | ||
|
||
const GET_TASKS = gql` | ||
query { | ||
tasks { | ||
id | ||
seniorname | ||
description | ||
type | ||
} | ||
} | ||
`; | ||
const JuniorFeed = () => { | ||
const {loading, error, data} = useQuery(GET_TASKS); | ||
if (loading) return <Text>Loading...</Text>; | ||
if (error) { | ||
console.log('error', error); | ||
return <Text>Error :( </Text>; | ||
} | ||
// console.log('data', data); | ||
|
||
// const tickets = data.helpers[0].map( task => <SeniorTicket task={task}/>) | ||
const tickets = data.tasks.map(task => <Ticket task={task} key={task.id} />); | ||
// console.log('tickets', tickets) | ||
return ( | ||
<ScrollView style={styles.container}> | ||
{tickets} | ||
{/* <SeniorTicket/> | ||
<SeniorTicket/> | ||
<SeniorTicket/> */} | ||
</ScrollView> | ||
); | ||
}; | ||
|
||
export default JuniorFeed; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
width: '80%', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import {StyleSheet, Text, View} from 'react-native'; | ||
|
||
const JuniorProfile = () => { | ||
return ( | ||
<View> | ||
<Text>Profile Page!</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
export default JuniorProfile; | ||
|
||
const styles = StyleSheet.create({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import {StyleSheet, Text, View} from 'react-native'; | ||
|
||
// TODO: get ID of whoever is logged in so that we can query the tasks assigned to specific id | ||
|
||
const JuniorTickets = () => { | ||
return ( | ||
<View> | ||
<Text style={styles.text}>My Tickets</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
export default JuniorTickets; | ||
|
||
const styles = StyleSheet.create({ | ||
text: { | ||
fontSize: 20, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.