Skip to content
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

Aivant/offline #56

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
09e7a93
Added course_teachers and sessions download to Courses screen. workin…
aivantg Apr 12, 2018
4c23688
finished making ViewcourseScreen offline
aivantg Apr 12, 2018
4ea4e32
Merge branch 'aivant/attendanceUpdates' of https://github.com/calblue…
aivantg Apr 12, 2018
1ff4bc0
View Course Screen is now offline
aivantg Apr 12, 2018
00a869e
updates
aivantg Apr 17, 2018
30d8066
Merge branch 'aivant/attendanceUpdates' of https://github.com/calblue…
aivantg Apr 17, 2018
fe3305a
Finished Student Stats....still need to deal with student dupiclate c…
aivantg Apr 17, 2018
a784bc1
Fixed modal index error
aivantg Apr 18, 2018
a83d8d9
No longer logs in twice
aivantg Apr 18, 2018
73802dc
fixed attendance modal, student stats, and attendance unsynced on cou…
aivantg Apr 19, 2018
cd839ac
Changed a reducer to include locale and added localization on Teacher…
aivantg Apr 19, 2018
ec3213b
I18nized courses screen and removed loginscreen junk
aivantg Apr 19, 2018
0683214
Merged with localization
aivantg Apr 19, 2018
8eba0a8
fixed coursesscreen small bug
aivantg Apr 19, 2018
aef2584
Merged + Finished localization
aivantg Apr 20, 2018
ae93aa8
doing stuffs
aivantg Apr 21, 2018
7656791
Switched to Expo Fork of React Native and now sync local changes when…
aivantg Apr 21, 2018
947ba99
MErged from master and removed fake offline throws
aivantg Apr 21, 2018
4cfc657
reduxified StudentProfile (but not the embedded screens
aivantg Apr 21, 2018
e121fa5
Internationalized ViewCourseScreen
aivantg Apr 21, 2018
e239338
Merge branch 'master' of https://github.com/calblueprint/dream-mobile…
Apr 22, 2018
34932ef
styled student profile midway
Apr 22, 2018
fc94741
Merge branch 'master' of https://github.com/calblueprint/dream-mobile…
JustinMi Apr 22, 2018
d594ecc
Fixed student mapping bug temporarily
aivantg Apr 22, 2018
11598e6
fixed course editing bug
aivantg Apr 22, 2018
d3b145f
switched settings back to localhost
aivantg Apr 22, 2018
7c66921
Merge branch 'aivant/offline' of https://github.com/calblueprint/drea…
JustinMi Apr 22, 2018
31938de
empty state for courses
Apr 22, 2018
54bb0d9
Merge branch 'aivant/offline' of https://github.com/calblueprint/drea…
Apr 22, 2018
32ed4fe
added [email protected] alias
aivantg Apr 22, 2018
4ffeb1e
Merge branch 'aivant/offline' of https://github.com/calblueprint/drea…
JustinMi Apr 22, 2018
92be205
Merge branch 'aivant/offline' of https://github.com/calblueprint/drea…
Apr 22, 2018
050ce11
fixed course card padding
Apr 22, 2018
b348863
styled student profile
Apr 22, 2018
389a25d
removed edit from attendance summary screen
Apr 22, 2018
50b26ec
Merge branch 'vanessa/student_styling' of https://github.com/calbluep…
Apr 22, 2018
13c32cb
made navbar of edit course neutral
Apr 22, 2018
4e949b5
navigate error on edit student proflie fixed but rails error
Apr 22, 2018
06ca3a6
removed refresh students function
Apr 22, 2018
1351325
courseId lol
Apr 22, 2018
a38434f
Fixed Enroll Student Screen
aivantg Apr 22, 2018
8d08ab8
Disabled gestures on courses screen so you can't swipe back to log out
aivantg Apr 22, 2018
9fa8dbf
Merge branch 'aivant/offline' of https://github.com/calblueprint/drea…
JustinMi Apr 22, 2018
940745a
made the courses screen background entirely white
JustinMi Apr 22, 2018
b4ada1c
Added alt url and faked attendance item post
aivantg Apr 23, 2018
bcbfbc0
Merge branch 'aivant/offline' of https://github.com/calblueprint/drea…
aivantg Apr 23, 2018
704b418
added empty state for no students and no sessions
May 6, 2018
6002297
navigate back to viewCourseScreen after creating a student)
May 6, 2018
e85e299
headerLeft button on ViewCourseScreen always go back to courses
May 6, 2018
4369a7a
Revert "headerLeft button on ViewCourseScreen always go back to courses"
May 6, 2018
8df1a71
adjustments for iphone5s on attendance screen and login screen
May 6, 2018
a473259
removed pre login info
May 6, 2018
ae7ed06
disabled edit course and student button because they don't work yet
May 7, 2018
488495f
Updated Expo SDK to latest version
aivantg Jun 21, 2018
efa4481
Merged
aivantg Jun 30, 2018
51680f2
ahhhhhh
aivantg Oct 11, 2018
7a79e9e
updated proptypes and stuff
aivantg Oct 30, 2018
82bf14e
merged
aivantg Oct 30, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default class App extends React.Component {
<Provider store={store}>
<HomeStack />
</Provider>

)
}
}
58 changes: 58 additions & 0 deletions actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@ import types from '../lib/actionTypes'

