mirror of
https://github.com/hexolan/panels.git
synced 2026-03-26 20:41:15 +00:00
init frontend
This commit is contained in:
24
services/frontend/src/components/PostCommentsFeed.tsx
Normal file
24
services/frontend/src/components/PostCommentsFeed.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Center, Loader, Text } from '@mantine/core'
|
||||
|
||||
import CommentsFeed from './CommentsFeed'
|
||||
import { useGetPostCommentsQuery } from '../app/api/comments'
|
||||
import type { Post } from '../app/types/common'
|
||||
|
||||
function PostCommentsFeed({ post }: { post: Post }) {
|
||||
const { data, isLoading } = useGetPostCommentsQuery({ postId: post.id })
|
||||
if (isLoading) {
|
||||
return (
|
||||
<Center>
|
||||
<Loader color='dark' size='sm' />
|
||||
</Center>
|
||||
)
|
||||
} else if (!data) {
|
||||
return <Text color='red' align='center'>Failed to Load Comments</Text>
|
||||
} else if (!data.length) {
|
||||
return null
|
||||
}
|
||||
|
||||
return <CommentsFeed comments={data} />
|
||||
}
|
||||
|
||||
export default PostCommentsFeed
|
||||
Reference in New Issue
Block a user