Merge pull request #123 from SlimusMinus/feat-chat_post_info
All checks were successful
deploy-frontend / deploy (push) Successful in 56s
All checks were successful
deploy-frontend / deploy (push) Successful in 56s
Show which listing each chat is about
This commit is contained in:
@@ -6,7 +6,25 @@ import { useAuthContext } from "../context/AuthContext";
|
|||||||
import PostOnFeed from "../pages/PostOnFeed";
|
import PostOnFeed from "../pages/PostOnFeed";
|
||||||
import CloseIcon from "./icons/CloseIcon";
|
import CloseIcon from "./icons/CloseIcon";
|
||||||
|
|
||||||
export default function PostDetailModal({ postId, onClose, onLocationClick, onAuthRequired }) {
|
/**
|
||||||
|
* Модалка с полным объявлением, догружаемым по id.
|
||||||
|
*
|
||||||
|
* compact — компактная карточка (без адреса и даты), как при открытии с карты;
|
||||||
|
* hideContact — без кнопки «Написать» (модалка открыта из самого чата);
|
||||||
|
* fallbackTitle — что показать над сообщением, если объявление удалено или скрыто;
|
||||||
|
* footer(post) — дополнительные действия под карточкой.
|
||||||
|
*
|
||||||
|
* @param {{
|
||||||
|
* postId: any, onClose: () => void,
|
||||||
|
* onLocationClick?: (ad: any) => void, onAuthRequired?: () => void,
|
||||||
|
* compact?: boolean, hideContact?: boolean,
|
||||||
|
* fallbackTitle?: string, footer?: (post: any) => any,
|
||||||
|
* }} props
|
||||||
|
*/
|
||||||
|
export default function PostDetailModal({
|
||||||
|
postId, onClose, onLocationClick, onAuthRequired,
|
||||||
|
compact = true, hideContact = false, fallbackTitle, footer,
|
||||||
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { user } = useAuthContext();
|
const { user } = useAuthContext();
|
||||||
const [post, setPost] = useState(null);
|
const [post, setPost] = useState(null);
|
||||||
@@ -22,6 +40,8 @@ export default function PostDetailModal({ postId, onClose, onLocationClick, onAu
|
|||||||
setError(null);
|
setError(null);
|
||||||
try {
|
try {
|
||||||
const res = await apiFetch(`${API_URL}/api/v1/posts/${encodeURIComponent(postId)}`);
|
const res = await apiFetch(`${API_URL}/api/v1/posts/${encodeURIComponent(postId)}`);
|
||||||
|
// 404 — объявление удалено или снято с публикации (модерация, отклонено)
|
||||||
|
if (res.status === 404) throw new Error("notFound");
|
||||||
if (!res.ok) throw new Error("Failed to load post");
|
if (!res.ok) throw new Error("Failed to load post");
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
@@ -52,20 +72,31 @@ export default function PostDetailModal({ postId, onClose, onLocationClick, onAu
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{error && (
|
{error === "notFound" && (
|
||||||
|
<div className="f-post-detail-status f-post-detail-gone" role="status">
|
||||||
|
{fallbackTitle && <div className="f-post-detail-gone-title">{fallbackTitle}</div>}
|
||||||
|
<div className="f-post-detail-gone-text">{t("chat.postUnavailable")}</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{error && error !== "notFound" && (
|
||||||
<div className="f-post-detail-status f-post-detail-error">
|
<div className="f-post-detail-status f-post-detail-error">
|
||||||
{t("common.error")}
|
{t("common.error")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{post && (
|
{post && (
|
||||||
<PostOnFeed
|
<>
|
||||||
ad={post}
|
<PostOnFeed
|
||||||
isOwner={isOwner}
|
ad={post}
|
||||||
onLocationClick={onLocationClick}
|
isOwner={isOwner}
|
||||||
onAuthRequired={onAuthRequired}
|
onLocationClick={onLocationClick}
|
||||||
compact
|
onAuthRequired={onAuthRequired}
|
||||||
/>
|
compact={compact}
|
||||||
|
hideContact={hideContact}
|
||||||
|
/>
|
||||||
|
{footer?.(post)}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,14 +1,45 @@
|
|||||||
export default function ChatHeader({ title, onBack, avatar }) {
|
/**
|
||||||
|
* Шапка чата. С 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 (
|
return (
|
||||||
<div className="chat-header">
|
<div className="chat-header">
|
||||||
<button className="chat-back-btn" onClick={onBack}>
|
<button className="chat-back-btn" onClick={onBack}>
|
||||||
←
|
←
|
||||||
</button>
|
</button>
|
||||||
{avatar !== undefined && (
|
{onInfo ? (
|
||||||
<div className="chat-header-avatar">{avatar}</div>
|
<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 className="chat-header-title">{title}</div>
|
|
||||||
<div />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { getChatDisplayInfo } from "../../utils/chatDisplay";
|
import { getChatDisplayInfo } from "../../utils/chatDisplay";
|
||||||
import TrashIcon from "../icons/TrashIcon";
|
import TrashIcon from "../icons/TrashIcon";
|
||||||
|
import ChatPostMeta from "./ChatPostMeta";
|
||||||
|
|
||||||
export default function ChatListItem({ chat, post, unreadMap, t, onOpen, onDelete }) {
|
export default function ChatListItem({ chat, post, unreadMap, t, onOpen, onDelete }) {
|
||||||
const { title, imgSrc, emoji, unreadCount, preview } = getChatDisplayInfo(chat, post, unreadMap, t);
|
const { title, imgSrc, emoji, unreadCount, preview } = getChatDisplayInfo(chat, post, unreadMap, t);
|
||||||
@@ -18,6 +19,7 @@ export default function ChatListItem({ chat, post, unreadMap, t, onOpen, onDelet
|
|||||||
</div>
|
</div>
|
||||||
<div className="chat-list-info">
|
<div className="chat-list-info">
|
||||||
<div className="chat-list-name">{title}</div>
|
<div className="chat-list-name">{title}</div>
|
||||||
|
<ChatPostMeta post={post} t={t} />
|
||||||
<div className="chat-list-preview">
|
<div className="chat-list-preview">
|
||||||
{preview}
|
{preview}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
38
src/components/chat/ChatPostInfo.test.jsx
Normal file
38
src/components/chat/ChatPostInfo.test.jsx
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* По какому объявлению чат: подпись в списке/шапке (тип, город, статус)
|
||||||
|
* и кнопка в шапке, открывающая карточку. Удалённое объявление помечается.
|
||||||
|
*/
|
||||||
|
import { render, screen, fireEvent } from "@testing-library/react";
|
||||||
|
import i18n from "../../i18n";
|
||||||
|
import ChatPostMeta from "./ChatPostMeta";
|
||||||
|
import ChatHeader from "./ChatHeader";
|
||||||
|
import { cachePostsFromChats, getPostForChat } from "../../stores/chatPostStore";
|
||||||
|
|
||||||
|
const t = i18n.t.bind(i18n);
|
||||||
|
|
||||||
|
beforeAll(() => i18n.changeLanguage("ru"));
|
||||||
|
|
||||||
|
test("подпись показывает тип, город и закрытый статус", () => {
|
||||||
|
render(<ChatPostMeta post={{ type: "FOUND", status: "CLOSED", city: "Москва" }} t={t} />);
|
||||||
|
expect(screen.getByText("Находка")).toBeTruthy();
|
||||||
|
expect(screen.getByText("Москва")).toBeTruthy();
|
||||||
|
expect(screen.getByText("Закрыто")).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("удалённое объявление сохраняет прежний заголовок и помечается", () => {
|
||||||
|
cachePostsFromChats([{ id: 501, postId: 9, post: { id: 9, title: "Шляпа", images: [] } }]);
|
||||||
|
cachePostsFromChats([{ id: 501, postId: 9, post: null }]);
|
||||||
|
|
||||||
|
const post = getPostForChat(501);
|
||||||
|
expect(post).toMatchObject({ id: 9, title: "Шляпа", removed: true });
|
||||||
|
|
||||||
|
render(<ChatPostMeta post={post} t={t} />);
|
||||||
|
expect(screen.getByText("Объявление удалено")).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("кнопка в шапке открывает объявление", () => {
|
||||||
|
const onInfo = jest.fn();
|
||||||
|
render(<ChatHeader title="Шляпа" onBack={() => {}} onInfo={onInfo} infoLabel="Объявление этого чата" />);
|
||||||
|
fireEvent.click(screen.getByLabelText("Объявление этого чата"));
|
||||||
|
expect(onInfo).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
34
src/components/chat/ChatPostMeta.jsx
Normal file
34
src/components/chat/ChatPostMeta.jsx
Normal 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>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -215,7 +215,12 @@
|
|||||||
"noChats": "You have no chats yet",
|
"noChats": "You have no chats yet",
|
||||||
"deleteChat": "Delete chat",
|
"deleteChat": "Delete chat",
|
||||||
"confirmDeleteChat": "Are you sure you want to delete this chat?",
|
"confirmDeleteChat": "Are you sure you want to delete this chat?",
|
||||||
"user": "User"
|
"user": "User",
|
||||||
|
"postInfo": "Listing for this chat",
|
||||||
|
"postRemoved": "Listing deleted",
|
||||||
|
"postClosed": "Closed",
|
||||||
|
"postUnavailable": "The listing was deleted or unpublished. The conversation is kept.",
|
||||||
|
"showOnMap": "Show on map"
|
||||||
},
|
},
|
||||||
"reviews": {
|
"reviews": {
|
||||||
"anonymous": "Anonymous",
|
"anonymous": "Anonymous",
|
||||||
@@ -592,7 +597,8 @@
|
|||||||
"processingFailed": "Failed to process the image"
|
"processingFailed": "Failed to process the image"
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
"close": "Close"
|
"close": "Close",
|
||||||
|
"error": "Failed to load"
|
||||||
},
|
},
|
||||||
"fullscreenAd": {
|
"fullscreenAd": {
|
||||||
"label": "Ad",
|
"label": "Ad",
|
||||||
|
|||||||
@@ -215,7 +215,12 @@
|
|||||||
"noChats": "У вас пока нет чатов",
|
"noChats": "У вас пока нет чатов",
|
||||||
"deleteChat": "Удалить чат",
|
"deleteChat": "Удалить чат",
|
||||||
"confirmDeleteChat": "Вы уверены, что хотите удалить этот чат?",
|
"confirmDeleteChat": "Вы уверены, что хотите удалить этот чат?",
|
||||||
"user": "Пользователь"
|
"user": "Пользователь",
|
||||||
|
"postInfo": "Объявление этого чата",
|
||||||
|
"postRemoved": "Объявление удалено",
|
||||||
|
"postClosed": "Закрыто",
|
||||||
|
"postUnavailable": "Объявление удалено или снято с публикации. Переписка сохранилась.",
|
||||||
|
"showOnMap": "Показать на карте"
|
||||||
},
|
},
|
||||||
"reviews": {
|
"reviews": {
|
||||||
"anonymous": "Аноним",
|
"anonymous": "Аноним",
|
||||||
@@ -592,7 +597,8 @@
|
|||||||
"processingFailed": "Не удалось обработать изображение"
|
"processingFailed": "Не удалось обработать изображение"
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
"close": "Закрыть"
|
"close": "Закрыть",
|
||||||
|
"error": "Ошибка загрузки"
|
||||||
},
|
},
|
||||||
"fullscreenAd": {
|
"fullscreenAd": {
|
||||||
"label": "Реклама",
|
"label": "Реклама",
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ import { getImageUrl } from "../config/authConstants";
|
|||||||
import ChatHeader from "../components/chat/ChatHeader";
|
import ChatHeader from "../components/chat/ChatHeader";
|
||||||
import MessageBubble from "../components/chat/MessageBubble";
|
import MessageBubble from "../components/chat/MessageBubble";
|
||||||
import ChatInputBar from "../components/chat/ChatInputBar";
|
import ChatInputBar from "../components/chat/ChatInputBar";
|
||||||
|
import ChatPostMeta from "../components/chat/ChatPostMeta";
|
||||||
|
import PostDetailModal from "../components/PostDetailModal";
|
||||||
|
import { POST_STATUS_CLOSED } from "../config/postConstants";
|
||||||
import Toast from "../components/Toast";
|
import Toast from "../components/Toast";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,6 +40,7 @@ export default function ChatPage({ embedded = false, onActivity } = {}) {
|
|||||||
const [input, setInput] = useState("");
|
const [input, setInput] = useState("");
|
||||||
const [loadError, setLoadError] = useState("");
|
const [loadError, setLoadError] = useState("");
|
||||||
const [sendError, setSendError] = useState("");
|
const [sendError, setSendError] = useState("");
|
||||||
|
const [showPost, setShowPost] = useState(false);
|
||||||
const messagesEndRef = useRef(null);
|
const messagesEndRef = useRef(null);
|
||||||
const pageRef = useRef(null);
|
const pageRef = useRef(null);
|
||||||
|
|
||||||
@@ -149,6 +153,17 @@ export default function ChatPage({ embedded = false, onActivity } = {}) {
|
|||||||
|
|
||||||
const post = draft ? draft.post : getPostForChat(chatId);
|
const post = draft ? draft.post : getPostForChat(chatId);
|
||||||
const postImg = getImageUrl(post?.images?.[0]);
|
const postImg = getImageUrl(post?.images?.[0]);
|
||||||
|
const postId = post?.id ?? draft?.postId;
|
||||||
|
|
||||||
|
// «Перейти к объявлению» — на карту с фокусом на нём (тот же URL, что у
|
||||||
|
// кнопки адреса в ленте). Без координат на карте фокусироваться не на чем.
|
||||||
|
const hasCoords = (ad) => ad?.latitude != null && ad?.longitude != null
|
||||||
|
&& Number.isFinite(Number(ad.latitude)) && Number.isFinite(Number(ad.longitude));
|
||||||
|
const openOnMap = (ad) => {
|
||||||
|
if (!hasCoords(ad)) return;
|
||||||
|
const params = new URLSearchParams({ view: "map", post: String(ad.id), lat: String(ad.latitude), lng: String(ad.longitude) });
|
||||||
|
navigate(`/feed?${params.toString()}`);
|
||||||
|
};
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<>
|
<>
|
||||||
@@ -156,6 +171,9 @@ export default function ChatPage({ embedded = false, onActivity } = {}) {
|
|||||||
<ChatHeader
|
<ChatHeader
|
||||||
title={post?.title || t('chat.title')}
|
title={post?.title || t('chat.title')}
|
||||||
onBack={() => navigate("/chats")}
|
onBack={() => navigate("/chats")}
|
||||||
|
subtitle={<ChatPostMeta post={post} t={t} className="chat-header-meta" />}
|
||||||
|
onInfo={postId != null ? () => setShowPost(true) : undefined}
|
||||||
|
infoLabel={t('chat.postInfo')}
|
||||||
avatar={postImg ? (
|
avatar={postImg ? (
|
||||||
<img src={postImg} alt="" className="chat-header-avatar-img" />
|
<img src={postImg} alt="" className="chat-header-avatar-img" />
|
||||||
) : (
|
) : (
|
||||||
@@ -183,6 +201,24 @@ export default function ChatPage({ embedded = false, onActivity } = {}) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{showPost && (
|
||||||
|
<PostDetailModal
|
||||||
|
postId={postId}
|
||||||
|
onClose={() => setShowPost(false)}
|
||||||
|
onLocationClick={openOnMap}
|
||||||
|
compact={false}
|
||||||
|
hideContact
|
||||||
|
fallbackTitle={post?.title}
|
||||||
|
footer={(ad) => ad.status !== POST_STATUS_CLOSED && hasCoords(ad) && (
|
||||||
|
<div className="chat-post-modal-actions">
|
||||||
|
<button type="button" className="chat-post-open-btn" onClick={() => openOnMap(ad)}>
|
||||||
|
{t('chat.showOnMap')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{sendError && (
|
{sendError && (
|
||||||
<Toast
|
<Toast
|
||||||
message={sendError}
|
message={sendError}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import RewardPopup from "../components/feed/RewardPopup";
|
|||||||
import Toast from "../components/Toast";
|
import Toast from "../components/Toast";
|
||||||
import {useTranslation} from 'react-i18next';
|
import {useTranslation} from 'react-i18next';
|
||||||
|
|
||||||
export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen, isOwner, authorLabel, allowEditClosed, onLocationClick, onAuthRequired, compact }) {
|
export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen, isOwner, authorLabel, allowEditClosed, onLocationClick, onAuthRequired, compact, hideContact }) {
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
const [showCalendar, setShowCalendar] = useState(false);
|
const [showCalendar, setShowCalendar] = useState(false);
|
||||||
const [showReward, setShowReward] = useState(false);
|
const [showReward, setShowReward] = useState(false);
|
||||||
@@ -346,7 +346,7 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
|
|||||||
<div className="f-card-foot-right">
|
<div className="f-card-foot-right">
|
||||||
{isOwnAd ? (
|
{isOwnAd ? (
|
||||||
<span className="f-card-own-label">{t('postCard.ownAd')}</span>
|
<span className="f-card-own-label">{t('postCard.ownAd')}</span>
|
||||||
) : (
|
) : !hideContact && (
|
||||||
<button type="button" className="f-card-contact"
|
<button type="button" className="f-card-contact"
|
||||||
onClick={handleContact}>
|
onClick={handleContact}>
|
||||||
{t('postCard.write')}
|
{t('postCard.write')}
|
||||||
|
|||||||
@@ -51,6 +51,12 @@ export function cachePostsFromChats(chats) {
|
|||||||
for (const chat of chats) {
|
for (const chat of chats) {
|
||||||
if (chat.post) {
|
if (chat.post) {
|
||||||
postByChatId.set(key(chat.id), chat.post);
|
postByChatId.set(key(chat.id), chat.post);
|
||||||
|
} else if (chat.postId != null) {
|
||||||
|
// Объявление удалено: бэкенд оставил postId, но краткой карточки нет.
|
||||||
|
// Сохраняем то, что знали о нём раньше (заголовок, фото), и помечаем removed,
|
||||||
|
// чтобы в списке и шапке было понятно, о какой вещи был чат.
|
||||||
|
const prev = postByChatId.get(key(chat.id));
|
||||||
|
postByChatId.set(key(chat.id), { ...prev, id: chat.postId, removed: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chats.length) persist();
|
if (chats.length) persist();
|
||||||
|
|||||||
@@ -122,10 +122,113 @@
|
|||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
.chat-header-title {
|
.chat-header-title {
|
||||||
flex: 1;
|
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
/* Аватар + заголовок объявления; с onInfo — кнопка, открывающая карточку */
|
||||||
|
.chat-header-post {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
font: inherit;
|
||||||
|
color: inherit;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
button.chat-header-post { cursor: pointer; }
|
||||||
|
button.chat-header-post:hover .chat-header-title { text-decoration: underline; }
|
||||||
|
.chat-header-text {
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.chat-header-meta { margin-top: 2px; }
|
||||||
|
.chat-header-info-btn {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
background: none;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 10px;
|
||||||
|
color: var(--muted);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background .15s, color .15s;
|
||||||
|
}
|
||||||
|
.chat-header-info-btn:hover {
|
||||||
|
background: var(--hover-bg);
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Подпись объявления чата: тип, город, статус — различает похожие чаты */
|
||||||
|
.chat-post-meta {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
margin-top: 2px;
|
||||||
|
min-width: 0;
|
||||||
|
font-size: .7rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.chat-post-tag {
|
||||||
|
flex-shrink: 0;
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 1px 7px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.chat-post-tag--loss { background: rgba(237,73,86,.1); color: #ed4956; }
|
||||||
|
.chat-post-tag--found { background: rgba(48,168,94,.1); color: #30a85e; }
|
||||||
|
.chat-post-tag--closed,
|
||||||
|
.chat-post-tag--removed { background: var(--bg-input); color: var(--muted); }
|
||||||
|
.chat-post-city {
|
||||||
|
color: var(--muted);
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Модалка объявления, открытая из чата */
|
||||||
|
.chat-post-modal-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 12px 16px 16px;
|
||||||
|
}
|
||||||
|
.chat-post-open-btn {
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: var(--bg-input);
|
||||||
|
color: var(--text-primary);
|
||||||
|
font: inherit;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: .85rem;
|
||||||
|
padding: 9px 18px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background .15s;
|
||||||
|
}
|
||||||
|
.chat-post-open-btn:hover { background: var(--hover-bg); }
|
||||||
|
.f-post-detail-gone {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 48px 24px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.f-post-detail-gone-title {
|
||||||
|
color: var(--text-primary);
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
.f-post-detail-gone-text {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: .9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-header-avatar {
|
.chat-header-avatar {
|
||||||
|
|||||||
@@ -986,6 +986,10 @@
|
|||||||
}
|
}
|
||||||
.fd-chats-main .chat-page--embedded .chat-header { padding: 14px 24px; }
|
.fd-chats-main .chat-page--embedded .chat-header { padding: 14px 24px; }
|
||||||
.fd-chats-main .chat-page--embedded .chat-header-title { font-size: 1.02rem; }
|
.fd-chats-main .chat-page--embedded .chat-header-title { font-size: 1.02rem; }
|
||||||
|
.fd-chats-main .chat-page--embedded .chat-header-info-btn {
|
||||||
|
border-color: var(--fd-border);
|
||||||
|
background: var(--fd-surface);
|
||||||
|
}
|
||||||
.fd-chats-main .chat-page--embedded .chat-messages {
|
.fd-chats-main .chat-page--embedded .chat-messages {
|
||||||
padding-left: max(24px, calc((100% - 820px) / 2));
|
padding-left: max(24px, calc((100% - 820px) / 2));
|
||||||
padding-right: max(24px, calc((100% - 820px) / 2));
|
padding-right: max(24px, calc((100% - 820px) / 2));
|
||||||
|
|||||||
Reference in New Issue
Block a user