The chat list and header show the listing's type, city and closed/deleted status; the header info button opens the full listing in PostDetailModal with a "show on map" action. Deleted or unpublished listings are marked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.4 KiB
JavaScript
35 lines
1.4 KiB
JavaScript
import { POST_STATUS_CLOSED } from "../../config/postConstants";
|
|
|
|
/**
|
|
* Короткая подпись объявления, к которому относится чат: тип, город, статус.
|
|
* Помогает различать чаты по похожим объявлениям (три «шляпы» в списке).
|
|
* Тип и статус бэкенд отдаёт в верхнем регистре (FOUND, CLOSED).
|
|
*/
|
|
export default function ChatPostMeta({ post, t, className = "" }) {
|
|
if (!post) return null;
|
|
|
|
if (post.removed) {
|
|
return (
|
|
<div className={`chat-post-meta ${className}`}>
|
|
<span className="chat-post-tag chat-post-tag--removed">{t("chat.postRemoved")}</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const type = String(post.type || "").toLowerCase();
|
|
const isClosed = String(post.status || "").toUpperCase() === POST_STATUS_CLOSED;
|
|
if (!type && !post.city && !isClosed) return null;
|
|
|
|
return (
|
|
<div className={`chat-post-meta ${className}`}>
|
|
{type && (
|
|
<span className={`chat-post-tag chat-post-tag--${type === "found" ? "found" : "loss"}`}>
|
|
{type === "found" ? t("postCard.found") : t("postCard.loss")}
|
|
</span>
|
|
)}
|
|
{post.city && <span className="chat-post-city">{post.city}</span>}
|
|
{isClosed && <span className="chat-post-tag chat-post-tag--closed">{t("chat.postClosed")}</span>}
|
|
</div>
|
|
);
|
|
}
|