fix/search: SUBJECT+FROM поиск вместо TEXT + liquid glass для пилюли
- IMAP: заменил TEXT на SUBJECT+FROM (серверные индексы, мгновенный отклик) - Пропуск Trash/Spam папок при поиске - Слияние результатов SUBJECT и FROM без дублей - CSS: clip-path вместо overflow:hidden (backdrop-filter работает корректно) - Усиленный glass-эффект: blur(32px), яркие inset-highlight и accent-ring - Placeholder цвет, иконка поиска, кнопка закрытия — правильные opacity Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2bf608b276
commit
025ffccbe0
2 changed files with 64 additions and 40 deletions
|
|
@ -285,6 +285,16 @@ export class ImapProvider implements IEmailProvider {
|
|||
return results
|
||||
}
|
||||
|
||||
private shouldSkipFolder(folder: ImapMailbox): boolean {
|
||||
const n = folder.name.toLowerCase()
|
||||
const p = (folder.path ?? '').toLowerCase()
|
||||
return (
|
||||
n === 'trash' || n === 'deleted items' || n === 'deleted messages' ||
|
||||
n === 'spam' || n === 'junk' || n === 'junk e-mail' ||
|
||||
p.includes('[gmail]/trash') || p.includes('[gmail]/spam')
|
||||
)
|
||||
}
|
||||
|
||||
private async searchFolderTree(
|
||||
folders: ImapMailbox[],
|
||||
query: string,
|
||||
|
|
@ -293,16 +303,27 @@ export class ImapProvider implements IEmailProvider {
|
|||
): Promise<void> {
|
||||
for (const folder of folders) {
|
||||
if (results.length >= limit) break
|
||||
if (this.shouldSkipFolder(folder)) {
|
||||
if (folder.folders?.length && results.length < limit) {
|
||||
await this.searchFolderTree(folder.folders, query, limit, results)
|
||||
}
|
||||
continue
|
||||
}
|
||||
let lock: Awaited<ReturnType<typeof this.client.getMailboxLock>> | null = null
|
||||
try {
|
||||
lock = await this.client.getMailboxLock(folder.path)
|
||||
|
||||
// TEXT ищет в заголовках + теле — работает на всех IMAP-серверах
|
||||
const uids = await this.client.search({ text: query }, { uid: true }) as number[]
|
||||
// SUBJECT — быстрый поиск по теме (серверный индекс, не требует загрузки тел)
|
||||
const subjectUids = await this.client.search({ subject: query }, { uid: true }) as number[]
|
||||
// FROM — дополнительный поиск по отправителю
|
||||
const fromUids = await this.client.search({ from: query }, { uid: true }) as number[]
|
||||
|
||||
if (uids?.length) {
|
||||
// Объединяем UIDs без дублей
|
||||
const merged = [...new Set([...(subjectUids ?? []), ...(fromUids ?? [])])]
|
||||
|
||||
if (merged.length) {
|
||||
const remaining = limit - results.length
|
||||
const sorted = [...uids].sort((a, b) => b - a).slice(0, remaining)
|
||||
const sorted = [...merged].sort((a, b) => b - a).slice(0, remaining)
|
||||
for await (const msg of this.client.fetch(sorted.join(','), {
|
||||
uid: true, envelope: true, flags: true, bodyStructure: true
|
||||
}, { uid: true })) {
|
||||
|
|
|
|||
|
|
@ -1093,24 +1093,24 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
|
|||
transform: translateY(-50%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
height: 28px;
|
||||
width: 28px; /* свёрнута — размер кнопки */
|
||||
|
||||
/* Liquid glass */
|
||||
background:
|
||||
linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.03) 100%),
|
||||
rgba(14, 14, 22, 0.55);
|
||||
backdrop-filter: blur(28px) saturate(1.8);
|
||||
-webkit-backdrop-filter: blur(28px) saturate(1.8);
|
||||
border: 1px solid rgba(255, 255, 255, 0.11);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.14),
|
||||
0 2px 10px rgba(0, 0, 0, 0.30);
|
||||
|
||||
width: 28px; /* свёрнута — круглая кнопка */
|
||||
border-radius: 9999px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
|
||||
background:
|
||||
linear-gradient(160deg, rgba(255,255,255,0.11) 0%, rgba(255,255,255,0.04) 100%),
|
||||
rgba(18, 18, 28, 0.60);
|
||||
backdrop-filter: blur(32px) saturate(2);
|
||||
-webkit-backdrop-filter: blur(32px) saturate(2);
|
||||
border: 1px solid rgba(255, 255, 255, 0.13);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.16),
|
||||
0 2px 12px rgba(0, 0, 0, 0.35);
|
||||
|
||||
/* clip-path даёт pill-форму при clip без overflow:hidden */
|
||||
clip-path: inset(0 round 9999px);
|
||||
|
||||
transition:
|
||||
width 0.30s cubic-bezier(0.34, 1.12, 0.64, 1),
|
||||
background 0.2s ease,
|
||||
|
|
@ -1120,35 +1120,36 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
|
|||
|
||||
.search-pill:hover:not(.search-pill--open) {
|
||||
background:
|
||||
linear-gradient(135deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.05) 100%),
|
||||
rgba(14, 14, 22, 0.65);
|
||||
border-color: rgba(255, 255, 255, 0.18);
|
||||
linear-gradient(160deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.07) 100%),
|
||||
rgba(18, 18, 28, 0.72);
|
||||
border-color: rgba(255, 255, 255, 0.22);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.18),
|
||||
0 3px 14px rgba(0, 0, 0, 0.35);
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.20),
|
||||
0 3px 16px rgba(0, 0, 0, 0.40);
|
||||
}
|
||||
|
||||
.search-pill--open {
|
||||
width: calc(100% - 24px); /* разворачивается на всю ширину хедера */
|
||||
background:
|
||||
linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%),
|
||||
rgba(10, 10, 18, 0.72);
|
||||
border-color: color-mix(in srgb, var(--accent) 30%, rgba(255, 255, 255, 0.12));
|
||||
width: calc(100% - 24px);
|
||||
cursor: default;
|
||||
background:
|
||||
linear-gradient(160deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.02) 100%),
|
||||
rgba(12, 12, 20, 0.75);
|
||||
border-color: color-mix(in srgb, var(--accent) 45%, rgba(255,255,255,0.14));
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.12),
|
||||
0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent),
|
||||
0 4px 20px rgba(0, 0, 0, 0.35);
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.15),
|
||||
0 0 0 2.5px color-mix(in srgb, var(--accent) 22%, transparent),
|
||||
0 4px 24px rgba(0, 0, 0, 0.40);
|
||||
}
|
||||
|
||||
.search-pill-icon {
|
||||
flex-shrink: 0;
|
||||
width: 28px; /* занимает место кнопки */
|
||||
width: 28px; /* занимает место кнопки — без отступа слева */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--text-muted);
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
transition: color 0.18s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.search-pill--open .search-pill-icon {
|
||||
|
|
@ -1177,12 +1178,14 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
|
|||
}
|
||||
|
||||
.search-pill-input::placeholder {
|
||||
color: var(--text-muted);
|
||||
color: rgba(255, 255, 255, 0.28);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.search-pill-spinner {
|
||||
flex-shrink: 0;
|
||||
margin-right: 4px;
|
||||
margin-right: 6px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.search-pill-close {
|
||||
|
|
@ -1193,14 +1196,14 @@ async function handleSwipeAction(action: SwipeAction, messageId: string): Promis
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
color: var(--text-muted);
|
||||
margin-right: 3px;
|
||||
color: rgba(255, 255, 255, 0.35);
|
||||
margin-right: 4px;
|
||||
transition: background 0.15s ease, color 0.15s ease;
|
||||
}
|
||||
|
||||
.search-pill-close:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: var(--text-primary);
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
color: rgba(255, 255, 255, 0.80);
|
||||
}
|
||||
|
||||
/* ── Search results ──────────────────────────────────────── */
|
||||
|
|
|
|||
Loading…
Reference in a new issue