2025-05-21 22:13:09 +07:00
|
|
|
|
<template>
|
2025-05-23 18:42:29 +07:00
|
|
|
|
<div class="app-chat-view">
|
|
|
|
|
<!-- Фиксированный хедер -->
|
2025-05-23 16:02:15 +07:00
|
|
|
|
<div v-if="conversationData && !loadingInitialMessages" class="chat-header">
|
2025-05-23 18:42:29 +07:00
|
|
|
|
<div class="header-content">
|
|
|
|
|
<router-link to="/chats" class="back-button">
|
|
|
|
|
<i class="bi-arrow-left"></i>
|
|
|
|
|
</router-link>
|
|
|
|
|
<div class="participant-avatar">
|
|
|
|
|
<img
|
|
|
|
|
v-if="getOtherParticipant()?.mainPhotoUrl"
|
|
|
|
|
:src="getOtherParticipant()?.mainPhotoUrl"
|
|
|
|
|
:alt="getOtherParticipantName() || 'Фото собеседника'"
|
|
|
|
|
class="avatar-image"
|
|
|
|
|
/>
|
|
|
|
|
<div v-else class="avatar-placeholder">
|
|
|
|
|
<i class="bi-person"></i>
|
2025-05-23 16:02:15 +07:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-05-23 18:42:29 +07:00
|
|
|
|
<div class="participant-info">
|
|
|
|
|
<h2 class="participant-name">{{ getOtherParticipantName() || 'Собеседник' }}</h2>
|
|
|
|
|
<p v-if="otherUserIsTyping" class="typing-status">
|
|
|
|
|
<span class="typing-animation">
|
|
|
|
|
<span class="dot"></span>
|
|
|
|
|
<span class="dot"></span>
|
|
|
|
|
<span class="dot"></span>
|
|
|
|
|
</span>
|
|
|
|
|
печатает...
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2025-05-21 22:13:09 +07:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
<!-- Основное содержимое -->
|
|
|
|
|
<main class="chat-content">
|
|
|
|
|
<!-- Loading State -->
|
|
|
|
|
<div v-if="loadingInitialMessages" class="loading-section">
|
|
|
|
|
<div class="loading-spinner">
|
|
|
|
|
<div class="spinner"></div>
|
|
|
|
|
<p>Загрузка сообщений...</p>
|
|
|
|
|
</div>
|
2025-05-23 16:02:15 +07:00
|
|
|
|
</div>
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
<!-- Error State -->
|
|
|
|
|
<div v-if="error" class="error-section">
|
2025-05-23 16:02:15 +07:00
|
|
|
|
<div class="error-card">
|
|
|
|
|
<i class="bi-exclamation-triangle"></i>
|
|
|
|
|
<h3>Ошибка загрузки</h3>
|
|
|
|
|
<p>{{ error }}</p>
|
|
|
|
|
<button class="retry-btn" @click="fetchInitialMessages">Попробовать снова</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
<!-- No Data State -->
|
|
|
|
|
<div v-if="!loadingInitialMessages && !conversationData && !error" class="empty-section">
|
2025-05-23 16:02:15 +07:00
|
|
|
|
<div class="empty-card">
|
|
|
|
|
<i class="bi-chat-dots"></i>
|
|
|
|
|
<h3>Диалог недоступен</h3>
|
|
|
|
|
<p>Не удалось загрузить данные диалога.</p>
|
|
|
|
|
<router-link to="/chats" class="action-btn primary">К списку диалогов</router-link>
|
2025-05-21 22:13:09 +07:00
|
|
|
|
</div>
|
2025-05-23 16:02:15 +07:00
|
|
|
|
</div>
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
<!-- Messages Container -->
|
|
|
|
|
<div v-if="conversationData && !loadingInitialMessages && !error" ref="messagesContainer" class="messages-container">
|
|
|
|
|
<template v-for="item in messagesWithDateSeparators" :key="item.id">
|
|
|
|
|
<!-- Date Separator -->
|
|
|
|
|
<div v-if="item.type === 'date_separator'" class="date-separator">
|
|
|
|
|
<span class="date-badge">{{ formatDateHeader(item.timestamp) }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Message Item -->
|
|
|
|
|
<div v-else-if="item.type === 'message'"
|
|
|
|
|
:class="['message-item', item.data.sender?._id === currentUser?._id ? 'sent' : 'received']"
|
|
|
|
|
@mouseenter="!isTouchDevice.value && handleMouseEnter(item.data)"
|
|
|
|
|
@mouseleave="!isTouchDevice.value && handleMouseLeave()"
|
|
|
|
|
@click.stop="handleMessageTap(item.data, $event)"
|
|
|
|
|
@contextmenu.stop="handleNativeContextMenu($event, item.data)">
|
|
|
|
|
<div class="message-wrapper">
|
|
|
|
|
<div
|
|
|
|
|
class="message-bubble"
|
|
|
|
|
:class="{
|
|
|
|
|
'edited': item.data.isEdited,
|
|
|
|
|
'with-actions': !isTouchDevice.value && hoveredMessageId === item.data._id && item.data.sender?._id === currentUser?._id
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<div class="message-content">
|
|
|
|
|
<p class="message-text">{{ item.data.text }}</p>
|
|
|
|
|
<div class="message-meta">
|
|
|
|
|
<span class="message-time">{{ formatMessageTimestamp(item.data.createdAt) }}</span>
|
|
|
|
|
<span v-if="item.data.isEdited" class="message-edited">(изменено)</span>
|
2025-05-24 22:48:34 +07:00
|
|
|
|
<!-- Индикатор статуса теперь внутри пузырька для отправленных сообщений -->
|
|
|
|
|
<span v-if="item.data.sender?._id === currentUser?._id" class="message-status-inside">
|
|
|
|
|
<i :class="getMessageStatusIcon(item.data)"></i>
|
|
|
|
|
</span>
|
2025-05-23 16:02:15 +07:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-05-23 18:42:29 +07:00
|
|
|
|
</div>
|
2025-05-21 22:13:09 +07:00
|
|
|
|
</div>
|
2025-05-23 18:42:29 +07:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- Scroll to Bottom Button -->
|
|
|
|
|
<button v-if="showScrollButton" class="scroll-bottom-btn" @click="scrollToBottom">
|
|
|
|
|
<i class="bi-arrow-down"></i>
|
|
|
|
|
</button>
|
2025-05-23 16:02:15 +07:00
|
|
|
|
</div>
|
2025-05-23 18:42:29 +07:00
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
<!-- Фиксированный нижний блок для ввода сообщений -->
|
|
|
|
|
<div v-if="isAuthenticated && conversationData" class="message-input-container">
|
|
|
|
|
<form @submit.prevent="editingMessageId ? saveEditedMessage() : sendMessage()" class="message-form">
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
v-model="newMessageText"
|
|
|
|
|
class="message-input"
|
|
|
|
|
:placeholder="editingMessageId ? 'Редактирование сообщения...' : 'Введите сообщение...'"
|
|
|
|
|
:disabled="sendingMessage || savingEdit"
|
|
|
|
|
ref="messageInputRef"
|
|
|
|
|
/>
|
|
|
|
|
<div class="input-actions">
|
|
|
|
|
<button
|
|
|
|
|
v-if="editingMessageId"
|
|
|
|
|
type="button"
|
|
|
|
|
class="action-btn secondary"
|
|
|
|
|
@click="cancelEditMessage"
|
|
|
|
|
:disabled="savingEdit"
|
|
|
|
|
>
|
|
|
|
|
Отмена
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="submit"
|
|
|
|
|
class="action-btn primary"
|
|
|
|
|
:disabled="sendingMessage || savingEdit || !newMessageText.trim()"
|
|
|
|
|
>
|
|
|
|
|
<span v-if="sendingMessage || savingEdit" class="spinner-small"></span>
|
|
|
|
|
<i v-else :class="editingMessageId ? 'bi-check' : 'bi-send'"></i>
|
|
|
|
|
{{ editingMessageId ? 'Сохранить' : 'Отправить' }}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
2025-05-21 22:13:09 +07:00
|
|
|
|
</div>
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
<!-- Context Menu (Mobile) -->
|
2025-05-21 22:13:09 +07:00
|
|
|
|
<div v-if="contextMenu && contextMenu.visible"
|
|
|
|
|
ref="contextMenuRef"
|
|
|
|
|
class="context-menu"
|
|
|
|
|
:style="{ top: contextMenu.y + 'px', left: contextMenu.x + 'px' }">
|
2025-05-23 16:02:15 +07:00
|
|
|
|
<div class="context-menu-content">
|
|
|
|
|
<button @click="startEditMessage(contextMenu.messageId)" class="context-menu-item">
|
|
|
|
|
<i class="bi-pencil-fill"></i>
|
2025-05-22 00:28:14 +07:00
|
|
|
|
<span>Редактировать</span>
|
|
|
|
|
</button>
|
2025-05-23 16:02:15 +07:00
|
|
|
|
<button @click="confirmDeleteMessage(contextMenu.messageId)" class="context-menu-item">
|
|
|
|
|
<i class="bi-trash"></i>
|
|
|
|
|
<span>Удалить</span>
|
2025-05-21 22:13:09 +07:00
|
|
|
|
</button>
|
2025-05-23 16:02:15 +07:00
|
|
|
|
</div>
|
2025-05-21 22:13:09 +07:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-05-23 18:42:29 +07:00
|
|
|
|
// Используем существующий script setup без изменений
|
2025-05-21 22:13:09 +07:00
|
|
|
|
import { ref, onMounted, onUnmounted, nextTick, computed, watch } from 'vue';
|
2025-05-23 16:02:15 +07:00
|
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
2025-05-21 22:13:09 +07:00
|
|
|
|
import api from '@/services/api';
|
|
|
|
|
import { useAuth } from '@/auth';
|
2025-05-23 18:42:29 +07:00
|
|
|
|
import { getSocket, connectSocket } from '@/services/socketService';
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
|
|
|
|
const route = useRoute();
|
2025-05-23 16:02:15 +07:00
|
|
|
|
const router = useRouter();
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const { user: currentUser, isAuthenticated } = useAuth();
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
// Все существующие константы и функции остаются без изменений
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const isTouchDevice = ref(false);
|
|
|
|
|
const hoveredMessageId = ref(null);
|
|
|
|
|
const contextMenu = ref({ visible: false, x: 0, y: 0, messageId: null });
|
|
|
|
|
const contextMenuRef = ref(null);
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
// Новая переменная для кнопки прокрутки вниз
|
|
|
|
|
const showScrollButton = ref(false);
|
|
|
|
|
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const handleMouseEnter = (message) => {
|
|
|
|
|
if (!isTouchDevice.value) {
|
|
|
|
|
hoveredMessageId.value = message._id;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleMouseLeave = () => {
|
|
|
|
|
if (!isTouchDevice.value) {
|
|
|
|
|
hoveredMessageId.value = null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// New handler for tap/click
|
|
|
|
|
const handleMessageTap = (message, event) => {
|
|
|
|
|
if (message.sender?._id === currentUser.value?._id) {
|
|
|
|
|
showContextMenu(message, event);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const showContextMenu = (message, eventSource) => {
|
|
|
|
|
if (message.sender?._id === currentUser.value?._id) {
|
|
|
|
|
contextMenu.value.messageId = message._id;
|
|
|
|
|
let x = eventSource.clientX;
|
|
|
|
|
let y = eventSource.clientY;
|
|
|
|
|
|
|
|
|
|
contextMenu.value.x = x;
|
|
|
|
|
contextMenu.value.y = y;
|
|
|
|
|
contextMenu.value.visible = true;
|
|
|
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
if (contextMenuRef.value) {
|
|
|
|
|
const menuWidth = contextMenuRef.value.offsetWidth;
|
|
|
|
|
const menuHeight = contextMenuRef.value.offsetHeight;
|
|
|
|
|
const screenWidth = window.innerWidth;
|
|
|
|
|
const screenHeight = window.innerHeight;
|
|
|
|
|
const PADDING = 10; // Screen edge padding
|
|
|
|
|
|
|
|
|
|
if (x + menuWidth > screenWidth - PADDING) {
|
|
|
|
|
x = screenWidth - menuWidth - PADDING;
|
|
|
|
|
}
|
|
|
|
|
if (x < PADDING) {
|
|
|
|
|
x = PADDING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (y + menuHeight > screenHeight - PADDING) {
|
|
|
|
|
y = screenHeight - menuHeight - PADDING;
|
|
|
|
|
}
|
|
|
|
|
if (y < PADDING) {
|
|
|
|
|
y = PADDING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
contextMenu.value.x = x;
|
|
|
|
|
contextMenu.value.y = y;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
contextMenu.value.visible = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const conversationId = ref(route.params.conversationId);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
const conversationData = ref(null);
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const messages = ref([]);
|
|
|
|
|
const newMessageText = ref('');
|
|
|
|
|
|
|
|
|
|
const loadingInitialMessages = ref(true);
|
|
|
|
|
const sendingMessage = ref(false);
|
|
|
|
|
const error = ref('');
|
|
|
|
|
|
2025-05-22 00:28:14 +07:00
|
|
|
|
// Для редактирования сообщений
|
|
|
|
|
const editingMessageId = ref(null);
|
|
|
|
|
const originalMessageText = ref('');
|
|
|
|
|
const savingEdit = ref(false);
|
|
|
|
|
const messageInputRef = ref(null);
|
|
|
|
|
|
2025-05-21 22:13:09 +07:00
|
|
|
|
let socket = null;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
const otherUserIsTyping = ref(false);
|
|
|
|
|
let stopTypingEmitTimer = null;
|
|
|
|
|
const userHasSentTypingEvent = ref(false);
|
|
|
|
|
const TYPING_TIMER_LENGTH = 1500;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
// Другие вычисляемые свойства и методы
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const messagesWithDateSeparators = computed(() => {
|
|
|
|
|
if (!messages.value || messages.value.length === 0) return [];
|
|
|
|
|
|
|
|
|
|
const result = [];
|
|
|
|
|
let lastDate = null;
|
|
|
|
|
|
|
|
|
|
messages.value.forEach(message => {
|
2025-05-23 16:02:15 +07:00
|
|
|
|
const messageTimestamp = message.createdAt || Date.now();
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const messageDate = new Date(messageTimestamp).toDateString();
|
|
|
|
|
if (messageDate !== lastDate) {
|
|
|
|
|
result.push({ type: 'date_separator', timestamp: messageTimestamp, id: `date-${messageTimestamp}-${message._id || Math.random()}` });
|
|
|
|
|
lastDate = messageDate;
|
|
|
|
|
}
|
|
|
|
|
result.push({ type: 'message', data: message, id: message._id || message.tempId || `msg-${Math.random()}` });
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
// Все оставшиеся методы остаются без изменений
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const formatDateHeader = (timestamp) => {
|
|
|
|
|
if (!timestamp) return '';
|
|
|
|
|
const date = new Date(timestamp);
|
|
|
|
|
const today = new Date();
|
|
|
|
|
const yesterday = new Date(today);
|
|
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
|
|
|
|
|
|
|
if (date.toDateString() === today.toDateString()) {
|
|
|
|
|
return 'Сегодня';
|
|
|
|
|
} else if (date.toDateString() === yesterday.toDateString()) {
|
|
|
|
|
return 'Вчера';
|
|
|
|
|
} else {
|
|
|
|
|
return date.toLocaleDateString([], { day: 'numeric', month: 'long', year: 'numeric' });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const markMessagesAsReadOnServer = () => {
|
|
|
|
|
if (socket && conversationId.value && currentUser.value?._id) {
|
|
|
|
|
const unreadMessagesFromOther = messages.value.some(
|
|
|
|
|
msg => msg.sender?._id !== currentUser.value._id &&
|
|
|
|
|
(!msg.readBy || !msg.readBy.includes(currentUser.value._id))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (unreadMessagesFromOther) {
|
|
|
|
|
console.log('[ChatView] Отправка события markMessagesAsRead для диалога:', conversationId.value);
|
|
|
|
|
socket.emit('markMessagesAsRead', {
|
|
|
|
|
conversationId: conversationId.value,
|
|
|
|
|
userId: currentUser.value._id,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const messagesContainer = ref(null);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
// Обновляем scrollToBottom для показа/скрытия кнопки прокрутки
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const scrollToBottom = () => {
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
if (messagesContainer.value) {
|
|
|
|
|
messagesContainer.value.scrollTop = messagesContainer.value.scrollHeight;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
showScrollButton.value = false;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
// Новый метод для проверки необходимости показа кнопки прокрутки
|
|
|
|
|
const checkScrollPosition = () => {
|
|
|
|
|
if (messagesContainer.value) {
|
|
|
|
|
const { scrollTop, scrollHeight, clientHeight } = messagesContainer.value;
|
|
|
|
|
// Показываем кнопку, если пользователь прокрутил вверх больше чем на 100px
|
|
|
|
|
showScrollButton.value = scrollHeight - scrollTop - clientHeight > 100;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const fetchInitialMessages = async () => {
|
|
|
|
|
if (!conversationId.value) return;
|
|
|
|
|
loadingInitialMessages.value = true;
|
|
|
|
|
error.value = '';
|
|
|
|
|
try {
|
|
|
|
|
console.log(`[ChatView] Запрос истории сообщений для диалога: ${conversationId.value}`);
|
|
|
|
|
const response = await api.getMessagesForConversation(conversationId.value);
|
|
|
|
|
messages.value = response.data.messages || [];
|
2025-05-23 16:02:15 +07:00
|
|
|
|
conversationData.value = response.data.conversation;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
|
|
|
|
console.log('[ChatView] Сообщения загружены:', messages.value);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
console.log('[ChatView] Данные диалога загружены:', conversationData.value);
|
2025-05-21 22:13:09 +07:00
|
|
|
|
scrollToBottom();
|
2025-05-23 16:02:15 +07:00
|
|
|
|
markMessagesAsReadOnServer();
|
2025-05-21 22:13:09 +07:00
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('[ChatView] Ошибка загрузки сообщений:', err);
|
|
|
|
|
error.value = err.response?.data?.message || 'Не удалось загрузить сообщения.';
|
|
|
|
|
} finally {
|
|
|
|
|
loadingInitialMessages.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const getOtherParticipant = () => {
|
|
|
|
|
if (conversationData.value && conversationData.value.participants && currentUser.value) {
|
|
|
|
|
return conversationData.value.participants.find(p => p._id !== currentUser.value._id);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
const getOtherParticipantName = () => getOtherParticipant()?.name;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
|
|
|
|
const sendMessage = () => {
|
2025-05-22 00:28:14 +07:00
|
|
|
|
if (!newMessageText.value.trim() || !socket || !currentUser.value || sendingMessage.value || editingMessageId.value) return;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
const otherParticipant = getOtherParticipant();
|
2025-05-21 22:13:09 +07:00
|
|
|
|
let receiverId;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
2025-05-21 22:13:09 +07:00
|
|
|
|
if (otherParticipant) {
|
|
|
|
|
receiverId = otherParticipant._id;
|
|
|
|
|
} else {
|
|
|
|
|
console.error("Не удалось определить получателя!");
|
|
|
|
|
error.value = "Не удалось определить получателя для отправки сообщения.";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const messageData = {
|
|
|
|
|
senderId: currentUser.value._id,
|
2025-05-23 16:02:15 +07:00
|
|
|
|
receiverId: receiverId,
|
2025-05-21 22:13:09 +07:00
|
|
|
|
text: newMessageText.value,
|
2025-05-23 16:02:15 +07:00
|
|
|
|
conversationId: conversationId.value,
|
2025-05-21 22:13:09 +07:00
|
|
|
|
};
|
2025-05-24 02:39:39 +07:00
|
|
|
|
|
|
|
|
|
// Создаем временное сообщение с локальным ID и статусом "отправляется"
|
|
|
|
|
const tempMessage = {
|
|
|
|
|
_id: `temp-${Date.now()}`,
|
|
|
|
|
tempId: `temp-${Date.now()}`, // используем tempId для идентификации временного сообщения
|
|
|
|
|
conversationId: conversationId.value,
|
|
|
|
|
sender: currentUser.value, // Используем полный объект текущего пользователя
|
|
|
|
|
text: newMessageText.value,
|
|
|
|
|
createdAt: new Date(),
|
|
|
|
|
status: 'sending' // Устанавливаем начальный статус "отправляется"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Добавляем временное сообщение в массив
|
|
|
|
|
messages.value.push(tempMessage);
|
|
|
|
|
scrollToBottom();
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
|
|
|
|
console.log('[ChatView] Отправка сообщения через сокет:', messageData);
|
|
|
|
|
sendingMessage.value = true;
|
|
|
|
|
socket.emit('sendMessage', messageData);
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
newMessageText.value = '';
|
|
|
|
|
if (messageInputRef.value) messageInputRef.value.focus();
|
2025-05-21 22:13:09 +07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleNewMessage = (message) => {
|
|
|
|
|
console.log('[ChatView] Получено новое сообщение:', message);
|
2025-05-24 02:39:39 +07:00
|
|
|
|
|
2025-05-21 22:13:09 +07:00
|
|
|
|
if (message.conversationId === conversationId.value) {
|
2025-05-24 02:39:39 +07:00
|
|
|
|
// Проверяем, является ли это сообщение подтверждением отправки ранее добавленного временного сообщения
|
|
|
|
|
if (message.sender?._id === currentUser.value?._id) {
|
|
|
|
|
// Находим и удаляем все временные сообщения (они могут накапливаться при быстрой отправке)
|
|
|
|
|
messages.value = messages.value.filter(msg => !msg.tempId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Проверяем, есть ли поле status в сообщении, если нет - добавляем
|
|
|
|
|
if (!message.status) {
|
|
|
|
|
message.status = 'delivered';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Добавляем полученное сообщение
|
|
|
|
|
messages.value.push(message);
|
2025-05-21 22:13:09 +07:00
|
|
|
|
scrollToBottom();
|
|
|
|
|
|
2025-05-24 02:39:39 +07:00
|
|
|
|
// Если сообщение от другого пользователя и окно активно - помечаем как прочитанное
|
2025-05-21 22:13:09 +07:00
|
|
|
|
if (message.sender?._id !== currentUser.value?._id && document.hasFocus()) {
|
|
|
|
|
markMessagesAsReadOnServer();
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-24 02:39:39 +07:00
|
|
|
|
|
|
|
|
|
sendingMessage.value = false;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleMessageDeletedBySocket = (data) => {
|
|
|
|
|
console.log('[ChatView] Получено событие удаления сообщения от сокета:', data);
|
|
|
|
|
const { messageId, conversationId: convId } = data;
|
|
|
|
|
if (convId === conversationId.value) {
|
|
|
|
|
messages.value = messages.value.filter(msg => msg._id !== messageId);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
if (contextMenu.value && contextMenu.value.messageId === messageId) {
|
|
|
|
|
contextMenu.value.visible = false;
|
|
|
|
|
}
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-22 00:28:14 +07:00
|
|
|
|
const startEditMessage = (messageId) => {
|
|
|
|
|
const messageToEdit = messages.value.find(msg => msg._id === messageId);
|
|
|
|
|
if (messageToEdit && messageToEdit.sender?._id === currentUser.value?._id) {
|
|
|
|
|
editingMessageId.value = messageId;
|
|
|
|
|
originalMessageText.value = messageToEdit.text;
|
|
|
|
|
newMessageText.value = messageToEdit.text;
|
|
|
|
|
contextMenu.value.visible = false;
|
|
|
|
|
if (messageInputRef.value) messageInputRef.value.focus();
|
|
|
|
|
console.log('[ChatView] Начало редактирования сообщения:', messageId);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const cancelEditMessage = () => {
|
|
|
|
|
editingMessageId.value = null;
|
|
|
|
|
newMessageText.value = '';
|
|
|
|
|
originalMessageText.value = '';
|
|
|
|
|
console.log('[ChatView] Редактирование отменено');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const saveEditedMessage = async () => {
|
|
|
|
|
if (!editingMessageId.value || !newMessageText.value.trim() || savingEdit.value) return;
|
|
|
|
|
|
|
|
|
|
const newText = newMessageText.value.trim();
|
|
|
|
|
if (newText === originalMessageText.value) {
|
|
|
|
|
cancelEditMessage();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
savingEdit.value = true;
|
|
|
|
|
error.value = '';
|
|
|
|
|
try {
|
|
|
|
|
console.log(`[ChatView] Сохранение отредактированного сообщения ${editingMessageId.value} с текстом: "${newText}"`);
|
|
|
|
|
const updatedMessage = await api.editMessage(conversationId.value, editingMessageId.value, newText);
|
|
|
|
|
|
|
|
|
|
const index = messages.value.findIndex(msg => msg._id === editingMessageId.value);
|
|
|
|
|
if (index !== -1) {
|
|
|
|
|
messages.value[index] = { ...messages.value[index], ...updatedMessage.data };
|
|
|
|
|
console.log('[ChatView] Сообщение локально обновлено:', messages.value[index]);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
cancelEditMessage();
|
2025-05-22 00:28:14 +07:00
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('[ChatView] Ошибка при сохранении отредактированного сообщения:', err);
|
|
|
|
|
error.value = err.response?.data?.message || 'Не удалось сохранить изменения.';
|
|
|
|
|
} finally {
|
|
|
|
|
savingEdit.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleMessageEditedBySocket = ({ message: editedMessage, conversationId: convId }) => {
|
|
|
|
|
if (convId === conversationId.value) {
|
|
|
|
|
const index = messages.value.findIndex(msg => msg._id === editedMessage._id);
|
|
|
|
|
if (index !== -1) {
|
|
|
|
|
messages.value[index] = { ...messages.value[index], ...editedMessage };
|
2025-05-23 16:02:15 +07:00
|
|
|
|
console.log('[ChatView] Сообщение обновлено через сокет:', messages.value[index]);
|
2025-05-22 00:28:14 +07:00
|
|
|
|
} else {
|
2025-05-23 16:02:15 +07:00
|
|
|
|
console.warn('[ChatView] Получено отредактированное сообщение, которое не найдено локально:', editedMessage._id);
|
2025-05-22 00:28:14 +07:00
|
|
|
|
}
|
2025-05-22 00:44:28 +07:00
|
|
|
|
} else {
|
|
|
|
|
console.log(`[ChatView] Событие messageEdited для другого диалога (${convId}), текущий открытый: ${conversationId.value}`);
|
2025-05-22 00:28:14 +07:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const confirmDeleteMessage = (messageId) => {
|
|
|
|
|
deleteMessage(messageId);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const deleteMessage = async (messageId) => {
|
|
|
|
|
try {
|
|
|
|
|
messages.value = messages.value.filter(msg => msg._id !== messageId);
|
|
|
|
|
await api.deleteMessage(conversationId.value, messageId);
|
|
|
|
|
console.log(`[ChatView] Сообщение ${messageId} удалено локально и на сервере.`);
|
|
|
|
|
|
|
|
|
|
if (contextMenu.value && contextMenu.value.messageId === messageId) {
|
|
|
|
|
contextMenu.value.visible = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error(`[ChatView] Ошибка удаления сообщения ${messageId}:`, err);
|
|
|
|
|
error.value = err.response?.data?.message || 'Не удалось удалить сообщение.';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-24 02:34:45 +07:00
|
|
|
|
const handleMessagesReadByOther = ({ conversationId: readConversationId, readerId, status }) => {
|
2025-05-21 22:13:09 +07:00
|
|
|
|
if (readConversationId === conversationId.value) {
|
|
|
|
|
console.log(`[ChatView] Сообщения в диалоге ${readConversationId} прочитаны пользователем ${readerId}`);
|
|
|
|
|
messages.value = messages.value.map(msg => {
|
|
|
|
|
if (msg.sender?._id === currentUser.value?._id) {
|
2025-05-24 02:34:45 +07:00
|
|
|
|
// Обновляем массив readBy
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const updatedReadBy = msg.readBy ? [...msg.readBy] : [];
|
|
|
|
|
if (!updatedReadBy.includes(readerId)) {
|
|
|
|
|
updatedReadBy.push(readerId);
|
|
|
|
|
}
|
2025-05-24 02:34:45 +07:00
|
|
|
|
|
|
|
|
|
// Обновляем статус сообщения на 'read'
|
|
|
|
|
return {
|
|
|
|
|
...msg,
|
|
|
|
|
readBy: updatedReadBy,
|
|
|
|
|
status: 'read'
|
|
|
|
|
};
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
return msg;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleVisibilityChange = () => {
|
|
|
|
|
if (document.visibilityState === 'visible') {
|
|
|
|
|
markMessagesAsReadOnServer();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
watch(newMessageText, (newValue) => {
|
2025-05-21 22:13:09 +07:00
|
|
|
|
if (!socket || !isAuthenticated.value || !conversationData.value || !currentUser.value) return;
|
|
|
|
|
|
|
|
|
|
const otherParticipant = getOtherParticipant();
|
|
|
|
|
if (!otherParticipant?._id) {
|
|
|
|
|
console.warn("[ChatView] Не удалось определить собеседника для событий печати.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const receiverId = otherParticipant._id;
|
|
|
|
|
|
|
|
|
|
const payload = {
|
|
|
|
|
conversationId: conversationId.value,
|
|
|
|
|
receiverId: receiverId,
|
|
|
|
|
senderId: currentUser.value._id
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
clearTimeout(stopTypingEmitTimer);
|
|
|
|
|
|
|
|
|
|
if (newValue.trim().length > 0) {
|
|
|
|
|
if (!userHasSentTypingEvent.value) {
|
2025-05-22 00:28:14 +07:00
|
|
|
|
if (socket.connected) {
|
2025-05-21 22:13:09 +07:00
|
|
|
|
socket.emit('typing', payload);
|
|
|
|
|
userHasSentTypingEvent.value = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stopTypingEmitTimer = setTimeout(() => {
|
2025-05-22 00:28:14 +07:00
|
|
|
|
if (socket.connected) {
|
2025-05-21 22:13:09 +07:00
|
|
|
|
socket.emit('stopTyping', payload);
|
2025-05-22 00:28:14 +07:00
|
|
|
|
userHasSentTypingEvent.value = false;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
}, TYPING_TIMER_LENGTH);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if (userHasSentTypingEvent.value) {
|
2025-05-22 00:28:14 +07:00
|
|
|
|
if (socket.connected) {
|
2025-05-21 22:13:09 +07:00
|
|
|
|
socket.emit('stopTyping', payload);
|
|
|
|
|
userHasSentTypingEvent.value = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
isTouchDevice.value = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0);
|
|
|
|
|
if (!isAuthenticated.value) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
await fetchInitialMessages();
|
|
|
|
|
|
|
|
|
|
socket = getSocket();
|
|
|
|
|
if (!socket) {
|
|
|
|
|
socket = connectSocket();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (socket) {
|
|
|
|
|
socket.on('getMessage', handleNewMessage);
|
|
|
|
|
socket.on('messagesRead', handleMessagesReadByOther);
|
|
|
|
|
socket.on('userTyping', ({ conversationId: incomingConvId, senderId }) => {
|
|
|
|
|
const otherP = getOtherParticipant();
|
|
|
|
|
if (incomingConvId === conversationId.value && otherP && senderId === otherP._id) {
|
|
|
|
|
otherUserIsTyping.value = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
socket.on('userStopTyping', ({ conversationId: incomingConvId, senderId }) => {
|
|
|
|
|
const otherP = getOtherParticipant();
|
|
|
|
|
if (incomingConvId === conversationId.value && otherP && senderId === otherP._id) {
|
|
|
|
|
otherUserIsTyping.value = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
socket.on('messageDeleted', handleMessageDeletedBySocket);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
socket.on('messageEdited', handleMessageEditedBySocket);
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
|
|
|
|
if (conversationId.value) {
|
|
|
|
|
socket.emit('joinConversationRoom', conversationId.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
markMessagesAsReadOnServer();
|
|
|
|
|
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
|
|
|
window.addEventListener('focus', markMessagesAsReadOnServer);
|
|
|
|
|
document.addEventListener('click', handleClickOutsideContextMenu, true);
|
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
// Добавляем обработчик события прокрутки
|
|
|
|
|
if (messagesContainer.value) {
|
|
|
|
|
messagesContainer.value.addEventListener('scroll', checkScrollPosition);
|
|
|
|
|
}
|
2025-05-21 22:13:09 +07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
if (socket) {
|
|
|
|
|
socket.off('getMessage', handleNewMessage);
|
|
|
|
|
socket.off('messagesRead', handleMessagesReadByOther);
|
|
|
|
|
socket.off('userTyping');
|
|
|
|
|
socket.off('userStopTyping');
|
|
|
|
|
socket.off('messageDeleted', handleMessageDeletedBySocket);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
socket.off('messageEdited', handleMessageEditedBySocket);
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
|
|
|
|
if (conversationId.value) {
|
|
|
|
|
socket.emit('leaveConversationRoom', conversationId.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
|
|
|
window.removeEventListener('focus', markMessagesAsReadOnServer);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
document.removeEventListener('click', handleClickOutsideContextMenu, true);
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
clearTimeout(stopTypingEmitTimer);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
// Удаляем обработчик события прокрутки
|
|
|
|
|
if (messagesContainer.value) {
|
|
|
|
|
messagesContainer.value.removeEventListener('scroll', checkScrollPosition);
|
|
|
|
|
}
|
2025-05-21 22:13:09 +07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const formatMessageTimestamp = (timestamp) => {
|
|
|
|
|
if (!timestamp) return '';
|
|
|
|
|
return new Date(timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const getMessageStatusIcon = (message) => {
|
2025-05-24 02:34:45 +07:00
|
|
|
|
// Приоритет отдаем полю status, если оно есть
|
|
|
|
|
if (message.status) {
|
|
|
|
|
switch (message.status) {
|
|
|
|
|
case 'sending':
|
|
|
|
|
return 'bi bi-clock';
|
|
|
|
|
case 'delivered':
|
|
|
|
|
return 'bi bi-check2';
|
|
|
|
|
case 'read':
|
|
|
|
|
return 'bi bi-check2-all';
|
|
|
|
|
default:
|
|
|
|
|
return 'bi bi-check2';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Для обратной совместимости проверяем старую логику, если поле status не установлено
|
2025-05-21 22:13:09 +07:00
|
|
|
|
if (message.isSending) {
|
2025-05-23 16:02:15 +07:00
|
|
|
|
return 'bi bi-clock';
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-24 02:34:45 +07:00
|
|
|
|
|
2025-05-21 22:13:09 +07:00
|
|
|
|
const otherParticipant = getOtherParticipant();
|
|
|
|
|
if (otherParticipant && message.readBy && message.readBy.includes(otherParticipant._id)) {
|
2025-05-23 16:02:15 +07:00
|
|
|
|
return 'bi bi-check2-all';
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-24 02:34:45 +07:00
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
return 'bi bi-check2';
|
2025-05-21 22:13:09 +07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleNativeContextMenu = (event, message) => {
|
|
|
|
|
if (message.sender?._id === currentUser.value?._id) {
|
2025-05-23 16:02:15 +07:00
|
|
|
|
event.preventDefault();
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleClickOutsideContextMenu = (event) => {
|
|
|
|
|
if (contextMenu.value.visible && contextMenuRef.value && !contextMenuRef.value.contains(event.target)) {
|
|
|
|
|
contextMenu.value.visible = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Основные стили */
|
|
|
|
|
.app-chat-view {
|
2025-05-23 16:02:15 +07:00
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
height: 100vh;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
width: 100%;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
position: relative;
|
|
|
|
|
background-color: #f8f9fa;
|
|
|
|
|
background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
|
|
|
overflow: hidden;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Хедер */
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.chat-header {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
background: rgba(33, 33, 60, 0.9);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
backdrop-filter: blur(10px);
|
|
|
|
|
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
2025-05-23 18:42:29 +07:00
|
|
|
|
padding: 0.8rem 1rem;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
color: white;
|
2025-05-23 20:28:18 +07:00
|
|
|
|
position: fixed; /* Меняем со sticky на fixed */
|
2025-05-23 16:02:15 +07:00
|
|
|
|
top: 0;
|
2025-05-23 20:28:18 +07:00
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
z-index: 100; /* Увеличиваем z-index для правильного отображения */
|
2025-05-23 18:42:29 +07:00
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
height: var(--header-height, 56px);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.header-content {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 1rem;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
max-width: 800px;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
width: 100%;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.back-button {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
width: 36px;
|
|
|
|
|
height: 36px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background: rgba(255, 255, 255, 0.2);
|
|
|
|
|
color: white;
|
|
|
|
|
text-decoration: none;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
flex-shrink: 0;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.participant-avatar {
|
|
|
|
|
width: 40px;
|
|
|
|
|
height: 40px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
border: 2px solid white;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
flex-shrink: 0;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
.avatar-image {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.avatar-placeholder {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
background: rgba(255, 255, 255, 0.3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.avatar-placeholder i {
|
|
|
|
|
font-size: 1.5rem;
|
|
|
|
|
color: white;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.participant-info {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
overflow: hidden;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
.participant-name {
|
|
|
|
|
margin: 0;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
font-size: 1.1rem;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
font-weight: 600;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
white-space: nowrap;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.typing-status {
|
|
|
|
|
margin: 0;
|
|
|
|
|
font-size: 0.8rem;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
opacity: 0.9;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
font-style: italic;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 0.4rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.typing-animation {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 3px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dot {
|
|
|
|
|
width: 4px;
|
|
|
|
|
height: 4px;
|
|
|
|
|
background-color: white;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
animation: bouncingDots 1.4s infinite;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dot:nth-child(2) {
|
|
|
|
|
animation-delay: 0.2s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dot:nth-child(3) {
|
|
|
|
|
animation-delay: 0.4s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes bouncingDots {
|
|
|
|
|
0%, 100% { transform: translateY(0); }
|
|
|
|
|
50% { transform: translateY(-4px); }
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Основная область содержимого */
|
|
|
|
|
.chat-content {
|
|
|
|
|
flex: 1;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
position: relative;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
2025-05-23 20:28:18 +07:00
|
|
|
|
padding-top: var(--header-height, 56px); /* Добавляем отступ сверху для фиксированного хедера */
|
|
|
|
|
padding-bottom: calc(70px + var(--nav-height, 60px)); /* Отступ снизу для блока ввода и навигационной панели */
|
2025-05-23 18:42:29 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Состояния загрузки и ошибки */
|
|
|
|
|
.loading-section,
|
|
|
|
|
.error-section,
|
|
|
|
|
.empty-section {
|
2025-05-23 16:02:15 +07:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
flex: 1;
|
|
|
|
|
padding: 1rem;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
.loading-spinner {
|
|
|
|
|
text-align: center;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
color: white;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
.spinner {
|
|
|
|
|
width: 50px;
|
|
|
|
|
height: 50px;
|
|
|
|
|
border: 4px solid rgba(255, 255, 255, 0.3);
|
|
|
|
|
border-left: 4px solid white;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
animation: spin 1s linear infinite;
|
|
|
|
|
margin: 0 auto 1rem;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
.spinner-small {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
width: 16px;
|
|
|
|
|
height: 16px;
|
|
|
|
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
|
|
|
border-left: 2px solid white;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
animation: spin 0.8s linear infinite;
|
|
|
|
|
margin-right: 0.5rem;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
@keyframes spin {
|
|
|
|
|
0% { transform: rotate(0deg); }
|
|
|
|
|
100% { transform: rotate(360deg); }
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.error-card,
|
|
|
|
|
.empty-card {
|
|
|
|
|
background: white;
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
padding: 2rem;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
text-align: center;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
|
|
|
|
|
max-width: 400px;
|
|
|
|
|
width: 100%;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.error-card i,
|
|
|
|
|
.empty-card i {
|
2025-05-23 16:02:15 +07:00
|
|
|
|
font-size: 3rem;
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.error-card i {
|
|
|
|
|
color: #dc3545;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.empty-card i {
|
|
|
|
|
color: #6c757d;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.error-card h3,
|
|
|
|
|
.empty-card h3 {
|
|
|
|
|
color: #343a40;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.retry-btn,
|
|
|
|
|
.action-btn.primary {
|
2025-05-23 16:02:15 +07:00
|
|
|
|
background: linear-gradient(45deg, #667eea, #764ba2);
|
|
|
|
|
color: white;
|
|
|
|
|
border: none;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
padding: 0.75rem 1.5rem;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
border-radius: 50px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: all 0.3s ease;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
text-decoration: none;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Контейнер сообщений */
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.messages-container {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
flex: 1;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
overflow-y: auto;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
padding: 1rem;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
scrollbar-width: thin;
|
|
|
|
|
scrollbar-color: rgba(102, 126, 234, 0.5) rgba(255, 255, 255, 0.1);
|
2025-05-23 18:42:29 +07:00
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 0.8rem;
|
|
|
|
|
-webkit-overflow-scrolling: touch;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.messages-container::-webkit-scrollbar {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
width: 5px;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.messages-container::-webkit-scrollbar-track {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
background: transparent;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.messages-container::-webkit-scrollbar-thumb {
|
|
|
|
|
background-color: rgba(102, 126, 234, 0.5);
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Кнопка прокрутки вниз */
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.scroll-bottom-btn {
|
|
|
|
|
position: absolute;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
right: 16px;
|
|
|
|
|
bottom: 16px;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
width: 40px;
|
|
|
|
|
height: 40px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background: linear-gradient(45deg, #667eea, #764ba2);
|
|
|
|
|
color: white;
|
|
|
|
|
border: none;
|
|
|
|
|
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
z-index: 5;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Разделитель даты */
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.date-separator {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
margin: 1rem 0;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.date-badge {
|
|
|
|
|
background: rgba(255, 255, 255, 0.9);
|
|
|
|
|
color: #495057;
|
|
|
|
|
padding: 0.5rem 1rem;
|
|
|
|
|
border-radius: 20px;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
font-size: 0.85rem;
|
|
|
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Стили сообщений */
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.message-item {
|
2025-05-21 22:13:09 +07:00
|
|
|
|
display: flex;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
margin-bottom: 0.4rem;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.message-item.sent {
|
2025-05-21 22:13:09 +07:00
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
.message-wrapper {
|
|
|
|
|
position: relative;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
max-width: 80%;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message-bubble {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
padding: 0.7rem 1rem;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
border-radius: 18px;
|
|
|
|
|
position: relative;
|
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.sent .message-bubble {
|
|
|
|
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
|
|
|
color: white;
|
|
|
|
|
border-bottom-right-radius: 4px;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.received .message-bubble {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
background: white;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
color: #333;
|
|
|
|
|
border-bottom-left-radius: 4px;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
.message-text {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
margin: 0 0 0.4rem;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
line-height: 1.4;
|
|
|
|
|
word-break: break-word;
|
2025-05-22 00:28:14 +07:00
|
|
|
|
}
|
2025-05-21 22:13:09 +07:00
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.message-meta {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
font-size: 0.7rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.received .message-meta {
|
2025-05-21 22:13:09 +07:00
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.message-actions {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 50%;
|
|
|
|
|
transform: translateY(-50%);
|
2025-05-23 18:42:29 +07:00
|
|
|
|
left: -60px;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
display: flex;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
gap: 0.4rem;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
opacity: 0;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
transition: opacity 0.3s ease;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.sent .message-wrapper:hover .message-actions {
|
2025-05-21 22:13:09 +07:00
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.action-icon {
|
|
|
|
|
width: 28px;
|
|
|
|
|
height: 28px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
2025-05-22 00:28:14 +07:00
|
|
|
|
border: none;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: all 0.2s ease;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
background: white;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
color: #495057;
|
2025-05-22 00:28:14 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
.edit-icon:hover {
|
|
|
|
|
background: #0dcaf0;
|
|
|
|
|
color: white;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.delete-icon:hover {
|
|
|
|
|
background: #dc3545;
|
|
|
|
|
color: white;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Контейнер ввода сообщений */
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.message-input-container {
|
|
|
|
|
background: white;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
|
|
|
|
padding: 0.8rem 1rem;
|
2025-05-23 20:28:18 +07:00
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: var(--nav-height, 60px); /* Размещаем прямо над навигационными табами */
|
2025-05-23 20:20:01 +07:00
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
2025-05-23 20:28:18 +07:00
|
|
|
|
z-index: 100;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
max-width: 800px;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
width: 100%;
|
|
|
|
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message-form {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 0.75rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message-input {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
flex: 1;
|
|
|
|
|
padding: 0.7rem 1rem;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
|
|
|
border-radius: 24px;
|
|
|
|
|
font-size: 0.95rem;
|
|
|
|
|
background: white;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message-input:focus {
|
|
|
|
|
outline: none;
|
|
|
|
|
border-color: #667eea;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.input-actions {
|
|
|
|
|
display: flex;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.action-btn {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 0.5rem;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
padding: 0.7rem 1.2rem;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
border: none;
|
|
|
|
|
border-radius: 50px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.action-btn.secondary {
|
|
|
|
|
background: #f1f3f5;
|
|
|
|
|
color: #495057;
|
2025-05-22 00:28:14 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.action-btn:disabled {
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Контекстное меню */
|
2025-05-21 22:13:09 +07:00
|
|
|
|
.context-menu {
|
|
|
|
|
position: fixed;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
z-index: 1000;
|
|
|
|
|
background: white;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
|
|
|
overflow: hidden;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
min-width: 180px;
|
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
|
|
|
|
|
.context-menu-item {
|
2025-05-21 22:13:09 +07:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2025-05-23 16:02:15 +07:00
|
|
|
|
gap: 0.75rem;
|
|
|
|
|
padding: 0.8rem 1rem;
|
|
|
|
|
border: none;
|
|
|
|
|
background: none;
|
|
|
|
|
text-align: left;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: background 0.2s;
|
2025-05-23 18:42:29 +07:00
|
|
|
|
width: 100%;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.context-menu-item:hover {
|
|
|
|
|
background: #f8f9fa;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.context-menu-item i {
|
|
|
|
|
font-size: 1rem;
|
2025-05-21 22:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.context-menu-item:first-child i {
|
|
|
|
|
color: #0dcaf0;
|
2025-05-22 00:28:14 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 16:02:15 +07:00
|
|
|
|
.context-menu-item:last-child i {
|
|
|
|
|
color: #dc3545;
|
2025-05-22 00:28:14 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-24 02:39:39 +07:00
|
|
|
|
/* Индикаторы статуса сообщений */
|
|
|
|
|
.message-status {
|
2025-05-24 02:52:23 +07:00
|
|
|
|
font-size: 1.1rem;
|
2025-05-24 02:39:39 +07:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2025-05-24 02:49:19 +07:00
|
|
|
|
opacity: 1;
|
2025-05-24 02:52:23 +07:00
|
|
|
|
color: white;
|
|
|
|
|
margin-left: 8px;
|
2025-05-24 02:39:39 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message-status i {
|
2025-05-24 02:52:23 +07:00
|
|
|
|
font-size: 18px; /* Значительно увеличиваем размер иконок статуса */
|
2025-05-24 02:39:39 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Адаптивные стили */
|
2025-05-23 16:02:15 +07:00
|
|
|
|
@media (max-width: 576px) {
|
|
|
|
|
.message-wrapper {
|
|
|
|
|
max-width: 85%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.message-actions {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
display: none; /* Скрываем на мобильных, используем контекстное меню */
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
2025-05-23 17:13:32 +07:00
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.action-btn {
|
|
|
|
|
padding: 0.6rem 1rem;
|
|
|
|
|
font-size: 0.85rem;
|
2025-05-23 17:13:32 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.back-button {
|
|
|
|
|
width: 32px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 375px) {
|
|
|
|
|
.message-wrapper {
|
|
|
|
|
max-width: 90%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.context-menu {
|
|
|
|
|
width: 160px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Учитываем наличие нижней навигационной панели */
|
|
|
|
|
@media (max-height: 680px) {
|
|
|
|
|
.messages-container {
|
|
|
|
|
padding: 0.8rem;
|
|
|
|
|
gap: 0.6rem;
|
2025-05-23 17:13:32 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.message-input-container {
|
|
|
|
|
padding: 0.7rem;
|
2025-05-23 17:13:32 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.message-input {
|
|
|
|
|
padding: 0.6rem 0.8rem;
|
2025-05-23 17:13:32 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.action-btn {
|
|
|
|
|
padding: 0.6rem 1rem;
|
2025-05-23 17:13:32 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
/* Ландшафтная ориентация на мобильных */
|
|
|
|
|
@media (max-height: 450px) and (orientation: landscape) {
|
2025-05-23 17:13:32 +07:00
|
|
|
|
.chat-header {
|
2025-05-23 18:42:29 +07:00
|
|
|
|
padding: 0.5rem 1rem;
|
|
|
|
|
height: 46px;
|
2025-05-23 17:13:32 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.participant-avatar {
|
|
|
|
|
width: 32px;
|
|
|
|
|
height: 32px;
|
2025-05-23 17:13:32 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.participant-name {
|
|
|
|
|
font-size: 1rem;
|
2025-05-23 17:13:32 +07:00
|
|
|
|
}
|
|
|
|
|
|
2025-05-23 18:42:29 +07:00
|
|
|
|
.message-input-container {
|
2025-05-23 17:13:32 +07:00
|
|
|
|
padding: 0.5rem;
|
|
|
|
|
}
|
2025-05-23 18:42:29 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Учет нижней мобильной навигации (примерно 60px) */
|
|
|
|
|
@supports (padding-bottom: env(safe-area-inset-bottom)) {
|
|
|
|
|
.message-input-container {
|
|
|
|
|
padding-bottom: calc(0.8rem + env(safe-area-inset-bottom, 0px));
|
2025-05-23 17:13:32 +07:00
|
|
|
|
}
|
2025-05-23 16:02:15 +07:00
|
|
|
|
}
|
2025-05-21 22:13:09 +07:00
|
|
|
|
</style>
|