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>
46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
/**
|
||
* Шапка чата. С onInfo аватар и заголовок объявления кликабельны, а справа
|
||
* есть кнопка «ⓘ» — обе открывают карточку объявления, к которому относится чат.
|
||
*/
|
||
export default function ChatHeader({ title, onBack, avatar, subtitle, onInfo, infoLabel }) {
|
||
const main = (
|
||
<>
|
||
{avatar !== undefined && (
|
||
<div className="chat-header-avatar">{avatar}</div>
|
||
)}
|
||
<div className="chat-header-text">
|
||
<div className="chat-header-title">{title}</div>
|
||
{subtitle}
|
||
</div>
|
||
</>
|
||
);
|
||
|
||
return (
|
||
<div className="chat-header">
|
||
<button className="chat-back-btn" onClick={onBack}>
|
||
←
|
||
</button>
|
||
{onInfo ? (
|
||
<button type="button" className="chat-header-post" onClick={onInfo} title={infoLabel}>
|
||
{main}
|
||
</button>
|
||
) : (
|
||
<div className="chat-header-post">{main}</div>
|
||
)}
|
||
{onInfo ? (
|
||
<button type="button" className="chat-header-info-btn" onClick={onInfo}
|
||
aria-label={infoLabel} title={infoLabel}>
|
||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
||
<circle cx="12" cy="12" r="10" />
|
||
<line x1="12" y1="16" x2="12" y2="11" />
|
||
<line x1="12" y1="8" x2="12.01" y2="8" />
|
||
</svg>
|
||
</button>
|
||
) : (
|
||
<div />
|
||
)}
|
||
</div>
|
||
);
|
||
}
|