diff --git a/functions/handlers/post.js b/functions/handlers/post.js index 063f634..5f361fe 100644 --- a/functions/handlers/post.js +++ b/functions/handlers/post.js @@ -28,7 +28,7 @@ exports.putPost = (req, res) => { exports.getallPostsforUser = (req, res) => { - admin.firestore().collection('posts').where('userHandle', '==', 'user' ).get() + admin.firestore().collection('posts').where('userHandle', '==', 'new user' ).get() .then((data) => { let posts = []; data.forEach(function(doc) { diff --git a/twistter-frontend/src/Userline.js b/twistter-frontend/src/Userline.js index e8168ce..b9e0d9c 100644 --- a/twistter-frontend/src/Userline.js +++ b/twistter-frontend/src/Userline.js @@ -2,6 +2,12 @@ import React, { Component } from "react"; import { BrowserRouter as Router } from 'react-router-dom'; import Route from 'react-router-dom/Route'; import axios from 'axios'; +import Box from '@material-ui/core/Box' +import {borders} from '@material-ui/system'; +import { sizing } from '@material-ui/system'; +var moment = require('moment'); + + class Userline extends Component { @@ -23,20 +29,36 @@ class Userline extends Component { this.setState({microBlogs : post}) }) - - - - - } + } render() { - let sortedPosts = []; - + const sortedPosts = (this.state.microBlogs).sort((a,b) => + -a.createdAt.localeCompare(b.createdAt) + ) + return ( - - ) - } +
+
+

Userline

+
+ +
+

+ {sortedPosts.map((microBlog) =>

Microblog Title: {microBlog.microBlogTitle} +

When post was created: {microBlog.createdAt.substring(0,10) + + " " + microBlog.createdAt.substring(11,19)} +

Number of comments: {microBlog.commentCount} +

Number of likes: {microBlog.likeCount} +

Body of post: {microBlog.body} +

Tagged topics: {microBlog.microBlogTopics.join("," + " ")} +

)} +

+
+
+
+ + ) + } + } export default Userline; diff --git a/twistter-frontend/src/Writing_Microblogs.js b/twistter-frontend/src/Writing_Microblogs.js index 0c3ddcc..3bda6cc 100644 --- a/twistter-frontend/src/Writing_Microblogs.js +++ b/twistter-frontend/src/Writing_Microblogs.js @@ -12,7 +12,7 @@ class Writing_Microblogs extends Component { value: '', title: '', topics: '', - characterCount: 10 + characterCount: 250 }; @@ -48,8 +48,9 @@ class Writing_Microblogs extends Component { ) console.log(response.data); + alert('Post was shared successfully!'); event.preventDefault(); - this.setState({value: '', title: '',characterCount: 10, topics: ''}) + this.setState({value: '', title: '',characterCount: 250, topics: ''}) } handleChangeforPost(event) { @@ -58,7 +59,7 @@ class Writing_Microblogs extends Component { handleChangeforCharacterCount(event) { const charCount = event.target.value.length - const charRemaining = 10 - charCount + const charRemaining = 250 - charCount this.setState({characterCount: charRemaining }) } @@ -80,7 +81,7 @@ class Writing_Microblogs extends Component {
-