From 598ed08f7d304e7057e57ed1edd3408bec82c1e4 Mon Sep 17 00:00:00 2001 From: Rikki Kendall Date: Sat, 16 Nov 2019 02:28:16 -0500 Subject: [PATCH 1/6] routing initial commit --- app/containers/App.js | 15 ++++- app/containers/EditTeamSettings.js | 78 +++++++++++++++++++++++++ app/containers/EditUserSettings.js | 78 +++++++++++++++++++++++++ app/containers/Footer.js | 27 +++++++++ app/containers/SettingsTabs.js | 37 ++++++++++++ app/containers/TeamSettings.js | 91 ++++++++++++++++++++++++++++++ app/containers/UpcomingShifts.js | 9 ++- app/containers/UserSettings.js | 84 +++++++++++++++++++++++++++ package.json | 2 +- yarn.lock | 51 ++++++++++++++++- 10 files changed, 464 insertions(+), 8 deletions(-) create mode 100644 app/containers/EditTeamSettings.js create mode 100644 app/containers/EditUserSettings.js create mode 100644 app/containers/Footer.js create mode 100644 app/containers/SettingsTabs.js create mode 100644 app/containers/TeamSettings.js create mode 100644 app/containers/UserSettings.js diff --git a/app/containers/App.js b/app/containers/App.js index f3315225..acdd458e 100644 --- a/app/containers/App.js +++ b/app/containers/App.js @@ -1,11 +1,19 @@ // @flow import React, { Component } from 'react'; +import { Text, StyleSheet, View } from 'react-native'; import { Provider } from 'react-redux'; // import Login from './Login'; import UpcomingShifts from './UpcomingShifts'; +import SettingsTabs from './SettingsTabs'; +import TeamSettings from './TeamSettings'; +import EditTeamSettings from './EditTeamSettings'; +import EditUserSettings from './EditUserSettings'; import { configureStore } from '../redux/utils/store'; +import { NativeRouter, Route, Link } from 'react-router-native'; +// import Home from './UpcomingShifts'; + type Props = any; export default class App extends Component { @@ -14,7 +22,12 @@ export default class App extends Component { return ( - + + + + + + ); } diff --git a/app/containers/EditTeamSettings.js b/app/containers/EditTeamSettings.js new file mode 100644 index 00000000..1f461641 --- /dev/null +++ b/app/containers/EditTeamSettings.js @@ -0,0 +1,78 @@ +// @flow + +import React, { Component } from 'react'; +import { Agenda } from 'react-native-calendars'; +import { connect } from 'react-redux'; +import { bindActionCreators } from 'redux'; +import moment from 'moment'; + +import { getAllShifts } from '../redux/actions/shifts'; +import { renderItem, renderEmptyDate, rowHasChanged } from '../components/AgendaItems'; +import Footer from './Footer'; + +import { Toast, Button, Icon, Body, Left, Right, Title, Text, Container, Header, Content, Form, Item, Input, Label } from 'native-base'; + +import { Link } from 'react-router-native'; + +type Props = { + getAllShifts: () => void, +}; + +class EditTeamSettings extends Component { + componentWillMount() { + this.props.getAllShifts(); + } + + render() { + + return ( + +
+ + + + +
+ +
+ + + + + + + + +
+ +
+
+ ); + } +} + +const mapStateToProps = state => ({ + shifts: state.shifts, +}); + +const mapDispatchToProps = dispatch => + bindActionCreators( + { + getAllShifts, + }, + dispatch, + ); + +export default connect( + mapStateToProps, + mapDispatchToProps, +)(EditTeamSettings); diff --git a/app/containers/EditUserSettings.js b/app/containers/EditUserSettings.js new file mode 100644 index 00000000..a9653fca --- /dev/null +++ b/app/containers/EditUserSettings.js @@ -0,0 +1,78 @@ +// @flow + +import React, { Component } from 'react'; +import { Agenda } from 'react-native-calendars'; +import { connect } from 'react-redux'; +import { bindActionCreators } from 'redux'; +import moment from 'moment'; + +import { getAllShifts } from '../redux/actions/shifts'; +import { renderItem, renderEmptyDate, rowHasChanged } from '../components/AgendaItems'; +import Footer from './Footer'; + +import { Toast, Button, Icon, Body, Left, Right, Title, Text, Container, Header, Content, Form, Item, Input, Label } from 'native-base'; + +import { Link } from 'react-router-native'; + +type Props = { + getAllShifts: () => void, +}; + +class EditUserSettings extends Component { + componentWillMount() { + this.props.getAllShifts(); + } + + render() { + + return ( + +
+ + + + +
+ +
+ + + + + + + + +
+ +
+
+ ); + } +} + +const mapStateToProps = state => ({ + shifts: state.shifts, +}); + +const mapDispatchToProps = dispatch => + bindActionCreators( + { + getAllShifts, + }, + dispatch, + ); + +export default connect( + mapStateToProps, + mapDispatchToProps, +)(EditUserSettings); diff --git a/app/containers/Footer.js b/app/containers/Footer.js new file mode 100644 index 00000000..9e0f235e --- /dev/null +++ b/app/containers/Footer.js @@ -0,0 +1,27 @@ +import React, { Component } from 'react'; +import { Container, Header, Content, Footer, FooterTab, Button, Icon, Text } from 'native-base'; +export default class FooterTabsIconTextExample extends Component { + render() { + return ( + + +
+ + + + + +
+
+ ); + } +} diff --git a/app/containers/SettingsTabs.js b/app/containers/SettingsTabs.js new file mode 100644 index 00000000..a066a9cb --- /dev/null +++ b/app/containers/SettingsTabs.js @@ -0,0 +1,37 @@ +import React, { Component } from 'react'; +import { Button, Icon, Title, Right, Left, Container, Header, Content, Tab, Tabs } from 'native-base'; +import TeamSettings from './TeamSettings'; +import UserSettings from './UserSettings'; +import EditUserSettings from './EditUserSettings'; + +import { Link } from 'react-router-native'; + +export default class SettingsTabs extends Component { + render() { + return ( + +
+ + + + +
+ + + + + + + + +
+ ); + } +} diff --git a/app/containers/TeamSettings.js b/app/containers/TeamSettings.js new file mode 100644 index 00000000..2b54a280 --- /dev/null +++ b/app/containers/TeamSettings.js @@ -0,0 +1,91 @@ +// @flow + +import React, { Component } from 'react'; +import { View } from 'react-native'; +import { Agenda } from 'react-native-calendars'; +import { connect } from 'react-redux'; +import { bindActionCreators } from 'redux'; +import moment from 'moment'; +import UpcomingShifts from './UpcomingShifts'; + +import { getAllShifts } from '../redux/actions/shifts'; +import { renderItem, renderEmptyDate, rowHasChanged } from '../components/AgendaItems'; + +import { + Container, + Icon, + Content, + Header, + Left, + Right, + Body, + Title, + Text, + Button, + Card, + CardItem, +} from 'native-base'; + +import { Link } from 'react-router-native'; + +type Props = { + getAllShifts: () => void, +}; + +class TeamSettings extends Component { + componentWillMount() { + this.props.getAllShifts(); + } + + render() { + return ( + + + + + Team Name: Team GTHC + + + Tent Type: Black + + + Passcode: ADC9L + + + + + + + ); + } +} + +const mapStateToProps = state => ({ + shifts: state.shifts, +}); + +const mapDispatchToProps = dispatch => + bindActionCreators( + { + getAllShifts, + }, + dispatch, + ); + +export default connect( + mapStateToProps, + mapDispatchToProps, +)(TeamSettings); diff --git a/app/containers/UpcomingShifts.js b/app/containers/UpcomingShifts.js index d252c567..c74dcb20 100644 --- a/app/containers/UpcomingShifts.js +++ b/app/containers/UpcomingShifts.js @@ -1,6 +1,7 @@ // @flow import React, { Component } from 'react'; +import { Text, StyleSheet } from 'react-native'; import { Agenda } from 'react-native-calendars'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; @@ -9,6 +10,8 @@ import moment from 'moment'; import { getAllShifts } from '../redux/actions/shifts'; import { renderItem, renderEmptyDate, rowHasChanged } from '../components/AgendaItems'; +import { Link } from 'react-router-native'; + type Props = { getAllShifts: () => void, }; @@ -27,9 +30,9 @@ class UpcomingShifts extends Component { return ( void, +}; + +class UserSettings extends Component { + componentWillMount() { + this.props.getAllShifts(); + } + + render() { + + return ( + + + + + + Name: Rikki Kendall + + + + + Email: yrk3@duke.edu + + + + + Phone: 5593266408 + + + + + + + + + + ); + } +} + +const mapStateToProps = state => ({ + shifts: state.shifts, +}); + +const mapDispatchToProps = dispatch => + bindActionCreators( + { + getAllShifts, + }, + dispatch, + ); + +export default connect( + mapStateToProps, + mapDispatchToProps, +)(UserSettings); diff --git a/package.json b/package.json index 10e51d95..6901ce4f 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "lint": "eslint ./", "test:unit": "jest", "test": "yarn lint && yarn flow", - "precommit": "lint-staged && yarn test", "pretty": "prettier --print-width 100 --single-quote --trailing-comma all --write \".//**/*.js\"" }, "lint-staged": { @@ -32,6 +31,7 @@ "react-native-calendars": "^1.20.0", "react-navigation": "^2.14.2", "react-redux": "^6.0.1", + "react-router-native": "^5.1.2", "react-router-redux": "^4.0.8", "redux": "^4.0.4", "redux-devtools": "^3.5.0", diff --git a/yarn.lock b/yarn.lock index 3dc28227..7f321be5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -677,6 +677,13 @@ dependencies: regenerator-runtime "^0.13.2" +"@babel/runtime@^7.4.0": + version "7.7.2" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.2.tgz#111a78002a5c25fc8e3361bedc9529c696b85a6a" + integrity sha512-JONRbXbTXc9WQE2mAZd1p0Z3DZ/6vaQIkgYMSTP3KjRCyd7rCZCcfhCyX+YjwcKxcZ82UrxbRD358bpExNgrjw== + dependencies: + regenerator-runtime "^0.13.2" + "@babel/template@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0.tgz#c2bc9870405959c89a9c814376a2ecb247838c80" @@ -3505,7 +3512,7 @@ heap@^0.2.6: version "0.2.6" resolved "https://registry.yarnpkg.com/heap/-/heap-0.2.6.tgz#087e1f10b046932fc8594dd9e6d378afc9d1e5ac" -history@^4.10.1: +history@^4.10.1, history@^4.9.0: version "4.10.1" resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3" integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew== @@ -3540,7 +3547,7 @@ hoist-non-react-statics@^2.2.0, hoist-non-react-statics@^2.3.1, hoist-non-react- version "2.5.5" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" -hoist-non-react-statics@^3.3.0: +hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz#b09178f0122184fb95acf525daaecb4d8f45958b" integrity sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA== @@ -5112,6 +5119,15 @@ min-document@^2.19.0: dependencies: dom-walk "^0.1.0" +mini-create-react-context@^0.3.0: + version "0.3.2" + resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.3.2.tgz#79fc598f283dd623da8e088b05db8cddab250189" + integrity sha512-2v+OeetEyliMt5VHMXsBhABoJ0/M4RCe7fatd/fBy6SMiKazUSEt3gxxypfnk2SHMkdBYvorHRoQxuGoiwbzAw== + dependencies: + "@babel/runtime" "^7.4.0" + gud "^1.0.0" + tiny-warning "^1.0.2" + mini-store@^1.0.2, mini-store@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/mini-store/-/mini-store-1.1.2.tgz#cc150e0878e080ca58219d47fccefefe2c9aea3e" @@ -6346,6 +6362,11 @@ react-is@^16.4.2, react-is@^16.5.0: version "16.5.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.5.1.tgz#c6e8734fd548a22e1cef4fd0833afbeb433b85ee" +react-is@^16.6.0: + version "16.11.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa" + integrity sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw== + react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.2: version "16.8.6" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16" @@ -6585,11 +6606,35 @@ react-router-dom@^4.2.2: react-router "^4.3.1" warning "^4.0.1" +react-router-native@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/react-router-native/-/react-router-native-5.1.2.tgz#1ef02785cb396f2b4234b85ab32e551c191ff41b" + integrity sha512-0dOsu3qe6CRqLVjgoYvjQrOLzDwS3Z6oWiiKFswEohQ/fLXx/w9168ay7b/q855SrOZdk1ZwcvT3Xdc2Ki29Xg== + dependencies: + prop-types "^15.6.1" + react-router "5.1.2" + react-router-redux@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/react-router-redux/-/react-router-redux-4.0.8.tgz#227403596b5151e182377dab835b5d45f0f8054e" integrity sha1-InQDWWtRUeGCN32rg1tdRfD4BU4= +react-router@5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.1.2.tgz#6ea51d789cb36a6be1ba5f7c0d48dd9e817d3418" + integrity sha512-yjEuMFy1ONK246B+rsa0cUam5OeAQ8pyclRDgpxuSCrAlJ1qN9uZ5IgyKC7gQg0w8OM50NXHEegPh/ks9YuR2A== + dependencies: + "@babel/runtime" "^7.1.2" + history "^4.9.0" + hoist-non-react-statics "^3.1.0" + loose-envify "^1.3.1" + mini-create-react-context "^0.3.0" + path-to-regexp "^1.7.0" + prop-types "^15.6.2" + react-is "^16.6.0" + tiny-invariant "^1.0.2" + tiny-warning "^1.0.0" + react-router@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.3.1.tgz#aada4aef14c809cb2e686b05cee4742234506c4e" @@ -7580,7 +7625,7 @@ tiny-invariant@^1.0.2: resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.0.6.tgz#b3f9b38835e36a41c843a3b0907a5a7b3755de73" integrity sha512-FOyLWWVjG+aC0UqG76V53yAWdXfH8bO6FNmyZOuUrzDzK8DI3/JRY25UD7+g49JWM1LXwymsKERB+DzI0dTEQA== -tiny-warning@^1.0.0: +tiny-warning@^1.0.0, tiny-warning@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== From a60265dca5b271481a0c99a63b887a993c0a9fcf Mon Sep 17 00:00:00 2001 From: Rikki Kendall Date: Sat, 16 Nov 2019 02:46:44 -0500 Subject: [PATCH 2/6] completed routing for edit user and edit team settings pages --- app/containers/App.js | 6 ++- app/containers/EditPassword.js | 82 ++++++++++++++++++++++++++++++ app/containers/EditTeamSettings.js | 4 +- app/containers/TeamSettings.js | 2 +- app/containers/UserSettings.js | 4 +- 5 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 app/containers/EditPassword.js diff --git a/app/containers/App.js b/app/containers/App.js index acdd458e..1410c0b4 100644 --- a/app/containers/App.js +++ b/app/containers/App.js @@ -9,6 +9,7 @@ import SettingsTabs from './SettingsTabs'; import TeamSettings from './TeamSettings'; import EditTeamSettings from './EditTeamSettings'; import EditUserSettings from './EditUserSettings'; +import EditPassword from './EditPassword'; import { configureStore } from '../redux/utils/store'; import { NativeRouter, Route, Link } from 'react-router-native'; @@ -25,8 +26,9 @@ export default class App extends Component { - - + + + ); diff --git a/app/containers/EditPassword.js b/app/containers/EditPassword.js new file mode 100644 index 00000000..cf31f7eb --- /dev/null +++ b/app/containers/EditPassword.js @@ -0,0 +1,82 @@ +// @flow + +import React, { Component } from 'react'; +import { Agenda } from 'react-native-calendars'; +import { connect } from 'react-redux'; +import { bindActionCreators } from 'redux'; +import moment from 'moment'; + +import { getAllShifts } from '../redux/actions/shifts'; +import { renderItem, renderEmptyDate, rowHasChanged } from '../components/AgendaItems'; +import Footer from './Footer'; + +import { Toast, Button, Icon, Body, Left, Right, Title, Text, Container, Header, Content, Form, Item, Input, Label } from 'native-base'; + +import { Link } from 'react-router-native'; + +type Props = { + getAllShifts: () => void, +}; + +class EditTeamSettings extends Component { + componentWillMount() { + this.props.getAllShifts(); + } + + render() { + + return ( + +
+ + + + +
+ +
+ + + + + + + + + + + + +
+ +
+
+ ); + } +} + +const mapStateToProps = state => ({ + shifts: state.shifts, +}); + +const mapDispatchToProps = dispatch => + bindActionCreators( + { + getAllShifts, + }, + dispatch, + ); + +export default connect( + mapStateToProps, + mapDispatchToProps, +)(EditTeamSettings); diff --git a/app/containers/EditTeamSettings.js b/app/containers/EditTeamSettings.js index 1f461641..9ea2cbe5 100644 --- a/app/containers/EditTeamSettings.js +++ b/app/containers/EditTeamSettings.js @@ -43,11 +43,11 @@ class EditTeamSettings extends Component {
- + - +
diff --git a/app/containers/TeamSettings.js b/app/containers/TeamSettings.js index 2b54a280..bfc08446 100644 --- a/app/containers/TeamSettings.js +++ b/app/containers/TeamSettings.js @@ -60,7 +60,7 @@ class TeamSettings extends Component { diff --git a/app/containers/UserSettings.js b/app/containers/UserSettings.js index 4661a433..4c451fb0 100644 --- a/app/containers/UserSettings.js +++ b/app/containers/UserSettings.js @@ -47,12 +47,14 @@ class UserSettings extends Component { - - - - - -
- - - - - - - - - - - - -
- -
- - ); - } -} - -const mapStateToProps = state => ({ - shifts: state.shifts, -}); - -const mapDispatchToProps = dispatch => - bindActionCreators( - { - getAllShifts, - }, - dispatch, - ); - -export default connect( - mapStateToProps, - mapDispatchToProps, -)(EditTeamSettings); diff --git a/app/containers/EditUserSettings.js b/app/containers/EditUserSettings.js index a9653fca..49673830 100644 --- a/app/containers/EditUserSettings.js +++ b/app/containers/EditUserSettings.js @@ -2,6 +2,7 @@ import React, { Component } from 'react'; import { Agenda } from 'react-native-calendars'; +import { StyleSheet, View } from 'react-native'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import moment from 'moment'; @@ -18,6 +19,19 @@ type Props = { getAllShifts: () => void, }; +const styles = StyleSheet.create({ + container: {}, + content: { + alignItems: 'center', + flex: 1, + justifyContent: 'center' + }, + form: { + width: '100%' + }, + item: {} +}); + class EditUserSettings extends Component { componentWillMount() { this.props.getAllShifts(); @@ -51,9 +65,11 @@ class EditUserSettings extends Component { - +
); diff --git a/app/containers/SettingsTabs.js b/app/containers/SettingsTabs.js index a066a9cb..c1370a7b 100644 --- a/app/containers/SettingsTabs.js +++ b/app/containers/SettingsTabs.js @@ -3,6 +3,7 @@ import { Button, Icon, Title, Right, Left, Container, Header, Content, Tab, Tabs import TeamSettings from './TeamSettings'; import UserSettings from './UserSettings'; import EditUserSettings from './EditUserSettings'; +import Footer from './Footer'; import { Link } from 'react-router-native'; @@ -23,6 +24,7 @@ export default class SettingsTabs extends Component { + @@ -31,6 +33,8 @@ export default class SettingsTabs extends Component { + +