4wswt4ex2: Add like and unlike for post cards

This commit is contained in:
2026-10-19 14:16:52 -06:00
parent 20cca38619
commit 28037a2849
9 changed files with 402 additions and 5 deletions
+11 -1
View File
@@ -12,6 +12,9 @@ export interface FeedViewProps {
newCount: number;
onRetry: () => void;
onShowNew: () => void;
onToggleLike?: (post: CardPost) => void;
likeBusy?: ReadonlySet<string>;
likeErrors?: ReadonlySet<string>;
sentinelRef?: Ref<HTMLDivElement>;
now?: number;
}
@@ -50,7 +53,14 @@ export function FeedView(p: FeedViewProps) {
{p.posts.length === 0 ? (
<p className="feed-message">No posts yet.</p>
) : (
p.posts.map((post) => <PostCard key={post.key} post={post} now={p.now} />)
p.posts.map((post) => <PostCard
key={post.key}
post={post}
now={p.now}
onToggleLike={p.onToggleLike}
likeBusy={p.likeBusy?.has(post.key)}
likeError={p.likeErrors?.has(post.key)}
/>)
)}
{p.loadMoreFailed ? (
<div className="feed-message" role="alert">