This commit is contained in:
john 2025-05-06 18:13:12 +02:00
parent 4573048a47
commit d4a1492d56
16 changed files with 463 additions and 98 deletions

View file

@ -1,30 +0,0 @@
import { useCallback } from 'react'
import FeedView from '../feed/FeedView.tsx'
import { PostsService } from '../feed/models/posts/postsService.ts'
import { useParams } from 'react-router'
import SingleColumnLayout from '../layouts/SingleColumnLayout.tsx'
import NavBar from '../components/NavBar.tsx'
import { useFeedViewModel } from '../feed/FeedView.ts'
interface AuthorPageParams {
postsService: PostsService
}
export default function AuthorPage({ postsService }: AuthorPageParams) {
const { username } = useParams()
const fetchPosts = useCallback(
async (cursor: string | null, amount: number | null) => {
return postsService.loadByAuthor(username!, cursor, amount)
},
[postsService, username],
)
const { pages, loadNextPage } = useFeedViewModel(fetchPosts)
return (
<SingleColumnLayout navbar={<NavBar />}>
<FeedView pages={pages} onLoadMore={loadNextPage} />
</SingleColumnLayout>
)
}