доработка чата
This commit is contained in:
parent
ed0bcfc4d4
commit
3eb33bf5f4
@ -19,6 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="participant-info">
|
<div class="participant-info">
|
||||||
<h2 class="participant-name">{{ getOtherParticipantName() || 'Собеседник' }}</h2>
|
<h2 class="participant-name">{{ getOtherParticipantName() || 'Собеседник' }}</h2>
|
||||||
|
<div class="typing-status-container">
|
||||||
<p v-if="otherUserIsTyping" class="typing-status">
|
<p v-if="otherUserIsTyping" class="typing-status">
|
||||||
<span class="typing-animation">
|
<span class="typing-animation">
|
||||||
<span class="dot"></span>
|
<span class="dot"></span>
|
||||||
@ -27,6 +28,8 @@
|
|||||||
</span>
|
</span>
|
||||||
печатает...
|
печатает...
|
||||||
</p>
|
</p>
|
||||||
|
<p v-else class="typing-status-placeholder"></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -110,14 +113,15 @@
|
|||||||
<!-- Фиксированный нижний блок для ввода сообщений -->
|
<!-- Фиксированный нижний блок для ввода сообщений -->
|
||||||
<div v-if="isAuthenticated && conversationData" class="message-input-container">
|
<div v-if="isAuthenticated && conversationData" class="message-input-container">
|
||||||
<form @submit.prevent="editingMessageId ? saveEditedMessage() : sendMessage()" class="message-form">
|
<form @submit.prevent="editingMessageId ? saveEditedMessage() : sendMessage()" class="message-form">
|
||||||
<input
|
<textarea
|
||||||
type="text"
|
|
||||||
v-model="newMessageText"
|
v-model="newMessageText"
|
||||||
class="message-input"
|
class="message-input"
|
||||||
:placeholder="editingMessageId ? 'Редактирование сообщения...' : 'Введите сообщение...'"
|
:placeholder="editingMessageId ? 'Редактирование сообщения...' : 'Введите сообщение...'"
|
||||||
:disabled="sendingMessage || savingEdit"
|
:disabled="sendingMessage || savingEdit"
|
||||||
ref="messageInputRef"
|
ref="messageInputRef"
|
||||||
/>
|
@input="resizeTextarea"
|
||||||
|
rows="1"
|
||||||
|
></textarea>
|
||||||
<div class="input-actions">
|
<div class="input-actions">
|
||||||
<button
|
<button
|
||||||
v-if="editingMessageId"
|
v-if="editingMessageId"
|
||||||
@ -130,12 +134,12 @@
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="action-btn primary"
|
class="send-button"
|
||||||
:disabled="sendingMessage || savingEdit || !newMessageText.trim()"
|
:disabled="sendingMessage || savingEdit || !newMessageText.trim()"
|
||||||
|
:class="{ 'active': newMessageText.trim() }"
|
||||||
>
|
>
|
||||||
<span v-if="sendingMessage || savingEdit" class="spinner-small"></span>
|
<span v-if="sendingMessage || savingEdit" class="spinner-small"></span>
|
||||||
<i v-else :class="editingMessageId ? 'bi-check' : 'bi-send'"></i>
|
<i v-else :class="editingMessageId ? 'bi-check' : 'bi-send-fill'"></i>
|
||||||
{{ editingMessageId ? 'Сохранить' : 'Отправить' }}
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -763,6 +767,22 @@ const handleClickOutsideContextMenu = (event) => {
|
|||||||
contextMenu.value.visible = false;
|
contextMenu.value.visible = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const resizeTextarea = (event) => {
|
||||||
|
const textarea = event.target;
|
||||||
|
|
||||||
|
// Сбрасываем высоту к минимуму для правильного расчета
|
||||||
|
textarea.style.height = 'auto';
|
||||||
|
|
||||||
|
// Вычисляем новую высоту на основе содержимого, но не более 150px
|
||||||
|
const newHeight = Math.min(textarea.scrollHeight, 150);
|
||||||
|
|
||||||
|
// Минимальная высота - одна строка (примерно 38px с учетом padding)
|
||||||
|
const minHeight = 38;
|
||||||
|
|
||||||
|
// Устанавливаем новую высоту, но не меньше минимальной
|
||||||
|
textarea.style.height = `${Math.max(minHeight, newHeight)}px`;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -859,6 +879,12 @@ const handleClickOutsideContextMenu = (event) => {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.typing-status-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 20px; /* Фиксированная высота для области статуса печати */
|
||||||
|
}
|
||||||
|
|
||||||
.typing-status {
|
.typing-status {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
@ -1178,12 +1204,17 @@ const handleClickOutsideContextMenu = (event) => {
|
|||||||
padding: 0.7rem 1rem;
|
padding: 0.7rem 1rem;
|
||||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
border-radius: 24px;
|
border-radius: 24px;
|
||||||
font-size: 16px; /* Устанавливаем оптимальный размер шрифта для мобильных устройств */
|
font-size: 16px;
|
||||||
background: white;
|
background: white;
|
||||||
-webkit-appearance: none; /* Предотвращаем стилизацию браузера на iOS */
|
-webkit-appearance: none;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
-webkit-tap-highlight-color: transparent; /* Убираем подсветку на тап */
|
-webkit-tap-highlight-color: transparent;
|
||||||
touch-action: manipulation; /* Улучшение отзывчивости на мобильных устройствах */
|
touch-action: manipulation;
|
||||||
|
resize: none; /* Убираем возможность изменения размера пользователем */
|
||||||
|
max-height: 150px; /* Максимальная высота поля ввода */
|
||||||
|
overflow-y: auto; /* Добавляем прокрутку при достижении максимальной высоты */
|
||||||
|
word-wrap: break-word; /* Обеспечиваем перенос длинных слов */
|
||||||
|
line-height: 1.4; /* Оптимальная высота строки */
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-input:focus {
|
.message-input:focus {
|
||||||
@ -1197,6 +1228,40 @@ const handleClickOutsideContextMenu = (event) => {
|
|||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Круглая кнопка отправки в стиле Телеграма */
|
||||||
|
.send-button {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
min-width: 40px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: none;
|
||||||
|
background: #e0e0e0;
|
||||||
|
color: #8e8e8e;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
box-shadow: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.send-button.active {
|
||||||
|
background: linear-gradient(45deg, #667eea, #764ba2);
|
||||||
|
color: white;
|
||||||
|
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.send-button:disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.send-button i {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
.action-btn {
|
.action-btn {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user