Closed CarlKhraiche closed 1 year ago
Display a user's latest posts on their profile. Fetch and display posts from the server based on the user's ID. Implement infinite scrolling to load more posts as the user scrolls down. Show user and car information along with post descriptions and timestamps. Allow users to view post images in a modal when clicked. Provide options for liking and commenting on posts. Comments for what has been completed:
The component fetches and displays the user's latest posts. Infinite scrolling is implemented to load more posts as the user scrolls. User and car information, post descriptions, and timestamps are displayed. Post images can be viewed in a modal when clicked. Options for liking and commenting on posts are available.
Display popular posts on a user's profile. Fetch and display posts from the server based on the user's ID. Implement infinite scrolling to load more popular posts as the user scrolls down. Show user and car information along with post descriptions and timestamps. Allow users to view post images in a modal when clicked. Provide options for liking and commenting on posts. Comments for what has been completed:
The component fetches and displays popular posts on the user's profile. Infinite scrolling is implemented to load more posts as the user scrolls. User and car information, post descriptions, and timestamps are displayed. Post images can be viewed in a modal when clicked. Options for liking and commenting on posts are available.
import React, { useEffect, useState, useContext } from "react"; import axios from "axios"; import Slider from "react-slick"; import "slick-carousel/slick/slick.css"; import "slick-carousel/slick/slick-theme.css"; import InfiniteScroll from "react-infinite-scroll-component"; import moment from "moment"; import PostImageModal from "./PostImageModal"; import { CurrentUserContext } from "../App";
const ProfilePopular = ({ sortType }) => { const currentUser = useContext(CurrentUserContext); const [posts, setPosts] = useState([]); const [hasMore, setHasMore] = useState(true); const [page, setPage] = useState(1); const [isImageModalOpen, setIsImageModalOpen] = useState(false); const [modalPost, setModalPost] = useState();
};
export default ProfilePopular;
import React, { useEffect, useState, useContext } from "react"; import axios from "axios"; import Slider from "react-slick"; import "slick-carousel/slick/slick.css"; import "slick-carousel/slick/slick-theme.css"; import InfiniteScroll from "react-infinite-scroll-component"; import moment from "moment"; import PostImageModal from "./PostImageModal"; import { CurrentUserContext } from "../App";
const ProfileLatest = ({ sortType }) => { const currentUser = useContext(CurrentUserContext); const [posts, setPosts] = useState([]); const [hasMore, setHasMore] = useState(true); const [page, setPage] = useState(1); const [isImageModalOpen, setIsImageModalOpen] = useState(false); const [modalPost, setModalPost] = useState();
};
export default ProfileLatest;