From 15637abd8dcc83193e8226c6b3f51df5aa35f0c5 Mon Sep 17 00:00:00 2001 From: asivaga Date: Sat, 3 Nov 2018 14:17:15 -0400 Subject: [PATCH 01/24] Signup_start --- components/.expo/packager-info.json | 4 - components/.expo/settings.json | 7 - .../AssignmentDetailsComponent.js | 437 +++++++++++++----- components/Auth/loginComponent.js | 149 +----- .../ChangeHandle/ChangeHandleComponent.js | 75 --- components/ChangeHandle/ChangeHandleView.js | 145 ------ components/MainComponent.js | 25 +- .../PreferenceComponent.js | 30 +- .../PreferenceComponentView.js | 15 +- .../ProfileComponent/ProfileComponentView.js | 18 +- components/ReviewComponent/ReviewComponent.js | 50 +- components/SignUpComponent/SignUpComponent.js | 154 ++++++ .../YourScoresComponent/ScoresbyQuestion.js | 139 ++++++ .../YourScoresComponent.js | 260 +++++++++++ .../StudentTeamComponent.js | 48 +- redux/ActionTypes.js | 5 +- redux/actions/Auth.js | 45 +- redux/actions/Grade.js | 4 +- redux/actions/ParticipantHandle.js | 21 +- redux/actions/Profile.js | 4 +- redux/actions/SignUpSheetList.js | 72 +++ redux/actions/StudentTaskView.js | 18 +- redux/configureStore.js | 5 + redux/index.js | 17 +- redux/reducers/Grade.js | 2 +- redux/reducers/SignUpSheetList.js | 47 ++ redux/reducers/StudentTaskView.js | 4 +- 27 files changed, 1124 insertions(+), 676 deletions(-) delete mode 100644 components/.expo/packager-info.json delete mode 100644 components/.expo/settings.json delete mode 100644 components/ChangeHandle/ChangeHandleComponent.js delete mode 100644 components/ChangeHandle/ChangeHandleView.js create mode 100644 components/SignUpComponent/SignUpComponent.js create mode 100644 components/YourScoresComponent/ScoresbyQuestion.js create mode 100644 components/YourScoresComponent/YourScoresComponent.js create mode 100644 redux/actions/SignUpSheetList.js create mode 100644 redux/reducers/SignUpSheetList.js 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/AssignmentDetailsComponent/AssignmentDetailsComponent.js b/components/AssignmentDetailsComponent/AssignmentDetailsComponent.js index b8ff67b..cb0d106 100644 --- a/components/AssignmentDetailsComponent/AssignmentDetailsComponent.js +++ b/components/AssignmentDetailsComponent/AssignmentDetailsComponent.js @@ -7,11 +7,17 @@ import Timeline from 'react-native-timeline-listview'; import Spinner from 'react-native-loading-spinner-overlay'; + + class AssignmentDetails extends Component { + + f = true + time_array = [] + options_list = [] + constructor(props) { super(props); this.state = { - } } @@ -21,20 +27,257 @@ class AssignmentDetails extends Component { 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) + this.props.onLoad(part_id, this.props.jwt) } - author_review_table = () => { + getAliasName = () => { + let alias_name; + if (this.props.authorization !== 'reader') { + alias_name = "Others' work" + }else { + alias_name = "Your readings" + } + return alias_name + } - options_available = [] - temp_object = {} + get_options_list = () => { + let i = 0 + options_available = [] + list_array = [] + card_array = [] + temp_object = {} + // Sign up option + + if(this.props.topics.length > 0) + { + if(this.props.authorization === 'participant' || this.props.authorization === 'submitter') + { + temp_object["name"] = "Sign up sheet" + temp_object["desc"] = "Sign up for a topic" + options_available.push(temp_object) + temp_object = {} + } + } + + // View and manage your team + + + + if(this.props.assignment.max_team_size > 1) + { + if(this.props.authorization === 'participant') + { + temp_object["name"] = "Your team" + temp_object["desc"] = "View and Manage your team" + options_available.push(temp_object) + temp_object = {} + } + } + + + + // 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 link here + temp_object["name"] = "Your work" + temp_object["desc"] = "Submit and view your work" + options_available.push(temp_object) + temp_object = {} + } + else{ + temp_object["name"] = "Your work" + temp_object["desc"] = "You have to choose a topic first" + options_available.push(temp_object) + temp_object = {} + } + } + else{ + + if(this.props.submission_allowed) + { + temp_object["name"] = "Your work" + temp_object["desc"] = "Submit and view your work" + options_available.push(temp_object) + temp_object = {} + } + else{ + temp_object["name"] = "Your work" + temp_object["desc"] = "You are not allowed to submit your work right now" + options_available.push(temp_object) + temp_object = {} + } + + } + } + + // + + 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 link here + temp_object["name"] = this.getAliasName() + temp_object["desc"] = "(Give feedback to others on their work)" + options_available.push(temp_object) + temp_object = {} + } + else + { + temp_object["name"] = this.getAliasName() + temp_object["desc"] = "(Give feedback to others on their work)" + options_available.push(temp_object) + temp_object = {} + } + } + + // Quiz + + if(this.props.assignment.require_quiz) + { + if(this.props.authorization === 'participant' || this.props.can_take_quiz) + { + // Add link here + temp_object["name"] = "Take quizzes" + temp_object["desc"] = "(Take quizzes over the work you have read)" + options_available.push(temp_object) + temp_object = {} + } + else + { + temp_object["name"] = "Take quizzes" + temp_object["desc"] = "(Take quizzes over the work you have read)" + options_available.push(temp_object) + temp_object = {} + } + } + + // 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) + { + // Add link here + temp_object["name"] = "Your scores" + temp_object["desc"] = "(You have to submit self-review under 'Your work' before checking 'Your scores')" + options_available.push(temp_object) + temp_object = {} + } + else + { + temp_object["name"] = "Your scores" + temp_object["desc"] = "(View feedback on your work)" + options_available.push(temp_object) + temp_object = {} + } + } + + if(this.props.can_provide_suggestions) + { + temp_object["name"] = "Suggest a topic" + temp_object["desc"] = "" + options_available.push(temp_object) + temp_object = {} + } + + if(this.props.get_current_stage === "Complete") + { + temp_object["name"] = "Take a survey" + temp_object["desc"] = "" + options_available.push(temp_object) + temp_object = {} + } + + temp_object["name"] = "Change your handle" + temp_object["desc"] = "" + options_available.push(temp_object) + temp_object = {} + + + // List items that has the options related to the assignment + let par_id + let ass_name + + options_available.map((l,i) => ( + list_array.push( + { + + if(l.desc == "(View feedback on your work)") + { + + this.props.navigation.navigate('Scores', { + par_id: this.props.participant.id, + ass_name: this.props.assignment.name, + + }); + + } + + if(l.desc == "Sign up for a topic") + { + + this.props.navigation.navigate('Signup', { + par_id: this.props.participant.id, + ass_name: this.props.assignment.name, + + }); + + } + + }} + + /> + ) + ) + ) + + card_array.push( + + {list_array} + + + ) + + + + return card_array + } - return options_available - } get_timeline = () => { @@ -44,29 +287,52 @@ class AssignmentDetails extends Component { 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) @@ -74,13 +340,13 @@ class AssignmentDetails extends Component { } - ); + ); } 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'} - + /> ); @@ -126,125 +392,46 @@ class AssignmentDetails extends Component { return timeline_print; } + + static navigationOptions = ({ navigation }) => { const { params } = navigation.state; - + return { title: params ? params.ass_name : 'Assignment Info', } }; - + + render(){ + const {navigation} = this.props; + const part_id = navigation.getParam('par_id', 'NO-ID'); + const part_id_string = JSON.stringify(part_id) + + if(this.props.loaded && this.props.participant.id == part_id ){ + + this.time_array = this.get_timeline() - 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) - { return( - - - { - - list.map((l,i) => ( - - )) - } - - - - - - {temp_print} + {this.get_timeline()} - ) - } - else{ - return( - - - ) - } - - } else{ @@ -257,15 +444,15 @@ class AssignmentDetails extends Component { ) - + } } - + } const mapStateToProps = state => { return { - + participant: state.studentTaskView.participant, can_submit : state.studentTaskView.can_submit, can_review: state.studentTaskView.can_review, @@ -303,3 +490,7 @@ const mapDispatchToProps = dispatch => { } 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} - /> -