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(),
|
||||
likeCount: 0,
|
||||
commentCount: 0,
|
||||
microBlogTopics: req.body.microBlogTopics
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -45,4 +45,5 @@
|
||||
.container {
|
||||
margin: 80px auto 0 auto;
|
||||
max-width: 1200px;
|
||||
color: #1da1f2;
|
||||
}
|
||||
|
||||
@ -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';
|
||||
@ -20,10 +20,9 @@ class App extends Component {
|
||||
render() {
|
||||
return (
|
||||
<Router>
|
||||
<div className='container'>
|
||||
<div className='container' >
|
||||
<Navbar />
|
||||
</div>
|
||||
|
||||
<div className="app">
|
||||
<Route exact path="/" component={home}/>
|
||||
<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);
|
||||
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>)}
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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>
|
||||
)
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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 {
|
||||
@ -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 {
|
||||
@ -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 {
|
||||
Loading…
Reference in New Issue
Block a user