From 101d9918e5f03f17641f6cdddaf89f50761ac32c Mon Sep 17 00:00:00 2001 From: Leon Liang Date: Tue, 1 Oct 2019 14:43:41 -0400 Subject: [PATCH 1/6] Changes to navigation bar --- twistter-frontend/src/App.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/twistter-frontend/src/App.js b/twistter-frontend/src/App.js index e6efa6c..7a7f46b 100644 --- a/twistter-frontend/src/App.js +++ b/twistter-frontend/src/App.js @@ -6,7 +6,7 @@ import './App.css'; import { BrowserRouter as Router } from 'react-router-dom'; import Route from 'react-router-dom/Route'; -import NavBar, { Navbar } from './components/layout/NavBar'; +import NavBar from './components/layout/NavBar'; import home from './Home.js'; import register from './Register.js'; @@ -22,7 +22,6 @@ class App extends Component {
-
From 8eb0872d16be44038a29f05a276af01aa090d83b Mon Sep 17 00:00:00 2001 From: Danny Voltz Date: Tue, 1 Oct 2019 17:27:52 -0500 Subject: [PATCH 2/6] logout ui --- twistter-frontend/src/Logout.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 twistter-frontend/src/Logout.js diff --git a/twistter-frontend/src/Logout.js b/twistter-frontend/src/Logout.js new file mode 100644 index 0000000..df36575 --- /dev/null +++ b/twistter-frontend/src/Logout.js @@ -0,0 +1,22 @@ +/* eslint-disable */ +import React, { Component} from 'react'; +import './App.css'; +import logo from './images/twistter-logo.png'; +import TextField from '@material-ui/core/TextField'; + +class Logout extends Component { + render() { + return( +
+ logo +

+ Logout of your Twistter Account +

+

+ +
+ ); + }; +} + +export default Logout; From fadb0f0399c47b217d6a77eeffaba88c30fa6b67 Mon Sep 17 00:00:00 2001 From: Danny Voltz Date: Tue, 1 Oct 2019 17:34:19 -0500 Subject: [PATCH 3/6] added logout support --- twistter-frontend/src/components/layout/NavBar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/twistter-frontend/src/components/layout/NavBar.js b/twistter-frontend/src/components/layout/NavBar.js index e4ee5c5..0b6ba22 100644 --- a/twistter-frontend/src/components/layout/NavBar.js +++ b/twistter-frontend/src/components/layout/NavBar.js @@ -19,7 +19,9 @@ export class Navbar extends Component { - + ) From b9909c1616864ef6b285be1d4db931a9a3b174f4 Mon Sep 17 00:00:00 2001 From: Leon Liang Date: Tue, 1 Oct 2019 18:44:49 -0400 Subject: [PATCH 4/6] move home.js and so on into according folders --- twistter-frontend/src/App.js | 8 ++++---- twistter-frontend/src/components/topic/ChipsArray.js | 4 +++- twistter-frontend/src/{ => pages}/Home.js | 0 twistter-frontend/src/{ => pages}/Login.js | 4 ++-- twistter-frontend/src/{ => pages}/Register.js | 0 5 files changed, 9 insertions(+), 7 deletions(-) rename twistter-frontend/src/{ => pages}/Home.js (100%) rename twistter-frontend/src/{ => pages}/Login.js (90%) rename twistter-frontend/src/{ => pages}/Register.js (100%) diff --git a/twistter-frontend/src/App.js b/twistter-frontend/src/App.js index e6efa6c..44f3e12 100644 --- a/twistter-frontend/src/App.js +++ b/twistter-frontend/src/App.js @@ -8,10 +8,10 @@ import Route from 'react-router-dom/Route'; import NavBar, { Navbar } from './components/layout/NavBar'; -import home from './Home.js'; -import register from './Register.js'; -import login from './Login.js'; -import user from './pages/user'; +import home from './pages/Home'; +import register from './pages/Register'; +import login from './pages/Login'; +import user from './pages/User'; import writeMicroblog from './Writing_Microblogs.js'; import userLine from './Userline.js'; diff --git a/twistter-frontend/src/components/topic/ChipsArray.js b/twistter-frontend/src/components/topic/ChipsArray.js index a99afd1..2bb2013 100644 --- a/twistter-frontend/src/components/topic/ChipsArray.js +++ b/twistter-frontend/src/components/topic/ChipsArray.js @@ -3,7 +3,9 @@ import { makeStyles } from '@material-ui/core/styles'; import Chip from '@material-ui/core/Chip'; import Paper from '@material-ui/core/Paper'; -const useStyles = makeStyles(theme => ({ + +// TODO: fix the style +const styles = makeStyles(theme => ({ root: { display: 'flex', justifyContent: 'center', diff --git a/twistter-frontend/src/Home.js b/twistter-frontend/src/pages/Home.js similarity index 100% rename from twistter-frontend/src/Home.js rename to twistter-frontend/src/pages/Home.js diff --git a/twistter-frontend/src/Login.js b/twistter-frontend/src/pages/Login.js similarity index 90% rename from twistter-frontend/src/Login.js rename to twistter-frontend/src/pages/Login.js index 550ed54..76531d2 100644 --- a/twistter-frontend/src/Login.js +++ b/twistter-frontend/src/pages/Login.js @@ -1,8 +1,8 @@ /* eslint-disable */ import React, { Component } from 'react'; -import './App.css'; +import '../App.css'; -import logo from './images/twistter-logo.png'; +import logo from '../images/twistter-logo.png'; import TextField from '@material-ui/core/TextField'; class Login extends Component { diff --git a/twistter-frontend/src/Register.js b/twistter-frontend/src/pages/Register.js similarity index 100% rename from twistter-frontend/src/Register.js rename to twistter-frontend/src/pages/Register.js From 89e894262438dd2fd708bbfcafcac460f4beafbb Mon Sep 17 00:00:00 2001 From: Leon Liang Date: Tue, 1 Oct 2019 18:54:26 -0400 Subject: [PATCH 5/6] file organization for twistter frontend --- twistter-frontend/src/App.css | 1 + twistter-frontend/src/App.js | 2 +- twistter-frontend/src/pages/Home.js | 4 ++-- twistter-frontend/src/pages/Register.js | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/twistter-frontend/src/App.css b/twistter-frontend/src/App.css index 5935fb8..6b2ecb1 100644 --- a/twistter-frontend/src/App.css +++ b/twistter-frontend/src/App.css @@ -45,4 +45,5 @@ .container { margin: 80px auto 0 auto; max-width: 1200px; + color: #1da1f2; } \ No newline at end of file diff --git a/twistter-frontend/src/App.js b/twistter-frontend/src/App.js index 44f3e12..57c7672 100644 --- a/twistter-frontend/src/App.js +++ b/twistter-frontend/src/App.js @@ -19,7 +19,7 @@ class App extends Component { render() { return ( -
+
diff --git a/twistter-frontend/src/pages/Home.js b/twistter-frontend/src/pages/Home.js index dfd653c..43bf100 100644 --- a/twistter-frontend/src/pages/Home.js +++ b/twistter-frontend/src/pages/Home.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; -import './App.css'; +import '../App.css'; -import logo from './images/twistter-logo.png'; +import logo from '../images/twistter-logo.png'; class Home extends Component { diff --git a/twistter-frontend/src/pages/Register.js b/twistter-frontend/src/pages/Register.js index c67d8c2..3d5db00 100644 --- a/twistter-frontend/src/pages/Register.js +++ b/twistter-frontend/src/pages/Register.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; -import './App.css'; +import '../App.css'; -import logo from './images/twistter-logo.png'; +import logo from '../images/twistter-logo.png'; import TextField from '@material-ui/core/TextField'; class Register extends Component { From 9d4f175a49bd82f8aa9cc49ab07f028280078a0b Mon Sep 17 00:00:00 2001 From: Aditya Sankaran Date: Tue, 1 Oct 2019 19:07:57 -0400 Subject: [PATCH 6/6] added entering topics field and database call for adding topics when writing microblog --- functions/handlers/post.js | 1 + functions/index.js | 3 ++- twistter-frontend/src/Userline.js | 9 ++++++-- twistter-frontend/src/Writing_Microblogs.js | 25 ++++++++++++++++----- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/functions/handlers/post.js b/functions/handlers/post.js index d15ea33..20528c0 100644 --- a/functions/handlers/post.js +++ b/functions/handlers/post.js @@ -11,6 +11,7 @@ exports.putPost = (req, res) => { createdAt: new Date().toISOString(), likeCount: 0, commentCount: 0, + microBlogTopics: req.body.microBlogTopics }; diff --git a/functions/index.js b/functions/index.js index 6ff3bd3..05f3dd3 100644 --- a/functions/index.js +++ b/functions/index.js @@ -253,7 +253,8 @@ const {putPost, getallPostsforUser} = require('./handlers/post'); app.get('/getallPostsforUser', getallPostsforUser); // Adds one post to the database -app.post('/putPost', fbAuth, putPost); +app.post('/putPost', firebaseAuth, putPost); + exports.api = functions.https.onRequest(app); \ No newline at end of file diff --git a/twistter-frontend/src/Userline.js b/twistter-frontend/src/Userline.js index 51d74f4..e8168ce 100644 --- a/twistter-frontend/src/Userline.js +++ b/twistter-frontend/src/Userline.js @@ -9,7 +9,8 @@ class Userline extends Component { { super(props); this.state = { - microBlogs : [] + microBlogs : [], + } } @@ -21,12 +22,16 @@ class Userline extends Component { const post = res.data; this.setState({microBlogs : post}) - }) + }) + + } render() { + let sortedPosts = []; + return (
    { this.state.microBlogs.map(microBlog =>

    {microBlog.body}

    )} diff --git a/twistter-frontend/src/Writing_Microblogs.js b/twistter-frontend/src/Writing_Microblogs.js index 1858193..0c3ddcc 100644 --- a/twistter-frontend/src/Writing_Microblogs.js +++ b/twistter-frontend/src/Writing_Microblogs.js @@ -11,6 +11,7 @@ class Writing_Microblogs extends Component { this.state = { value: '', title: '', + topics: '', characterCount: 10 }; @@ -19,12 +20,18 @@ class Writing_Microblogs extends Component { this.handleChange = this.handleChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); this.handleChangeforPost = this.handleChangeforPost.bind(this); + this.handleChangeforTopics = this.handleChangeforTopics.bind(this); + } handleChange(event) { this.setState( {title: event.target.value }); } + handleChangeforTopics(event) { + this.setState( {topics: event.target.value}); + } + handleSubmit(event) { // alert('A title for the microblog was inputted: ' + this.state.title + '\nA microblog was posted: ' + this.state.value); @@ -33,15 +40,16 @@ class Writing_Microblogs extends Component { { body: this.state.value, userHandle: "new user", userImage: "bing-url", - microBlogTitle: this.state.title - + microBlogTitle: this.state.title, + microBlogTopics: this.state.topics.split(', ') + }, { headers: { 'Content-Type': 'application/json'} } ) console.log(response.data); event.preventDefault(); - this.setState({value: '', title: '',characterCount: 10}) + this.setState({value: '', title: '',characterCount: 10, topics: ''}) } handleChangeforPost(event) { @@ -55,13 +63,18 @@ class Writing_Microblogs extends Component { } - render() { return (
    -
    +
    - +