diff --git a/src/renderer/src/components/messages/MessageList.vue b/src/renderer/src/components/messages/MessageList.vue index 9570787..b8fd61e 100644 --- a/src/renderer/src/components/messages/MessageList.vue +++ b/src/renderer/src/components/messages/MessageList.vue @@ -4,6 +4,7 @@ import { useMessagesStore } from '../../stores/messages.store' import { useFoldersStore } from '../../stores/folders.store' import { useAccountsStore } from '../../stores/accounts.store' import { useSettingsStore, type SwipeAction } from '../../stores/settings.store' +import MessageListItem from './MessageListItem.vue' import ThreadListItem from './ThreadListItem.vue' import AppIcon from '../AppIcon.vue' import { buildThreads, type Thread } from '../../utils/threading' @@ -29,11 +30,23 @@ const allVisibleSelected = computed(() => // ── Threads ─────────────────────────────────────────────── const threads = computed(() => buildThreads(messagesStore.filteredMessages)) -const selectedThreadId = ref(null) +const expandedThreadIds = ref(new Set()) -function selectThread(thread: Thread): void { - selectedThreadId.value = thread.id - messagesStore.selectMessage(thread.latest.id) +function toggleThread(thread: Thread): void { + if (thread.messages.length === 1) { + // Один элемент — открываем напрямую + messagesStore.selectMessage(thread.messages[0].id) + return + } + if (expandedThreadIds.value.has(thread.id)) { + expandedThreadIds.value.delete(thread.id) + } else { + expandedThreadIds.value.add(thread.id) + // Открываем последнее письмо треда + messagesStore.selectMessage(thread.latest.id) + } + // trigger reactivity + expandedThreadIds.value = new Set(expandedThreadIds.value) } // ── Refresh ─────────────────────────────────────────────── @@ -186,29 +199,6 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis - -
- - {{ messagesStore.selectedIds.size }} - выбрано - -
- - - -
- -
-
{{ messagesStore.unreadOnly ? 'Нет непрочитанных писем' : 'В папке нет писем' }}
+ +
+ + {{ messagesStore.selectedIds.size }} + выбрано + +
+ + + +
+ +
+
- + +
+ + + + + + + Выбрать все +
+ +
Загрузка... @@ -686,4 +747,17 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis @keyframes spin { to { transform: rotate(360deg); } } + +/* Дочерние письма раскрытого треда */ +:deep(.thread-child-item) { + margin-left: 12px; + margin-top: 0; + border-radius: 0; + border-top-color: transparent; +} + +:deep(.thread-child-item:last-child) { + border-bottom-left-radius: 10px; + border-bottom-right-radius: 10px; +} diff --git a/src/renderer/src/components/messages/ThreadListItem.vue b/src/renderer/src/components/messages/ThreadListItem.vue index 85113e4..650ef3c 100644 --- a/src/renderer/src/components/messages/ThreadListItem.vue +++ b/src/renderer/src/components/messages/ThreadListItem.vue @@ -7,6 +7,7 @@ import AppIcon from '../AppIcon.vue' const props = defineProps<{ thread: Thread selected: boolean + expanded?: boolean }>() defineEmits<{ click: [] }>() @@ -32,7 +33,7 @@ const snippet = computed(() => props.thread.latest.snippet || '')