From 7c4659a906c5bdb0e5720ce25855478e6c518c58 Mon Sep 17 00:00:00 2001 From: Yiyuan Fang Date: Thu, 11 Jun 2020 16:21:13 -0400 Subject: [PATCH] added logic, thank page, modify page --- src/components/Help.js | 11 ++++++++++ src/components/Signin.js | 44 +++++++++++++++++++++++--------------- src/components/Thank.js | 22 +++++++++++++++++++ src/components/Top.js | 2 +- src/containers/Airport.css | 3 --- src/containers/Airport.js | 43 ------------------------------------- src/containers/Airport2.js | 9 +++----- src/containers/App.js | 31 ++++++++++++++++++++++++++- 8 files changed, 94 insertions(+), 71 deletions(-) create mode 100644 src/components/Help.js create mode 100644 src/components/Thank.js delete mode 100644 src/containers/Airport.css delete mode 100644 src/containers/Airport.js diff --git a/src/components/Help.js b/src/components/Help.js new file mode 100644 index 0000000..8022e8b --- /dev/null +++ b/src/components/Help.js @@ -0,0 +1,11 @@ +import React from 'react'; + +function Help (){ + return ( +
+

Help

+
+ ) +} + +export default Help \ No newline at end of file diff --git a/src/components/Signin.js b/src/components/Signin.js index 0e59d66..13de0f9 100644 --- a/src/components/Signin.js +++ b/src/components/Signin.js @@ -1,30 +1,40 @@ import React from 'react'; -function Signin (){ +function Signin ({onRouteChange}){ return ( -
-
-
- Sign In -
- - + ); } diff --git a/src/components/Thank.js b/src/components/Thank.js new file mode 100644 index 0000000..76e1d2d --- /dev/null +++ b/src/components/Thank.js @@ -0,0 +1,22 @@ +import React from 'react'; + +function Thank ({onRouteChange}) { + return ( +
+

Thank you for using Divvy!

+
+ +


+
+ {onRouteChange ('firsttime')}} /> +
+
) +} + +export default Thank \ No newline at end of file diff --git a/src/components/Top.js b/src/components/Top.js index f84a0e1..2446e52 100644 --- a/src/components/Top.js +++ b/src/components/Top.js @@ -4,7 +4,7 @@ import './Top.css'; function Top () { return (
-

Welcome to Divvy

+

Welcome to Divvy

) } diff --git a/src/containers/Airport.css b/src/containers/Airport.css deleted file mode 100644 index ac031d3..0000000 --- a/src/containers/Airport.css +++ /dev/null @@ -1,3 +0,0 @@ -.Basket{ - text-align: center; -} \ No newline at end of file diff --git a/src/containers/Airport.js b/src/containers/Airport.js deleted file mode 100644 index 53654d3..0000000 --- a/src/containers/Airport.js +++ /dev/null @@ -1,43 +0,0 @@ -import React, {useState} from 'react'; -import DatePicker from "react-datepicker"; -import "react-datepicker/dist/react-datepicker.css"; -import './Airport.css'; -import Basket from '../components/Basket.js'; -import '../components/Basket.css'; -import {users, airports} from '../components/fakedata.js'; -import Scroll from '../components/Scroll'; - -function Airport () { - const [startDate, setStartDate] = useState(new Date()); - - const airportlist = airports.map((name, i)=> { - return - }) - - return ( -
-
- setStartDate(date)}/> -
- {airportlist} -
- ) -} -export default Airport; - -function Block (props) { - const blocklist = users.filter(user => { - return (Number(user.month) === (props.date.getMonth()+1) && user.airport.toLowerCase() === props.name.toLowerCase()) - }) - - const blockmap = blocklist.map((name, i) => { - return - }) - - return ( -
-
{props.name} {props.date.getMonth()+1}
- {blockmap} -
- ) -} \ No newline at end of file diff --git a/src/containers/Airport2.js b/src/containers/Airport2.js index 01e4a59..0101764 100644 --- a/src/containers/Airport2.js +++ b/src/containers/Airport2.js @@ -1,13 +1,12 @@ import React, {Component} from 'react'; import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; -import './Airport.css'; +import './Airport2.css'; import Basket from '../components/Basket.js'; import '../components/Basket.css'; import {users, airports} from '../components/fakedata.js'; import Scroll from '../components/Scroll'; import './Airport2.css' -import Signin from '../components/Signin' class Airport2 extends Component { @@ -16,21 +15,19 @@ class Airport2 extends Component { this.state = { startDate: new Date(), airports: airports, - users: users + users: users, };} onChange = date => {this.setState({startDate: date});}; - + render () { const Airmaps = this.state.airports.map((name, i) => { return }); - return (
-
diff --git a/src/containers/App.js b/src/containers/App.js index 6f384e5..3780e1f 100644 --- a/src/containers/App.js +++ b/src/containers/App.js @@ -1,14 +1,43 @@ import React, {Component} from 'react'; import Airport2 from './Airport2'; import Top from '../components/Top'; -import './App.css'; +import Signin from '../components/Signin'; +import './Airport2.css'; +import Help from '../components/Help' +import Thank from '../components/Thank' class App extends Component{ + constructor (){ + super() + this.state = { + route: 'firsttime' + }; + }; + + onRouteChange = (route) => { + this.setState({route:route}); + } + render () { return (
+ {this.state.route === 'firsttime' + ?
+
+
Login
+ +
+ :(this.state.route === 'Thank' + ?
+ +
+ :
+ + +
+ )}
); }