add post reaction timeline

This commit is contained in:
john 2025-08-10 18:41:45 +02:00
parent 5aeed54b20
commit 7ecea242f2
2 changed files with 36 additions and 3 deletions

View file

@ -10,6 +10,7 @@ import { useTranslations } from '../../i18n/translations.ts'
import { usePostViewModel } from '../posts/usePostViewModel.ts'
import { Temporal } from '@js-temporal/polyfill'
import { useUserStore } from '../../user/user.ts'
import { PostTimeline } from '../components/PostTimeline.tsx'
interface PostPageProps {
postsService: PostsService
@ -17,11 +18,11 @@ interface PostPageProps {
export default function PostPage({ postsService }: PostPageProps) {
const { postId } = useParams<{ postId: string }>()
const { posts, setPosts, addReaction, reactions, removeReaction } = usePostViewModel()
const { posts, setPosts, addReaction, reactions: _reactions, removeReaction } = usePostViewModel()
const { t } = useTranslations()
const username = useUserStore((state) => state.user?.username)
const post = posts.at(0)
const reactions = (post?.postId ? _reactions[post.postId] : []) ?? []
useEffect(() => {
if (!postId) return
@ -59,11 +60,12 @@ export default function PostPage({ postsService }: PostPageProps) {
<div className="w-full">
<PostItem
post={post}
reactions={reactions[post.postId] ?? []}
reactions={reactions}
addReaction={onAddReaction}
clearReaction={onClearReaction}
hideViewButton={true}
/>
<PostTimeline reactions={reactions} />
</div>
)}
</main>