fixed code
This commit is contained in:
14
src/utils/chatDisplay.jsx
Normal file
14
src/utils/chatDisplay.jsx
Normal 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 };
|
||||
}
|
||||
3
src/utils/isMobileDevice.js
Normal file
3
src/utils/isMobileDevice.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export function isMobileDevice() {
|
||||
return /Mobi|Android|iPhone/i.test(navigator.userAgent);
|
||||
}
|
||||
Reference in New Issue
Block a user