feat: Implement post deletion functionality across feeds and profiles, and refactor PostCard component into a shared module.

This commit is contained in:
Christopher
2026-01-22 19:26:47 -08:00
parent 66cd763c30
commit a6e0ef2278
6 changed files with 69 additions and 114 deletions
+11
View File
@@ -110,6 +110,16 @@ export default function ProfilePage() {
router.push(`/${post.author.handle}/posts/${post.id}`);
};
const handleDelete = (postId: string) => {
setPosts(prev => prev.filter(p => p.id !== postId));
if (user && isOwnProfile) {
setUser({
...user,
postsCount: (user.postsCount || 0) - 1
});
}
};
useEffect(() => {
if (user && currentUser?.handle === user.handle) {
setProfileForm({
@@ -582,6 +592,7 @@ export default function ProfilePage() {
onLike={handleLike}
onRepost={handleRepost}
onComment={handleComment}
onDelete={handleDelete}
/>
))
)