Skip to content

Commit

Permalink
Merge pull request #362 from Aymanhki/ayman
Browse files Browse the repository at this point in the history
Bug fix for feed scrolling
  • Loading branch information
Aymanhki authored Mar 30, 2024
2 parents 7c81d53 + 9f3d79f commit 44feaa2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions epoch_backend/business/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ def get_post_dict(current_post, posts_media, username, profile_picture_url, prof
i):
post_dict = {}
post_dict["post_id"] = current_post[0]
post_dict["user_id"] = current_post[1]
post_dict["profile_picture"] = profile_picture_url
post_dict["profile_picture_type"] = profile_picture_type
post_dict["profile_picture_name"] = profile_picture_name
Expand Down
4 changes: 2 additions & 2 deletions epoch_frontend/src/modules/NotificationsPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ function NotificationsPopup ({showNotifications, setShowNotifications, newUnread
const {user} = useContext(UserContext);
const[notifications, setNotifications] = useState((user && user.notifications) || []);
const [offset, setOffset] = useState(0);
const limit = useState(10);
const limit = 10;
const [isLoading, setIsLoading] = useState(false);
const [noMoreNotifications, setNoMoreNotifications] = useState(false);
const [countUnreadNotifications, setCountUnreadNotifications] = useState(0);
const [loadMorePrompt, setLoadMorePrompt] = useState('Load more');
const [markAllAsReadPrompt, setMarkAllAsReadPrompt] = useState('Mark all as read');
const getNotificationsEvery = 90000000; // 10 seconds
const getNotificationsEvery = 3000; // 3 seconds

const {transform: inTransform, opacity: inOpacity} = useSpring({
opacity: showNotifications ? 1 : 0,
Expand Down
8 changes: 6 additions & 2 deletions epoch_frontend/src/pages/Comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { UserContext } from '../services/UserContext';
import { getUserInfo } from "../services/user";
import CommentPopup from "../modules/CommentPopup";
import {useNavigate} from "react-router-dom";
import Feed from "../modules/Feed";



Expand Down Expand Up @@ -118,7 +119,10 @@ function Comments() {
<div className={"post-comments-page-wrapper"}>
<div className={"post-comments-page-feed"}>
<div className={'comments-post-wrapper'}>
{commentsPost && (<Post key={ commentsPost.post_id } post={commentsPost} postViewer={user} refreshFeed={refreshComments} setRefreshFeed={setRefreshComments} isInFavorites={false}></Post>)}
{commentsPost && (
// <Post key={ commentsPost.post_id } post={commentsPost} postViewer={user} refreshFeed={refreshComments} setRefreshFeed={setRefreshComments} isInFavorites={false}></Post>
<Feed feedUsername={user.username} feedUserId={commentsPost.user_id} isInProfile={false} currentUser={user} showNewPostPopup={showNewPostPopup} setShowNewPostPopup={setShowNewPostPopup} refreshFeed={refreshFeed} setRefreshFeed={setRefreshFeed} viewingOnly={true} posts={[commentsPost]} isInFavorites={false} isInHashtags={false} hashtag={null}></Feed>
)}
</div>

{(<button className={`new-comment-button ${showNewCommentPopup ? 'rotate' : ''}`}
Expand All @@ -141,7 +145,7 @@ function Comments() {
</div>
)}
<PostPopup showPopup={showNewPostPopup} setShowPopup={setShowNewPostPopup} username={user.username} profilePic={user.profile_pic_data} refreshFeed={refreshFeed} setRefreshFeed={setRefreshFeed}/>
<CommentPopup showPopup={showNewCommentPopup} setShowPopup={setShowNewCommentPopup} postId={postId} username={user.username} profilePic={user.profile_pic_data} refreshComments={refreshComments} setRefreshComments={setRefreshComments}/>
<CommentPopup showPopup={showNewCommentPopup} setShowPopup={setShowNewCommentPopup} postId={postId} username={user.username} profilePic={user.profile_pic_data} refreshComments={refreshComments} setRefreshComments={setRefreshComments}/>
</>
)
}
Expand Down
2 changes: 1 addition & 1 deletion epoch_frontend/src/styles/PostComments.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
display: flex;
flex-direction: column;
align-items: center;
width: 90%;
width: 80%;
height: auto;
padding: 1rem;
margin: 1rem;
Expand Down

0 comments on commit 44feaa2

Please sign in to comment.