diff --git a/App.js b/App.js index 6a8049e..7b9c554 100644 --- a/App.js +++ b/App.js @@ -6,9 +6,7 @@ import { ConfigureStore } from './redux/configureStore'; const store = ConfigureStore(); export default class App extends React.Component { - - - render() { +render() { return (
diff --git a/app.json b/app.json index 3a3e99c..8d54120 100644 --- a/app.json +++ b/app.json @@ -8,7 +8,7 @@ "platforms": ["ios", "android"], "version": "1.0.0", "orientation": "portrait", - "icon": "./assets/images/logo.png", + "icon": "./assets/images/square.png", "splash": { "image": "./assets/images/splash.png", "resizeMode": "contain", @@ -20,6 +20,9 @@ "assetBundlePatterns": [ "**/*" ], + "android": { + "package": "com.expertiza.expertiza" + }, "ios": { "supportsTablet": true } diff --git a/assets/images/square.png b/assets/images/square.png new file mode 100644 index 0000000..4969f87 Binary files /dev/null and b/assets/images/square.png differ diff --git a/axios-instance.js b/axios-instance.js index 6cc99a8..071a1b1 100644 --- a/axios-instance.js +++ b/axios-instance.js @@ -1,9 +1,10 @@ import axios from 'axios'; -import { SecureStore } from 'expo'; +import { SecureStore } from 'expo'; const instance = axios.create({ - baseURL : 'http://192.168.1.122:3000/api/v1/' + baseURL : 'http://152.46.17.203:3001/api/v1/' }); + export default instance; diff --git a/components/.expo/packager-info.json b/components/.expo/packager-info.json deleted file mode 100644 index ef4df49..0000000 --- a/components/.expo/packager-info.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "devToolsPort": 19002, - "expoServerPort": null -} \ No newline at end of file diff --git a/components/.expo/settings.json b/components/.expo/settings.json deleted file mode 100644 index 8e4fcd2..0000000 --- a/components/.expo/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "hostType": "lan", - "lanType": "ip", - "dev": true, - "minify": false, - "urlRandomness": null -} \ No newline at end of file diff --git a/components/AndroidManifest.xml b/components/AndroidManifest.xml new file mode 100644 index 0000000..1239300 --- /dev/null +++ b/components/AndroidManifest.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/AssignmentComponent/AssignmentComponent.js b/components/AssignmentComponent/AssignmentComponent.js index 490be2a..7334e18 100644 --- a/components/AssignmentComponent/AssignmentComponent.js +++ b/components/AssignmentComponent/AssignmentComponent.js @@ -25,13 +25,10 @@ class Assignment extends Component { } } - componentDidMount(){ this.props.fetchStudentTasks(this.props.jwt); this.props.fetchStudentsTeamedWith(this.props.jwt); } - - create_cards = () => { let flags = [] @@ -41,42 +38,28 @@ class Assignment extends Component { let list_array = [] { this.props.studentTasks.map((studentTask1) => { - - if(flags.indexOf(studentTask1.course_name) < 0){ - flags.push(studentTask1.course_name); - count++; - } - } - ); + if(flags.indexOf(studentTask1.course_name) < 0){ + flags.push(studentTask1.course_name); + count++; + } + }); } - for(i=0; i < flags.length; i++) - { - let f - f = flags[i]; - - - { - this.props.studentTasks.map((studentTask2) => { - + { + let f + f = flags[i]; + {this.props.studentTasks.map((studentTask2) => { let deadline = studentTask2.stage_deadline.split(".",1).toString(); - var q = new Date(); var m = q.getMonth(); var d = q.getDay(); var y = q.getFullYear(); - var date = new Date(y,m,d); - deadline = deadline.split("T",1).toString(); - mydate=new Date(deadline); - - if(date>mydate) - { + if(date>mydate){ deadline = "Finished"; } - if(studentTask2.course_name == f){ list_array.push( ) } - } - ) - } - card_array.push( - - - {list_array} - - - ); - } - - + })} + card_array.push( + {list_array} + ); + } return card_array; } - - static navigationOptions = ({ navigation, navigationOptions }) => { return{ - title: 'Assignments', - headerLeft: navigation.toggleDrawer() } /> - }; + title: 'Assignments', + headerLeft: navigation.toggleDrawer() } /> + } }; - render(){ - return( - - - - - {this.create_cards()} - - + + {this.create_cards()} + ); } diff --git a/components/AssignmentDetailsComponent/AssignmentDetailsComponent.js b/components/AssignmentDetailsComponent/AssignmentDetailsComponent.js index b8ff67b..ca91e97 100644 --- a/components/AssignmentDetailsComponent/AssignmentDetailsComponent.js +++ b/components/AssignmentDetailsComponent/AssignmentDetailsComponent.js @@ -6,81 +6,206 @@ import * as actions from '../../redux' import Timeline from 'react-native-timeline-listview'; import Spinner from 'react-native-loading-spinner-overlay'; - class AssignmentDetails extends Component { + + options_available = [] + temp_object = {} + f = true + time_array = [] + options_list = [] + constructor(props) { super(props); this.state = { - } } - - - componentDidMount() { - - const {navigation} = this.props; - const part_id = navigation.getParam('par_id', 'NO-ID'); - const part_id_string = JSON.stringify(part_id) - - this.props.onLoad(part_id, this.props.jwt) - + componentDidMount = () => { + const {navigation} = this.props; + const part_id = navigation.getParam('par_id', 'NO-ID'); + const part_id_string = JSON.stringify(part_id) + this.props.onLoad(part_id, this.props.jwt) } + getAliasName = () => { + let alias_name; + if (this.props.authorization !== 'reader') { + alias_name = "Others' work" + }else { + alias_name = "Your readings" + } + return alias_name + } + filltemp = (name,desc,handler) => { + this.temp_object["name"] = name + this.temp_object["desc"] = desc + this.temp_object["handler"] = handler + this.options_available.push(this.temp_object) + this.temp_object = {} + } + get_options_list = () => { + let i = 0 + list_array = [] + card_array = [] + // Sign up option + this.props.topics.length > 0 ? this.props.authorization === 'participant' || this.props.authorization === 'submitter' ? + this.filltemp("Sign up sheet","Sign up for a topic", () => { + this.props.navigation.navigate('Signup', { + par_id: this.props.participant.id, + ass_name: this.props.assignment.name,}) + }) : : + + // View and manage your team + if(this.props.assignment.max_team_size > 1){ + if(this.props.authorization === 'participant'){ + // Add your Screen name here + this.filltemp("Your team","View and Manage your team", ()=>{ + this.props.navigation.navigate('Screen name', {}); + } + ) + } + } + // Your work + if(this.props.authorization === 'participant' || this.props.can_submit === true){ + if(this.props.topics.size > 0){ + if(this.props.topic_id && !this.props.submission_allowed){ + // Add your Screen name here + this.filltemp("Your work","Submit and view your work", ()=>{ + this.props.navigation.navigate('Screen name', {}); + }) + } + else{ + this.filltemp("Your work","You have to choose a topic first", () => {}) + } + } + else{ + if(!this.props.submission_allowed){ + this.filltemp("Your work","Submit and view your work", () => {}) + } + else{ + this.filltemp("Your work","You are not allowed to submit your work right now", () => {}) + } + } + } + // + if(this.props.authorization === 'participant' || this.props.can_review){ + if(this.props.check_reviewable_topics || this.props.metareview_allowed || this.props.get_current_stage === "Finished"){ + // Add your Screen name here + this.filltemp(this.getAliasName(),"(Give feedback to others on their work)",()=>{ + this.props.navigation.navigate('OthersWork', { + par_id: this.props.participant.id + }); + }) + } + else{ + this.filltemp(this.getAliasName(),"(Give feedback to others on their work)",() => {}) + } + } + // Quiz + if(this.props.assignment.require_quiz){ + if(this.props.authorization === 'participant' || this.props.can_take_quiz){ + // Add your Screen name here + this.filltemp("Take quizzes","(Take quizzes over the work you have read)",()=>{ + this.props.navigation.navigate('Screen name', {}); + }) + } + else{ + this.filltemp("Take quizzes","(Take quizzes over the work you have read)",()=>{}) + } + } + // Only if the assignment supports self-review and students submitted self-review can he or she view scores + if(this.props.team && (this.props.authorization === 'participant' || this.props.can_submit)) + { + if(this.props.assignment.is_selfreview_enabled && this.props.unsubmitted_self_review){ + this.filltemp("Your scores","(You have to submit self-review under 'Your work' before checking 'Your scores')",()=>{}) + } + else + { + this.filltemp("Your scores","(View feedback on your work)",()=>{ + this.props.navigation.navigate('Scores', { + par_id: this.props.participant.id, + ass_name: this.props.assignment.name, + }); + }) + } + } + if(this.props.can_provide_suggestions){ + // Add your Screen name here + this.filltemp("Suggest a Topic","",()=>{ this.props.navigation.navigate('Screen name', {}) }) + } + if(this.props.get_current_stage === "Complete"){ + // Add your Screen name here + this.filltemp("Take a Survey","",()=>{ this.props.navigation.navigate('Screen name', {}) }) + } - author_review_table = () => { - - options_available = [] - temp_object = {} - - - - return options_available - } + // Add your Screen name here + this.filltemp("Change your handle","",()=>{ this.props.navigation.navigate('Screen name', {}) }) + + // List items that has the options related to the assignment + let par_id + let ass_name + this.options_available.map((l,i) => ( + list_array.push( + + ) + )) + card_array.push( + {list_array}) + this.options_available = [] + return card_array + } +// Show Timeline get_timeline = () => { - let timeline_print = [] let timeline_array = [] let data = {} let i = 0 let time let temp_id - + let style_flag { - this.props.timeline_list.map((timelineitem) => { - - data["title"] = timelineitem.label - - time = timelineitem.updated_at.split("," , 2) - - data["time"] = time[1].toString(); - if(timelineitem.id) { - data["description"] = 'Id:' + timelineitem.id + data["desc"] = 'Id:' + timelineitem.id + data["description"] = timelineitem.label + time = timelineitem.updated_at.split("," , 2) + data["time"] = time[1].toString(); + data["title"] = "Peer review" } - else if(timelineitem.link){ - data["description"] = 'Link:' + timelineitem.link + data["desc"] = 'Link:' + timelineitem.link + data["description"] = timelineitem.label + time = timelineitem.updated_at.split("," , 2) + data["time"] = time[1].toString(); + data["title"] = "Peer review" } - else { - data["description"] = 'Id not available' + data["desc"] = 'Id not available' + data["description"] = "" + time = timelineitem.updated_at.split("," , 2) + data["time"] = time[1].toString(); + data["title"] = timelineitem.label } timeline_array.push(data) - data = {} - } - - ); - + }); } - timeline_print.push( - { - temp_id = e.description.split(":") - + temp_id = e.desc.split(":") + if( temp_id[0] == "Id"){ console.log(e.title) console.log(temp_id[1]) this.props.navigation.navigate('Review', { r_id: Number(temp_id[1]), title_name: e.title, - }); - } + }); + } else{ console.log('No id available') - } + } }} timeStyle={{textAlign: 'center', color:'red', padding:5, fontSize:9}} - titleStyle={{color:'black', padding:5,fontSize:12}} - descriptionStyle={{color:'gray'}} + titleStyle={{color:'black', padding:0,fontSize:12}} + descriptionStyle={{color:'red', padding:0,fontSize:12}} options={{ style:{paddingTop:5} }} innerCircle={'dot'} - + /> ); - return timeline_print; } - static navigationOptions = ({ navigation }) => { const { params } = navigation.state; - + return { title: params ? params.ass_name : 'Assignment Info', } }; - + + render(){ - - - if(this.props.loaded){ - - - let temp_print = [] - temp_print = this.get_timeline() - - const list = [ - - { - name: "Signup sheet", - desc: "Sign up for a topic" - }, - { - name: "Your team", - desc: "You have to choose a topic first", - handler: ()=>{ - this.props.navigation.navigate('StudentTeamComponent', {}); - } - }, - { - name: "Your work", - desc: "You have to choose a topic first" - }, - { - name: "Others Work", - desc: "Give feedback to others on their work" - }, - { - name: "Change handle", - desc: "Provide a different handle for this assignment", - handler: ()=>{ - this.props.navigation.navigate('ChangeHandle', {}); - } - }, - ] - -// Implement a spinner so that it loads until the new timeine is printed - - if(temp_print) - { + const {navigation} = this.props; + const part_id = navigation.getParam('par_id', 'NO-ID'); + if(this.props.loaded && this.props.participant.id == part_id ){ return( - - - - - - - { - - list.map((l,i) => ( - - )) - } - - - - - - {temp_print} - - - + + {this.get_options_list()} + {this.get_timeline()} + - ) - } - - else{ - return( - - - - ) - } - - } - else{ - return( - - - - ) - - + + ) } } - + } const mapStateToProps = state => { - return { - + return { participant: state.studentTaskView.participant, can_submit : state.studentTaskView.can_submit, can_review: state.studentTaskView.can_review, @@ -284,8 +303,6 @@ const mapStateToProps = state => { metareview_allowed: state.studentTaskView.metareview_allowed, get_current_stage: state.studentTaskView.get_current_stage, jwt: state.auth.jwt - - } } @@ -294,6 +311,18 @@ const styles = StyleSheet.create({ flex: 1, backgroundColor: 'white' }, + card: { + borderWidth: 1, + borderColor: 'gray', + marginRight:20, + marginLeft:20, + marginTop:10, + paddingTop:10, + paddingBottom:10, + paddingRight:1, + paddingLeft:10, + borderRadius:10 + } }); const mapDispatchToProps = dispatch => { @@ -302,4 +331,4 @@ const mapDispatchToProps = dispatch => { } } -export default connect(mapStateToProps, mapDispatchToProps)(AssignmentDetails); +export default connect(mapStateToProps, mapDispatchToProps)(AssignmentDetails); \ No newline at end of file diff --git a/components/Auth/loginComponent.js b/components/Auth/loginComponent.js index 9ab6dc2..891561a 100644 --- a/components/Auth/loginComponent.js +++ b/components/Auth/loginComponent.js @@ -1,22 +1,8 @@ import React, { Component } from 'react'; -import { View, StyleSheet, ScrollView, Image, Modal, TouchableWithoutFeedback, TouchableOpacity, Alert } from 'react-native'; -import { Input, Button, Icon, Text } from 'react-native-elements'; +import { View, StyleSheet, Text, ScrollView, Image } from 'react-native'; +import { Input, CheckBox, Button, Icon } from 'react-native-elements'; import { SecureStore } from 'expo'; import { createBottomTabNavigator } from 'react-navigation'; -import { KeyboardAvoidingView } from 'react-native'; -import { connect } from 'react-redux'; -import * as actions from '../../redux/index'; - -const mapStatetoProps = state => { - return { - } - } - - const mapDispatchToProps = dispatch => { - return { - passwordResetEmailSend: (name) => {dispatch(actions.passwordResetEmailSend(name))}, - } - } class LoginTab extends Component { @@ -24,17 +10,15 @@ class LoginTab extends Component { super(props); this.state = { username: '', - email: '', password: '', - remember: true, - modalVisible: false, + remember: true } } - - setModalVisible(visible) { - this.setState({modalVisible: visible}); - } - + // componentDidMount(){ + // SecureStore.getItemAsync('userinfo') + // .then(()=>this.props.navigation.navigate('AuthLoading')) + // .catch((err)=>console.log(err)) + // } static navigationOptions = { title: 'Login ', tabBarIcon: ({ tintColor }) => ( @@ -54,75 +38,7 @@ class LoginTab extends Component { } render() { return ( - - { - Alert.alert('Modal has been closed.'); - }}> - {this.setModalVisible(false)}} - > - - - - Forgot Password? - Enter your email to request a password reset - this.setState({email})} - value={this.state.email} - containerStyle={styles.formInput} - style = {styles.modalinput} - /> -