remove unused thing
This commit is contained in:
parent
c21e193fbf
commit
e16f7941d5
3 changed files with 20 additions and 47 deletions
|
@ -1,5 +0,0 @@
|
|||
import { useCallback, useRef, useState } from 'react'
|
||||
import { Post } from '../posts/posts.ts'
|
||||
import { produce, WritableDraft } from 'immer'
|
||||
|
||||
const PageSize = 20
|
|
@ -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<void>
|
||||
addReaction: (postId: string, emoji: string) => void
|
||||
clearReaction: (postId: string, emoji: string) => void
|
||||
}
|
||||
|
||||
export default function FeedView({ posts, onLoadMore, addReaction, clearReaction }: FeedViewProps) {
|
||||
const sentinelRef = useRef<HTMLDivElement | null>(null)
|
||||
|
||||
useIntersectionLoad(onLoadMore, sentinelRef)
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<div className="flex flex-col gap-6 w-full">
|
||||
<div className="flex flex-col gap-6 w-full">
|
||||
{posts.map((post) => (
|
||||
<PostItem
|
||||
key={post.postId}
|
||||
post={post}
|
||||
addReaction={(emoji) => addReaction(post.postId, emoji)}
|
||||
clearReaction={(emoji) => clearReaction(post.postId, emoji)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div ref={sentinelRef} className="h-1" />
|
||||
</div>
|
||||
)
|
||||
}
|
|
@ -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<HTMLDivElement | null>(null)
|
||||
useIntersectionLoad(loadNextPage, sentinelRef)
|
||||
|
||||
return (
|
||||
<SingleColumnLayout
|
||||
navbar={
|
||||
|
@ -136,12 +140,21 @@ export default function HomePage({ postsService, mediaService }: HomePageProps)
|
|||
>
|
||||
<main className={`w-full max-w-3xl mx-auto`}>
|
||||
{isLoggedIn && <NewPostWidget onSubmit={onCreatePost} isSubmitting={isSubmitting} />}
|
||||
<FeedView
|
||||
posts={posts}
|
||||
onLoadMore={loadNextPage}
|
||||
addReaction={onAddReaction}
|
||||
clearReaction={onClearReaction}
|
||||
<div className="w-full">
|
||||
<div className="flex flex-col gap-6 w-full">
|
||||
<div className="flex flex-col gap-6 w-full">
|
||||
{posts.map((post) => (
|
||||
<PostItem
|
||||
key={post.postId}
|
||||
post={post}
|
||||
addReaction={(emoji) => onAddReaction(post.postId, emoji)}
|
||||
clearReaction={(emoji) => onClearReaction(post.postId, emoji)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div ref={sentinelRef} className="h-1" />
|
||||
</div>
|
||||
</main>
|
||||
</SingleColumnLayout>
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue