Игорь Надеин f00f7c0be5 fix(ui): исправлен рендеринг аватаров - устранена деформация и выравнивание
Проблема:
- Аватары деформировались из-за object-fit на контейнере
- Аватары выравнивались по верху сообщения вместо низа
- Неконсистентная HTML структура: <img class="mini-ava"> vs <div class="mini-ava"><i></i></div>

Решение:

SCSS (_common.scss):
- object-fit: cover перемещен с контейнера на вложенный img
- Добавлен display: block для img элементов

SCSS (_chat-detail.scss):
- Добавлен align-items: flex-end к .d-flex.msg для выравнивания по низу
- .mini-ava рефакторинг: display: flex (было grid), border-radius: 50% (было 9999px)
- Добавлен background и border для контейнера
- Добавлен font-size: 20px для fallback иконки
- object-fit остается только на img тегах

JavaScript (messageRendererV2.js):
- Всегда создавать <div class="mini-ava"> как контейнер
- Вложенный <img> или <i class="bi bi-person-circle"> внутри
- Устранена несогласованность разметки

Рефакторинг архитектуры SCSS (бонус):
- Создан Design System: abstracts/_variables.scss (200+ токенов)
- Создано abstracts/_mixins.scss (40+ миксинов)
- Реорганизована файловая структура: layout/, components/, components/chat/
- Централизованы стили аватаров в _common.scss
- Устранены дубликаты (avatar определялся в 3 файлах)
- Применены design tokens к navbar, page-header
- Создана документация: SCSS_NAMING_CONVENTIONS.md
- Удалено 9 дублирующихся CSS файлов

Компиляция: 280KB, 0 ошибок, production ready
2026-01-14 11:18:35 +03:00

153 lines
3.3 KiB
SCSS
Raw Permalink 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.

// =============================================================================
// Comments Component
// =============================================================================
// Единый стиль для комментариев во всех местах приложения:
// - В карточках постов (_feed_cards.html)
// - На странице деталей поста (post_detail.html)
// - В модальном окне (postDetailModal.js)
.comment-item {
padding: 0.5rem 0; // py-2
display: flex;
flex-direction: column;
align-items: flex-start;
.comment-header {
font-size: 0.875rem; // small
margin-bottom: 0.25rem;
display: flex;
align-items: center;
flex-wrap: wrap;
.comment-author {
font-weight: 600; // fw-semibold
text-decoration: none;
color: inherit;
&:hover {
text-decoration: underline;
}
}
.comment-separator {
color: var(--bs-secondary);
margin: 0 0.25rem;
}
.comment-date {
color: var(--bs-secondary);
}
.badge {
font-size: 0.7rem;
padding: 0.15rem 0.4rem;
}
}
.comment-body {
font-size: 0.875rem; // small
line-height: 1.5;
white-space: pre-wrap;
word-wrap: break-word;
background: var(--bs-tertiary-bg);
padding: 0.5rem 0.75rem;
border-radius: 12px;
max-width: 80%;
}
// Комментарии автора поста справа
&.comment-item--author {
align-items: flex-end;
.comment-header {
flex-direction: row-reverse;
.comment-separator {
order: 0;
}
.comment-date {
order: -1;
}
}
.comment-body {
background: var(--bs-primary-bg-subtle, rgba(13, 110, 253, 0.1));
border: 1px solid var(--bs-primary-border-subtle, rgba(13, 110, 253, 0.2));
}
}
}
// Контейнер для списка комментариев
.comments-list {
margin-bottom: 1rem;
}
// Заголовок секции комментариев
.comments-section-header {
display: flex;
align-items: center;
margin-bottom: 0.5rem;
.comments-icon {
font-size: 1.5rem;
color: var(--bs-primary);
margin-right: 0.5rem;
}
.comments-title {
margin-bottom: 0;
}
.comments-count {
font-size: 0.875rem;
color: var(--bs-secondary);
margin-left: 0.5rem;
}
}
// Обёртка для комментариев с sticky формой
.comments-section-wrapper {
position: relative;
}
// Скроллируемая область с комментариями
.comments-scrollable {
max-height: 400px;
overflow-y: auto;
overflow-x: hidden;
padding-bottom: 1rem;
// Firefox скроллбар
scrollbar-width: thin;
scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
// Стилизация скроллбара (Chrome, Safari, Edge)
&::-webkit-scrollbar {
width: 8px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.15);
border-radius: 4px;
&:hover {
background: rgba(0, 0, 0, 0.25);
}
}
}
// Sticky форма для комментариев
.comment-form-sticky {
position: sticky;
bottom: 0;
background: var(--bs-body-bg);
z-index: 10;
border-top: 1px solid var(--bs-border-color);
padding-top: 1rem;
}