// src/components/PostOnFeed.jsx import PinIcon from "../components/icons/PinIcon"; import CalendarIcon from "../components/icons/CalendarIcon"; import PhoneIcon from "../components/icons/PhoneIcon"; import MapIcon from "../components/icons/MapIcon"; import HeartIcon from "../components/icons/HeartIcon"; import TrashIcon from "../components/icons/TrashIcon"; import { useState } from "react"; import { useContactSeller } from "../hooks/useContactSeller"; import { useAuthContext } from "../context/AuthContext"; import { getImageUrl } from "../config/authConstants"; import DateCalendarPopup from "../components/DateCalendarPopup"; import Toast from "../components/Toast"; import { useTranslation } from 'react-i18next'; export default function PostOnFeed({ ad, liked, onLike, onEdit, onDelete, onMarkFound, isOwner, onImageClick, onAuthRequired }) { const { t } = useTranslation(); const [showCalendar, setShowCalendar] = useState(false); const { isAuthenticated } = useAuthContext(); const { contactSeller, error: contactError, clearError } = useContactSeller(ad); const handleContact = (e) => { e.stopPropagation(); if (!isAuthenticated) { if (onAuthRequired) onAuthRequired(); return; } contactSeller(); }; const imageUrl = getImageUrl(ad.images?.[0]); const address = ad.city; const createdAt = ad.createdAt ? new Date(ad.createdAt).toLocaleDateString("ru-RU") : null; const isClosed = ad.status === 'CLOSED'; const roleClass = ad.userRole === 'LOST_AND_FOUND' ? 'f-card-role-lost-found' : ad.userRole === 'METRO' ? 'f-card-role-metro' : ''; const roleBadge = ad.userRole === 'LOST_AND_FOUND' ? (