added delete posts

This commit is contained in:
SlimusMinus
2026-06-23 00:39:03 +03:00
parent 15c8f9291a
commit 486be6577a
3 changed files with 40 additions and 2 deletions

View File

@@ -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} />