Show which listing each chat is about

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>
This commit is contained in:
SlimusMinus
2026-10-28 21:17:58 +03:00
parent 3811c5a133
commit 33bd002f98
12 changed files with 319 additions and 22 deletions

View File

@@ -0,0 +1,34 @@
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>
);
}