Component Update
This commit is contained in:
@@ -75,6 +75,7 @@ function Mobile() {
|
|||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
{friendsPostsData.map((post, index) => (
|
{friendsPostsData.map((post, index) => (
|
||||||
<Post
|
<Post
|
||||||
|
showDeleteButton={false} // No delete option for friends' posts
|
||||||
key={index}
|
key={index}
|
||||||
post={post}
|
post={post}
|
||||||
allowReactions={true} // Allow reactions for friends' posts
|
allowReactions={true} // Allow reactions for friends' posts
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ interface PostProps {
|
|||||||
onLike: () => void;
|
onLike: () => void;
|
||||||
onWarning: () => void;
|
onWarning: () => void;
|
||||||
onDelete: () => void; // Callback for deleting the post
|
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({
|
export default function Post({
|
||||||
@@ -23,6 +24,7 @@ export default function Post({
|
|||||||
onWarning,
|
onWarning,
|
||||||
onDelete,
|
onDelete,
|
||||||
allowReactions,
|
allowReactions,
|
||||||
|
showDeleteButton = true, // Default to true if not provided
|
||||||
}: PostProps) {
|
}: PostProps) {
|
||||||
const [userData, setUserData] = useState<{ username: string; avatar: number } | null>({
|
const [userData, setUserData] = useState<{ username: string; avatar: number } | null>({
|
||||||
username: "Loading...",
|
username: "Loading...",
|
||||||
@@ -112,12 +114,14 @@ export default function Post({
|
|||||||
>
|
>
|
||||||
😭 Stop drinking that ({post.reactions.filter((reaction) => reaction.warned).length})
|
😭 Stop drinking that ({post.reactions.filter((reaction) => reaction.warned).length})
|
||||||
</button>
|
</button>
|
||||||
|
{showDeleteButton && (
|
||||||
<button
|
<button
|
||||||
onClick={onDelete}
|
onClick={onDelete}
|
||||||
className="px-3 py-1 rounded text-sm bg-red-600 hover:bg-red-700 text-white"
|
className="px-3 py-1 rounded text-sm bg-red-600 hover:bg-red-700 text-white"
|
||||||
>
|
>
|
||||||
🗑️ Delete
|
🗑️ Delete
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user