Переработать thread-view: liquid glass панель + форматирование дат

- Раскрытый тред — единая glass-панель с accent-градиентом и призматической верхней гранью
- Убрать хак с вертикальной линией, дочерние письма — ряды внутри панели без двойных рамок
- Форматирование дат: сегодня HH:mm, вчера "Вчера HH:mm", эта неделя "Среда 14:30", старше — yyyy-MM-dd HH:mm

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
d.a.kolesov 2026-04-01 14:06:17 +07:00
parent 2fb444eeb5
commit 37e1c1e9e8
2 changed files with 69 additions and 28 deletions

View file

@ -294,7 +294,7 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
@swipe-action="(action) => handleSwipeAction(action, thread.messages[0].id)"
/>
<!-- Несколько писем — группа с вертикальной линией при раскрытии -->
<!-- Несколько писем — glass-панель -->
<div
v-else
class="thread-group"
@ -309,7 +309,7 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
<Transition name="thread-expand">
<div v-if="expandedThreadIds.has(thread.id)" class="thread-children">
<MessageListItem
v-for="msg in thread.messages"
v-for="(msg, i) in thread.messages"
:key="msg.id"
:message="msg"
:selected="messagesStore.selectedMessageId === msg.id"
@ -317,7 +317,7 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
:select-mode="selectMode"
:swipe-left-action="settingsStore.swipeLeftAction"
:swipe-right-action="settingsStore.swipeRightAction"
class="thread-child-item"
:class="['thread-child-item', { 'thread-child-last': i === thread.messages.length - 1 }]"
@click="messagesStore.selectMessage(msg.id)"
@toggle-select="messagesStore.toggleSelect(msg.id)"
@swipe-action="(action) => handleSwipeAction(action, msg.id)"
@ -756,25 +756,62 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
/* ── Группа треда ───────────────────────────────────────── */
.thread-group {
position: relative;
/* collapsed: без стилей — ThreadListItem рендерит собственную карточку */
}
/* Вертикальная accent-линия — появляется только когда тред открыт */
/* Открытый тред — единая glass-панель */
.thread-group--open {
position: relative;
margin: 2px 5px;
border-radius: 10px;
overflow: hidden;
background: linear-gradient(
135deg,
color-mix(in srgb, var(--accent) 14%, transparent) 0%,
color-mix(in srgb, var(--accent) 5%, transparent) 50%,
transparent 100%
);
backdrop-filter: blur(40px) saturate(1.8);
-webkit-backdrop-filter: blur(40px) saturate(1.8);
border: 1px solid rgba(255, 255, 255, 0.13);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.18),
0 4px 24px rgba(0, 0, 0, 0.30);
z-index: 1;
}
/* Призматическая верхняя грань */
.thread-group--open::before {
content: '';
position: absolute;
left: 13px;
top: 46px; /* ниже заголовка треда */
bottom: 8px;
width: 2px;
border-radius: 2px;
left: 0;
top: 0;
right: 0;
height: 1px;
background: linear-gradient(
to bottom,
var(--accent),
color-mix(in srgb, var(--accent) 30%, transparent)
90deg,
transparent 0%,
rgba(255, 120, 120, 0.55) 12%,
rgba(255, 200, 80, 0.55) 28%,
rgba(200, 255, 100, 0.55) 45%,
rgba( 80, 200, 255, 0.55) 62%,
rgba(160, 100, 255, 0.55) 78%,
rgba(255, 120, 200, 0.55) 92%,
transparent 100%
);
pointer-events: none;
z-index: 1;
z-index: 3;
}
/* Заголовок треда внутри открытой панели: убираем собственную карточку */
.thread-group--open :deep(.thread-card),
.thread-group--open :deep(.thread-card.expanded) {
margin: 0;
border: none;
border-radius: 0;
background: transparent;
box-shadow: none;
border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
/* Контейнер дочерних писем */
@ -782,18 +819,17 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
overflow: hidden;
}
/* Дочерние письма — отступ, чтобы освободить место для линии */
/* Дочерние письма: убираем собственные карточки, они — ряды внутри панели */
:deep(.thread-child-item) {
margin-left: 20px;
margin-top: 0;
border-radius: 0;
border-top-color: transparent;
margin: 0 !important;
border-radius: 0 !important;
border: none !important;
box-shadow: none !important;
}
:deep(.thread-child-item:last-child) {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
margin-bottom: 2px;
/* Разделитель между соседними дочерними письмами */
.thread-children :deep(.thread-child-item:not(:first-child) .message-item) {
border-top: 1px solid rgba(255, 255, 255, 0.04);
}
/* ── Анимация раскрытия ─────────────────────────────────── */

View file

@ -1,21 +1,26 @@
import { formatDistanceToNow, format, isToday, isYesterday, isThisYear } from 'date-fns'
import { format, isToday, isYesterday, startOfWeek } from 'date-fns'
import { ru } from 'date-fns/locale'
export function formatMessageDate(dateStr: string): string {
const date = new Date(dateStr)
const now = new Date()
if (isToday(date)) {
return format(date, 'HH:mm')
}
if (isYesterday(date)) {
return 'Yesterday'
return `Вчера ${format(date, 'HH:mm')}`
}
if (isThisYear(date)) {
return format(date, 'MMM d')
const weekStart = startOfWeek(now, { weekStartsOn: 1 })
if (date >= weekStart) {
// Первая буква заглавная: "Понедельник 14:30"
const str = format(date, 'EEEE HH:mm', { locale: ru })
return str.charAt(0).toUpperCase() + str.slice(1)
}
return format(date, 'MMM d, yyyy')
return format(date, 'yyyy-MM-dd HH:mm')
}
export function formatFullDate(dateStr: string): string {