mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 10:18:48 +00:00
Merge branch 'master' into edit-profile-frontend
This commit is contained in:
commit
88310714b2
@ -10,6 +10,7 @@ exports.putPost = (req, res) => {
|
|||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
likeCount: 0,
|
likeCount: 0,
|
||||||
commentCount: 0,
|
commentCount: 0,
|
||||||
|
microBlogTopics: req.body.microBlogTopics
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -45,4 +45,5 @@
|
|||||||
.container {
|
.container {
|
||||||
margin: 80px auto 0 auto;
|
margin: 80px auto 0 auto;
|
||||||
max-width: 1200px;
|
max-width: 1200px;
|
||||||
|
color: #1da1f2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,13 +5,13 @@ import './App.css';
|
|||||||
|
|
||||||
import { BrowserRouter as Router } from 'react-router-dom';
|
import { BrowserRouter as Router } from 'react-router-dom';
|
||||||
import Route from 'react-router-dom/Route';
|
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 writeMicroblog from './Writing_Microblogs.js';
|
||||||
import edit from './pages/edit.js';
|
import edit from './pages/edit.js';
|
||||||
import userLine from './Userline.js';
|
import userLine from './Userline.js';
|
||||||
@ -20,10 +20,9 @@ class App extends Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
<div className='container'>
|
<div className='container' >
|
||||||
<Navbar />
|
<Navbar />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="app">
|
<div className="app">
|
||||||
<Route exact path="/" component={home}/>
|
<Route exact path="/" component={home}/>
|
||||||
<Route exact path="/register" component={register}/>
|
<Route exact path="/register" component={register}/>
|
||||||
|
|||||||
22
twistter-frontend/src/Logout.js
Normal file
22
twistter-frontend/src/Logout.js
Normal 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;
|
||||||
@ -9,7 +9,8 @@ class Userline extends Component {
|
|||||||
{
|
{
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
microBlogs : []
|
microBlogs : [],
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -21,12 +22,16 @@ class Userline extends Component {
|
|||||||
const post = res.data;
|
const post = res.data;
|
||||||
this.setState({microBlogs : post})
|
this.setState({microBlogs : post})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let sortedPosts = [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ul>
|
<ul>
|
||||||
{ this.state.microBlogs.map(microBlog => <p>{microBlog.body}</p>)}
|
{ this.state.microBlogs.map(microBlog => <p>{microBlog.body}</p>)}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ class Writing_Microblogs extends Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
value: '',
|
value: '',
|
||||||
title: '',
|
title: '',
|
||||||
|
topics: '',
|
||||||
characterCount: 10
|
characterCount: 10
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -19,12 +20,18 @@ class Writing_Microblogs extends Component {
|
|||||||
this.handleChange = this.handleChange.bind(this);
|
this.handleChange = this.handleChange.bind(this);
|
||||||
this.handleSubmit = this.handleSubmit.bind(this);
|
this.handleSubmit = this.handleSubmit.bind(this);
|
||||||
this.handleChangeforPost = this.handleChangeforPost.bind(this);
|
this.handleChangeforPost = this.handleChangeforPost.bind(this);
|
||||||
|
this.handleChangeforTopics = this.handleChangeforTopics.bind(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChange(event) {
|
handleChange(event) {
|
||||||
this.setState( {title: event.target.value });
|
this.setState( {title: event.target.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleChangeforTopics(event) {
|
||||||
|
this.setState( {topics: event.target.value});
|
||||||
|
}
|
||||||
|
|
||||||
handleSubmit(event) {
|
handleSubmit(event) {
|
||||||
// alert('A title for the microblog was inputted: ' + this.state.title + '\nA microblog was posted: ' + this.state.value);
|
// 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,
|
{ body: this.state.value,
|
||||||
userHandle: "new user",
|
userHandle: "new user",
|
||||||
userImage: "bing-url",
|
userImage: "bing-url",
|
||||||
microBlogTitle: this.state.title
|
microBlogTitle: this.state.title,
|
||||||
|
microBlogTopics: this.state.topics.split(', ')
|
||||||
|
|
||||||
},
|
},
|
||||||
{ headers: { 'Content-Type': 'application/json'} }
|
{ headers: { 'Content-Type': 'application/json'} }
|
||||||
|
|
||||||
)
|
)
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.setState({value: '', title: '',characterCount: 10})
|
this.setState({value: '', title: '',characterCount: 10, topics: ''})
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChangeforPost(event) {
|
handleChangeforPost(event) {
|
||||||
@ -55,13 +63,18 @@ class Writing_Microblogs extends Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div style={{ width: "200px", height: "50px", marginTop: "180px", marginLeft: "30px" }}>
|
<div style={{ width: "200px", height: "50px", marginTop: "180px", marginLeft: "50px" }}>
|
||||||
<form>
|
<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>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,9 @@ export class Navbar extends Component {
|
|||||||
<Button component={ Link } to='/register'>
|
<Button component={ Link } to='/register'>
|
||||||
Register
|
Register
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button component={ Link } to='/logout'>
|
||||||
|
Logout
|
||||||
|
</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,7 +3,9 @@ import { makeStyles } from '@material-ui/core/styles';
|
|||||||
import Chip from '@material-ui/core/Chip';
|
import Chip from '@material-ui/core/Chip';
|
||||||
import Paper from '@material-ui/core/Paper';
|
import Paper from '@material-ui/core/Paper';
|
||||||
|
|
||||||
const useStyles = makeStyles(theme => ({
|
|
||||||
|
// TODO: fix the style
|
||||||
|
const styles = makeStyles(theme => ({
|
||||||
root: {
|
root: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react';
|
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 {
|
class Home extends Component {
|
||||||
@ -1,8 +1,8 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import React, { Component } from 'react';
|
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';
|
import TextField from '@material-ui/core/TextField';
|
||||||
|
|
||||||
class Login extends Component {
|
class Login extends Component {
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react';
|
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';
|
import TextField from '@material-ui/core/TextField';
|
||||||
|
|
||||||
class Register extends Component {
|
class Register extends Component {
|
||||||
Loading…
Reference in New Issue
Block a user