Skip to content
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

Profile feed time #1041

Merged
merged 3 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion src/components/CommunityChat/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ const ChatBox = () => {
getUsername();
}

// console.log(messages[0])
function getTime(timestamp) {
const timeInMilliSec = timestamp * 1000;
const date = new Date(timeInMilliSec);
Expand Down
1 change: 1 addition & 0 deletions src/pages/Profile/feed/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useNavigate } from "react-router-dom";

const ProfieFeed = ({ feed }) => {
const navigate = useNavigate();

return (
<Box className="profile-feed-main-container">
<div className="app__posts__feed" id="feed-sub-container">
Expand Down
12 changes: 8 additions & 4 deletions src/pages/Profile/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
onSnapshot,
query,
where,
orderBy,
} from "firebase/firestore";
import { lazy, useEffect, useState } from "react";
import { playErrorSound, playSuccessSound } from "../../js/sounds";
Expand Down Expand Up @@ -239,7 +240,11 @@ function Profile() {

// Get user's posts from posts collection
useEffect(() => {
const q = query(collection(db, "posts"), where("uid", "==", uid));
const q = query(
collection(db, "posts"),
where("uid", "==", uid),
orderBy("timestamp", "desc")
);
const unsubscribe = onSnapshot(q, (querySnapshot) => {
const userPosts = [];
querySnapshot.forEach((doc) => {
Expand Down Expand Up @@ -388,9 +393,8 @@ function Profile() {
}}
alt={name}
src={avatar}
className={`profile-pic-container ${
storyTimestamp ? "story_available_border" : null
}`}
className={`profile-pic-container ${storyTimestamp ? "story_available_border" : null
}`}
/>
) : (
<FaUserCircle className="profile-pic-container" />
Expand Down
Loading