Skip to content

Styling user #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 78 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
0035da0
created relation between posts and users, included user id in posts r…
addauk Mar 7, 2023
28a8cec
name field added to user and set to populate on posts based on who cr…
addauk Mar 7, 2023
8dd2f2f
mend
addauk Mar 7, 2023
dcbf85c
mend
addauk Mar 7, 2023
92bc0d5
mend
addauk Mar 7, 2023
b7151c8
API tests updated
addauk Mar 8, 2023
ce8d975
Added frontend and e2e tests
addauk Mar 8, 2023
aebbb4a
Changed page title and favicon
doragores Mar 8, 2023
e0cbd24
Merge pull request #2 from moeid9/title-favicon
addauk Mar 8, 2023
79defd0
Merge pull request #1 from moeid9/user-name-on-posts
iamdobbs Mar 8, 2023
5554d02
Posts are now displayed in reverse chrono order
mirandaweston Mar 8, 2023
a09f240
Updating test suite: posts in reverse chrono order
mirandaweston Mar 8, 2023
b771bf6
Implemented CreatePost feature. Exposed user_id through the TokenGene…
iamdobbs Mar 8, 2023
34aa665
updated one API test
addauk Mar 8, 2023
46c49fc
Merge pull request #3 from moeid9/reverse-chrono-feed
addauk Mar 8, 2023
f14b72b
Refactored so user_id isn't being passed around uncoded
addauk Mar 9, 2023
e7df18c
Added hook for updating posts rather than doing full window reload
addauk Mar 9, 2023
05f0fbc
Merge branch 'main' into create-post
addauk Mar 9, 2023
82685e0
Tweaked some logic for readability
addauk Mar 9, 2023
866b629
Updated token test to ensure users were cleaned before next one ran
addauk Mar 9, 2023
019ebf8
Added working timestamps for posts
moeid9 Mar 9, 2023
7acbcec
Merge pull request #4 from moeid9/post-timestamp
mirandaweston Mar 9, 2023
6ac428d
Added tests for time stamps
moeid9 Mar 10, 2023
8175941
edited tests for time stamps to work with seconds
moeid9 Mar 10, 2023
1a115c0
Tests in place but bug on cypress is causing issues with createpost c…
addauk Mar 10, 2023
de7a456
Updated time with name id on post
ChalkandFeather Mar 10, 2023
75fa50a
Merge pull request #5 from moeid9/post-timestamp
addauk Mar 10, 2023
71a0a3a
Merge branch 'main' into create-post
addauk Mar 10, 2023
3ca7962
package changes
addauk Mar 10, 2023
5503ff1
Merge pull request #6 from moeid9/create-post
moeid9 Mar 10, 2023
9755fd4
Added css files for signup and login pages
doragores Mar 13, 2023
1b59e96
Added like functionality, delete your posts db before using
addauk Mar 13, 2023
ddcd2fd
added reactive button state
addauk Mar 13, 2023
a3199b8
frontend support for reactive state
addauk Mar 13, 2023
5e838ce
removing unneeded logs
addauk Mar 13, 2023
d87f599
Added a navbar with updating status
moeid9 Mar 13, 2023
8b17895
Added submit button styling
moeid9 Mar 13, 2023
fd8c331
Removed second logout button
moeid9 Mar 13, 2023
50f2724
Made Acebook a clickable object
doragores Mar 14, 2023
b85bb46
Added border for each post
doragores Mar 14, 2023
c551869
changed navbar colour
doragores Mar 14, 2023
242f644
added a strong tag to Post From user.name
doragores Mar 14, 2023
e1e112e
Fixed when Acebook would not show when logged in
moeid9 Mar 14, 2023
148a025
moved message and submit button to middle of the page
doragores Mar 14, 2023
8409271
curved posts container and changed message and submit button size
doragores Mar 14, 2023
796b4ac
added Feed to navbar and changed posts colour
doragores Mar 14, 2023
d61e995
centered login and sign up button
doragores Mar 15, 2023
5524a6d
bcrypt encryption added for both signup and login
iamdobbs Mar 15, 2023
c7706d9
Merge pull request #7 from moeid9/toggle-likes
moeid9 Mar 15, 2023
981b2e4
Merge branch 'main' into styling
moeid9 Mar 15, 2023
3d1d9ae
Merge pull request #8 from moeid9/bcrypt
doragores Mar 15, 2023
98adc12
Added styling for the like buttons and posts
moeid9 Mar 15, 2023
76767b3
Merge pull request #9 from moeid9/styling
doragores Mar 15, 2023
908f52b
New comment branch
ChalkandFeather Mar 15, 2023
d8f887f
CreateComment method in api posts/controllers
ChalkandFeather Mar 15, 2023
de12ba1
initial addition of comments backend. Requires html frontend
ChalkandFeather Mar 15, 2023
0c7c683
updated comment with name
ChalkandFeather Mar 15, 2023
bb4b9a1
comments not loading. Console logs comments
ChalkandFeather Mar 15, 2023
ec41b2a
functioning comments with timestamp and user name
ChalkandFeather Mar 15, 2023
cd0a690
Added hardcoded user avatar
moeid9 Mar 16, 2023
5739e69
Finished implimentation and likes involved, needs styling
addauk Mar 16, 2023
a3516ab
fixing comments page reload issue
addauk Mar 16, 2023
3d03464
Merge branch 'main' into comment
addauk Mar 16, 2023
442b5f4
Amazing styling
addauk Mar 16, 2023
f8de8fd
Merge pull request #10 from moeid9/comment
ChalkandFeather Mar 16, 2023
1e13074
Merge branch 'main' into avatar
moeid9 Mar 16, 2023
b52c179
Added a working user model
moeid9 Mar 16, 2023
3176146
Added a working user image
moeid9 Mar 16, 2023
358f19f
UserProfile.js created. Functions to fetch user + post data by id inc…
iamdobbs Mar 16, 2023
2619252
styled avatar box input
doragores Mar 16, 2023
34f4c75
Merging main
iamdobbs Mar 16, 2023
f812120
Added route to show feed on homepage, redirect changes if not logged …
iamdobbs Mar 16, 2023
5342a6b
Merge pull request #11 from moeid9/user-profile
addauk Mar 16, 2023
b9c0ddd
Merge branch 'main' into avatar
moeid9 Mar 17, 2023
7c01625
Added button to navbar for profile page and user image to the comment…
moeid9 Mar 17, 2023
7518fde
removed vscode settings file
moeid9 Mar 17, 2023
3614320
Merge pull request #12 from moeid9/avatar
doragores Mar 17, 2023
99741e0
Styled UserProfile
doragores Mar 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactored so user_id isn't being passed around uncoded
addauk committed Mar 9, 2023
commit f14b72bbac8e2498180432d30fa958efa8df1159
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
4 changes: 3 additions & 1 deletion api/controllers/posts.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,9 @@ const PostsController = {
});
},
Create: (req, res) => {
const post = new Post(req.body);
//injecting user_id here
let postContent = { ...req.body, user: req.user_id };
const post = new Post(postContent);
post.save(async (err) => {
if (err) {
throw err;
Binary file modified frontend/cypress/videos/making_a_post.cy.js.mp4
Binary file not shown.
Binary file modified frontend/cypress/videos/signing_in.cy.js.mp4
Binary file not shown.
Binary file modified frontend/cypress/videos/signing_up.cy.js.mp4
Binary file not shown.
1 change: 0 additions & 1 deletion frontend/src/components/auth/LoginForm.js
Original file line number Diff line number Diff line change
@@ -22,7 +22,6 @@ const LogInForm = ({ navigate }) => {
console.log("oop");
let data = await response.json();
window.localStorage.setItem("token", data.token);
window.localStorage.setItem("user_id", data.user);
navigate("/posts");
}
};
18 changes: 9 additions & 9 deletions frontend/src/components/create-post/CreatePost.js
Original file line number Diff line number Diff line change
@@ -2,26 +2,26 @@ import React, { useState } from "react";

const CreatePost = () => {
const [message, setMessage] = useState("");

const handleSubmit = async (event) => {
event.preventDefault();

let response = await fetch("/posts", {
method: "post",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${window.localStorage.getItem("token")}`
Authorization: `Bearer ${window.localStorage.getItem("token")}`,
},
body: JSON.stringify({ message: message, user: window.localStorage.getItem("user_id") }),
body: JSON.stringify({ message: message }),
});

if (response.status === 201) {
console.log('post is successful');
window.location.reload()
console.log("post is successful");
window.location.reload();
} else {
console.log('post did not complete')
}
};
console.log("post did not complete");
}
};

const handleMessageChange = (event) => {
setMessage(event.target.value);
5 changes: 2 additions & 3 deletions frontend/src/components/feed/Feed.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import CreatePost from "../create-post/CreatePost";
const Feed = ({ navigate }) => {
const [posts, setPosts] = useState([]);
const [token, setToken] = useState(window.localStorage.getItem("token"));

useEffect(() => {
if (token) {
fetch("/posts", {
@@ -24,7 +24,6 @@ const Feed = ({ navigate }) => {

const logout = () => {
window.localStorage.removeItem("token");
window.localStorage.removeItem("user_id");
navigate("/login");
};

@@ -33,7 +32,7 @@ const Feed = ({ navigate }) => {
<>
<h2>Posts</h2>
<button onClick={logout}>Logout</button>
<CreatePost/>
<CreatePost />
<div id="feed" role="feed">
{posts.map((post) => (
<Post post={post} key={post._id} />