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
+3
View File
@@ -18,6 +18,8 @@ export interface CardPost {
time: number;
text: string;
likesCount: number;
/** Whether the signed-in person has liked the post. */
isLiked: boolean;
commentsCount: number;
media: CardMedia[];
}
@@ -99,6 +101,7 @@ export function toCardPost(item: unknown, index = 0): CardPost | null {
time: Number.isFinite(t) ? t : Number.NEGATIVE_INFINITY,
text: typeof post.content === "string" ? post.content : "",
likesCount: num(item.likesCount ?? post.likesCount),
isLiked: post.isLiked === true || item.isLiked === true,
commentsCount: num(item.commentsCount ?? post.commentsCount),
media: toMedia(post.mediaItems),
};