Merge branch 'master' into edit-profile-frontend

This commit is contained in:
Clayton Wilson 2019-10-01 21:01:02 -04:00 committed by GitHub
commit 88310714b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 69 additions and 24 deletions

View File

@ -10,6 +10,7 @@ exports.putPost = (req, res) => {
createdAt: new Date().toISOString(),
likeCount: 0,
commentCount: 0,
microBlogTopics: req.body.microBlogTopics
};

View File

@ -45,4 +45,5 @@
.container {
margin: 80px auto 0 auto;
max-width: 1200px;
color: #1da1f2;
}

View File

@ -5,13 +5,13 @@ 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 './pages/Home';
import register from './pages/Register';
import login from './pages/Login';
import user from './pages/User';
// Pages
import home from './Home.js';
import register from './Register.js';
import login from './Login.js';
import user from './pages/user';
import writeMicroblog from './Writing_Microblogs.js';
import edit from './pages/edit.js';
import userLine from './Userline.js';
@ -23,7 +23,6 @@ class App extends Component {
<div className='container' >
<Navbar />
</div>
<div className="app">
<Route exact path="/" component={home}/>
<Route exact path="/register" component={register}/>

View File

@ -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(
<div>
<img src={logo} className="app-logo" alt="logo" />
<br/><br/>
<b>Logout of your Twistter Account</b>
<br/><br/>
<br/><br/>
<button className="authButtons register" type="submit">Sign Out</button>
</div>
);
};
}
export default Logout;

View File

@ -9,7 +9,8 @@ class Userline extends Component {
{
super(props);
this.state = {
microBlogs : []
microBlogs : [],
}
}
@ -24,9 +25,13 @@ class Userline extends Component {
})
}
render() {
let sortedPosts = [];
return (
<ul>
{ this.state.microBlogs.map(microBlog => <p>{microBlog.body}</p>)}

View File

@ -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,7 +40,8 @@ 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'} }
@ -41,7 +49,7 @@ class Writing_Microblogs extends Component {
)
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 (
<div>
<div style={{ width: "200px", height: "50px", marginTop: "180px", marginLeft: "30px" }}>
<div style={{ width: "200px", height: "50px", marginTop: "180px", marginLeft: "50px" }}>
<form>
<input type="text" placeholder="Enter Microblog Title" value={this.state.title} onChange={this.handleChange} />
<textarea placeholder="Enter Microblog Title" value={this.state.title} required onChange={this.handleChange} cols={30} rows={1} />
</form>
</div>
<div style={{ width: "200px", height: "50px", marginLeft: "50px"}} >
<form>
<textarea placeholder="Enter topics seperated by a comma" value={this.state.topics} required onChange={this.handleChangeforTopics} cols={40} rows={1} />
</form>
</div>

View File

@ -19,7 +19,9 @@ export class Navbar extends Component {
<Button component={ Link } to='/register'>
Register
</Button>
<Button component={ Link } to='/logout'>
Logout
</Button>
</ToolBar>
</AppBar>
)

View File

@ -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',

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {