thread-view: очевидная визуализация раскрытого треда

- Вертикальная accent-линия слева соединяет заголовок с дочерними письмами
- Заголовок раскрытого треда: accent-тинт фон + accent border
- Дочерние письма со сдвигом вправо освобождают место под линию
- Анимация раскрытия: fade + slide-down (Transition)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
d.a.kolesov 2026-04-01 13:26:19 +07:00
parent dd04f1f6bd
commit 2fb444eeb5
2 changed files with 86 additions and 24 deletions

View file

@ -280,7 +280,7 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
</div> </div>
<template v-for="thread in threads" :key="thread.id"> <template v-for="thread in threads" :key="thread.id">
<!-- Одно письмо в треде — показываем MessageListItem напрямую --> <!-- Одно письмо — напрямую, без обёртки -->
<MessageListItem <MessageListItem
v-if="thread.messages.length === 1" v-if="thread.messages.length === 1"
:message="thread.messages[0]" :message="thread.messages[0]"
@ -294,31 +294,37 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
@swipe-action="(action) => handleSwipeAction(action, thread.messages[0].id)" @swipe-action="(action) => handleSwipeAction(action, thread.messages[0].id)"
/> />
<!-- Несколько писем — заголовок треда + раскрываемые сообщения --> <!-- Несколько писем — группа с вертикальной линией при раскрытии -->
<template v-else> <div
v-else
class="thread-group"
:class="{ 'thread-group--open': expandedThreadIds.has(thread.id) }"
>
<ThreadListItem <ThreadListItem
:thread="thread" :thread="thread"
:expanded="expandedThreadIds.has(thread.id)" :expanded="expandedThreadIds.has(thread.id)"
:selected="thread.messages.some(m => messagesStore.selectedMessageId === m.id)" :selected="thread.messages.some(m => messagesStore.selectedMessageId === m.id)"
@click="toggleThread(thread)" @click="toggleThread(thread)"
/> />
<template v-if="expandedThreadIds.has(thread.id)"> <Transition name="thread-expand">
<MessageListItem <div v-if="expandedThreadIds.has(thread.id)" class="thread-children">
v-for="msg in thread.messages" <MessageListItem
:key="msg.id" v-for="msg in thread.messages"
:message="msg" :key="msg.id"
:selected="messagesStore.selectedMessageId === msg.id" :message="msg"
:checked="messagesStore.selectedIds.has(msg.id)" :selected="messagesStore.selectedMessageId === msg.id"
:select-mode="selectMode" :checked="messagesStore.selectedIds.has(msg.id)"
:swipe-left-action="settingsStore.swipeLeftAction" :select-mode="selectMode"
:swipe-right-action="settingsStore.swipeRightAction" :swipe-left-action="settingsStore.swipeLeftAction"
class="thread-child-item" :swipe-right-action="settingsStore.swipeRightAction"
@click="messagesStore.selectMessage(msg.id)" class="thread-child-item"
@toggle-select="messagesStore.toggleSelect(msg.id)" @click="messagesStore.selectMessage(msg.id)"
@swipe-action="(action) => handleSwipeAction(action, msg.id)" @toggle-select="messagesStore.toggleSelect(msg.id)"
/> @swipe-action="(action) => handleSwipeAction(action, msg.id)"
</template> />
</template> </div>
</Transition>
</div>
</template> </template>
<div v-if="messagesStore.loading" class="loading-more"> <div v-if="messagesStore.loading" class="loading-more">
@ -748,9 +754,37 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
to { transform: rotate(360deg); } to { transform: rotate(360deg); }
} }
/* Дочерние письма раскрытого треда */ /* ── Группа треда ───────────────────────────────────────── */
.thread-group {
position: relative;
}
/* Вертикальная accent-линия — появляется только когда тред открыт */
.thread-group--open::before {
content: '';
position: absolute;
left: 13px;
top: 46px; /* ниже заголовка треда */
bottom: 8px;
width: 2px;
border-radius: 2px;
background: linear-gradient(
to bottom,
var(--accent),
color-mix(in srgb, var(--accent) 30%, transparent)
);
pointer-events: none;
z-index: 1;
}
/* Контейнер дочерних писем */
.thread-children {
overflow: hidden;
}
/* Дочерние письма — отступ, чтобы освободить место для линии */
:deep(.thread-child-item) { :deep(.thread-child-item) {
margin-left: 12px; margin-left: 20px;
margin-top: 0; margin-top: 0;
border-radius: 0; border-radius: 0;
border-top-color: transparent; border-top-color: transparent;
@ -759,5 +793,22 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
:deep(.thread-child-item:last-child) { :deep(.thread-child-item:last-child) {
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
margin-bottom: 2px;
}
/* ── Анимация раскрытия ─────────────────────────────────── */
.thread-expand-enter-active {
transition: opacity 180ms ease, transform 220ms cubic-bezier(0.34, 1.1, 0.64, 1);
}
.thread-expand-leave-active {
transition: opacity 140ms ease, transform 160ms ease;
}
.thread-expand-enter-from {
opacity: 0;
transform: translateY(-6px);
}
.thread-expand-leave-to {
opacity: 0;
transform: translateY(-4px);
} }
</style> </style>

View file

@ -276,10 +276,21 @@ const snippet = computed(() => props.thread.latest.snippet || '')
color: var(--accent); color: var(--accent);
} }
/* Раскрытый тред — убираем нижний border-radius чтобы слиться с дочерними письмами */ /* Раскрытый тред */
.thread-card.expanded { .thread-card.expanded {
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
border-bottom-color: transparent; border-color: color-mix(in srgb, var(--accent) 30%, rgba(255,255,255,0.08));
border-bottom-color: color-mix(in srgb, var(--accent) 15%, transparent);
background:
linear-gradient(180deg, color-mix(in srgb, var(--accent) 6%, transparent) 0%, transparent 100%),
rgba(255, 255, 255, 0.04);
box-shadow:
inset 0 1px 0 color-mix(in srgb, var(--accent) 20%, rgba(255,255,255,0.08)),
0 2px 12px rgba(0, 0, 0, 0.2);
}
.thread-card.expanded .thread-item {
background: transparent;
} }
</style> </style>