Component Update

This commit is contained in:
2025-04-13 07:52:39 -04:00
parent bdd9ac6ea3
commit 73cd3bbb70
2 changed files with 12 additions and 7 deletions

View File

@@ -75,6 +75,7 @@ function Mobile() {
<div className="space-y-6">
{friendsPostsData.map((post, index) => (
<Post
showDeleteButton={false} // No delete option for friends' posts
key={index}
post={post}
allowReactions={true} // Allow reactions for friends' posts

View File

@@ -14,7 +14,8 @@ interface PostProps {
onLike: () => void;
onWarning: () => void;
onDelete: () => void; // Callback for deleting the post
allowReactions: boolean; // New property to toggle reactions
allowReactions: boolean; // Property to toggle reactions
showDeleteButton?: boolean; // New property to toggle the delete button
}
export default function Post({
@@ -23,6 +24,7 @@ export default function Post({
onWarning,
onDelete,
allowReactions,
showDeleteButton = true, // Default to true if not provided
}: PostProps) {
const [userData, setUserData] = useState<{ username: string; avatar: number } | null>({
username: "Loading...",
@@ -112,12 +114,14 @@ export default function Post({
>
😭 Stop drinking that ({post.reactions.filter((reaction) => reaction.warned).length})
</button>
<button
onClick={onDelete}
className="px-3 py-1 rounded text-sm bg-red-600 hover:bg-red-700 text-white"
>
🗑 Delete
</button>
{showDeleteButton && (
<button
onClick={onDelete}
className="px-3 py-1 rounded text-sm bg-red-600 hover:bg-red-700 text-white"
>
🗑 Delete
</button>
)}
</div>
</div>
);