From e16f7941d51c7dbde51791b9ce066f6c2cb823de Mon Sep 17 00:00:00 2001 From: john Date: Wed, 28 May 2025 22:08:15 +0200 Subject: [PATCH] remove unused thing --- src/app/feed/components/FeedView.ts | 5 ---- src/app/feed/components/FeedView.tsx | 35 ---------------------------- src/app/feed/pages/HomePage.tsx | 27 +++++++++++++++------ 3 files changed, 20 insertions(+), 47 deletions(-) delete mode 100644 src/app/feed/components/FeedView.ts delete mode 100644 src/app/feed/components/FeedView.tsx diff --git a/src/app/feed/components/FeedView.ts b/src/app/feed/components/FeedView.ts deleted file mode 100644 index d8ed6bd..0000000 --- a/src/app/feed/components/FeedView.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { useCallback, useRef, useState } from 'react' -import { Post } from '../posts/posts.ts' -import { produce, WritableDraft } from 'immer' - -const PageSize = 20 diff --git a/src/app/feed/components/FeedView.tsx b/src/app/feed/components/FeedView.tsx deleted file mode 100644 index 2b814b3..0000000 --- a/src/app/feed/components/FeedView.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { useRef } from 'react' -import { useIntersectionLoad } from '../../../hooks/useIntersectionLoad.ts' -import { Post } from '../posts/posts.ts' -import PostItem from './PostItem.tsx' - -interface FeedViewProps { - posts: Post[] - onLoadMore: () => Promise - addReaction: (postId: string, emoji: string) => void - clearReaction: (postId: string, emoji: string) => void -} - -export default function FeedView({ posts, onLoadMore, addReaction, clearReaction }: FeedViewProps) { - const sentinelRef = useRef(null) - - useIntersectionLoad(onLoadMore, sentinelRef) - - return ( -
-
-
- {posts.map((post) => ( - addReaction(post.postId, emoji)} - clearReaction={(emoji) => clearReaction(post.postId, emoji)} - /> - ))} -
-
-
-
- ) -} diff --git a/src/app/feed/pages/HomePage.tsx b/src/app/feed/pages/HomePage.tsx index e0b73b8..738d168 100644 --- a/src/app/feed/pages/HomePage.tsx +++ b/src/app/feed/pages/HomePage.tsx @@ -1,5 +1,4 @@ import { useCallback, useRef, useState } from 'react' -import FeedView from '../components/FeedView.tsx' import { PostsService } from '../posts/postsService.ts' import { useUser } from '../../user/user.ts' import { MediaService } from '../../media/mediaService.ts' @@ -10,6 +9,8 @@ import AuthNavButtons from '../../auth/components/AuthNavButtons.tsx' import { useSaveSignupCodeToLocalStorage } from '../../../hooks/useSaveSignupCodeToLocalStorage.ts' import { Post } from '../posts/posts.ts' import { produce, WritableDraft } from 'immer' +import PostItem from '../components/PostItem.tsx' +import { useIntersectionLoad } from '../../../hooks/useIntersectionLoad.ts' interface HomePageProps { postsService: PostsService @@ -126,6 +127,9 @@ export default function HomePage({ postsService, mediaService }: HomePageProps) ) } + const sentinelRef = useRef(null) + useIntersectionLoad(loadNextPage, sentinelRef) + return (
{isLoggedIn && } - +
+
+
+ {posts.map((post) => ( + onAddReaction(post.postId, emoji)} + clearReaction={(emoji) => onClearReaction(post.postId, emoji)} + /> + ))} +
+
+
+
)