From 11f4ef4a79854335ea062829e31319763037b6c3 Mon Sep 17 00:00:00 2001 From: Ayush Tiwari Date: Sun, 14 Jul 2024 01:18:41 +0530 Subject: [PATCH 1/2] add userPost Queries, skeleton --- src/app/community/[id]/page.tsx | 1 + src/app/timeline/page.tsx | 46 ++++++---- src/components/Timeline/PostInput.tsx | 32 +++++-- src/components/Timeline/PostSkeleton.tsx | 21 +++++ src/services/community-timeline.ts | 110 +++++++++++++++++++++++ 5 files changed, 184 insertions(+), 26 deletions(-) create mode 100644 src/components/Timeline/PostSkeleton.tsx create mode 100644 src/services/community-timeline.ts diff --git a/src/app/community/[id]/page.tsx b/src/app/community/[id]/page.tsx index 5cc0a220..4565eb81 100644 --- a/src/app/community/[id]/page.tsx +++ b/src/app/community/[id]/page.tsx @@ -89,6 +89,7 @@ const Page = () => { idToPost={currSelectedGroup._id} setModalContentType={setModalContentType} setIsModalOpen={setIsModalOpen} + type="Community" /> )} diff --git a/src/app/timeline/page.tsx b/src/app/timeline/page.tsx index f2e34d6c..7fcbd94d 100644 --- a/src/app/timeline/page.tsx +++ b/src/app/timeline/page.tsx @@ -15,6 +15,8 @@ import { ModalContentType } from '@/types/global' import Recommendations from '@/components/Timeline/Recommendations' import { useUniStore } from '@/store/store' import { useParams } from 'next/navigation' +import { useGetUserPosts } from '@/services/community-timeline' +import PostSkeleton from '@/components/Timeline/PostSkeleton' interface User { name: string bio: string @@ -79,7 +81,11 @@ const Timeline = () => { const params = useParams() const { userData, userProfileData, userFollowingData } = useUniStore() const [modalContentType, setModalContentType] = useState() + const { isLoading, data: TimelinePosts, error } = useGetUserPosts() + const timelinePosts = TimelinePosts?.timelinePosts + console.log(timelinePosts) + console.log(isLoading, TimelinePosts, error) console.log(params) const modalContent = (modalContentType: string) => { @@ -117,24 +123,30 @@ const Timeline = () => {
- + - + {isLoading && Array.from({ length: 2 }).map((_, index) => )} + {!isLoading && + timelinePosts?.map((post: any) => { + return ( + + ) + })}