Skip to content

Commit

Permalink
ui changes and mutation connection
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmadrigal committed Sep 10, 2020
1 parent 041d8d1 commit 1248b38
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .expo/packager-info.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"devToolsPort": 19002,
"devToolsPort": 19003,
"expoServerPort": 19000,
"packagerPort": 19003,
"packagerPid": 49692,
"packagerPort": 19005,
"packagerPid": 55473,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null,
Expand Down
38 changes: 26 additions & 12 deletions components/Feed.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react'
import { StyleSheet, Text, View } from 'react-native'
import React, {useEffect, useState} from 'react'
import { StyleSheet, Text, View, RefreshControl } from 'react-native'
import SeniorTicket from './SeniorTicket'
import { useQuery, gql } from '@apollo/client';
import { ScrollView } from 'react-native-gesture-handler';


const GET_TEST = gql`
Expand All @@ -15,37 +16,50 @@ query {
}
}`
const Feed = () => {
// useEffect(() => {
// console.log('useeffect')
// }, [])
const [refreshing, useRefresh] = useState('false');
const onRefresh = () => {
console.log('refreshing');
}

//wrapper for useQuery



const { loading, error, data } = useQuery(GET_TEST);
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}/>)
let tickets;
try {
tickets = data.tasks.map( task => <SeniorTicket key={task.id} task={task}/>)
tickets = data.tasks.map( task => <SeniorTicket key={task.id} task={task}/>).reverse();
} catch (e) {
console.log('error in gql feed', e);
}
// console.log('tickets', tickets)
return (
<View style={styles.container}>
<ScrollView
contentContainerStyle={styles.container}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={onRefresh}
/>}
>
{tickets}
{/* <SeniorTicket/>
<SeniorTicket/>
<SeniorTicket/> */}
</View>
</ScrollView>
)
}

export default Feed

const styles = StyleSheet.create({
container: {
width: '81%',
alignSelf: 'center',
width: '100%',
}
})

2 changes: 1 addition & 1 deletion components/NewTicketDesc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const NewTicketDesc = ({navigation, route}) => {
description: value
},
});
navigation.navigate('SeniorDash');
navigation.navigate('SeniorDash', {fetch: true});
} catch (e) {
console.log('error in addTask', e)
}
Expand Down
5 changes: 3 additions & 2 deletions components/SeniorDash.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import {StyleSheet, Text, View, TouchableOpacity} from 'react-native';
import Feed from './Feed'
import {useQuery, gql} from '@apollo/client';

export default function SeniorDash({navigation}) {
export default function SeniorDash({navigation, route}) {
console.log('navigation', navigation)
console.log('route', route)
return (
<View style={styles.container}>
<TouchableOpacity
Expand Down
10 changes: 4 additions & 6 deletions components/SeniorTicket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import { Text, View, StyleSheet } from 'react-native'


const SeniorTicket = ({task}) => {
const date = task.deadline
return (
<View style={styles.container}>
<Text style={styles.text}>Deadline: {task.deadline} </Text>
<Text style={styles.text}>Type {task.type}</Text>
<Text style={styles.text}>Description {task.description}</Text>
<Text style={styles.text}>Type: {task.type}</Text>
<Text style={styles.text}>Description: {task.description}</Text>
</View>
)
}
Expand All @@ -18,7 +16,6 @@ const styles = StyleSheet.create({
flexDirection: 'column',
alignItems: 'flex-start',
justifyContent: 'center',
width: '100%',
backgroundColor: 'lightblue',
margin: 5,
borderStyle: 'solid',
Expand All @@ -28,7 +25,8 @@ const styles = StyleSheet.create({
display: 'flex',
},
text: {
fontSize: 25
fontSize: 25,
fontWeight: 'bold'
}
})

Expand Down

0 comments on commit 1248b38

Please sign in to comment.