diff --git a/diagrams/Block Diagram.png b/diagrams/Block Diagram.png new file mode 100644 index 0000000..5c0b0e9 Binary files /dev/null and b/diagrams/Block Diagram.png differ diff --git a/diagrams/Class Diagram.png b/diagrams/Class Diagram.png new file mode 100644 index 0000000..e38ac3e Binary files /dev/null and b/diagrams/Class Diagram.png differ diff --git a/gamersnet_frontend/package-lock.json b/gamersnet_frontend/package-lock.json index 748d4a4..b632c76 100644 --- a/gamersnet_frontend/package-lock.json +++ b/gamersnet_frontend/package-lock.json @@ -14831,12 +14831,21 @@ "is-typedarray": "^1.0.0" } }, +<<<<<<< HEAD +<<<<<<< HEAD +======= +======= +>>>>>>> befc5f3a8de6baadaa9b7b37c89a796fc77017b0 "typescript": { "version": "3.9.9", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.9.tgz", "integrity": "sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==", "peer": true }, +<<<<<<< HEAD +>>>>>>> frontend_signin +======= +>>>>>>> befc5f3a8de6baadaa9b7b37c89a796fc77017b0 "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", diff --git a/gamersnet_frontend/src/components/createPost/index.js b/gamersnet_frontend/src/components/createPost/index.js new file mode 100644 index 0000000..59c30ad --- /dev/null +++ b/gamersnet_frontend/src/components/createPost/index.js @@ -0,0 +1,145 @@ +import React from 'react'; +import {withRouter} from 'react-router-dom'; + +import APIFetch from '../../api'; +import './styles.css'; +class AddPost extends React.Component{ + + constructor(props){ + super(props); + + this.state = { + gameName: 'Apex Legends', + description: '', + numPlayers: 1, + gameTimeUTC: 0, + duration: '', + location: '', + message: '' + }; + + this.inputgameName = this.inputgameName.bind(this); + this.inputDescription = this.inputDescription.bind(this); + this.inputLocation = this.inputLocation.bind(this); + this.inputDuration = this.inputDuration.bind(this); + this.inputPlayers = this.inputPlayers.bind(this); + this.inputDate = this.inputDate.bind(this); + + this.handle = this.handle.bind(this); + } + + inputDescription(event){ + this.setState({description: event.target.value}); + } + + inputgameName(event){ + this.setState({gameName: event.target.value}); + } + + inputLocation(event){ + this.setState({location: event.target.value}); + } + + inputPlayers(event){ + this.setState({numPlayers: event.target.value}); + } + + inputDuration(event){ + this.setState({duration: event.target.value}); + } + + inputDate(event){ + this.setState({gameTimeUTC: event.target.valueAsNumber}); + } + + + handle(event) { + let body = { + gameName: this.state.gameName, + description: this.state.description, + numPlayers: this.state.numPlayers, + gameTimeUTC: this.state.gameTimeUTC, + duration: this.state.duration, + location: this.state.location + }; +console.log(body); + let fetchData = APIFetch('/posts/createPost', JSON.stringify(body), 'POST'); + + fetchData.then(async (data) => { + if (await data.ok) { + this.props.history.push('/'); + this.props.updateHeader(); + } else { + this.setState({message: 'something went wrong'}); + } + }); + + + event.preventDefault(); + } + + render() { + return ( +
+
+

Create a Post:

+ +
+

Add Game Name you want to play:

+ + +

Description

+ + +

Number of players to play with:

+ + +

Add location:

+ + +

Duration to play:

+ + +

Select a date to play on:

+ + +
+

{this.state.message}

+
+ ); + } +} +export default withRouter(AddPost); \ No newline at end of file diff --git a/gamersnet_frontend/src/components/createPost/styles.css b/gamersnet_frontend/src/components/createPost/styles.css new file mode 100644 index 0000000..607e938 --- /dev/null +++ b/gamersnet_frontend/src/components/createPost/styles.css @@ -0,0 +1,31 @@ +.post-form { + width: 25%; + left: 50%; + transform: translateX(-50%); + position: relative; + padding: 3rem 4rem 3rem 4rem; + border-radius: 15px; + border: 1px solid var(--accent); +} + +.post-form > .vertical-center { + display: flex; + flex-direction: column; +} + +.post-form > .vertical-center > * { + margin-top: 2rem; +} + +.post-form > .vertical-center > input { + padding: 0.5rem; + border: 1px solid white; +} + +.post-form > .vertical-center > button { + color: white; + padding: 0.5rem; + border: 1px solid rgb(47, 47, 255); + background-color: rgb(95, 95, 255); + border-radius: 15px; +} \ No newline at end of file diff --git a/gamersnet_frontend/src/components/header/index.js b/gamersnet_frontend/src/components/header/index.js index 237f91c..847fc54 100644 --- a/gamersnet_frontend/src/components/header/index.js +++ b/gamersnet_frontend/src/components/header/index.js @@ -7,6 +7,7 @@ export default class Header extends React.Component { authLinks() { return (
+ Post Logout password
diff --git a/gamersnet_frontend/src/index.js b/gamersnet_frontend/src/index.js index 1b1d2b2..079ffee 100644 --- a/gamersnet_frontend/src/index.js +++ b/gamersnet_frontend/src/index.js @@ -13,6 +13,7 @@ import SignIn from './components/signin'; import Register from './components/register'; import Password from './components/password'; import Logout from './components/logout'; +import AddPost from './components/createPost'; // import header import Header from './components/header'; @@ -43,6 +44,7 @@ class App extends React.Component { return (
+ } /> } /> } /> } />