Переработать 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:
parent
2fb444eeb5
commit
37e1c1e9e8
2 changed files with 69 additions and 28 deletions
|
|
@ -294,7 +294,7 @@ 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)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Несколько писем — группа с вертикальной линией при раскрытии -->
|
<!-- Несколько писем — glass-панель -->
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
class="thread-group"
|
class="thread-group"
|
||||||
|
|
@ -309,7 +309,7 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
|
||||||
<Transition name="thread-expand">
|
<Transition name="thread-expand">
|
||||||
<div v-if="expandedThreadIds.has(thread.id)" class="thread-children">
|
<div v-if="expandedThreadIds.has(thread.id)" class="thread-children">
|
||||||
<MessageListItem
|
<MessageListItem
|
||||||
v-for="msg in thread.messages"
|
v-for="(msg, i) in thread.messages"
|
||||||
:key="msg.id"
|
:key="msg.id"
|
||||||
:message="msg"
|
:message="msg"
|
||||||
:selected="messagesStore.selectedMessageId === msg.id"
|
:selected="messagesStore.selectedMessageId === msg.id"
|
||||||
|
|
@ -317,7 +317,7 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
|
||||||
:select-mode="selectMode"
|
:select-mode="selectMode"
|
||||||
:swipe-left-action="settingsStore.swipeLeftAction"
|
:swipe-left-action="settingsStore.swipeLeftAction"
|
||||||
:swipe-right-action="settingsStore.swipeRightAction"
|
: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)"
|
@click="messagesStore.selectMessage(msg.id)"
|
||||||
@toggle-select="messagesStore.toggleSelect(msg.id)"
|
@toggle-select="messagesStore.toggleSelect(msg.id)"
|
||||||
@swipe-action="(action) => handleSwipeAction(action, msg.id)"
|
@swipe-action="(action) => handleSwipeAction(action, msg.id)"
|
||||||
|
|
@ -756,25 +756,62 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
|
||||||
|
|
||||||
/* ── Группа треда ───────────────────────────────────────── */
|
/* ── Группа треда ───────────────────────────────────────── */
|
||||||
.thread-group {
|
.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 {
|
.thread-group--open::before {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 13px;
|
left: 0;
|
||||||
top: 46px; /* ниже заголовка треда */
|
top: 0;
|
||||||
bottom: 8px;
|
right: 0;
|
||||||
width: 2px;
|
height: 1px;
|
||||||
border-radius: 2px;
|
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
to bottom,
|
90deg,
|
||||||
var(--accent),
|
transparent 0%,
|
||||||
color-mix(in srgb, var(--accent) 30%, transparent)
|
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;
|
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;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Дочерние письма — отступ, чтобы освободить место для линии */
|
/* Дочерние письма: убираем собственные карточки, они — ряды внутри панели */
|
||||||
:deep(.thread-child-item) {
|
:deep(.thread-child-item) {
|
||||||
margin-left: 20px;
|
margin: 0 !important;
|
||||||
margin-top: 0;
|
border-radius: 0 !important;
|
||||||
border-radius: 0;
|
border: none !important;
|
||||||
border-top-color: transparent;
|
box-shadow: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.thread-child-item:last-child) {
|
/* Разделитель между соседними дочерними письмами */
|
||||||
border-bottom-left-radius: 10px;
|
.thread-children :deep(.thread-child-item:not(:first-child) .message-item) {
|
||||||
border-bottom-right-radius: 10px;
|
border-top: 1px solid rgba(255, 255, 255, 0.04);
|
||||||
margin-bottom: 2px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Анимация раскрытия ─────────────────────────────────── */
|
/* ── Анимация раскрытия ─────────────────────────────────── */
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
export function formatMessageDate(dateStr: string): string {
|
||||||
const date = new Date(dateStr)
|
const date = new Date(dateStr)
|
||||||
|
const now = new Date()
|
||||||
|
|
||||||
if (isToday(date)) {
|
if (isToday(date)) {
|
||||||
return format(date, 'HH:mm')
|
return format(date, 'HH:mm')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isYesterday(date)) {
|
if (isYesterday(date)) {
|
||||||
return 'Yesterday'
|
return `Вчера ${format(date, 'HH:mm')}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isThisYear(date)) {
|
const weekStart = startOfWeek(now, { weekStartsOn: 1 })
|
||||||
return format(date, 'MMM d')
|
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 {
|
export function formatFullDate(dateStr: string): string {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue