added delete posts
This commit is contained in:
@@ -3,12 +3,13 @@ import CalendarIcon from "./icons/CalendarIcon";
|
||||
import PhoneIcon from "./icons/PhoneIcon";
|
||||
import MapIcon from "./icons/MapIcon";
|
||||
import HeartIcon from "./icons/HeartIcon";
|
||||
import TrashIcon from "./icons/TrashIcon";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useChats } from "../hooks/useChats";
|
||||
import { useAuthContext } from "../context/AuthContext";
|
||||
import { API_URL } from "../config/authConstants";
|
||||
|
||||
export default function PostOnFeed({ ad, liked, onLike, onEdit, isOwner }) {
|
||||
export default function PostOnFeed({ ad, liked, onLike, onEdit, onDelete, isOwner }) {
|
||||
const navigate = useNavigate();
|
||||
const { createOrGetChat } = useChats();
|
||||
const { isAuthenticated } = useAuthContext();
|
||||
@@ -75,11 +76,17 @@ export default function PostOnFeed({ ad, liked, onLike, onEdit, isOwner }) {
|
||||
</button>
|
||||
)}
|
||||
{onEdit && isOwner && (
|
||||
<button className="f-like-btn"
|
||||
<button className="f-card-edit-btn"
|
||||
onClick={e => { e.stopPropagation(); onEdit(ad); }}>
|
||||
✏️
|
||||
</button>
|
||||
)}
|
||||
{onDelete && isOwner && (
|
||||
<button className="f-card-delete-btn"
|
||||
onClick={e => { e.stopPropagation(); onDelete(ad.id); }}>
|
||||
<TrashIcon />
|
||||
</button>
|
||||
)}
|
||||
<button className={`f-like-btn${liked ? " liked" : ""}`}
|
||||
onClick={e => { e.stopPropagation(); onLike(ad.id); }}>
|
||||
<HeartIcon filled={liked} />
|
||||
|
||||
Reference in New Issue
Block a user