Add Docker build and deploy pipeline
Some checks failed
deploy-frontend / deploy (push) Failing after 11s
Some checks failed
deploy-frontend / deploy (push) Failing after 11s
This commit is contained in:
@@ -3,16 +3,19 @@ import PinIcon from "../components/icons/PinIcon";
|
||||
import CalendarIcon from "../components/icons/CalendarIcon";
|
||||
import PhoneIcon from "../components/icons/PhoneIcon";
|
||||
import TrashIcon from "../components/icons/TrashIcon";
|
||||
import CheckIcon from "../components/icons/CheckIcon";
|
||||
import {useContactSeller} from "../hooks/useContactSeller";
|
||||
import {useAuthContext} from "../context/AuthContext";
|
||||
import {getImageUrl} from "../config/authConstants";
|
||||
import {CATEGORY_PET} from "../config/feedConstants";
|
||||
import {getFoundAt, formatFoundDate} from "../utils/foundAt";
|
||||
import DateCalendarPopup from "../components/DateCalendarPopup";
|
||||
import RewardPopup from "../components/feed/RewardPopup";
|
||||
import Toast from "../components/Toast";
|
||||
import {useTranslation} from 'react-i18next';
|
||||
|
||||
export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen, isOwner, authorLabel, allowEditClosed, onImageClick, onLocationClick, onAuthRequired, compact }) {
|
||||
const { t } = useTranslation();
|
||||
const { t, i18n } = useTranslation();
|
||||
const [showCalendar, setShowCalendar] = useState(false);
|
||||
const [showReward, setShowReward] = useState(false);
|
||||
const [descExpanded, setDescExpanded] = useState(false);
|
||||
@@ -50,6 +53,15 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
|
||||
: null;
|
||||
|
||||
const isClosed = ad.status === 'CLOSED';
|
||||
// Для питомцев «найдено» — это хорошая новость с воссоединением, поэтому
|
||||
// формулировка эмоциональнее, чем сухое «Найдено».
|
||||
const isPet = ad.category === CATEGORY_PET;
|
||||
const foundText = isPet ? t('postCard.petFoundStatus') : t('postCard.foundStatus');
|
||||
const foundDate = isClosed ? formatFoundDate(getFoundAt(ad), i18n.language) : null;
|
||||
// aria-подпись собираем целиком: статус не должен читаться только цветом.
|
||||
const foundAriaText = foundDate
|
||||
? t('postCard.foundStatusWithDate', {status: foundText, date: foundDate})
|
||||
: foundText;
|
||||
|
||||
const headAccentClass = ad.type === "found" ? " f-head-found" : " f-head-loss";
|
||||
|
||||
@@ -60,7 +72,9 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={`f-card${isClosed ? ' f-card-closed' : ''}${ad.type === "found" ? ' f-card-found' : ' f-card-loss'}`}>
|
||||
<div className={`f-card${isClosed ? ' f-card-closed' : ''}${ad.type === "found" ? ' f-card-found' : ' f-card-loss'}`}
|
||||
role="group"
|
||||
aria-label={isClosed ? `${ad.title}. ${foundAriaText}` : ad.title}>
|
||||
|
||||
<div className={`f-card-head${headAccentClass}`}>
|
||||
<div className="f-card-author">
|
||||
@@ -75,9 +89,6 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
|
||||
</div>
|
||||
<div className="f-card-head-side">
|
||||
{typeBadge}
|
||||
{isClosed && (
|
||||
<span className="f-status-badge f-status-closed">{t('postCard.foundStatus')}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -86,6 +97,14 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
|
||||
? <img src={imageUrl} alt={ad.title} />
|
||||
: <span className="f-card-emoji">{ad.emoji || "📋"}</span>
|
||||
}
|
||||
{/* Плашка статуса поверх фото: при быстром скролле шапка карточки
|
||||
проезжает мимо, а фото с плашкой — нет. */}
|
||||
{isClosed && (
|
||||
<span className={`f-img-found-badge${isPet ? ' f-img-found-badge-pet' : ''}`}>
|
||||
<CheckIcon size={12}/>
|
||||
<span>{foundText}</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{!compact && (
|
||||
@@ -210,15 +229,28 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{onReopen && isOwner && isClosed && (
|
||||
{isClosed && (
|
||||
<div className="f-card-found-wrap">
|
||||
<button type="button" className="f-card-found-btn f-card-reopen-btn"
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
onReopen(ad.id);
|
||||
}}>
|
||||
{t('postCard.reopen')}
|
||||
{/* Кнопка «найдено» становится неактивной подтверждением: видно,
|
||||
что действие уже применено, и повторно не нажать. */}
|
||||
<button type="button" className="f-card-found-btn f-card-found-btn-done"
|
||||
disabled
|
||||
aria-label={foundAriaText}
|
||||
title={foundAriaText}>
|
||||
<CheckIcon size={14}/>
|
||||
<span>{foundText}{foundDate ? ` ${foundDate}` : ''}</span>
|
||||
</button>
|
||||
{/* Отмена случайного нажатия — автору; в админ-панели это и есть
|
||||
возврат объявления в ленту. */}
|
||||
{onReopen && isOwner && (
|
||||
<button type="button" className="f-card-found-undo"
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
onReopen(ad.id);
|
||||
}}>
|
||||
{t('postCard.undoFound')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user