fixed code

This commit is contained in:
SlimusMinus
2026-08-11 00:24:07 +03:00
parent c50b75eece
commit 7f59ee1f38
95 changed files with 3623 additions and 2830 deletions

14
src/utils/chatDisplay.jsx Normal file
View File

@@ -0,0 +1,14 @@
import { getImageUrl } from "../config/authConstants";
/**
* Резолвит данные для отображения одного чата в списке:
* заголовок, картинку/эмодзи-аватар и счётчик непрочитанных.
*/
export function getChatDisplayInfo(chat, post, unreadMap, t) {
const title = post?.title || chat.otherUser?.name || t('chat.user');
const imgSrc = getImageUrl(post?.images?.[0]);
const emoji = post?.emoji;
const unreadCount = unreadMap[chat.id] ?? chat.unreadCount ?? chat.unreadMessages ?? 0;
return { title, imgSrc, emoji, unreadCount };
}

View File

@@ -0,0 +1,3 @@
export function isMobileDevice() {
return /Mobi|Android|iPhone/i.test(navigator.userAgent);
}