let actions = {
// GENERAL
enrollStudent: (student, courseId) => {
return {
type: types.ENROLL_STUDENT,
student,
courseId,
}
},
unenrollStudent: (studentId, courseId) => {
return {
type: types.UNENROLL_STUDENT,
studentId,
courseId,
}
},
updateLocale: (locale) => {
return {
type: types.UPDATE_LOCALE,
locale
}
},
receiveStandardError: (error) => {
return {
type: types.RECEIVE_STANDARD_ERROR,
Expand Down Expand Up @@ -71,6 +91,44 @@ let actions = {
courseId
}
},
updateStudentAttendanceStats: (attendances, curAttendances, courseId) => {
return {
type: types.UPDATE_STUDENT_ATTENDANCE_STATS,
attendances,
curAttendances,
courseId
}
},

// Sessions
requestSessions: (courseId) => {
return {
type: types.REQUEST_SESSIONS,
courseId
}
},
receiveSessionsSuccess: (sessions, courseId) => {
return {
type: types.RECEIVE_SESSIONS_SUCCESS,
sessions,
courseId
}
},

// Course Teachers
requestCourseTeachers: (courseId) => {
return {
type: types.REQUEST_COURSE_TEACHERS,
courseId
}
},
receiveCourseTeachersSuccess: (courseTeachers, courseId) => {
return {
type: types.RECEIVE_COURSE_TEACHERS_SUCCESS,
courseTeachers,
courseId
}
},

// ATTENDANCES
requestAttendances: (courseId, date) => {
Expand Down
34 changes: 18 additions & 16 deletions components/AttendanceCard/AttendanceCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { Image, View, Text, StyleSheet, Button, TouchableHighlight } from 'react-native';
import styles from './styles'
import Dropdown from '../Dropdown'
import PropTypes from 'prop-types'
import { textStyles } from '../../styles/textStyles';

class AttendanceCard extends React.Component {
Expand Down Expand Up @@ -57,7 +58,7 @@ class AttendanceCard extends React.Component {
source={require('../../icons/comment_active.png')}
/>
)
}
}
return (
<Image
style={styles.commentButton}
Expand All @@ -72,28 +73,29 @@ class AttendanceCard extends React.Component {
<View style={styles.nameContainer}>
<Text style={textStyles.body}>{this.props.name}</Text>
</View>
<View style={styles.spaceContainer}>
</View>
<View style={styles.leftContainer}>
{this.renderSelect()}
<TouchableHighlight
style={styles.commentButtonOuter}
onPress={() => this.props.setModal(this.props.index, this.props.attendance.comment)}
underlayColor='transparent'>
{this.renderCommentButton(this.props.attendance.comment)}
</TouchableHighlight>
<View style={styles.spaceContainer}/>
<View style={styles.leftOuterContainer}>
<View style={styles.leftContainer}>
{this.renderSelect()}
<TouchableHighlight
style={styles.commentButtonOuter}
onPress={() => this.props.setModal(this.props.attendance.comment)}
underlayColor='transparent'>
{this.renderCommentButton(this.props.attendance.comment)}
</TouchableHighlight>
</View>
</View>
</View>
)
}
}

AttendanceCard.propTypes = {
attendance: React.PropTypes.object.isRequired,
name: React.PropTypes.string.isRequired,
index: React.PropTypes.number.isRequired,
setModal: React.PropTypes.func.isRequired,
setType: React.PropTypes.func.isRequired,
attendance: PropTypes.object.isRequired,
name: PropTypes.string.isRequired,
index: PropTypes.number.isRequired,
setModal: PropTypes.func.isRequired,
setType: PropTypes.func.isRequired,
};

export default AttendanceCard;
15 changes: 11 additions & 4 deletions components/AttendanceCard/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,32 @@ import { StyleSheet } from 'react-native';
export default StyleSheet.create({
container: {
flexDirection: 'row',
flex: 1,
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: 24,
},
nameContainer: {
flexDirection: 'row',
flex: 1,
flex: 0.5,
},
spaceContainer:{
flex: 0.1,
flex: 0.01,
},
leftOuterContainer: {
flex: 0.49,
},
leftContainer: {
flexDirection: 'row',
alignItems: 'center',
marginRight: 16,
flex: 1,
},
attendanceButton: {
width: 116,
width: 100,
height: 40,
},
attendanceContainer: {
width: 100,
height: 40,
},
commentButton: {
Expand Down
10 changes: 5 additions & 5 deletions components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export default class StyledButton extends React.Component {
>{this.props.text}</Button>
);
}
if (this.props.noPaddingPrimaryButtonSmall) {
if (this.props.editButton) {
return (
<Button
onPress={this.props.onPress}
style={ buttonStyles.noPaddingPrimaryButtonSmall }
textStyle={ textStyles.buttonTextSmall }
style={ buttonStyles.editButton }
textStyle={ [textStyles.buttonTextDark] }
>{this.props.text}</Button>
);
}
Expand All @@ -38,7 +38,7 @@ export default class StyledButton extends React.Component {
<Button
onPress={this.props.onPress}
style={ buttonStyles.enrollSmall }
textStyle={ textStyles.enrollSmall }
textStyle={ textStyles.buttonText }
>{this.props.text}</Button>
);
}
Expand All @@ -65,7 +65,7 @@ export default class StyledButton extends React.Component {
<Button
onPress={this.props.onPress}
style={ buttonStyles.whiteButtonLarge }
textStyle={ textStyles.buttonTextYellow }
textStyle={ textStyles.buttonTextDark }
>{this.props.text}</Button>
);
}
Expand Down
12 changes: 6 additions & 6 deletions components/Button/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const buttonStyles = StyleSheet.create({
marginBottom: 8,
},

noPaddingPrimaryButtonSmall: {
backgroundColor: colors.primaryYellow,
borderColor: colors.primaryYellow,
editButton: {
backgroundColor: '#CFD8DC',
borderColor: '#CFD8DC',
width: 85,
height: 37,
height: 32,
marginLeft: 10,
marginBottom: -10,
marginBottom: 0,
},

clearButtonSmall: {
Expand Down Expand Up @@ -74,7 +74,7 @@ const buttonStyles = StyleSheet.create({
enrollSmall: {
backgroundColor: colors.courseBlue,
borderColor: colors.courseBlue,
width: 140,
width: 120,
height: 36,
},

Expand Down
9 changes: 5 additions & 4 deletions components/Collapse/Collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { View, TouchableHighlight } from 'react-native';
import { commonStyles } from '../../styles/styles';
import styles from './styles';
import PropTypes from 'prop-types'
import Collapsible from 'react-native-collapsible';

class Collapse extends React.Component {
Expand All @@ -24,10 +25,10 @@ class Collapse extends React.Component {


Collapse.propTypes = {
setCollapsed: React.PropTypes.func.isRequired,
header: React.PropTypes.object.isRequired,
isCollapsed: React.PropTypes.bool.isRequired,
headerStyle: React.PropTypes.object,
setCollapsed: PropTypes.func.isRequired,
header: PropTypes.object.isRequired,
isCollapsed: PropTypes.bool.isRequired,
headerStyle: PropTypes.object,
};

export default Collapse;
15 changes: 12 additions & 3 deletions components/CourseCard/CourseCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import PropTypes from 'prop-types';
import { cardStyles } from './styles';
import { textStyles } from '../../styles/textStyles';
import colors from '../../styles/colors';
import { FontAwesome } from '@expo/vector-icons';
import I18n from '../../lib/i18n/i18n';


/**
* @prop course_id - course ID
Expand All @@ -29,20 +32,26 @@ class CourseCard extends React.Component {
4: colors.courseBrown
}
const colorKey = this.props.index % 5
let syncText = this.props.synced ? "" : "Not Synced"
const unsyncedAttendances = (
<Text style={[cardStyles.count, textStyles.titleSmallLight]}>
<FontAwesome name="exclamation-triangle" size={14} color={colors.iconLight}/> {I18n.t('unsyncedattendances', {locale: this.props.locale})}
</Text>
)
let syncText = this.props.synced ? (I18n.t('lastsynced', {locale: this.props.locale}) + ": " + this.props.last_synced) : unsyncedAttendances
return (
<TouchableHighlight onPress={() => this.props.onSelectCourse(this.props.course_id, colorKey)}
underlayColor='transparent'>
<View style={[cardStyles.outerContainer, {backgroundColor: colorList[colorKey]}]}>
<View style={cardStyles.topContainer}>
<Text style={[cardStyles.title, textStyles.titleMediumLight]}>{this.props.title}</Text>
<Text style={[cardStyles.count, textStyles.titleSmallLight]}>{this.props.numStudents} Students</Text>
<Text style={[cardStyles.count, textStyles.titleSmallLight]}>5 {I18n.t('students', {locale: this.props.locale})}</Text>
<Text style={[cardStyles.count, textStyles.titleSmallLight]}>{syncText}</Text>

</View>
<View style={cardStyles.bottomContainer}>
<StyledButton
onPress={() => this.props.onTakeAttendance(this.props.course_id, this.props.title)}
text='Take Attendance'
text={I18n.t('takeattendance', {locale: this.props.locale})}
clearButtonSmall>
</StyledButton>
</View>
Expand Down
4 changes: 3 additions & 1 deletion components/CourseCard/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const cardStyles = StyleSheet.create({
},
topContainer: {
flex: 1,
height: 100,
// height: 100,
paddingRight: 8,
paddingBottom: 8,
backgroundColor: 'transparent'
},
bottomContainer: {
Expand Down
11 changes: 6 additions & 5 deletions components/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { View, Text, StyleSheet, Button, TextInput, Modal, TouchableHighlight } from 'react-native';
import { Select, Option } from 'react-native-chooser';
import styles from './styles';
import PropTypes from 'prop-types'
import { textStyles } from '../../styles/textStyles';

class Dropdown extends React.Component {
Expand Down Expand Up @@ -57,11 +58,11 @@ class Dropdown extends React.Component {
}

Dropdown.propTypes = {
onSelect: React.PropTypes.func.isRequired,
value: React.PropTypes.any.isRequired,
options: React.PropTypes.object.isRequired,
defaultText: React.PropTypes.string.isRequired,
styles: React.PropTypes.object,
onSelect: PropTypes.func.isRequired,
value: PropTypes.any.isRequired,
options: PropTypes.object.isRequired,
defaultText: PropTypes.string.isRequired,
styles: PropTypes.object,
};

export default Dropdown;
2 changes: 1 addition & 1 deletion components/SearchResultCard/SearchResultCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SearchResultCard extends React.Component {

render() {
return (
<TouchableHighlight onPress={() => this.props.onSelectStudent(this.props.student.id)}
<TouchableHighlight onPress={() => this.props.onSelectStudent(this.props.student)}
underlayColor='transparent'>
<View style={
{ backgroundColor: colors.courseWhite,
Expand Down
9 changes: 5 additions & 4 deletions components/SimpleModal/SimpleModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { commonStyles } from '../../styles/styles';
import styles from './styles';
import StyledButton from '../../components/Button/Button';
import Modal from 'react-native-modalbox';
import PropTypes from 'prop-types'
import { textStyles } from '../../styles/textStyles';

/**
Expand Down Expand Up @@ -71,10 +72,10 @@ class SimpleModal extends React.Component {


SimpleModal.propTypes = {
visible: React.PropTypes.bool.isRequired,
title: React.PropTypes.string.isRequired,
buttons: React.PropTypes.array.isRequired,
onClosed: React.PropTypes.func.isRequired,
visible: PropTypes.bool.isRequired,
title: PropTypes.string.isRequired,
buttons: PropTypes.array.isRequired,
onClosed: PropTypes.func.isRequired,
};

export default SimpleModal;
Loading