Corp/backend/static/css/components/chat-detail.css
Игорь Надеин 1e6f60ddfe feat: add paste and drag-and-drop support for chat files
- Added paste event handler to detect and handle files from clipboard
- Support for pasting images and files with Ctrl+V / Cmd+V
- Added drag-and-drop file upload functionality
- Visual feedback with green highlight during drag-over
- Supports multiple file paste/drop at once
- Prevents text insertion when files are pasted
- Uses clipboard items API for better file detection
- Fallback to clipboard files for broader compatibility
- Console logging for debugging paste/drop operations
2025-12-08 07:55:53 +03:00

547 lines
13 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* chat-detail.css
* Стили страницы детального чата: layout, scroll, bubbles, composer
*/
/* ─────────────────────────────────────────────────────────────
PAGE LAYOUT
────────────────────────────────────────────────────────────── */
/* прибиваем низ страницы и добавляем воздух снизу */
main.main {
padding-bottom: 0 !important;
}
/* ===== Контейнер страницы чата ===== */
@supports(height: 100svh) {
.chat-root {
height: calc(100svh - var(--navbar-h));
}
}
.chat-root > .row {
height: 100%;
min-height: 0;
}
.chat-col {
display: flex;
flex-direction: column;
height: 93%;
min-height: 0;
}
.section-header {
flex: 0 0 auto;
}
/* ─────────────────────────────────────────────────────────────
CHAT BOX
────────────────────────────────────────────────────────────── */
.card.chat-box {
position: relative;
flex: 1 1 auto;
min-height: 0;
display: grid;
grid-template-rows: 1fr auto; /* лента + композер */
overflow: hidden;
margin-bottom: 0;
background: var(--bs-body-bg);
}
/* ─────────────────────────────────────────────────────────────
CHAT SCROLL (с кастомным скроллбаром)
────────────────────────────────────────────────────────────── */
.chat-scroll {
overflow-y: auto;
padding: var(--space-2);
min-height: 0;
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
scrollbar-width: thin;
scrollbar-gutter: stable both-edges;
overscroll-behavior: contain;
scrollbar-color: color-mix(in srgb, var(--bs-body-color), transparent 70%) transparent;
}
.chat-scroll:hover {
scrollbar-color: color-mix(in srgb, var(--bs-body-color), transparent 55%) transparent;
}
.chat-scroll::-webkit-scrollbar {
width: 10px;
height: 10px;
}
.chat-scroll::-webkit-scrollbar-track {
background: transparent;
margin-block: 0;
}
.chat-scroll::-webkit-scrollbar-thumb {
background-color: color-mix(in srgb, var(--bs-body-color), transparent 75%);
border-radius: 999px;
border: 3px solid transparent;
background-clip: padding-box;
}
.chat-scroll:hover::-webkit-scrollbar-thumb {
background-color: color-mix(in srgb, var(--bs-body-color), transparent 55%);
}
[data-bs-theme="dark"] .chat-scroll {
scrollbar-color: color-mix(in srgb, var(--bs-body-color), transparent 78%) transparent;
}
[data-bs-theme="dark"] .chat-scroll:hover {
scrollbar-color: color-mix(in srgb, var(--bs-body-color), transparent 60%) transparent;
}
[data-bs-theme="dark"] .chat-scroll::-webkit-scrollbar-thumb {
background-color: color-mix(in srgb, var(--bs-body-color), transparent 78%);
}
[data-bs-theme="dark"] .chat-scroll:hover::-webkit-scrollbar-thumb {
background-color: color-mix(in srgb, var(--bs-body-color), transparent 60%);
}
@media (hover: none), (pointer: coarse) {
.chat-scroll {
scrollbar-width: none;
}
.chat-scroll::-webkit-scrollbar {
display: none;
}
}
/* ─────────────────────────────────────────────────────────────
COMPOSER (Modern Messenger Style)
────────────────────────────────────────────────────────────── */
.chat-composer {
position: sticky;
bottom: 0;
border-top: none;
box-shadow: inset 0 1px 0 var(--bs-border-color);
border-bottom-left-radius: inherit;
border-bottom-right-radius: inherit;
background-clip: padding-box;
background: color-mix(in srgb, var(--bs-body-bg) 94%, transparent);
padding: var(--space-1) var(--space-2) calc(var(--space-1) + env(safe-area-inset-bottom)) var(--space-2);
backdrop-filter: blur(8px);
z-index: 1;
}
.composer-wrap {
display: flex;
flex-direction: column;
gap: var(--space-1);
}
.composer-input-group {
display: flex;
align-items: flex-end;
gap: var(--space-1);
flex-wrap: nowrap;
}
.composer-textarea-wrapper {
flex: 1 1 auto;
position: relative;
min-width: 0;
}
.composer-textarea {
resize: none;
max-height: 120px;
border-radius: 20px;
padding: 10px 16px;
line-height: 1.4;
border: 1px solid var(--bs-border-color);
background: var(--bs-body-bg);
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
overflow-y: hidden; /* Убираем полоску прокрутки */
scrollbar-width: none; /* Firefox */
}
.composer-textarea::-webkit-scrollbar {
display: none; /* Chrome, Safari, Edge */
}
.composer-textarea:focus {
border-color: var(--bs-primary);
box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}
/* Стиль при перетаскивании файлов */
.composer-textarea.drag-over {
border-color: var(--bs-success);
background: rgba(var(--bs-success-rgb), 0.05);
box-shadow: 0 0 0 0.2rem rgba(var(--bs-success-rgb), 0.15);
}
.btn-attachment {
padding: 8px 12px;
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.btn-attachment:hover {
background: var(--bs-secondary-bg);
transform: scale(1.05);
}
.btn-send {
padding: 10px 16px;
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.btn-send:hover {
transform: scale(1.05);
}
.btn-send i {
font-size: 1.1rem;
}
/* Превью вложений */
.attachment-preview {
padding: var(--space-1) 0;
max-height: 200px;
overflow-y: auto;
}
.attachment-item {
background: var(--bs-secondary-bg);
transition: background-color 0.15s ease;
}
.attachment-item:hover {
background: var(--bs-tertiary-bg);
}
.attachment-item .btn-ghost {
opacity: 0.6;
}
.attachment-item .btn-ghost:hover {
opacity: 1;
}
/* Вложения в сообщениях */
.message-attachments {
margin-top: 8px;
}
.message-attachments .attachment-item {
background: transparent !important;
padding: 0;
margin-bottom: 8px;
}
.message-attachments a {
background: rgba(0, 0, 0, 0.05);
border: none;
transition: all 0.2s ease;
color: inherit;
}
.bubble-me .message-attachments a {
background: rgba(255, 255, 255, 0.15);
color: inherit;
}
.message-attachments a:hover {
background: rgba(0, 0, 0, 0.08);
}
.bubble-me .message-attachments a:hover {
background: rgba(255, 255, 255, 0.25);
}
.message-attachments video,
.message-attachments img,
.message-attachments audio {
max-width: 100%;
width: auto;
border-radius: 8px;
}
.chat-media {
display: inline-block;
width: auto !important;
max-width: min(640px, 85vw);
max-height: 520px;
height: auto !important;
border-radius: 12px;
background: rgba(0, 0, 0, 0.08);
content-visibility: auto;
}
.message-attachments .attachment-item > a,
.message-attachments .attachment-item > video,
.message-attachments .attachment-item > img {
display: inline-flex;
max-width: 100%;
}
.chat-media--video {
background: #000;
object-fit: contain;
}
.chat-media--image {
object-fit: cover;
}
.message-pending .chat-media {
min-width: 90px;
min-height: 64px;
}
.message-pending .bubble {
position: relative;
opacity: 0.8;
}
.message-pending .message-status {
color: rgba(255, 255, 255, 0.8);
}
.bubble-other .message-status {
color: rgba(0, 0, 0, 0.5);
}
.message-attachments .text-secondary {
color: inherit;
opacity: 0.7;
}
.bubble-me .message-attachments .text-secondary {
color: rgba(255, 255, 255, 0.9) !important;
opacity: 1;
}
.bubble-me .message-attachments .fw-semibold {
color: rgba(255, 255, 255, 0.95) !important;
}
.bubble-me .message-attachments i {
color: rgba(255, 255, 255, 0.9) !important;
}
.history-loader {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0.75rem 0;
color: var(--bs-secondary-color);
}
.history-loader .spinner-border {
width: 1rem;
height: 1rem;
}
/* Выпадающее меню вложений */
.dropdown-menu {
min-width: 200px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
padding: 8px;
}
.dropdown-item {
border-radius: 8px;
padding: 10px 12px;
transition: background-color 0.15s ease;
}
.dropdown-item:hover {
background: var(--bs-secondary-bg);
}
.dropdown-item i {
width: 24px;
}
.composer-tools {
display: flex;
gap: var(--space-1);
align-items: center;
}
/* ─────────────────────────────────────────────────────────────
SCROLL TO BOTTOM BUTTON
────────────────────────────────────────────────────────────── */
.scroll-to-bottom {
position: absolute;
right: var(--space-2);
bottom: 4.25rem;
z-index: 2;
display: none;
}
.scroll-to-bottom.show {
display: block;
}
/* ─────────────────────────────────────────────────────────────
BUBBLES & AVATARS
────────────────────────────────────────────────────────────── */
.bubble {
border-radius: 16px;
padding: var(--space-1) var(--space-2);
word-break: break-word;
white-space: pre-wrap; /* Сохраняет переносы строк и пробелы */
box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.bubble-me {
background: color-mix(in srgb, var(--bs-primary) 92%, #fff 0%);
color: #fff;
}
.bubble-other {
background: var(--bs-secondary-bg);
color: var(--bs-body-color);
}
/* Индикатор пересланного сообщения */
.forwarded-indicator {
padding: 8px 12px;
border-left: 3px solid #6c757d;
background: rgba(108, 117, 125, 0.08);
border-radius: 6px;
margin-bottom: 8px;
word-break: break-word;
overflow-wrap: break-word;
}
.forwarded-indicator i {
flex-shrink: 0;
font-size: 1rem;
opacity: 0.7;
margin-top: 2px;
}
.forwarded-indicator > div {
flex: 1;
min-width: 0;
}
.forwarded-indicator strong {
font-weight: 600;
}
/* Стили для своих сообщений (голубые пилюли) */
.bubble-me .forwarded-indicator {
background: rgba(0, 0, 0, 0.12);
border-left-color: rgba(255, 255, 255, 0.5);
color: rgba(255, 255, 255, 0.95) !important;
}
.bubble-me .forwarded-indicator strong {
color: #ffffff !important;
}
.bubble-me .forwarded-indicator i {
color: rgba(255, 255, 255, 0.9) !important;
}
.bubble-me .forwarded-indicator .small {
color: rgba(255, 255, 255, 0.9) !important;
}
/* Стили для чужих сообщений */
.bubble-other .forwarded-indicator {
border-left-color: #0d6efd;
background: rgba(13, 110, 253, 0.08);
}
[data-bs-theme="dark"] .forwarded-indicator {
background: rgba(255, 255, 255, 0.08);
border-left-color: #adb5bd;
}
[data-bs-theme="dark"] .bubble-me .forwarded-indicator {
background: rgba(255, 255, 255, 0.12);
border-left-color: rgba(255, 255, 255, 0.6);
}
[data-bs-theme="dark"] .bubble-other .forwarded-indicator {
background: rgba(13, 110, 253, 0.15);
border-left-color: #4dabf7;
}
.mini-ava {
width: 32px;
height: 32px;
border-radius: 9999px;
overflow: hidden;
display: grid;
place-items: center;
}
.mini-ava img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
/* ─────────────────────────────────────────────────────────────
DIVIDERS (день / непрочитанные)
────────────────────────────────────────────────────────────── */
.day-divider,
.unread-divider {
display: flex;
align-items: center;
justify-content: center;
gap: var(--space-1);
margin: var(--space-1) 0 var(--space-2);
font-size: .85rem;
line-height: 1;
font-weight: 700;
pointer-events: none;
user-select: none;
}
.day-divider::before,
.day-divider::after,
.unread-divider::before,
.unread-divider::after {
content: "";
flex: 1 1 auto;
height: 1px;
background: color-mix(in srgb, var(--bs-border-color), transparent 30%);
}
.day-divider > span,
.unread-divider > span {
flex: 0 0 auto;
padding: 0 var(--space-1);
background: transparent;
}
.day-divider {
color: var(--bs-secondary-color);
}
.unread-divider {
color: var(--bs-danger);
}