Skip to content

Commit

Permalink
display count for personal posts
Browse files Browse the repository at this point in the history
  • Loading branch information
annacai44 committed Jan 22, 2025
1 parent 3c8c8e8 commit 83af959
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function App() {
: <Navigate to="/" />}
/>
<Route path="/my-friends" element={isAuthenticated ? <MyFriends user={user} friends={friends} /> : <Navigate to="/" />} />
<Route path="/rating-history" element={isAuthenticated ? <RatingHistory userName={user} profilePic={profilePic}/> : <Navigate to="/" />} />
<Route path="/rating-history" element={isAuthenticated ? <RatingHistory userName={user} profilePic={profilePic} filteredPost={filteredPost} setFilteredPost={setFilteredPost}/> : <Navigate to="/" />} />
<Route path="/comment/:post_id" element={isAuthenticated ? <Comment userName={user} profilePic={profilePic} /> : <Navigate to="/" />} />
<Route path="*" element={<Navigate to="/" />} />
</Routes>
Expand Down
3 changes: 1 addition & 2 deletions src/components/Account/Account.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ function Account({
userName,
userEmail,
profilePic,
filteredPost,
setFilteredPost
filteredPost
}) {
const navigate = useNavigate();
const [friendCount, setFriendCount] = useState(0);
Expand Down
9 changes: 1 addition & 8 deletions src/components/RatingHistory/RatingHistory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import Avatar from '@mui/material/Avatar';
import { useState, useEffect } from 'react';


function RatingHistory({ userName, profilePic }) {
const [filteredPost, setFilteredPost] = useState([]);
function RatingHistory({ userName, filteredPost, setFilteredPost}) {

const fake_friends = ["Alice", "Bob", "Charlie", "David"];
// Add userName as a dependency to prevent it from running infinitely
Expand Down Expand Up @@ -44,12 +43,6 @@ function RatingHistory({ userName, profilePic }) {
fetchPosts();
}, [userName]); // Add userName as a dependency to prevent it from running infinitely

// print out the posts
useEffect(() => {
console.log(filteredPost);
}
, [filteredPost]);

return (
<div>
<AppBar />
Expand Down

0 comments on commit 83af959

Please sign in to comment.