diff --git a/frontend/src/components/CreateEvent.js b/frontend/src/components/CreateEvent.js index 5fab25f..1d5a080 100644 --- a/frontend/src/components/CreateEvent.js +++ b/frontend/src/components/CreateEvent.js @@ -18,7 +18,10 @@ const CreateEvent = (props) => { }); }; return ( -
+

Create Event

diff --git a/frontend/src/components/CreatePost.js b/frontend/src/components/CreatePost.js index 5a05215..5a54f4c 100644 --- a/frontend/src/components/CreatePost.js +++ b/frontend/src/components/CreatePost.js @@ -18,7 +18,10 @@ const CreatePost = (props) => { }); }; return ( -
+

Create Post

diff --git a/frontend/src/components/Event.js b/frontend/src/components/Event.js index 06c6936..4f8508f 100644 --- a/frontend/src/components/Event.js +++ b/frontend/src/components/Event.js @@ -71,7 +71,7 @@ const Event = (props) => { Event {props.match.params.id} -
+

Event: {state.event_title}

Website diff --git a/frontend/src/components/Events.js b/frontend/src/components/Events.js index 4494669..cb8cfc3 100644 --- a/frontend/src/components/Events.js +++ b/frontend/src/components/Events.js @@ -3,7 +3,48 @@ import React, { useState, useEffect } from "react"; const Events = (props) => { const [state, setState] = useState({ user: { username: "" }, - events: [{ id: 1, upvotes: 0, text: "Green Earth" }], + events: [ + { + id: 1, + upvotes: 0, + text: "Green Earth", + comments: 1, + topics: [ + "climate change", + "global warming", + "earth", + "green environment", + ], + }, + { + id: 2, + upvotes: 352, + text: "Walk for Gun Control", + comments: 53, + topics: ["gun control", "legislation"], + }, + { + id: 3, + upvotes: 1, + text: "Rights for Gays", + comments: 0, + topics: ["LGBTQ", "policy"], + }, + { + id: 4, + upvotes: 3, + text: "Black Lives Matter", + comments: 4, + topics: ["racial justice"], + }, + { + id: 5, + upvotes: 24, + text: "Ending COVID-19", + comments: 12, + topics: ["health", "covid19"], + }, + ], }); const [stocks, setStocks] = useState([]); @@ -27,21 +68,48 @@ const Events = (props) => { useEffect(() => { callAPI(); }, []); + const maybePluralize = (count, noun, suffix = "s") => + `${count} ${noun}${count !== 1 ? suffix : ""}`; return (
-

Events

+

+ Events +

Create Event
+

+

Hello {state.user.username}!

{state.events.map((event) => { return ( -
+
{event.text}

+{event.upvotes}

+

+ {maybePluralize(event.comments, "comment")} +

+
+ {event.topics.map((topic) => { + return ( +
+

{topic}

+
+ ); + })} +
); })} diff --git a/frontend/src/components/Post.js b/frontend/src/components/Post.js index 840a34c..04ff42c 100644 --- a/frontend/src/components/Post.js +++ b/frontend/src/components/Post.js @@ -75,7 +75,7 @@ const Post = (props) => {

Post {props.match.params.id}

-
+

{state.post_title}

{state.post_text}

Topics:

diff --git a/frontend/src/components/Posts.js b/frontend/src/components/Posts.js index 8239ac0..da7aaa1 100644 --- a/frontend/src/components/Posts.js +++ b/frontend/src/components/Posts.js @@ -3,7 +3,15 @@ import React, { useState, useEffect } from "react"; const Posts = (props) => { const [state, setState] = useState({ user: { username: "" }, - posts: [{ id: 1, upvotes: 0, text: "monkeys" }], + posts: [ + { + id: 1, + upvotes: 2, + text: "Action for Climate Change", + comments: 0, + topics: ["climate change", "air pollution"], + }, + ], }); const requestOptions = { @@ -26,21 +34,47 @@ const Posts = (props) => { useEffect(() => { callAPI(); }, []); + const maybePluralize = (count, noun, suffix = "s") => + `${count} ${noun}${count !== 1 ? suffix : ""}`; return (
-

Posts

+

+ Posts +

Create Post - {" "} +
+

Hello {state.user.username}!

{state.posts.map((post) => { return ( -
+
{post.text}

+{post.upvotes}

+

+ {maybePluralize(post.comments, "comment")} +

+
+ {post.topics.map((topic) => { + return ( +
+

{topic}

+
+ ); + })} +
); })} diff --git a/frontend/src/components/Profile.js b/frontend/src/components/Profile.js index bddb8af..d1ef060 100644 --- a/frontend/src/components/Profile.js +++ b/frontend/src/components/Profile.js @@ -29,7 +29,12 @@ const Profile = (props) => { }, []); return (
-

Profile

+

+ Profile +

Hello {state.user.username}!

Topics you are interested in: