thread-view: убрать переключатель, карточное разделение тредов
- Треды теперь единственный режим отображения (переключатель удалён) - threadMode убран из settings store - ThreadListItem: обёртка .thread-card с glass border/background/shadow в стиле MessageListItem (margin 2px 5px, border-radius 10px) - Unread-карточка чуть ярче, selected — glass fill + accent line Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
28a42c8f79
commit
18d059571d
3 changed files with 60 additions and 68 deletions
|
|
@ -4,7 +4,6 @@ import { useMessagesStore } from '../../stores/messages.store'
|
||||||
import { useFoldersStore } from '../../stores/folders.store'
|
import { useFoldersStore } from '../../stores/folders.store'
|
||||||
import { useAccountsStore } from '../../stores/accounts.store'
|
import { useAccountsStore } from '../../stores/accounts.store'
|
||||||
import { useSettingsStore, type SwipeAction } from '../../stores/settings.store'
|
import { useSettingsStore, type SwipeAction } from '../../stores/settings.store'
|
||||||
import MessageListItem from './MessageListItem.vue'
|
|
||||||
import ThreadListItem from './ThreadListItem.vue'
|
import ThreadListItem from './ThreadListItem.vue'
|
||||||
import AppIcon from '../AppIcon.vue'
|
import AppIcon from '../AppIcon.vue'
|
||||||
import { buildThreads, type Thread } from '../../utils/threading'
|
import { buildThreads, type Thread } from '../../utils/threading'
|
||||||
|
|
@ -27,16 +26,13 @@ const allVisibleSelected = computed(() =>
|
||||||
messagesStore.filteredMessages.every((m) => messagesStore.selectedIds.has(m.id))
|
messagesStore.filteredMessages.every((m) => messagesStore.selectedIds.has(m.id))
|
||||||
)
|
)
|
||||||
|
|
||||||
// ── Thread mode ───────────────────────────────────────────
|
// ── Threads ───────────────────────────────────────────────
|
||||||
const threads = computed<Thread[]>(() =>
|
const threads = computed<Thread[]>(() => buildThreads(messagesStore.filteredMessages))
|
||||||
settingsStore.threadMode ? buildThreads(messagesStore.filteredMessages) : []
|
|
||||||
)
|
|
||||||
|
|
||||||
const selectedThreadId = ref<string | null>(null)
|
const selectedThreadId = ref<string | null>(null)
|
||||||
|
|
||||||
function selectThread(thread: Thread): void {
|
function selectThread(thread: Thread): void {
|
||||||
selectedThreadId.value = thread.id
|
selectedThreadId.value = thread.id
|
||||||
// Открываем последнее (новое) письмо треда
|
|
||||||
messagesStore.selectMessage(thread.latest.id)
|
messagesStore.selectMessage(thread.latest.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,14 +162,6 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
|
||||||
{{ activeUnread }}
|
{{ activeUnread }}
|
||||||
</button>
|
</button>
|
||||||
<div class="header-actions">
|
<div class="header-actions">
|
||||||
<button
|
|
||||||
class="icon-btn"
|
|
||||||
:class="{ active: settingsStore.threadMode }"
|
|
||||||
title="Режим тредов"
|
|
||||||
@click="settingsStore.threadMode = !settingsStore.threadMode"
|
|
||||||
>
|
|
||||||
<AppIcon name="threads" :size="14" />
|
|
||||||
</button>
|
|
||||||
<button
|
<button
|
||||||
class="icon-btn select-mode-btn"
|
class="icon-btn select-mode-btn"
|
||||||
:class="{ active: selectMode }"
|
:class="{ active: selectMode }"
|
||||||
|
|
@ -262,11 +250,8 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
|
||||||
<span>{{ messagesStore.unreadOnly ? 'Нет непрочитанных писем' : 'В папке нет писем' }}</span>
|
<span>{{ messagesStore.unreadOnly ? 'Нет непрочитанных писем' : 'В папке нет писем' }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Список писем / тредов -->
|
<!-- Список тредов -->
|
||||||
<div v-else class="message-list" @scroll="onScroll" @wheel="onWheel">
|
<div v-else class="message-list" @scroll="onScroll" @wheel="onWheel">
|
||||||
|
|
||||||
<!-- ── Режим тредов ── -->
|
|
||||||
<template v-if="settingsStore.threadMode">
|
|
||||||
<ThreadListItem
|
<ThreadListItem
|
||||||
v-for="thread in threads"
|
v-for="thread in threads"
|
||||||
:key="thread.id"
|
:key="thread.id"
|
||||||
|
|
@ -274,37 +259,6 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
|
||||||
:selected="selectedThreadId === thread.id"
|
:selected="selectedThreadId === thread.id"
|
||||||
@click="selectThread(thread)"
|
@click="selectThread(thread)"
|
||||||
/>
|
/>
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- ── Обычный режим ── -->
|
|
||||||
<template v-else>
|
|
||||||
<div v-if="selectMode" class="select-all-row" @click="toggleSelectAll">
|
|
||||||
<span
|
|
||||||
class="select-all-circle"
|
|
||||||
:class="{ checked: allVisibleSelected, indeterminate: hasSelected && !allVisibleSelected }"
|
|
||||||
>
|
|
||||||
<svg v-if="allVisibleSelected" viewBox="0 0 16 16" width="10" height="10" fill="none">
|
|
||||||
<polyline points="3,8 6.5,12 13,4" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
</svg>
|
|
||||||
<span v-else-if="hasSelected && !allVisibleSelected" class="indeterminate-dash" />
|
|
||||||
</span>
|
|
||||||
<span class="select-all-text">Выбрать все</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<MessageListItem
|
|
||||||
v-for="message in messagesStore.filteredMessages"
|
|
||||||
:key="message.id"
|
|
||||||
:message="message"
|
|
||||||
:selected="messagesStore.selectedMessageId === message.id"
|
|
||||||
:checked="messagesStore.selectedIds.has(message.id)"
|
|
||||||
:select-mode="selectMode"
|
|
||||||
:swipe-left-action="settingsStore.swipeLeftAction"
|
|
||||||
:swipe-right-action="settingsStore.swipeRightAction"
|
|
||||||
@click="messagesStore.selectMessage(message.id)"
|
|
||||||
@toggle-select="messagesStore.toggleSelect(message.id)"
|
|
||||||
@swipe-action="(action) => handleSwipeAction(action, message.id)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div v-if="messagesStore.loading" class="loading-more">
|
<div v-if="messagesStore.loading" class="loading-more">
|
||||||
<div class="spinner-sm" /> Загрузка...
|
<div class="spinner-sm" /> Загрузка...
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ const snippet = computed(() => props.thread.latest.snippet || '')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<div class="thread-card" :class="{ selected, unread: isUnread }">
|
||||||
<div
|
<div
|
||||||
class="thread-item"
|
class="thread-item"
|
||||||
:class="{ selected, unread: isUnread }"
|
:class="{ selected, unread: isUnread }"
|
||||||
|
|
@ -71,27 +72,61 @@ const snippet = computed(() => props.thread.latest.snippet || '')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
/* Внешняя карточка — glass border, margin, radius */
|
||||||
|
.thread-card {
|
||||||
|
position: relative;
|
||||||
|
margin: 2px 5px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
|
background: rgba(255, 255, 255, 0.025);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
|
||||||
|
overflow: hidden;
|
||||||
|
transition:
|
||||||
|
border-color var(--transition-fast),
|
||||||
|
box-shadow var(--transition-fast);
|
||||||
|
}
|
||||||
|
|
||||||
|
.thread-card:hover {
|
||||||
|
border-color: rgba(255, 255, 255, 0.10);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08),
|
||||||
|
0 3px 10px rgba(0, 0, 0, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.thread-card.unread {
|
||||||
|
background:
|
||||||
|
linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.015) 100%),
|
||||||
|
#0d0d17;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thread-card.selected {
|
||||||
|
border-color: rgba(255, 255, 255, 0.18);
|
||||||
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.thread-item {
|
.thread-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
padding: 10px 10px 10px 4px;
|
padding: 10px 10px 10px 4px;
|
||||||
margin: 1px 4px;
|
|
||||||
border-radius: var(--radius-md);
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background var(--transition-fast);
|
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
|
||||||
|
|
||||||
.thread-item:hover {
|
/* Выбранное: glass fill */
|
||||||
background: var(--glass-bg-hover);
|
transition: background var(--transition-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.thread-item.selected {
|
.thread-item.selected {
|
||||||
background: var(--bg-selected);
|
background: linear-gradient(
|
||||||
|
145deg,
|
||||||
|
rgba(255, 255, 255, 0.10) 0%,
|
||||||
|
var(--bg-selected) 100%
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
.thread-item.selected::before {
|
.thread-item.selected::before {
|
||||||
|
|
@ -105,6 +140,12 @@ const snippet = computed(() => props.thread.latest.snippet || '')
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.thread-item:not(.selected):hover {
|
||||||
|
background:
|
||||||
|
linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.035) 100%),
|
||||||
|
#0c0c14;
|
||||||
|
}
|
||||||
|
|
||||||
/* Точка непрочитанного */
|
/* Точка непрочитанного */
|
||||||
.unread-dot-wrap {
|
.unread-dot-wrap {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ function load(): {
|
||||||
accentColor?: string
|
accentColor?: string
|
||||||
autoCheckInterval?: number
|
autoCheckInterval?: number
|
||||||
uiScale?: number
|
uiScale?: number
|
||||||
threadMode?: boolean
|
|
||||||
} {
|
} {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '{}')
|
return JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '{}')
|
||||||
|
|
@ -102,7 +101,6 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||||
const accentColor = ref<string>(saved.accentColor ?? '#a8e600')
|
const accentColor = ref<string>(saved.accentColor ?? '#a8e600')
|
||||||
const autoCheckInterval = ref<number>(saved.autoCheckInterval ?? 5)
|
const autoCheckInterval = ref<number>(saved.autoCheckInterval ?? 5)
|
||||||
const uiScale = ref<number>(saved.uiScale ?? 1.0)
|
const uiScale = ref<number>(saved.uiScale ?? 1.0)
|
||||||
const threadMode = ref<boolean>(saved.threadMode ?? false)
|
|
||||||
|
|
||||||
// Apply on init
|
// Apply on init
|
||||||
applyAccentColor(accentColor.value)
|
applyAccentColor(accentColor.value)
|
||||||
|
|
@ -118,7 +116,7 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||||
persist()
|
persist()
|
||||||
})
|
})
|
||||||
|
|
||||||
watch([swipeLeftAction, swipeRightAction, autoCheckInterval, threadMode], persist)
|
watch([swipeLeftAction, swipeRightAction, autoCheckInterval], persist)
|
||||||
|
|
||||||
function persist(): void {
|
function persist(): void {
|
||||||
localStorage.setItem(STORAGE_KEY, JSON.stringify({
|
localStorage.setItem(STORAGE_KEY, JSON.stringify({
|
||||||
|
|
@ -127,9 +125,8 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||||
accentColor: accentColor.value,
|
accentColor: accentColor.value,
|
||||||
autoCheckInterval: autoCheckInterval.value,
|
autoCheckInterval: autoCheckInterval.value,
|
||||||
uiScale: uiScale.value,
|
uiScale: uiScale.value,
|
||||||
threadMode: threadMode.value,
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
return { swipeLeftAction, swipeRightAction, accentColor, autoCheckInterval, uiScale, threadMode }
|
return { swipeLeftAction, swipeRightAction, accentColor, autoCheckInterval, uiScale }
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue