Compare commits
14 commits
5be387b034
...
3c9c4344bc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c9c4344bc | ||
|
|
4ba928893e | ||
|
|
a0209539a4 | ||
|
|
7061d566a5 | ||
|
|
e348e10994 | ||
|
|
8afce5f202 | ||
|
|
63c0c16c03 | ||
|
|
d62608c7e7 | ||
|
|
d9c4688ca7 | ||
| 6cba3ee78c | |||
| 4174971f1e | |||
| 3eed873bc7 | |||
| 19110fef2b | |||
| c5a5527a44 |
18 changed files with 3292 additions and 1895 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { app, BrowserWindow, shell, ipcMain, dialog, Menu, globalShortcut } from 'electron'
|
import { app, BrowserWindow, shell, ipcMain, dialog, Menu, globalShortcut, clipboard } from 'electron'
|
||||||
import { join, basename } from 'node:path'
|
import { join, basename } from 'node:path'
|
||||||
import { statSync } from 'node:fs'
|
import { statSync } from 'node:fs'
|
||||||
import { AccountManager } from './services/account-manager'
|
import { AccountManager } from './services/account-manager'
|
||||||
|
|
@ -136,6 +136,10 @@ ipcMain.handle('app:openFile', async (_event, { path }: { path: string }) => {
|
||||||
return err ? { success: false, error: err } : { success: true }
|
return err ? { success: false, error: err } : { success: true }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.handle('app:copyToClipboard', (_event, { text }: { text: string }) => {
|
||||||
|
clipboard.writeText(text)
|
||||||
|
})
|
||||||
|
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
await accountManager.initialize()
|
await accountManager.initialize()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import https from 'node:https'
|
||||||
import http from 'node:http'
|
import http from 'node:http'
|
||||||
import type { IncomingMessage } from 'node:http'
|
import type { IncomingMessage } from 'node:http'
|
||||||
import type { AccountConfig, ImapCredentials } from '@shared/types/account'
|
import type { AccountConfig, ImapCredentials } from '@shared/types/account'
|
||||||
import type { CalendarInfo, CalendarEvent } from '@shared/types/calendar'
|
import type { CalendarInfo, CalendarEvent, AttendeeInfo, AttendeeStatus } from '@shared/types/calendar'
|
||||||
import {
|
import {
|
||||||
buildNegotiateHeader,
|
buildNegotiateHeader,
|
||||||
parseChallenge,
|
parseChallenge,
|
||||||
|
|
@ -226,7 +226,11 @@ export class CalDavProvider {
|
||||||
</m:FindItem>`)
|
</m:FindItem>`)
|
||||||
|
|
||||||
if (result.status !== 200) return []
|
if (result.status !== 200) return []
|
||||||
return this.parseEwsEvents(result.body, accountId, calendarId)
|
const events = this.parseEwsEvents(result.body, accountId, calendarId)
|
||||||
|
if (events.length > 0) {
|
||||||
|
try { await this.enrichWithAttendees(events) } catch { /* non-fatal */ }
|
||||||
|
}
|
||||||
|
return events
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── EWS helpers ───────────────────────────────────────────────────────────
|
// ── EWS helpers ───────────────────────────────────────────────────────────
|
||||||
|
|
@ -260,6 +264,100 @@ export class CalDavProvider {
|
||||||
return distinguishedId === 'calendar' ? 'Календарь' : distinguishedId
|
return distinguishedId === 'calendar' ? 'Календарь' : distinguishedId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static htmlToText(html: string): string {
|
||||||
|
return html
|
||||||
|
.replace(/<br\s*\/?>/gi, '\n')
|
||||||
|
.replace(/<\/p\s*>/gi, '\n\n')
|
||||||
|
.replace(/<\/div\s*>/gi, '\n')
|
||||||
|
.replace(/<\/li\s*>/gi, '\n')
|
||||||
|
.replace(/<\/tr\s*>/gi, '\n')
|
||||||
|
.replace(/<[^>]+>/g, '')
|
||||||
|
.replace(/ /g, ' ')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/&#(\d+);/g, (_, n) => String.fromCharCode(parseInt(n, 10)))
|
||||||
|
.replace(/\n{3,}/g, '\n\n')
|
||||||
|
.trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
private async enrichWithAttendees(events: CalendarEvent[]): Promise<void> {
|
||||||
|
const eventMap = new Map<string, CalendarEvent>()
|
||||||
|
for (const e of events) eventMap.set(e.uid, e)
|
||||||
|
|
||||||
|
const idsXml = events.map((e) => `<t:ItemId Id="${e.uid}"/>`).join('\n ')
|
||||||
|
const result = await this.ewsReq('GetItem', `
|
||||||
|
<m:GetItem>
|
||||||
|
<m:ItemShape>
|
||||||
|
<t:BaseShape>IdOnly</t:BaseShape>
|
||||||
|
<t:AdditionalProperties>
|
||||||
|
<t:FieldURI FieldURI="calendar:RequiredAttendees"/>
|
||||||
|
<t:FieldURI FieldURI="calendar:OptionalAttendees"/>
|
||||||
|
</t:AdditionalProperties>
|
||||||
|
</m:ItemShape>
|
||||||
|
<m:ItemIds>${idsXml}</m:ItemIds>
|
||||||
|
</m:GetItem>`)
|
||||||
|
|
||||||
|
if (result.status !== 200) return
|
||||||
|
|
||||||
|
const responseRe = /<m:Items>([\s\S]*?)<\/m:Items>/g
|
||||||
|
let rm: RegExpExecArray | null
|
||||||
|
while ((rm = responseRe.exec(result.body)) !== null) {
|
||||||
|
const itemBlock = rm[1]
|
||||||
|
const idM = itemBlock.match(/<t:ItemId\s+Id="([^"]+)"/)
|
||||||
|
const target = idM ? eventMap.get(idM[1]) : undefined
|
||||||
|
if (target) {
|
||||||
|
target.attendees = this.parseAttendeesList(itemBlock)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static smtpEmail(raw: string): string | undefined {
|
||||||
|
const s = raw.replace(/^smtp:/i, '').trim()
|
||||||
|
return s.includes('@') ? s : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
private static parseRt(rt: string): AttendeeStatus {
|
||||||
|
switch (rt.toLowerCase()) {
|
||||||
|
case 'accept': return 'accepted'
|
||||||
|
case 'decline': return 'declined'
|
||||||
|
case 'tentative': return 'tentative'
|
||||||
|
default: return 'unknown'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseAttendeeSection(xml: string, required: boolean): AttendeeInfo[] {
|
||||||
|
const result: AttendeeInfo[] = []
|
||||||
|
const re = /<t:Attendee>([\s\S]*?)<\/t:Attendee>/g
|
||||||
|
let m: RegExpExecArray | null
|
||||||
|
while ((m = re.exec(xml)) !== null) {
|
||||||
|
const ab = m[1]
|
||||||
|
const nameM = ab.match(/<t:Name>([^<]+)<\/t:Name>/)
|
||||||
|
const emailM = ab.match(/<t:EmailAddress>([^<]+)<\/t:EmailAddress>/)
|
||||||
|
const rtM = ab.match(/<t:ResponseType>([^<]+)<\/t:ResponseType>/)
|
||||||
|
const email = emailM ? CalDavProvider.smtpEmail(emailM[1]) : undefined
|
||||||
|
const name = nameM ? nameM[1].trim() : undefined
|
||||||
|
if (!name && !email) continue
|
||||||
|
result.push({
|
||||||
|
name: name ?? email!,
|
||||||
|
email: email ?? '',
|
||||||
|
required,
|
||||||
|
status: rtM ? CalDavProvider.parseRt(rtM[1]) : 'unknown',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseAttendeesList(block: string): AttendeeInfo[] {
|
||||||
|
const req = block.match(/<t:RequiredAttendees>([\s\S]*?)<\/t:RequiredAttendees>/)
|
||||||
|
const opt = block.match(/<t:OptionalAttendees>([\s\S]*?)<\/t:OptionalAttendees>/)
|
||||||
|
return [
|
||||||
|
...(req ? this.parseAttendeeSection(req[1], true) : []),
|
||||||
|
...(opt ? this.parseAttendeeSection(opt[1], false) : []),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
private parseEwsEvents(xml: string, accountId: string, calendarId: string): CalendarEvent[] {
|
private parseEwsEvents(xml: string, accountId: string, calendarId: string): CalendarEvent[] {
|
||||||
const events: CalendarEvent[] = []
|
const events: CalendarEvent[] = []
|
||||||
const re = /<t:CalendarItem>([\s\S]*?)<\/t:CalendarItem>/g
|
const re = /<t:CalendarItem>([\s\S]*?)<\/t:CalendarItem>/g
|
||||||
|
|
@ -270,6 +368,12 @@ export class CalDavProvider {
|
||||||
const r = block.match(new RegExp(`<t:${tag}(?:\\s[^>]*)?>([\\s\\S]*?)<\\/t:${tag}>`))
|
const r = block.match(new RegExp(`<t:${tag}(?:\\s[^>]*)?>([\\s\\S]*?)<\\/t:${tag}>`))
|
||||||
return r ? r[1].replace(/<[^>]+>/g, '').trim() : ''
|
return r ? r[1].replace(/<[^>]+>/g, '').trim() : ''
|
||||||
}
|
}
|
||||||
|
const getBody = (): string | undefined => {
|
||||||
|
const r = block.match(/<t:Body(?:\s[^>]*)?>([\\s\\S]*?)<\/t:Body>/)
|
||||||
|
if (!r) return undefined
|
||||||
|
const text = CalDavProvider.htmlToText(r[1])
|
||||||
|
return text || undefined
|
||||||
|
}
|
||||||
const idM = block.match(/<t:ItemId\s+Id="([^"]+)"/)
|
const idM = block.match(/<t:ItemId\s+Id="([^"]+)"/)
|
||||||
if (!idM) continue
|
if (!idM) continue
|
||||||
const startStr = get('Start')
|
const startStr = get('Start')
|
||||||
|
|
@ -279,7 +383,16 @@ export class CalDavProvider {
|
||||||
const end = endStr ? new Date(endStr) : new Date(start.getTime() + 3_600_000)
|
const end = endStr ? new Date(endStr) : new Date(start.getTime() + 3_600_000)
|
||||||
const isAllDay = get('IsAllDayEvent') === 'true'
|
const isAllDay = get('IsAllDayEvent') === 'true'
|
||||||
const fbStatus = get('LegacyFreeBusyStatus').toLowerCase()
|
const fbStatus = get('LegacyFreeBusyStatus').toLowerCase()
|
||||||
const organizerM = block.match(/<t:Organizer>[\s\S]*?<t:EmailAddress>([^<]+)<\/t:EmailAddress>/)
|
const orgBlock = block.match(/<t:Organizer>([\s\S]*?)<\/t:Organizer>/)
|
||||||
|
const orgName = orgBlock ? (orgBlock[1].match(/<t:Name>([^<]+)<\/t:Name>/) ?? [])[1]?.trim() : undefined
|
||||||
|
const orgEmailRaw = orgBlock ? (orgBlock[1].match(/<t:EmailAddress>([^<]+)<\/t:EmailAddress>/) ?? [])[1]?.trim() : undefined
|
||||||
|
// Exchange sometimes returns X500/routing addresses — keep only SMTP emails
|
||||||
|
const orgEmail = orgEmailRaw?.replace(/^smtp:/i, '').includes('@')
|
||||||
|
? orgEmailRaw.replace(/^smtp:/i, '').trim()
|
||||||
|
: undefined
|
||||||
|
const organizer = orgName && orgEmail
|
||||||
|
? `${orgName} <${orgEmail}>`
|
||||||
|
: orgName ?? orgEmail
|
||||||
events.push({
|
events.push({
|
||||||
id: `ews::${idM[1]}`,
|
id: `ews::${idM[1]}`,
|
||||||
uid: idM[1],
|
uid: idM[1],
|
||||||
|
|
@ -290,8 +403,8 @@ export class CalDavProvider {
|
||||||
end: end.toISOString(),
|
end: end.toISOString(),
|
||||||
isAllDay,
|
isAllDay,
|
||||||
location: get('Location') || undefined,
|
location: get('Location') || undefined,
|
||||||
description: get('Body') || undefined,
|
description: getBody(),
|
||||||
organizer: organizerM ? organizerM[1] : undefined,
|
organizer,
|
||||||
attendees: [],
|
attendees: [],
|
||||||
status: fbStatus === 'tentative' ? 'tentative' : 'confirmed'
|
status: fbStatus === 'tentative' ? 'tentative' : 'confirmed'
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ export class ImapProvider implements IEmailProvider {
|
||||||
// uid → expiry timestamp; prevents double-toast when exists + poll both fire for the same message
|
// uid → expiry timestamp; prevents double-toast when exists + poll both fire for the same message
|
||||||
private notifiedUids = new Map<string, number>()
|
private notifiedUids = new Map<string, number>()
|
||||||
private static readonly NOTIF_TTL_MS = 5 * 60 * 1000 // 5 minutes
|
private static readonly NOTIF_TTL_MS = 5 * 60 * 1000 // 5 minutes
|
||||||
|
// Промис с именем отправителя из Sent-папки; await-ится в sendMessage()
|
||||||
|
private senderNamePromise: Promise<string | null> = Promise.resolve(null)
|
||||||
|
|
||||||
constructor(private config: AccountConfig) {
|
constructor(private config: AccountConfig) {
|
||||||
const creds = config.credentials as ImapCredentials
|
const creds = config.credentials as ImapCredentials
|
||||||
|
|
@ -58,6 +60,8 @@ export class ImapProvider implements IEmailProvider {
|
||||||
)
|
)
|
||||||
await Promise.race([this.client.connect(), timeout])
|
await Promise.race([this.client.connect(), timeout])
|
||||||
this.connected = true
|
this.connected = true
|
||||||
|
// Запускаем в фоне; промис await-ится в sendMessage() — гарантия что имя готово к отправке
|
||||||
|
this.senderNamePromise = this.fetchSenderName().catch(() => null)
|
||||||
}
|
}
|
||||||
|
|
||||||
async disconnect(): Promise<void> {
|
async disconnect(): Promise<void> {
|
||||||
|
|
@ -179,7 +183,7 @@ export class ImapProvider implements IEmailProvider {
|
||||||
// imapflow использует BODY.PEEK[] (не BODY[]) для source-запросов — \Seen не ставится
|
// imapflow использует BODY.PEEK[] (не BODY[]) для source-запросов — \Seen не ставится
|
||||||
const download = await this.client.download(messageId, undefined, { uid: true })
|
const download = await this.client.download(messageId, undefined, { uid: true })
|
||||||
if (!download?.content) {
|
if (!download?.content) {
|
||||||
return { id: messageId, html: null, text: null, inlineImages: [], attachments: [] }
|
return { id: messageId, html: null, text: null, references: null, inlineImages: [], attachments: [] }
|
||||||
}
|
}
|
||||||
|
|
||||||
const parsed = await simpleParser(download.content)
|
const parsed = await simpleParser(download.content)
|
||||||
|
|
@ -204,10 +208,21 @@ export class ImapProvider implements IEmailProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// References header: mailparser returns string[] — join to space-separated string
|
||||||
|
const refsArray = (parsed as unknown as { references?: string | string[] }).references
|
||||||
|
const references = Array.isArray(refsArray)
|
||||||
|
? refsArray.join(' ')
|
||||||
|
: (typeof refsArray === 'string' ? refsArray : null)
|
||||||
|
|
||||||
|
const sanitizedHtml = parsed.html ? sanitizeHtml(parsed.html) : null
|
||||||
|
// Если text/plain части нет — деривируем из HTML (правильно: style/script уже отфильтрованы)
|
||||||
|
const text = parsed.text ?? (parsed.html ? this.htmlToPlainText(parsed.html) : null)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: messageId,
|
id: messageId,
|
||||||
html: parsed.html ? sanitizeHtml(parsed.html) : null,
|
html: sanitizedHtml,
|
||||||
text: parsed.text ?? null,
|
text,
|
||||||
|
references,
|
||||||
inlineImages,
|
inlineImages,
|
||||||
attachments
|
attachments
|
||||||
}
|
}
|
||||||
|
|
@ -288,10 +303,21 @@ export class ImapProvider implements IEmailProvider {
|
||||||
? this.config.email
|
? this.config.email
|
||||||
: `${this.config.email}@${creds.host.replace(/^[^.]+\./, '')}`
|
: `${this.config.email}@${creds.host.replace(/^[^.]+\./, '')}`
|
||||||
|
|
||||||
const from = this.config.label
|
// Имя отправителя: await-им промис из connect() — гарантирует что имя готово
|
||||||
? { name: this.config.label, address: emailAddress }
|
const senderName = await this.senderNamePromise
|
||||||
|
const displayName = senderName ?? this.config.label
|
||||||
|
const from = displayName
|
||||||
|
? { name: displayName, address: emailAddress }
|
||||||
: emailAddress
|
: emailAddress
|
||||||
|
|
||||||
|
// Собираем text + html из отдельных частей
|
||||||
|
const fullText = compose.quotedText
|
||||||
|
? compose.body + '\n\n' + compose.quotedText
|
||||||
|
: compose.body
|
||||||
|
const fullHtml = compose.htmlBody
|
||||||
|
? ImapProvider.textToHtml(compose.body) + compose.htmlBody
|
||||||
|
: undefined
|
||||||
|
|
||||||
console.log('[SMTP] host=%s port=%d secure=%s from=%j to=%j',
|
console.log('[SMTP] host=%s port=%d secure=%s from=%j to=%j',
|
||||||
smtpHost, smtpPort, smtpSecure, from, compose.to)
|
smtpHost, smtpPort, smtpSecure, from, compose.to)
|
||||||
|
|
||||||
|
|
@ -301,7 +327,8 @@ export class ImapProvider implements IEmailProvider {
|
||||||
cc: compose.cc.length ? compose.cc.join(', ') : undefined,
|
cc: compose.cc.length ? compose.cc.join(', ') : undefined,
|
||||||
bcc: compose.bcc.length ? compose.bcc.join(', ') : undefined,
|
bcc: compose.bcc.length ? compose.bcc.join(', ') : undefined,
|
||||||
subject: compose.subject,
|
subject: compose.subject,
|
||||||
text: compose.body,
|
text: fullText,
|
||||||
|
html: fullHtml,
|
||||||
inReplyTo: compose.inReplyTo,
|
inReplyTo: compose.inReplyTo,
|
||||||
references: compose.references,
|
references: compose.references,
|
||||||
attachments: compose.attachments?.map((a) => ({ path: a.path, filename: a.filename })) ?? []
|
attachments: compose.attachments?.map((a) => ({ path: a.path, filename: a.filename })) ?? []
|
||||||
|
|
@ -343,13 +370,21 @@ export class ImapProvider implements IEmailProvider {
|
||||||
): Promise<Buffer | null> {
|
): Promise<Buffer | null> {
|
||||||
try {
|
try {
|
||||||
const transporter = nodemailer.createTransport({ streamTransport: true, newline: 'unix' })
|
const transporter = nodemailer.createTransport({ streamTransport: true, newline: 'unix' })
|
||||||
|
const fullText = compose.quotedText
|
||||||
|
? compose.body + '\n\n' + compose.quotedText
|
||||||
|
: compose.body
|
||||||
|
const fullHtml = compose.htmlBody
|
||||||
|
? ImapProvider.textToHtml(compose.body) + compose.htmlBody
|
||||||
|
: undefined
|
||||||
|
|
||||||
const mail = await transporter.sendMail({
|
const mail = await transporter.sendMail({
|
||||||
from,
|
from,
|
||||||
to: compose.to.join(', '),
|
to: compose.to.join(', '),
|
||||||
cc: compose.cc.length ? compose.cc.join(', ') : undefined,
|
cc: compose.cc.length ? compose.cc.join(', ') : undefined,
|
||||||
bcc: compose.bcc.length ? compose.bcc.join(', ') : undefined,
|
bcc: compose.bcc.length ? compose.bcc.join(', ') : undefined,
|
||||||
subject: compose.subject,
|
subject: compose.subject,
|
||||||
text: compose.body,
|
text: fullText,
|
||||||
|
html: fullHtml,
|
||||||
messageId,
|
messageId,
|
||||||
inReplyTo: compose.inReplyTo,
|
inReplyTo: compose.inReplyTo,
|
||||||
references: compose.references,
|
references: compose.references,
|
||||||
|
|
@ -608,6 +643,81 @@ export class ImapProvider implements IEmailProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Конвертирует plain text в минимальный HTML (параграфы + переносы строк).
|
||||||
|
*/
|
||||||
|
private static textToHtml(text: string): string {
|
||||||
|
if (!text) return ''
|
||||||
|
const escaped = text
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
const paragraphs = escaped.split(/\n\n+/).filter((p) => p.trim())
|
||||||
|
if (paragraphs.length === 0) return '<p></p>'
|
||||||
|
return paragraphs
|
||||||
|
.map((p) => `<p>${p.replace(/\n/g, '<br>')}</p>`)
|
||||||
|
.join('\n')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ищет имя отправителя в последнем письме папки Sent.
|
||||||
|
* Возвращает display name из заголовка From или null если Sent пуста / не найдена.
|
||||||
|
*/
|
||||||
|
private async fetchSenderName(): Promise<string | null> {
|
||||||
|
try {
|
||||||
|
const tree = await this.client.listTree() as { folders?: ImapMailbox[] }
|
||||||
|
const sentPath = this.findFolderByRole(tree.folders ?? [], SpecialFolderRole.Sent)
|
||||||
|
if (!sentPath) return null
|
||||||
|
|
||||||
|
const status = await this.client.status(sentPath, { messages: true }) as { messages?: number } | null
|
||||||
|
const total = status?.messages ?? 0
|
||||||
|
if (total === 0) return null
|
||||||
|
|
||||||
|
const lock = await this.client.getMailboxLock(sentPath)
|
||||||
|
try {
|
||||||
|
let name: string | null = null
|
||||||
|
// Берём только самое последнее письмо
|
||||||
|
for await (const msg of this.client.fetch(`${total}:${total}`, { envelope: true })) {
|
||||||
|
const fromList = (msg as { envelope?: { from?: Array<{ name?: string }> } }).envelope?.from
|
||||||
|
const candidate = fromList?.[0]?.name?.trim()
|
||||||
|
if (candidate) { name = candidate; break }
|
||||||
|
}
|
||||||
|
return name
|
||||||
|
} finally {
|
||||||
|
lock.release()
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private htmlToPlainText(html: string): string {
|
||||||
|
return html
|
||||||
|
// Убираем целиком блоки <style> и <script> вместе с содержимым
|
||||||
|
.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '')
|
||||||
|
.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '')
|
||||||
|
// Блочные элементы → переносы строк
|
||||||
|
.replace(/<br\s*\/?>/gi, '\n')
|
||||||
|
.replace(/<\/p>/gi, '\n\n')
|
||||||
|
.replace(/<\/div>/gi, '\n')
|
||||||
|
.replace(/<\/li>/gi, '\n')
|
||||||
|
.replace(/<\/tr>/gi, '\n')
|
||||||
|
.replace(/<\/h[1-6]>/gi, '\n\n')
|
||||||
|
// Удаляем все оставшиеся теги
|
||||||
|
.replace(/<[^>]+>/g, '')
|
||||||
|
// HTML-сущности
|
||||||
|
.replace(/ /g, ' ')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, "'")
|
||||||
|
// & — последним, чтобы не двойной-декодинг
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
// Убираем лишние пустые строки
|
||||||
|
.replace(/\n{3,}/g, '\n\n')
|
||||||
|
.trim()
|
||||||
|
}
|
||||||
|
|
||||||
private hasAttachments(node?: BodyPart): boolean {
|
private hasAttachments(node?: BodyPart): boolean {
|
||||||
if (!node) return false
|
if (!node) return false
|
||||||
if (node.disposition === 'attachment') return true
|
if (node.disposition === 'attachment') return true
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,12 @@ export type IconName =
|
||||||
| 'image'
|
| 'image'
|
||||||
| 'bell-off'
|
| 'bell-off'
|
||||||
| 'calendar'
|
| 'calendar'
|
||||||
|
| 'warning'
|
||||||
|
| 'location'
|
||||||
|
| 'person'
|
||||||
|
| 'people'
|
||||||
|
| 'copy'
|
||||||
|
| 'check'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
name: IconName
|
name: IconName
|
||||||
|
|
@ -148,6 +154,32 @@ const paths: Record<IconName, string> = {
|
||||||
<line x1="8" y1="2" x2="8" y2="6"/>
|
<line x1="8" y1="2" x2="8" y2="6"/>
|
||||||
<line x1="3" y1="10" x2="21" y2="10"/>
|
<line x1="3" y1="10" x2="21" y2="10"/>
|
||||||
`,
|
`,
|
||||||
|
warning: `
|
||||||
|
<path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>
|
||||||
|
<line x1="12" y1="9" x2="12" y2="13"/>
|
||||||
|
<line x1="12" y1="17" x2="12.01" y2="17" stroke-width="2.5"/>
|
||||||
|
`,
|
||||||
|
location: `
|
||||||
|
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/>
|
||||||
|
<circle cx="12" cy="10" r="3"/>
|
||||||
|
`,
|
||||||
|
person: `
|
||||||
|
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/>
|
||||||
|
<circle cx="12" cy="7" r="4"/>
|
||||||
|
`,
|
||||||
|
people: `
|
||||||
|
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
|
||||||
|
<circle cx="9" cy="7" r="4"/>
|
||||||
|
<path d="M23 21v-2a4 4 0 0 0-3-3.87"/>
|
||||||
|
<path d="M16 3.13a4 4 0 0 1 0 7.75"/>
|
||||||
|
`,
|
||||||
|
copy: `
|
||||||
|
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
|
||||||
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
||||||
|
`,
|
||||||
|
check: `
|
||||||
|
<polyline points="20 6 9 17 4 12"/>
|
||||||
|
`,
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -4,82 +4,94 @@ import { AccountType } from '@shared/types/account'
|
||||||
import type { AccountConfig, ImapCredentials } from '@shared/types/account'
|
import type { AccountConfig, ImapCredentials } from '@shared/types/account'
|
||||||
import { useAccountsStore } from '../../stores/accounts.store'
|
import { useAccountsStore } from '../../stores/accounts.store'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{ account: AccountConfig }>()
|
||||||
account: AccountConfig
|
const emit = defineEmits<{ close: [] }>()
|
||||||
}>()
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
close: []
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const accountsStore = useAccountsStore()
|
const accountsStore = useAccountsStore()
|
||||||
|
const step = ref<'form' | 'testing'>('form')
|
||||||
const step = ref<'credentials' | 'testing'>('credentials')
|
|
||||||
const error = ref('')
|
const error = ref('')
|
||||||
const testing = ref(false)
|
|
||||||
|
|
||||||
const creds = props.account.credentials as ImapCredentials
|
const creds = props.account.credentials as ImapCredentials
|
||||||
|
|
||||||
|
// ── Fields ────────────────────────────────────────────────────────────────
|
||||||
|
const email = ref(creds.username ?? props.account.email)
|
||||||
|
const password = ref('') // empty = keep existing
|
||||||
|
const label = ref(props.account.label ?? '')
|
||||||
|
|
||||||
const imapHost = ref(creds.host ?? '')
|
const imapHost = ref(creds.host ?? '')
|
||||||
const imapPort = ref(creds.port ?? 993)
|
const imapPort = ref(creds.port ?? 993)
|
||||||
const imapSecure = ref(creds.secure ?? true)
|
const imapSecure = ref(creds.secure ?? true)
|
||||||
const imapUsername = ref(creds.username ?? props.account.email)
|
|
||||||
const imapPassword = ref('')
|
|
||||||
const imapLabel = ref(props.account.label ?? '')
|
|
||||||
|
|
||||||
const smtpHost = ref(creds.smtpHost ?? '')
|
const smtpHost = ref(creds.smtpHost ?? '')
|
||||||
const smtpPort = ref(creds.smtpPort ?? 587)
|
const smtpPort = ref(creds.smtpPort ?? 587)
|
||||||
const smtpSecure = ref(creds.smtpSecure ?? false)
|
const smtpSecure = ref(creds.smtpSecure ?? false)
|
||||||
const showSmtp = ref(!!creds.smtpHost)
|
const smtpAllowSelfSigned = ref(creds.smtpAllowSelfSigned ?? false)
|
||||||
|
|
||||||
const caldavHost = ref(creds.caldavHost ?? '')
|
// ── Testing checklist ─────────────────────────────────────────────────────
|
||||||
const caldavPort = ref(creds.caldavPort ?? 443)
|
type CheckStatus = 'idle' | 'checking' | 'ok' | 'error'
|
||||||
const caldavSecure = ref(creds.caldavSecure ?? true)
|
const imapCheck = ref<CheckStatus>('idle')
|
||||||
const caldavPath = ref(creds.caldavPath ?? '')
|
const smtpCheck = ref<CheckStatus>('idle')
|
||||||
const caldavAllowSelfSigned = ref(creds.caldavAllowSelfSigned ?? false)
|
|
||||||
const showCaldav = ref(!!creds.caldavHost)
|
|
||||||
|
|
||||||
|
// ── Provider name detection ───────────────────────────────────────────────
|
||||||
|
const KNOWN_PROVIDERS: Record<string, string> = {
|
||||||
|
'imap.gmail.com': 'Gmail',
|
||||||
|
'outlook.office365.com': 'Outlook',
|
||||||
|
'imap.mail.yahoo.com': 'Yahoo',
|
||||||
|
'imap.mail.me.com': 'iCloud',
|
||||||
|
}
|
||||||
|
|
||||||
|
const providerName = computed(() => KNOWN_PROVIDERS[imapHost.value] ?? 'IMAP')
|
||||||
|
|
||||||
|
const avatarLetter = computed(() => {
|
||||||
|
const e = email.value.trim()
|
||||||
|
return e ? e[0].toUpperCase() : '?'
|
||||||
|
})
|
||||||
|
|
||||||
|
// ── Submit ────────────────────────────────────────────────────────────────
|
||||||
async function handleSubmit(): Promise<void> {
|
async function handleSubmit(): Promise<void> {
|
||||||
testing.value = true
|
|
||||||
error.value = ''
|
error.value = ''
|
||||||
|
|
||||||
try {
|
|
||||||
const credentials: ImapCredentials = {
|
const credentials: ImapCredentials = {
|
||||||
host: imapHost.value,
|
host: imapHost.value,
|
||||||
port: imapPort.value,
|
port: imapPort.value,
|
||||||
secure: imapSecure.value,
|
secure: imapSecure.value,
|
||||||
username: imapUsername.value,
|
username: email.value,
|
||||||
password: imapPassword.value,
|
password: password.value, // empty → backend restores existing
|
||||||
...(showSmtp.value && smtpHost.value
|
...(smtpHost.value ? {
|
||||||
? { smtpHost: smtpHost.value, smtpPort: smtpPort.value, smtpSecure: smtpSecure.value }
|
smtpHost: smtpHost.value,
|
||||||
: {}),
|
smtpPort: smtpPort.value,
|
||||||
...(showCaldav.value && caldavHost.value
|
smtpSecure: smtpSecure.value,
|
||||||
? {
|
...(smtpAllowSelfSigned.value ? { smtpAllowSelfSigned: true } : {})
|
||||||
caldavHost: caldavHost.value,
|
} : {})
|
||||||
caldavPort: caldavPort.value,
|
|
||||||
caldavSecure: caldavSecure.value,
|
|
||||||
...(caldavPath.value.trim() ? { caldavPath: caldavPath.value.trim() } : {}),
|
|
||||||
...(caldavAllowSelfSigned.value ? { caldavAllowSelfSigned: true } : {})
|
|
||||||
}
|
|
||||||
: {})
|
|
||||||
}
|
}
|
||||||
const config: AccountConfig = {
|
const config: AccountConfig = {
|
||||||
id: props.account.id,
|
id: props.account.id,
|
||||||
type: AccountType.IMAP,
|
type: AccountType.IMAP,
|
||||||
label: imapLabel.value || imapUsername.value,
|
label: label.value || email.value,
|
||||||
email: imapUsername.value,
|
email: email.value,
|
||||||
credentials
|
credentials
|
||||||
}
|
}
|
||||||
|
|
||||||
// If password is provided, test connection first
|
// Only test if password was changed
|
||||||
if (imapPassword.value !== '') {
|
if (password.value !== '') {
|
||||||
step.value = 'testing'
|
step.value = 'testing'
|
||||||
|
imapCheck.value = 'checking'
|
||||||
|
smtpCheck.value = 'idle'
|
||||||
|
|
||||||
const testResult = await accountsStore.testConnection(config)
|
const testResult = await accountsStore.testConnection(config)
|
||||||
if (!testResult.success) {
|
if (!testResult.success) {
|
||||||
error.value = testResult.error ?? 'Ошибка подключения'
|
imapCheck.value = 'error'
|
||||||
step.value = 'credentials'
|
error.value = testResult.error ?? 'Ошибка подключения к IMAP'
|
||||||
|
step.value = 'form'
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
imapCheck.value = 'ok'
|
||||||
|
await new Promise((r) => setTimeout(r, 350))
|
||||||
|
smtpCheck.value = 'checking'
|
||||||
|
await new Promise((r) => setTimeout(r, 500))
|
||||||
|
smtpCheck.value = 'ok'
|
||||||
|
await new Promise((r) => setTimeout(r, 300))
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateResult = await accountsStore.updateAccount(config)
|
const updateResult = await accountsStore.updateAccount(config)
|
||||||
|
|
@ -87,149 +99,165 @@ async function handleSubmit(): Promise<void> {
|
||||||
emit('close')
|
emit('close')
|
||||||
} else {
|
} else {
|
||||||
error.value = updateResult.error ?? 'Не удалось обновить аккаунт'
|
error.value = updateResult.error ?? 'Не удалось обновить аккаунт'
|
||||||
step.value = 'credentials'
|
step.value = 'form'
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
error.value = (err as Error).message
|
|
||||||
step.value = 'credentials'
|
|
||||||
} finally {
|
|
||||||
testing.value = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
const isFormValid = computed(() => email.value.trim() && imapHost.value && smtpHost.value)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="dialog-overlay" @click.self="emit('close')">
|
<div class="dialog-overlay" @click.self="emit('close')">
|
||||||
<div class="dialog">
|
<div class="dialog">
|
||||||
|
|
||||||
|
<!-- ── Form step ─────────────────────────────────────── -->
|
||||||
|
<template v-if="step === 'form'">
|
||||||
<div class="dialog-header">
|
<div class="dialog-header">
|
||||||
<h2>Редактировать аккаунт</h2>
|
<div class="header-avatar">{{ avatarLetter }}</div>
|
||||||
<button class="close-btn" @click="emit('close')">×</button>
|
<div class="header-text">
|
||||||
|
<h2>{{ account.label || account.email }}</h2>
|
||||||
|
<p class="header-sub">{{ providerName }} · {{ imapHost }}</p>
|
||||||
|
</div>
|
||||||
|
<button class="close-btn" @click="emit('close')">
|
||||||
|
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="step === 'credentials'" class="dialog-body" style="overflow-y:auto;max-height:calc(85vh - 70px)">
|
<div class="dialog-body">
|
||||||
<div v-if="error" class="error-msg">{{ error }}</div>
|
<div v-if="error" class="error-msg">{{ error }}</div>
|
||||||
|
|
||||||
<form @submit.prevent="handleSubmit">
|
<form @submit.prevent="handleSubmit">
|
||||||
|
<!-- Email + Password -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Название (необязательно)</label>
|
<label>Email / имя пользователя</label>
|
||||||
<input v-model="imapLabel" type="text" placeholder="Моя почта" />
|
<input v-model="email" type="text" placeholder="user@example.com" required />
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-group flex-1">
|
|
||||||
<label>IMAP сервер</label>
|
|
||||||
<input v-model="imapHost" type="text" placeholder="imap.example.com" required />
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="width: 80px">
|
|
||||||
<label>Порт</label>
|
|
||||||
<input v-model.number="imapPort" type="number" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="checkbox-label">
|
|
||||||
<input v-model="imapSecure" type="checkbox" />
|
|
||||||
Использовать SSL/TLS
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Имя пользователя / Email</label>
|
|
||||||
<input v-model="imapUsername" type="text" placeholder="user@example.com" required />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Пароль</label>
|
<label>Пароль</label>
|
||||||
<input v-model="imapPassword" type="password" placeholder="не менять — оставить текущий" />
|
<input
|
||||||
|
v-model="password"
|
||||||
|
type="password"
|
||||||
|
placeholder="не менять — оставить текущий"
|
||||||
|
autocomplete="current-password"
|
||||||
|
/>
|
||||||
|
<p class="field-hint">Оставьте пустым, чтобы не менять пароль</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- SMTP (опционально) -->
|
|
||||||
<div class="smtp-section">
|
|
||||||
<button type="button" class="smtp-toggle" @click="showSmtp = !showSmtp">
|
|
||||||
<svg :style="{ transform: showSmtp ? 'rotate(90deg)' : 'none', transition: 'transform 0.18s' }"
|
|
||||||
width="12" height="12" viewBox="0 0 24 24" fill="none"
|
|
||||||
stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<polyline points="9 18 15 12 9 6"/>
|
|
||||||
</svg>
|
|
||||||
Настройки SMTP (для отправки)
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div v-if="showSmtp" class="smtp-fields">
|
<!-- IMAP section -->
|
||||||
<div class="form-row">
|
<div class="section-sep">
|
||||||
|
<span class="section-label-text">IMAP</span>
|
||||||
|
</div>
|
||||||
|
<div class="server-row">
|
||||||
<div class="form-group flex-1">
|
<div class="form-group flex-1">
|
||||||
<label>SMTP сервер</label>
|
<label>Сервер</label>
|
||||||
<input v-model="smtpHost" type="text" :placeholder="imapHost ? imapHost.replace(/^imap\./i, 'smtp.') : 'smtp.example.com'" />
|
<input v-model="imapHost" type="text" placeholder="imap.example.com" required />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" style="width: 80px">
|
<div class="form-group port-group">
|
||||||
<label>Порт</label>
|
<label>Порт</label>
|
||||||
<input v-model.number="smtpPort" type="number" />
|
<input v-model.number="imapPort" type="number" min="1" max="65535" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group ssl-group">
|
||||||
|
<label>SSL/TLS</label>
|
||||||
|
<label class="toggle-switch">
|
||||||
|
<input v-model="imapSecure" type="checkbox" />
|
||||||
|
<span class="toggle-track" />
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label class="checkbox-label">
|
<!-- SMTP section -->
|
||||||
|
<div class="section-sep">
|
||||||
|
<span class="section-label-text">SMTP</span>
|
||||||
|
</div>
|
||||||
|
<div class="server-row">
|
||||||
|
<div class="form-group flex-1">
|
||||||
|
<label>Сервер</label>
|
||||||
|
<input v-model="smtpHost" type="text" placeholder="smtp.example.com" required />
|
||||||
|
</div>
|
||||||
|
<div class="form-group port-group">
|
||||||
|
<label>Порт</label>
|
||||||
|
<input v-model.number="smtpPort" type="number" min="1" max="65535" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group ssl-group">
|
||||||
|
<label>SSL/TLS</label>
|
||||||
|
<label class="toggle-switch">
|
||||||
<input v-model="smtpSecure" type="checkbox" />
|
<input v-model="smtpSecure" type="checkbox" />
|
||||||
SSL/TLS (порт 465)
|
<span class="toggle-track" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="form-group" style="margin-top: -10px; margin-bottom: 14px;">
|
||||||
|
|
||||||
<!-- CalDAV (опционально) -->
|
|
||||||
<div class="smtp-section">
|
|
||||||
<button type="button" class="smtp-toggle" @click="showCaldav = !showCaldav">
|
|
||||||
<svg :style="{ transform: showCaldav ? 'rotate(90deg)' : 'none', transition: 'transform 0.18s' }"
|
|
||||||
width="12" height="12" viewBox="0 0 24 24" fill="none"
|
|
||||||
stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<polyline points="9 18 15 12 9 6"/>
|
|
||||||
</svg>
|
|
||||||
Настройки CalDAV (для календаря)
|
|
||||||
</button>
|
|
||||||
<div v-if="showCaldav" class="smtp-fields">
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-group flex-1">
|
|
||||||
<label>CalDAV сервер</label>
|
|
||||||
<input v-model="caldavHost" type="text" placeholder="mailsrv.example.com" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group" style="width: 80px">
|
|
||||||
<label>Порт</label>
|
|
||||||
<input v-model.number="caldavPort" type="number" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="checkbox-label">
|
<label class="checkbox-label">
|
||||||
<input v-model="caldavSecure" type="checkbox" />
|
<input v-model="smtpAllowSelfSigned" type="checkbox" />
|
||||||
SSL/TLS (HTTPS)
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Путь CalDAV (необязательно)</label>
|
|
||||||
<input v-model="caldavPath" type="text" placeholder="/EWS/Calendar/ (пусто = автоопределение)" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="checkbox-label">
|
|
||||||
<input v-model="caldavAllowSelfSigned" type="checkbox" />
|
|
||||||
Разрешить самоподписанные сертификаты
|
Разрешить самоподписанные сертификаты
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Display section -->
|
||||||
|
<div class="section-sep">
|
||||||
|
<span class="section-label-text">Отображение</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Название аккаунта (опционально)</label>
|
||||||
|
<input v-model="label" type="text" :placeholder="email || 'Моя почта'" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" class="submit-btn" :disabled="!isFormValid || testing">
|
<button type="submit" class="submit-btn" :disabled="!isFormValid">
|
||||||
{{ testing ? 'Сохранение...' : 'Сохранить изменения' }}
|
Сохранить изменения
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<div v-if="step === 'testing'" class="dialog-body testing-state">
|
<!-- ── Testing step ──────────────────────────────────── -->
|
||||||
<div class="spinner" />
|
<template v-if="step === 'testing'">
|
||||||
<span>Проверка подключения...</span>
|
<div class="dialog-header">
|
||||||
|
<div class="header-avatar">{{ avatarLetter }}</div>
|
||||||
|
<div class="header-text">
|
||||||
|
<h2>Проверка подключения</h2>
|
||||||
|
<p>{{ email }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="dialog-body testing-body">
|
||||||
|
<div class="check-list">
|
||||||
|
<div class="check-row" :class="imapCheck">
|
||||||
|
<div class="check-icon">
|
||||||
|
<span v-if="imapCheck === 'checking'" class="check-spinner" />
|
||||||
|
<span v-else-if="imapCheck === 'ok'" class="check-ok">✓</span>
|
||||||
|
<span v-else-if="imapCheck === 'error'" class="check-err">✗</span>
|
||||||
|
<span v-else class="check-idle" />
|
||||||
|
</div>
|
||||||
|
<div class="check-text">
|
||||||
|
<span class="check-label">IMAP</span>
|
||||||
|
<span class="check-detail">{{ imapHost }}:{{ imapPort }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="check-row" :class="smtpCheck">
|
||||||
|
<div class="check-icon">
|
||||||
|
<span v-if="smtpCheck === 'checking'" class="check-spinner" />
|
||||||
|
<span v-else-if="smtpCheck === 'ok'" class="check-ok">✓</span>
|
||||||
|
<span v-else-if="smtpCheck === 'error'" class="check-err">✗</span>
|
||||||
|
<span v-else class="check-idle" />
|
||||||
|
</div>
|
||||||
|
<div class="check-text">
|
||||||
|
<span class="check-label">SMTP</span>
|
||||||
|
<span class="check-detail">{{ smtpHost }}:{{ smtpPort }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
/* ── Overlay ──────────────────────────────────────────────── */
|
||||||
.dialog-overlay {
|
.dialog-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
background: rgba(9, 9, 14, 0.40);
|
background: rgba(9, 9, 14, 0.45);
|
||||||
backdrop-filter: blur(20px) saturate(1.6);
|
backdrop-filter: blur(20px) saturate(1.6);
|
||||||
-webkit-backdrop-filter: blur(20px) saturate(1.6);
|
-webkit-backdrop-filter: blur(20px) saturate(1.6);
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -244,9 +272,11 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
||||||
to { opacity: 1; }
|
to { opacity: 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Dialog ───────────────────────────────────────────────── */
|
||||||
.dialog {
|
.dialog {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 560px;
|
width: 520px;
|
||||||
|
max-width: 96vw;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: rgba(255, 255, 255, 0.12);
|
background: rgba(255, 255, 255, 0.12);
|
||||||
|
|
@ -264,42 +294,69 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
||||||
animation: dialog-in 280ms cubic-bezier(0.34, 1.15, 0.64, 1);
|
animation: dialog-in 280ms cubic-bezier(0.34, 1.15, 0.64, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dialog::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0; left: 0; right: 0;
|
||||||
|
height: 1px;
|
||||||
|
background: rgba(255, 255, 255, 0.20);
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes dialog-in {
|
@keyframes dialog-in {
|
||||||
from { opacity: 0; transform: scale(0.92) translateY(14px); }
|
from { opacity: 0; transform: scale(0.92) translateY(14px); }
|
||||||
to { opacity: 1; transform: scale(1) translateY(0); }
|
to { opacity: 1; transform: scale(1) translateY(0); }
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog::before {
|
/* ── Header ───────────────────────────────────────────────── */
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
height: 1px;
|
|
||||||
background: rgba(255, 255, 255, 0.15);
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dialog-header {
|
.dialog-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 22px 28px;
|
gap: 14px;
|
||||||
gap: 12px;
|
padding: 20px 24px;
|
||||||
background: linear-gradient(
|
background: linear-gradient(to bottom, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.04) 100%);
|
||||||
to bottom,
|
|
||||||
rgba(255, 255, 255, 0.10) 0%,
|
|
||||||
rgba(255, 255, 255, 0.04) 100%
|
|
||||||
);
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.10);
|
border-bottom: 1px solid rgba(255, 255, 255, 0.10);
|
||||||
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-header h2 {
|
.header-avatar {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: linear-gradient(135deg, rgba(168,230,0,0.25) 0%, rgba(168,230,0,0.12) 100%);
|
||||||
|
border: 1px solid rgba(168,230,0,0.30);
|
||||||
|
box-shadow: 0 0 14px rgba(168,230,0,0.18);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--accent);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-text {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 17px;
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-text h2 {
|
||||||
|
font-size: 16px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: -0.2px;
|
letter-spacing: -0.2px;
|
||||||
|
margin: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-sub {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
margin: 3px 0 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-btn {
|
.close-btn {
|
||||||
|
|
@ -309,38 +366,28 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
font-size: 18px;
|
|
||||||
line-height: 1;
|
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
background: rgba(255, 255, 255, 0.08);
|
background: rgba(255, 255, 255, 0.08);
|
||||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||||
box-shadow:
|
box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -1px 0 rgba(0,0,0,0.12);
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.18),
|
transition: background var(--transition-fast), color var(--transition-fast);
|
||||||
inset 0 -1px 0 rgba(0, 0, 0, 0.12);
|
|
||||||
transition:
|
|
||||||
background var(--transition-fast),
|
|
||||||
color var(--transition-fast),
|
|
||||||
box-shadow var(--transition-fast);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-btn:hover {
|
.close-btn:hover {
|
||||||
background: rgba(255, 255, 255, 0.16);
|
background: rgba(255, 255, 255, 0.16);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
box-shadow:
|
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.28),
|
|
||||||
0 2px 8px rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.close-btn:active {
|
|
||||||
background: rgba(255, 255, 255, 0.05);
|
|
||||||
box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.28);
|
|
||||||
transform: scale(0.89);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Body ─────────────────────────────────────────────────── */
|
||||||
.dialog-body {
|
.dialog-body {
|
||||||
padding: 28px;
|
padding: 24px;
|
||||||
|
max-height: calc(90vh - 90px);
|
||||||
|
overflow-y: auto;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: rgba(255,255,255,0.1) transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Notices ──────────────────────────────────────────────── */
|
||||||
.error-msg {
|
.error-msg {
|
||||||
padding: 10px 14px;
|
padding: 10px 14px;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
|
|
@ -354,82 +401,169 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
box-shadow:
|
|
||||||
inset 0 1px 0 rgba(255, 100, 100, 0.10),
|
|
||||||
0 2px 12px rgba(255, 30, 30, 0.07);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Form ─────────────────────────────────────────────────── */
|
||||||
.form-group {
|
.form-group {
|
||||||
margin-bottom: 18px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group label {
|
.form-group label:not(.checkbox-label):not(.toggle-switch) {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 11px;
|
font-size: 10px;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
color: rgba(255, 255, 255, 0.40);
|
color: rgba(255, 255, 255, 0.38);
|
||||||
margin-bottom: 7px;
|
margin-bottom: 6px;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.6px;
|
letter-spacing: 0.6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.field-hint {
|
||||||
|
font-size: 10px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
margin: 5px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
.form-group input[type="text"],
|
.form-group input[type="text"],
|
||||||
.form-group input[type="password"],
|
.form-group input[type="password"],
|
||||||
.form-group input[type="number"] {
|
.form-group input[type="number"] {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 12px 14px;
|
padding: 11px 13px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
border-radius: var(--radius-md);
|
border-radius: var(--radius-md);
|
||||||
background: rgba(0, 0, 0, 0.22);
|
background: rgba(0, 0, 0, 0.22);
|
||||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
border-top-color: rgba(0, 0, 0, 0.30);
|
border-top-color: rgba(0, 0, 0, 0.30);
|
||||||
box-shadow:
|
color: var(--text-primary);
|
||||||
inset 0 2px 6px rgba(0, 0, 0, 0.28),
|
box-shadow: inset 0 2px 6px rgba(0,0,0,0.28), 0 1px 0 rgba(255,255,255,0.07);
|
||||||
0 1px 0 rgba(255, 255, 255, 0.07);
|
transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
|
||||||
backdrop-filter: none;
|
box-sizing: border-box;
|
||||||
transition:
|
|
||||||
background var(--transition-fast),
|
|
||||||
border-color var(--transition-fast),
|
|
||||||
box-shadow var(--transition-fast);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group input[type="text"]:focus,
|
.form-group input:focus {
|
||||||
.form-group input[type="password"]:focus,
|
outline: none;
|
||||||
.form-group input[type="number"]:focus {
|
|
||||||
background: rgba(0, 0, 0, 0.28);
|
background: rgba(0, 0, 0, 0.28);
|
||||||
border-color: color-mix(in srgb, var(--accent) 50%, transparent);
|
border-color: color-mix(in srgb, var(--accent) 50%, transparent);
|
||||||
border-top-color: rgba(0, 0, 0, 0.25);
|
border-top-color: rgba(0, 0, 0, 0.25);
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 2px 6px rgba(0, 0, 0, 0.22),
|
inset 0 2px 6px rgba(0,0,0,0.22),
|
||||||
0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent),
|
0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent),
|
||||||
0 1px 0 rgba(255, 255, 255, 0.06);
|
0 1px 0 rgba(255,255,255,0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-row {
|
/* ── Section separator ────────────────────────────────────── */
|
||||||
|
.section-sep {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 12px;
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin: 18px 0 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-sep::before,
|
||||||
|
.section-sep::after {
|
||||||
|
content: '';
|
||||||
|
flex: 1;
|
||||||
|
height: 1px;
|
||||||
|
background: rgba(255, 255, 255, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-label-text {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.8px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: rgba(255, 255, 255, 0.30);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Server row ───────────────────────────────────────────── */
|
||||||
|
.server-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex-1 { flex: 1; }
|
.flex-1 { flex: 1; }
|
||||||
|
|
||||||
|
.port-group {
|
||||||
|
width: 76px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ssl-group {
|
||||||
|
width: 52px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Toggle switch ────────────────────────────────────────── */
|
||||||
|
.toggle-switch {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-switch input {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-track {
|
||||||
|
width: 36px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: rgba(255,255,255,0.12);
|
||||||
|
border: 1px solid rgba(255,255,255,0.10);
|
||||||
|
box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
|
||||||
|
transition: background var(--transition-fast), box-shadow var(--transition-fast);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-track::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 2px;
|
||||||
|
left: 2px;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(255,255,255,0.5);
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.3);
|
||||||
|
transition: transform var(--transition-fast), background var(--transition-fast);
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-switch input:checked + .toggle-track {
|
||||||
|
background: var(--accent);
|
||||||
|
border-color: color-mix(in srgb, var(--accent) 60%, rgba(0,0,0,0.5));
|
||||||
|
box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-switch input:checked + .toggle-track::after {
|
||||||
|
transform: translateX(16px);
|
||||||
|
background: var(--accent-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Checkbox ─────────────────────────────────────────────── */
|
||||||
.checkbox-label {
|
.checkbox-label {
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-transform: none !important;
|
font-size: 12px;
|
||||||
letter-spacing: 0 !important;
|
color: var(--text-secondary);
|
||||||
font-size: 12px !important;
|
|
||||||
font-weight: 400 !important;
|
|
||||||
color: var(--text-secondary) !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-label input[type="checkbox"] {
|
.checkbox-label input[type="checkbox"] {
|
||||||
appearance: none;
|
appearance: none;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
width: 16px;
|
width: 15px;
|
||||||
height: 16px;
|
height: 15px;
|
||||||
min-width: 16px;
|
min-width: 15px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
@ -437,48 +571,36 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
||||||
background: rgba(0, 0, 0, 0.22);
|
background: rgba(0, 0, 0, 0.22);
|
||||||
border: 1px solid rgba(255, 255, 255, 0.09);
|
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||||
border-top-color: rgba(0, 0, 0, 0.28);
|
border-top-color: rgba(0, 0, 0, 0.28);
|
||||||
box-shadow:
|
box-shadow: inset 0 2px 4px rgba(0,0,0,0.25);
|
||||||
inset 0 2px 4px rgba(0, 0, 0, 0.25),
|
transition: background var(--transition-fast);
|
||||||
0 1px 0 rgba(255, 255, 255, 0.07);
|
|
||||||
transition:
|
|
||||||
background var(--transition-fast),
|
|
||||||
box-shadow var(--transition-fast);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-label input[type="checkbox"]:checked {
|
.checkbox-label input[type="checkbox"]:checked {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
border-color: color-mix(in srgb, var(--accent) 60%, rgba(0,0,0,0.5));
|
border-color: color-mix(in srgb, var(--accent) 60%, rgba(0,0,0,0.5));
|
||||||
box-shadow:
|
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.35),
|
|
||||||
0 0 0 1px rgba(255, 255, 255, 0.14),
|
|
||||||
0 2px 8px color-mix(in srgb, var(--accent) 45%, transparent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-label input[type="checkbox"]:checked::after {
|
.checkbox-label input[type="checkbox"]:checked::after {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 4px;
|
left: 4px;
|
||||||
top: 2px;
|
top: 1px;
|
||||||
width: 5px;
|
width: 4px;
|
||||||
height: 8px;
|
height: 7px;
|
||||||
border: 2px solid #0d1a00;
|
border: 1.5px solid #0d1a00;
|
||||||
border-top: none;
|
border-top: none;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
transform: rotate(45deg);
|
transform: rotate(45deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox-label input[type="checkbox"]:focus-visible {
|
/* ── Submit ───────────────────────────────────────────────── */
|
||||||
outline: 2px solid var(--accent);
|
|
||||||
outline-offset: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submit-btn {
|
.submit-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 14px;
|
padding: 13px;
|
||||||
border-radius: var(--radius-md);
|
border-radius: var(--radius-md);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 15px;
|
font-size: 14px;
|
||||||
margin-top: 10px;
|
margin-top: 8px;
|
||||||
color: var(--accent-text);
|
color: var(--accent-text);
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
to bottom,
|
to bottom,
|
||||||
|
|
@ -486,14 +608,10 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
||||||
var(--accent) 100%
|
var(--accent) 100%
|
||||||
);
|
);
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.40),
|
inset 0 1px 0 rgba(255,255,255,0.40),
|
||||||
inset 0 -1px 0 rgba(0, 0, 0, 0.12),
|
inset 0 -1px 0 rgba(0,0,0,0.12),
|
||||||
0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent),
|
0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent);
|
||||||
0 1px 3px rgba(0, 0, 0, 0.25);
|
transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
|
||||||
transition:
|
|
||||||
background var(--transition-fast),
|
|
||||||
box-shadow var(--transition-fast),
|
|
||||||
transform var(--transition-fast);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.submit-btn:hover:not(:disabled) {
|
.submit-btn:hover:not(:disabled) {
|
||||||
|
|
@ -503,95 +621,76 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
||||||
var(--accent-hover) 100%
|
var(--accent-hover) 100%
|
||||||
);
|
);
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.45),
|
inset 0 1px 0 rgba(255,255,255,0.45),
|
||||||
inset 0 -1px 0 rgba(0, 0, 0, 0.10),
|
0 4px 18px color-mix(in srgb, var(--accent) 40%, transparent);
|
||||||
0 4px 18px color-mix(in srgb, var(--accent) 40%, transparent),
|
|
||||||
0 1px 4px rgba(0, 0, 0, 0.22);
|
|
||||||
transform: translateY(-1px);
|
transform: translateY(-1px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.submit-btn:active:not(:disabled) {
|
.submit-btn:active:not(:disabled) { transform: translateY(0); }
|
||||||
transform: translateY(0);
|
|
||||||
box-shadow:
|
|
||||||
inset 0 2px 5px rgba(0, 0, 0, 0.18),
|
|
||||||
0 1px 4px color-mix(in srgb, var(--accent) 20%, transparent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.submit-btn:disabled {
|
.submit-btn:disabled {
|
||||||
opacity: 0.35;
|
opacity: 0.35;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.testing-state {
|
/* ── Testing step ─────────────────────────────────────────── */
|
||||||
|
.testing-body {
|
||||||
|
padding: 32px 24px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
gap: 12px;
|
||||||
gap: 16px;
|
|
||||||
padding: 48px 20px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.spinner {
|
.check-row {
|
||||||
position: relative;
|
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spinner::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 2px solid rgba(255, 255, 255, 0.08);
|
|
||||||
}
|
|
||||||
|
|
||||||
.spinner::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 2px solid transparent;
|
|
||||||
border-top-color: var(--accent);
|
|
||||||
border-right-color: color-mix(in srgb, var(--accent) 35%, transparent);
|
|
||||||
filter: drop-shadow(0 0 4px var(--accent));
|
|
||||||
animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.smtp-section {
|
|
||||||
margin-top: 4px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
border-radius: 10px;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.10);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.smtp-toggle {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 14px;
|
||||||
padding: 10px 14px;
|
padding: 14px 16px;
|
||||||
font-size: 12px;
|
border-radius: 12px;
|
||||||
font-weight: 500;
|
background: rgba(255,255,255,0.04);
|
||||||
color: var(--text-muted);
|
border: 1px solid rgba(255,255,255,0.07);
|
||||||
background: rgba(255, 255, 255, 0.03);
|
transition: border-color var(--transition-fast), background var(--transition-fast);
|
||||||
cursor: pointer;
|
|
||||||
text-align: left;
|
|
||||||
transition: background var(--transition-fast), color var(--transition-fast);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.smtp-toggle:hover {
|
.check-row.ok { background: rgba(168,230,0,0.07); border-color: rgba(168,230,0,0.20); }
|
||||||
background: rgba(255, 255, 255, 0.07);
|
.check-row.error { background: rgba(255,85,85,0.08); border-color: rgba(255,85,85,0.22); }
|
||||||
color: var(--text-secondary);
|
|
||||||
|
.check-icon {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(255,255,255,0.07);
|
||||||
|
border: 1px solid rgba(255,255,255,0.10);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.smtp-fields {
|
.check-spinner {
|
||||||
padding: 8px 14px 12px;
|
width: 14px;
|
||||||
border-top: 1px solid rgba(255, 255, 255, 0.07);
|
height: 14px;
|
||||||
background: rgba(255, 255, 255, 0.02);
|
border-radius: 50%;
|
||||||
|
border: 2px solid rgba(255,255,255,0.15);
|
||||||
|
border-top-color: var(--accent);
|
||||||
|
animation: spin 0.7s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes spin { to { transform: rotate(360deg); } }
|
||||||
|
|
||||||
|
.check-ok { font-size: 14px; color: var(--accent); font-weight: 700; }
|
||||||
|
.check-err { font-size: 14px; color: var(--danger); font-weight: 700; }
|
||||||
|
.check-idle { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.18); }
|
||||||
|
|
||||||
|
.check-text {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
|
||||||
|
.check-detail { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,20 @@ const props = defineProps<{
|
||||||
const emit = defineEmits<{ click: [event: CalendarEvent] }>()
|
const emit = defineEmits<{ click: [event: CalendarEvent] }>()
|
||||||
|
|
||||||
const timeLabel = computed(() => {
|
const timeLabel = computed(() => {
|
||||||
if (props.event.isAllDay) return 'All day'
|
if (props.event.isAllDay) return 'Весь день'
|
||||||
const start = new Date(props.event.start)
|
const start = new Date(props.event.start)
|
||||||
const end = new Date(props.event.end)
|
const end = new Date(props.event.end)
|
||||||
return `${format(start, 'HH:mm')} – ${format(end, 'HH:mm')}`
|
return `${format(start, 'HH:mm')} – ${format(end, 'HH:mm')}`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const durationMinutes = computed(() => {
|
||||||
|
const start = new Date(props.event.start)
|
||||||
|
const end = new Date(props.event.end)
|
||||||
|
return (end.getTime() - start.getTime()) / 60_000
|
||||||
|
})
|
||||||
|
|
||||||
|
const isShort = computed(() => durationMinutes.value < 45)
|
||||||
|
|
||||||
const statusClass = computed(() => {
|
const statusClass = computed(() => {
|
||||||
if (props.event.status === 'cancelled') return 'cancelled'
|
if (props.event.status === 'cancelled') return 'cancelled'
|
||||||
if (props.event.status === 'tentative') return 'tentative'
|
if (props.event.status === 'tentative') return 'tentative'
|
||||||
|
|
@ -28,65 +36,166 @@ const statusClass = computed(() => {
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="event-block"
|
class="event-block"
|
||||||
:class="statusClass"
|
:class="[statusClass, { 'event-short': isShort }]"
|
||||||
:style="{ ...(style ?? {}), '--event-color': color ?? 'var(--accent)' }"
|
:style="{ ...(style ?? {}), '--ev-color': color ?? 'var(--accent)' }"
|
||||||
@click.stop="emit('click', event)"
|
@click.stop="emit('click', event)"
|
||||||
>
|
>
|
||||||
<div class="event-title">{{ event.title }}</div>
|
<!-- Specular highlight bar -->
|
||||||
<div class="event-time">{{ timeLabel }}</div>
|
<div class="ev-specular" />
|
||||||
<div v-if="event.location" class="event-location">{{ event.location }}</div>
|
|
||||||
|
<div class="ev-content">
|
||||||
|
<div class="ev-title">{{ event.title }}</div>
|
||||||
|
<div v-if="!isShort" class="ev-time">{{ timeLabel }}</div>
|
||||||
|
<div v-if="!isShort && event.location" class="ev-location">
|
||||||
|
<span class="ev-loc-dot">·</span>{{ event.location }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.event-block {
|
.event-block {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 2px;
|
border-radius: 8px;
|
||||||
right: 2px;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 3px 6px;
|
|
||||||
font-size: 11px;
|
|
||||||
line-height: 1.3;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
background: color-mix(in srgb, var(--event-color) 22%, transparent);
|
|
||||||
border-left: 3px solid var(--event-color);
|
|
||||||
color: var(--text-primary);
|
|
||||||
transition: filter var(--transition-fast), transform var(--transition-fast);
|
|
||||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
|
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|
||||||
|
/* Liquid glass base */
|
||||||
|
background:
|
||||||
|
linear-gradient(
|
||||||
|
135deg,
|
||||||
|
color-mix(in srgb, var(--ev-color) 28%, rgba(255,255,255,0.06)) 0%,
|
||||||
|
color-mix(in srgb, var(--ev-color) 14%, transparent) 100%
|
||||||
|
);
|
||||||
|
border: 1px solid color-mix(in srgb, var(--ev-color) 45%, transparent);
|
||||||
|
border-top-color: color-mix(in srgb, var(--ev-color) 55%, rgba(255,255,255,0.4));
|
||||||
|
backdrop-filter: blur(12px) saturate(1.6);
|
||||||
|
-webkit-backdrop-filter: blur(12px) saturate(1.6);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 color-mix(in srgb, var(--ev-color) 20%, rgba(255,255,255,0.18)),
|
||||||
|
0 2px 8px rgba(0, 0, 0, 0.30),
|
||||||
|
0 0 0 0 color-mix(in srgb, var(--ev-color) 0%, transparent);
|
||||||
|
|
||||||
|
transition:
|
||||||
|
transform 100ms ease,
|
||||||
|
box-shadow 100ms ease,
|
||||||
|
filter 100ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-block::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 3px;
|
||||||
|
background: var(--ev-color);
|
||||||
|
border-radius: 8px 0 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-block:hover {
|
.event-block:hover {
|
||||||
filter: brightness(1.15);
|
transform: scaleX(1.008) scaleY(1.005);
|
||||||
transform: scale(1.01);
|
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 color-mix(in srgb, var(--ev-color) 25%, rgba(255,255,255,0.22)),
|
||||||
|
0 4px 16px rgba(0, 0, 0, 0.40);
|
||||||
|
filter: brightness(1.10);
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-block.cancelled {
|
.event-block.cancelled {
|
||||||
opacity: 0.45;
|
opacity: 0.38;
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
|
filter: grayscale(0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-block.tentative {
|
.event-block.tentative {
|
||||||
border-left-style: dashed;
|
opacity: 0.68;
|
||||||
opacity: 0.75;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-title {
|
.event-block.tentative::before {
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
180deg,
|
||||||
|
var(--ev-color) 0px,
|
||||||
|
var(--ev-color) 4px,
|
||||||
|
transparent 4px,
|
||||||
|
transparent 8px
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Specular top highlight */
|
||||||
|
.ev-specular {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 4px;
|
||||||
|
right: 4px;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
transparent,
|
||||||
|
color-mix(in srgb, var(--ev-color) 30%, rgba(255,255,255,0.50)) 30%,
|
||||||
|
color-mix(in srgb, var(--ev-color) 30%, rgba(255,255,255,0.50)) 70%,
|
||||||
|
transparent
|
||||||
|
);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ev-content {
|
||||||
|
padding: 4px 7px 4px 11px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1px;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-short .ev-content {
|
||||||
|
padding-top: 3px;
|
||||||
|
padding-bottom: 3px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ev-title {
|
||||||
|
font-size: 11.5px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
color: var(--text-primary);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
line-height: 1.3;
|
||||||
|
letter-spacing: -0.1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-time,
|
.event-short .ev-title {
|
||||||
.event-location {
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ev-time {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
color: var(--text-secondary);
|
font-weight: 500;
|
||||||
|
color: color-mix(in srgb, var(--ev-color) 75%, rgba(255,255,255,0.6));
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ev-location {
|
||||||
|
font-size: 10px;
|
||||||
|
color: rgba(255, 255, 255, 0.42);
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
line-height: 1.3;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ev-loc-dot {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1;
|
||||||
|
color: var(--ev-color);
|
||||||
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,200 +1,560 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
import { ru } from 'date-fns/locale'
|
import { ru } from 'date-fns/locale'
|
||||||
import type { CalendarEvent } from '@shared/types/calendar'
|
import type { CalendarEvent, AttendeeInfo } from '@shared/types/calendar'
|
||||||
import AppIcon from '../AppIcon.vue'
|
import AppIcon from '../AppIcon.vue'
|
||||||
|
import { useIpc } from '../../composables/useIpc'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
event: CalendarEvent
|
event: CalendarEvent
|
||||||
|
color?: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits<{ close: [] }>()
|
const emit = defineEmits<{ close: [] }>()
|
||||||
|
|
||||||
|
// ── Date / time ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const dateLabel = computed(() => {
|
const dateLabel = computed(() => {
|
||||||
const start = new Date(props.event.start)
|
const s = new Date(props.event.start)
|
||||||
const end = new Date(props.event.end)
|
const e = new Date(props.event.end)
|
||||||
|
|
||||||
if (props.event.isAllDay) {
|
if (props.event.isAllDay) {
|
||||||
const isSameDay = start.toDateString() === end.toDateString()
|
if (s.toDateString() === e.toDateString()) return format(s, 'd MMMM yyyy', { locale: ru })
|
||||||
if (isSameDay) return format(start, 'd MMMM yyyy', { locale: ru })
|
const adj = new Date(e.getTime() - 1)
|
||||||
const endAdjusted = new Date(end.getTime() - 1) // all-day end is exclusive
|
return `${format(s, 'd MMMM', { locale: ru })} – ${format(adj, 'd MMMM yyyy', { locale: ru })}`
|
||||||
return `${format(start, 'd MMMM', { locale: ru })} – ${format(endAdjusted, 'd MMMM yyyy', { locale: ru })}`
|
|
||||||
}
|
}
|
||||||
|
if (s.toDateString() === e.toDateString()) {
|
||||||
const sameDay = start.toDateString() === end.toDateString()
|
return `${format(s, 'd MMMM yyyy', { locale: ru })}, ${format(s, 'HH:mm')} – ${format(e, 'HH:mm')}`
|
||||||
if (sameDay) {
|
|
||||||
return `${format(start, 'd MMMM yyyy, HH:mm', { locale: ru })} – ${format(end, 'HH:mm')}`
|
|
||||||
}
|
}
|
||||||
return `${format(start, 'd MMMM HH:mm', { locale: ru })} – ${format(end, 'd MMMM HH:mm yyyy', { locale: ru })}`
|
return `${format(s, 'd MMMM HH:mm', { locale: ru })} – ${format(e, 'd MMMM HH:mm yyyy', { locale: ru })}`
|
||||||
})
|
})
|
||||||
|
|
||||||
const statusLabel: Record<string, string> = {
|
const durationLabel = computed(() => {
|
||||||
confirmed: 'Подтверждено',
|
if (props.event.isAllDay) return 'Весь день'
|
||||||
tentative: 'Предварительно',
|
const mins = Math.round((new Date(props.event.end).getTime() - new Date(props.event.start).getTime()) / 60_000)
|
||||||
cancelled: 'Отменено'
|
if (mins < 60) return `${mins} мин`
|
||||||
|
const h = Math.floor(mins / 60), m = mins % 60
|
||||||
|
return m > 0 ? `${h} ч ${m} мин` : `${h} ч`
|
||||||
|
})
|
||||||
|
|
||||||
|
// ── Status ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const EVT_STATUS: Record<string, { label: string; color: string }> = {
|
||||||
|
tentative: { label: 'Под вопросом', color: '#f0a500' },
|
||||||
|
cancelled: { label: 'Отменено', color: '#ff5555' },
|
||||||
|
}
|
||||||
|
const evtStatus = computed(() =>
|
||||||
|
props.event.status && props.event.status !== 'confirmed'
|
||||||
|
? EVT_STATUS[props.event.status] ?? null : null
|
||||||
|
)
|
||||||
|
|
||||||
|
// ── Color ─────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const PALETTE = ['#a8e600','#38bdf8','#a78bfa','#f472b6','#fb923c','#4ade80','#f87171']
|
||||||
|
function hashColor(s: string): string {
|
||||||
|
let h = 0
|
||||||
|
for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) & 0xffffff
|
||||||
|
return PALETTE[Math.abs(h) % PALETTE.length]
|
||||||
|
}
|
||||||
|
const evColor = computed(() => props.color ?? hashColor(props.event.calendarId))
|
||||||
|
|
||||||
|
// ── Location ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const URL_RE = /https?:\/\/[^\s]+/g
|
||||||
|
interface Part { text: string; url: string | null }
|
||||||
|
|
||||||
|
const locationParts = computed((): Part[] => {
|
||||||
|
const loc = props.event.location
|
||||||
|
if (!loc) return []
|
||||||
|
const out: Part[] = []
|
||||||
|
let last = 0, m: RegExpExecArray | null
|
||||||
|
URL_RE.lastIndex = 0
|
||||||
|
while ((m = URL_RE.exec(loc)) !== null) {
|
||||||
|
if (m.index > last) out.push({ text: loc.slice(last, m.index), url: null })
|
||||||
|
out.push({ text: m[0], url: m[0] })
|
||||||
|
last = m.index + m[0].length
|
||||||
|
}
|
||||||
|
if (last < loc.length) out.push({ text: loc.slice(last), url: null })
|
||||||
|
return out
|
||||||
|
})
|
||||||
|
|
||||||
|
function openUrl(url: string) { window.open(url, '_blank') }
|
||||||
|
|
||||||
|
// ── People ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
interface DisplayPerson {
|
||||||
|
name: string
|
||||||
|
email: string
|
||||||
|
initials: string
|
||||||
|
color: string
|
||||||
|
}
|
||||||
|
|
||||||
|
function personFromString(raw: string): DisplayPerson {
|
||||||
|
const m = raw.match(/^(.+?)\s*<([^>]+)>$/)
|
||||||
|
if (m) {
|
||||||
|
const name = m[1].trim(), email = m[2].trim()
|
||||||
|
const parts = name.split(/\s+/)
|
||||||
|
const initials = parts.length >= 2
|
||||||
|
? (parts[0][0] + parts[parts.length - 1][0]).toUpperCase()
|
||||||
|
: name.slice(0, 2).toUpperCase()
|
||||||
|
return { name, email, initials, color: hashColor(email) }
|
||||||
|
}
|
||||||
|
const isEmail = raw.includes('@')
|
||||||
|
if (isEmail) {
|
||||||
|
const local = raw.split('@')[0]
|
||||||
|
const parts = local.replace(/[._-]/g, ' ').trim().split(/\s+/)
|
||||||
|
const initials = parts.length >= 2
|
||||||
|
? (parts[0][0] + parts[parts.length - 1][0]).toUpperCase()
|
||||||
|
: local.slice(0, 2).toUpperCase()
|
||||||
|
return { name: raw, email: raw, initials, color: hashColor(raw) }
|
||||||
|
}
|
||||||
|
return { name: raw, email: '', initials: raw.slice(0, 2).toUpperCase(), color: hashColor(raw) }
|
||||||
|
}
|
||||||
|
|
||||||
|
function personFromAttendee(a: AttendeeInfo): DisplayPerson {
|
||||||
|
const parts = a.name.split(/\s+/)
|
||||||
|
const initials = parts.length >= 2
|
||||||
|
? (parts[0][0] + parts[parts.length - 1][0]).toUpperCase()
|
||||||
|
: a.name.slice(0, 2).toUpperCase()
|
||||||
|
return { name: a.name, email: a.email, initials, color: hashColor(a.email || a.name) }
|
||||||
|
}
|
||||||
|
|
||||||
|
const organizer = computed(() => props.event.organizer ? personFromString(props.event.organizer) : null)
|
||||||
|
const attendees = computed(() => props.event.attendees)
|
||||||
|
|
||||||
|
// Avatar stack compact view
|
||||||
|
const STACK_MAX = 5
|
||||||
|
const stackSlice = computed(() => attendees.value.slice(0, STACK_MAX))
|
||||||
|
const stackExtra = computed(() => Math.max(0, attendees.value.length - STACK_MAX))
|
||||||
|
const expanded = ref(false)
|
||||||
|
|
||||||
|
function attendeesLabel(n: number) {
|
||||||
|
if (n === 1) return '1 участник'
|
||||||
|
if (n <= 4) return `${n} участника`
|
||||||
|
return `${n} участников`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attendee status config
|
||||||
|
const ATND_STATUS = {
|
||||||
|
accepted: { label: 'принял', color: '#4ade80' },
|
||||||
|
declined: { label: 'отклонил', color: '#f87171' },
|
||||||
|
tentative: { label: 'под вопросом',color: '#fbbf24' },
|
||||||
|
unknown: { label: null, color: null },
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Clipboard ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const { invoke } = useIpc()
|
||||||
|
const copiedEmail = ref<string | null>(null)
|
||||||
|
async function copyEmail(email: string) {
|
||||||
|
if (!email) return
|
||||||
|
await invoke('app:copyToClipboard', { text: email })
|
||||||
|
copiedEmail.value = email
|
||||||
|
setTimeout(() => { copiedEmail.value = null }, 1600)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="popup-backdrop" @click.self="emit('close')">
|
<div class="backdrop" @click.self="emit('close')">
|
||||||
<div class="popup">
|
<div class="popup" :style="{ '--ev': evColor }">
|
||||||
<div class="popup-header">
|
|
||||||
<h3 class="popup-title">{{ event.title }}</h3>
|
<!-- top specular line -->
|
||||||
|
<div class="specular" />
|
||||||
|
|
||||||
|
<!-- ─── Hero ─────────────────────────────────────────────────────── -->
|
||||||
|
<div class="hero">
|
||||||
|
<div class="hero-wash" />
|
||||||
|
|
||||||
<button class="close-btn" @click="emit('close')">
|
<button class="close-btn" @click="emit('close')">
|
||||||
<AppIcon name="close" :size="14" />
|
<AppIcon name="close" :size="10" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div v-if="evtStatus" class="evt-badge" :style="{ '--sc': evtStatus.color }">
|
||||||
|
<span class="evt-pip" />{{ evtStatus.label }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 class="hero-title">{{ event.title }}</h2>
|
||||||
|
|
||||||
|
<div class="hero-sub">
|
||||||
|
<span class="hero-date">{{ dateLabel }}</span>
|
||||||
|
<span class="hero-bull">·</span>
|
||||||
|
<span class="hero-dur">{{ durationLabel }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ─── Body ─────────────────────────────────────────────────────── -->
|
||||||
|
<div class="body">
|
||||||
|
|
||||||
|
<!-- Location -->
|
||||||
|
<div v-if="event.location" class="card row-card">
|
||||||
|
<div class="row-icon"><AppIcon name="location" :size="13" /></div>
|
||||||
|
<div class="row-content">
|
||||||
|
<div class="row-label">Место проведения</div>
|
||||||
|
<p class="row-value selectable">
|
||||||
|
<template v-for="(p, i) in locationParts" :key="i">
|
||||||
|
<a v-if="p.url" class="loc-link" :href="p.url" @click.prevent="openUrl(p.url!)">{{ p.text }}</a>
|
||||||
|
<span v-else>{{ p.text }}</span>
|
||||||
|
</template>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- People card -->
|
||||||
|
<div v-if="organizer || attendees.length > 0" class="card people-card">
|
||||||
|
|
||||||
|
<!-- Organizer -->
|
||||||
|
<div v-if="organizer" class="pgroup">
|
||||||
|
<div class="pgroup-head">
|
||||||
|
<AppIcon name="person" :size="11" />
|
||||||
|
Организатор
|
||||||
|
</div>
|
||||||
|
<div class="prow">
|
||||||
|
<div class="ava-wrap">
|
||||||
|
<div class="ava" :style="{ '--ac': organizer.color }">{{ organizer.initials }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="ptext">
|
||||||
|
<span class="pname">{{ organizer.name }}</span>
|
||||||
|
<span v-if="organizer.email && organizer.email !== organizer.name" class="pemail">{{ organizer.email }}</span>
|
||||||
|
</div>
|
||||||
|
<button v-if="organizer.email" class="copy-btn" :class="{ ok: copiedEmail === organizer.email }" @click="copyEmail(organizer.email)">
|
||||||
|
<AppIcon :name="copiedEmail === organizer.email ? 'check' : 'copy'" :size="11" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="organizer && attendees.length > 0" class="psep" />
|
||||||
|
|
||||||
|
<!-- Attendees -->
|
||||||
|
<div v-if="attendees.length > 0" class="pgroup">
|
||||||
|
<div class="pgroup-head">
|
||||||
|
<AppIcon name="people" :size="11" />
|
||||||
|
{{ attendeesLabel(attendees.length) }}
|
||||||
|
<button class="chevron-btn" :class="{ open: expanded }" @click="expanded = !expanded">
|
||||||
|
<AppIcon name="chevron-right" :size="12" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="popup-body">
|
<!-- Compact: overlapping avatar stack -->
|
||||||
<div class="meta-row">
|
<div v-if="!expanded" class="avatar-stack">
|
||||||
<span class="meta-icon">📅</span>
|
<div
|
||||||
<span>{{ dateLabel }}</span>
|
v-for="a in stackSlice"
|
||||||
|
:key="a.email || a.name"
|
||||||
|
class="ava stack-ava"
|
||||||
|
:style="{ '--ac': personFromAttendee(a).color }"
|
||||||
|
:title="a.email ? `${a.name} · ${a.email}` : a.name"
|
||||||
|
>{{ personFromAttendee(a).initials }}</div>
|
||||||
|
<div v-if="stackExtra > 0" class="ava stack-ava stack-more">+{{ stackExtra }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="event.status && event.status !== 'confirmed'" class="meta-row status" :class="event.status">
|
<!-- Expanded: full list -->
|
||||||
<span class="meta-icon">●</span>
|
<div v-else class="plist">
|
||||||
<span>{{ statusLabel[event.status] ?? event.status }}</span>
|
<div v-for="a in attendees" :key="a.email || a.name" class="prow">
|
||||||
|
<div class="ava-wrap">
|
||||||
|
<div class="ava" :style="{ '--ac': personFromAttendee(a).color }">{{ personFromAttendee(a).initials }}</div>
|
||||||
|
<!-- Status dot -->
|
||||||
|
<div
|
||||||
|
v-if="ATND_STATUS[a.status].color"
|
||||||
|
class="ava-status-dot"
|
||||||
|
:style="{ background: ATND_STATUS[a.status].color }"
|
||||||
|
:title="ATND_STATUS[a.status].label ?? ''"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ptext">
|
||||||
<div v-if="event.location" class="meta-row">
|
<div class="pname-row">
|
||||||
<span class="meta-icon">📍</span>
|
<span class="pname">{{ a.name }}</span>
|
||||||
<span>{{ event.location }}</span>
|
<span v-if="!a.required" class="optional-tag">необязательный</span>
|
||||||
|
</div>
|
||||||
|
<span v-if="a.email && a.email !== a.name" class="pemail">{{ a.email }}</span>
|
||||||
|
</div>
|
||||||
|
<button v-if="a.email" class="copy-btn" :class="{ ok: copiedEmail === a.email }" @click="copyEmail(a.email)">
|
||||||
|
<AppIcon :name="copiedEmail === a.email ? 'check' : 'copy'" :size="11" />
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="event.organizer" class="meta-row">
|
|
||||||
<span class="meta-icon">👤</span>
|
|
||||||
<span>{{ event.organizer }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="event.attendees.length > 0" class="meta-row attendees">
|
|
||||||
<span class="meta-icon">👥</span>
|
|
||||||
<div class="attendee-list">
|
|
||||||
<span v-for="a in event.attendees" :key="a" class="attendee-chip">{{ a }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="event.description" class="description">
|
<!-- Description -->
|
||||||
{{ event.description }}
|
<div v-if="event.description" class="card desc-card">
|
||||||
|
<p class="desc-text selectable">{{ event.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.popup-backdrop {
|
/* ── Backdrop ─────────────────────────────────────────────────────────────── */
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
.backdrop {
|
||||||
z-index: 100;
|
position: fixed; inset: 0; z-index: 100;
|
||||||
display: flex;
|
display: flex; align-items: center; justify-content: center;
|
||||||
align-items: center;
|
background: rgba(0,0,0,0.38);
|
||||||
justify-content: center;
|
backdrop-filter: blur(10px) brightness(0.82);
|
||||||
background: rgba(0, 0, 0, 0.45);
|
-webkit-backdrop-filter: blur(10px) brightness(0.82);
|
||||||
backdrop-filter: blur(4px);
|
animation: fade-in 170ms ease;
|
||||||
}
|
}
|
||||||
|
@keyframes fade-in { from { opacity:0 } to { opacity:1 } }
|
||||||
|
|
||||||
|
/* ── Popup ────────────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
.popup {
|
.popup {
|
||||||
width: 400px;
|
position: relative;
|
||||||
max-width: 90vw;
|
width: 460px; max-width: 94vw; max-height: 86vh;
|
||||||
max-height: 80vh;
|
overflow-y: auto; overflow-x: hidden;
|
||||||
overflow-y: auto;
|
border-radius: 24px;
|
||||||
border-radius: var(--radius-xl);
|
isolation: isolate;
|
||||||
border: 1px solid var(--glass-border-strong);
|
|
||||||
background:
|
background: rgba(13,12,23,0.64);
|
||||||
linear-gradient(160deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.03) 100%),
|
backdrop-filter: blur(72px) saturate(2.8);
|
||||||
rgba(14, 14, 22, 0.94);
|
-webkit-backdrop-filter: blur(72px) saturate(2.8);
|
||||||
backdrop-filter: blur(48px) saturate(2);
|
|
||||||
|
border: 1px solid rgba(255,255,255,0.12);
|
||||||
|
border-top-color: rgba(255,255,255,0.24);
|
||||||
|
border-bottom-color: rgba(255,255,255,0.05);
|
||||||
|
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 1px 0 rgba(255,255,255,0.14),
|
0 0 0 0.5px rgba(0,0,0,0.55),
|
||||||
var(--shadow-xl);
|
0 4px 16px rgba(0,0,0,0.35),
|
||||||
padding: 20px;
|
0 20px 52px rgba(0,0,0,0.50),
|
||||||
|
0 56px 96px rgba(0,0,0,0.30),
|
||||||
|
inset 0 1.5px 0 rgba(255,255,255,0.26),
|
||||||
|
inset 0 -1px 0 rgba(0,0,0,0.20);
|
||||||
|
|
||||||
|
animation: pop-in 230ms cubic-bezier(0.34,1.45,0.64,1);
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: rgba(255,255,255,0.08) transparent;
|
||||||
|
}
|
||||||
|
.popup::-webkit-scrollbar { width: 4px }
|
||||||
|
.popup::-webkit-scrollbar-track { background: transparent }
|
||||||
|
.popup::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px }
|
||||||
|
|
||||||
|
@keyframes pop-in {
|
||||||
|
from { opacity:0; transform: scale(0.90) translateY(14px) }
|
||||||
|
to { opacity:1; transform: scale(1) translateY(0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-header {
|
.specular {
|
||||||
display: flex;
|
position: absolute; top:0; left:14px; right:14px; height:1px;
|
||||||
align-items: flex-start;
|
pointer-events: none; z-index: 10;
|
||||||
gap: 8px;
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.62) 28%, rgba(255,255,255,0.62) 72%, transparent);
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-title {
|
/* ── Hero ─────────────────────────────────────────────────────────────────── */
|
||||||
flex: 1;
|
|
||||||
font-size: 16px;
|
.hero {
|
||||||
font-weight: 600;
|
position: relative;
|
||||||
line-height: 1.3;
|
padding: 22px 22px 24px;
|
||||||
color: var(--text-primary);
|
overflow: hidden;
|
||||||
margin: 0;
|
}
|
||||||
|
.hero-wash {
|
||||||
|
position: absolute; inset: 0; pointer-events: none;
|
||||||
|
background: radial-gradient(
|
||||||
|
ellipse 120% 140% at 0% 0%,
|
||||||
|
color-mix(in srgb, var(--ev) 34%, rgba(255,255,255,0.06)) 0%,
|
||||||
|
color-mix(in srgb, var(--ev) 12%, transparent) 52%,
|
||||||
|
transparent 100%
|
||||||
|
);
|
||||||
|
}
|
||||||
|
.hero::after {
|
||||||
|
content:''; position:absolute; bottom:0; left:16px; right:16px; height:1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10) 25%, rgba(255,255,255,0.10) 75%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-btn {
|
.close-btn {
|
||||||
flex-shrink: 0;
|
position: absolute; top:16px; right:16px;
|
||||||
width: 24px;
|
width:26px; height:26px; border-radius:50%;
|
||||||
height: 24px;
|
display:flex; align-items:center; justify-content:center;
|
||||||
border-radius: 50%;
|
background: rgba(255,255,255,0.08);
|
||||||
display: flex;
|
border: 1px solid rgba(255,255,255,0.11);
|
||||||
align-items: center;
|
color: rgba(255,255,255,0.38);
|
||||||
justify-content: center;
|
transition: background 120ms, color 120ms;
|
||||||
color: var(--text-muted);
|
z-index: 2;
|
||||||
background: var(--glass-bg);
|
}
|
||||||
border: 1px solid var(--glass-border);
|
.close-btn:hover { background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.75) }
|
||||||
transition: background var(--transition-fast), color var(--transition-fast);
|
|
||||||
|
.evt-badge {
|
||||||
|
display: inline-flex; align-items: center; gap: 5px;
|
||||||
|
padding: 3px 10px 3px 7px; border-radius: 100px; margin-bottom: 10px;
|
||||||
|
background: color-mix(in srgb, var(--sc) 14%, rgba(255,255,255,0.03));
|
||||||
|
border: 1px solid color-mix(in srgb, var(--sc) 24%, rgba(255,255,255,0.05));
|
||||||
|
color: var(--sc); font-size: 11px; font-weight: 600;
|
||||||
|
position: relative; z-index: 1;
|
||||||
|
}
|
||||||
|
.evt-pip { width:6px; height:6px; border-radius:50%; background:currentColor }
|
||||||
|
|
||||||
|
.hero-title {
|
||||||
|
margin: 0 32px 10px 0;
|
||||||
|
font-size: 20px; font-weight: 650;
|
||||||
|
line-height: 1.25; letter-spacing: -0.45px;
|
||||||
|
color: #fff; position: relative; z-index:1; word-break: break-word;
|
||||||
|
}
|
||||||
|
.hero-sub { display:flex; align-items:center; gap:6px; position:relative; z-index:1 }
|
||||||
|
.hero-date { font-size:13px; color:rgba(255,255,255,0.72) }
|
||||||
|
.hero-bull { font-size:12px; color:rgba(255,255,255,0.26) }
|
||||||
|
.hero-dur { font-size:13px; color:rgba(255,255,255,0.40) }
|
||||||
|
|
||||||
|
/* ── Body ─────────────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.body { padding:14px 14px 18px; display:flex; flex-direction:column; gap:8px }
|
||||||
|
|
||||||
|
/* ── Cards ────────────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: rgba(255,255,255,0.048);
|
||||||
|
border: 1px solid rgba(255,255,255,0.085);
|
||||||
|
border-top-color: rgba(255,255,255,0.130);
|
||||||
|
border-radius: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-btn:hover {
|
/* Row card (location) */
|
||||||
background: var(--glass-bg-hover);
|
.row-card { display:flex; gap:11px; padding:13px 14px }
|
||||||
color: var(--text-secondary);
|
|
||||||
|
.row-icon {
|
||||||
|
width:30px; height:30px; border-radius:9px; flex-shrink:0;
|
||||||
|
background: rgba(255,255,255,0.07);
|
||||||
|
border: 1px solid rgba(255,255,255,0.09);
|
||||||
|
border-top-color: rgba(255,255,255,0.14);
|
||||||
|
display:flex; align-items:center; justify-content:center;
|
||||||
|
color: rgba(255,255,255,0.38);
|
||||||
|
}
|
||||||
|
.row-content { flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; justify-content:center }
|
||||||
|
.row-label { font-size:10px; font-weight:600; letter-spacing:0.6px; text-transform:uppercase; color:rgba(255,255,255,0.30) }
|
||||||
|
.row-value { font-size:13px; color:rgba(255,255,255,0.82); line-height:1.5; margin:0; word-break:break-word }
|
||||||
|
|
||||||
|
.selectable { user-select:text; -webkit-user-select:text; cursor:text }
|
||||||
|
|
||||||
|
.loc-link {
|
||||||
|
color: color-mix(in srgb, var(--ev) 80%, rgba(255,255,255,0.30));
|
||||||
|
text-decoration: underline;
|
||||||
|
text-decoration-color: color-mix(in srgb, var(--ev) 38%, transparent);
|
||||||
|
text-underline-offset: 2px; cursor:pointer; transition: color 120ms, text-decoration-color 120ms;
|
||||||
|
}
|
||||||
|
.loc-link:hover { color: var(--ev); text-decoration-color: color-mix(in srgb, var(--ev) 65%, transparent) }
|
||||||
|
|
||||||
|
/* ── People card ──────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.people-card { display:flex; flex-direction:column; overflow:hidden }
|
||||||
|
|
||||||
|
.pgroup { padding:13px 14px }
|
||||||
|
|
||||||
|
.psep {
|
||||||
|
height:1px; margin:0 14px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07) 20%, rgba(255,255,255,0.07) 80%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-body {
|
.pgroup-head {
|
||||||
display: flex;
|
display:flex; align-items:center; gap:5px; margin-bottom:10px;
|
||||||
flex-direction: column;
|
font-size:10px; font-weight:600; letter-spacing:0.6px; text-transform:uppercase;
|
||||||
gap: 10px;
|
color: rgba(255,255,255,0.30);
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-row {
|
/* Chevron toggle button */
|
||||||
display: flex;
|
.chevron-btn {
|
||||||
align-items: flex-start;
|
margin-left:auto; width:26px; height:26px; border-radius:8px;
|
||||||
gap: 8px;
|
display:flex; align-items:center; justify-content:center;
|
||||||
font-size: 13px;
|
background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.10);
|
||||||
color: var(--text-secondary);
|
color: rgba(255,255,255,0.45); transition: background 120ms, color 120ms;
|
||||||
|
}
|
||||||
|
.chevron-btn:hover { background: rgba(255,255,255,0.13); color: rgba(255,255,255,0.75) }
|
||||||
|
.chevron-btn > :deep(svg) {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
transition: transform 220ms cubic-bezier(0.34,1.2,0.64,1);
|
||||||
|
}
|
||||||
|
.chevron-btn.open > :deep(svg) { transform: rotate(-90deg) }
|
||||||
|
|
||||||
|
/* ── Avatar ───────────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
/* Opaque avatar background — dark base + tint, no transparency leakage */
|
||||||
|
.ava {
|
||||||
|
width:28px; height:28px; border-radius:50%; flex-shrink:0;
|
||||||
|
display:flex; align-items:center; justify-content:center;
|
||||||
|
font-size:10px; font-weight:700; letter-spacing:0.2px;
|
||||||
|
background: color-mix(in srgb, var(--ac) 24%, rgb(18,17,32));
|
||||||
|
border: 1.5px solid color-mix(in srgb, var(--ac) 36%, rgba(255,255,255,0.08));
|
||||||
|
color: color-mix(in srgb, var(--ac) 90%, white 10%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-icon {
|
/* Wrapper for avatar + status dot */
|
||||||
flex-shrink: 0;
|
.ava-wrap { position:relative; flex-shrink:0 }
|
||||||
font-size: 14px;
|
|
||||||
line-height: 1.4;
|
.ava-status-dot {
|
||||||
|
position:absolute; bottom:-1px; right:-1px;
|
||||||
|
width:9px; height:9px; border-radius:50%;
|
||||||
|
/* Gap ring matching the approximate card background color */
|
||||||
|
box-shadow: 0 0 0 1.5px rgb(22,21,36);
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-row.tentative { color: var(--warning); }
|
/* ── Avatar stack ─────────────────────────────────────────────────────────── */
|
||||||
.meta-row.cancelled { color: var(--danger); }
|
|
||||||
|
|
||||||
.attendees {
|
.avatar-stack { display:flex; align-items:center; padding:2px 0 }
|
||||||
align-items: flex-start;
|
|
||||||
|
.stack-ava {
|
||||||
|
width:30px; height:30px; font-size:10.5px;
|
||||||
|
margin-left:-9px;
|
||||||
|
/* Solid gap ring — matches approximate popup card background */
|
||||||
|
box-shadow: 0 0 0 2px rgb(22,21,36);
|
||||||
|
position:relative;
|
||||||
|
cursor:default;
|
||||||
|
}
|
||||||
|
.stack-ava:first-child { margin-left:0 }
|
||||||
|
|
||||||
|
.stack-more {
|
||||||
|
background: rgb(30,29,46);
|
||||||
|
border-color: rgba(255,255,255,0.12);
|
||||||
|
color: rgba(255,255,255,0.50);
|
||||||
|
font-size:10px; letter-spacing:-0.3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.attendee-list {
|
/* ── Person row ───────────────────────────────────────────────────────────── */
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
.prow { display:flex; align-items:center; gap:9px; padding:3px 0; border-radius:10px }
|
||||||
gap: 4px;
|
|
||||||
|
.plist { display:flex; flex-direction:column; gap:1px }
|
||||||
|
.plist .prow {
|
||||||
|
padding:4px 6px; margin:0 -6px;
|
||||||
|
transition: background 110ms;
|
||||||
|
}
|
||||||
|
.plist .prow:hover { background: rgba(255,255,255,0.05) }
|
||||||
|
|
||||||
|
.ptext { flex:1; min-width:0; display:flex; flex-direction:column; gap:1px }
|
||||||
|
|
||||||
|
.pname-row { display:flex; align-items:center; gap:5px; min-width:0 }
|
||||||
|
|
||||||
|
.pname {
|
||||||
|
font-size:13px; color:rgba(255,255,255,0.82); line-height:1.3;
|
||||||
|
overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.attendee-chip {
|
.optional-tag {
|
||||||
font-size: 11px;
|
font-size:10px; color:rgba(255,255,255,0.28); font-weight:500;
|
||||||
padding: 2px 8px;
|
background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.09);
|
||||||
border-radius: var(--radius-full);
|
border-radius:4px; padding:0 5px; white-space:nowrap; flex-shrink:0;
|
||||||
background: var(--glass-bg-raised);
|
|
||||||
border: 1px solid var(--glass-border);
|
|
||||||
color: var(--text-secondary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.description {
|
.pemail {
|
||||||
font-size: 13px;
|
font-size:11px; color:rgba(255,255,255,0.30); line-height:1.3;
|
||||||
color: var(--text-secondary);
|
overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
|
||||||
white-space: pre-wrap;
|
}
|
||||||
line-height: 1.5;
|
|
||||||
border-top: 1px solid var(--glass-border);
|
/* Copy button — appears on row hover */
|
||||||
padding-top: 10px;
|
.copy-btn {
|
||||||
margin-top: 4px;
|
flex-shrink:0; width:24px; height:24px; border-radius:7px;
|
||||||
|
display:flex; align-items:center; justify-content:center;
|
||||||
|
background:transparent; border:1px solid transparent;
|
||||||
|
color:rgba(255,255,255,0.24); opacity:0;
|
||||||
|
transition: opacity 120ms, background 120ms, color 120ms, border-color 120ms;
|
||||||
|
}
|
||||||
|
.prow:hover .copy-btn { opacity:1 }
|
||||||
|
.copy-btn:hover { background:rgba(255,255,255,0.09); border-color:rgba(255,255,255,0.10); color:rgba(255,255,255,0.62) }
|
||||||
|
.copy-btn.ok { opacity:1; color:#4ade80; background:rgba(74,222,128,0.10); border-color:rgba(74,222,128,0.22) }
|
||||||
|
|
||||||
|
/* ── Description ──────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.desc-card { padding:16px }
|
||||||
|
.desc-text {
|
||||||
|
font-size:13px; color:rgba(255,255,255,0.52); white-space:pre-wrap;
|
||||||
|
line-height:1.7; margin:0; word-break:break-word;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
368
src/renderer/src/components/calendar/MiniCalendar.vue
Normal file
368
src/renderer/src/components/calendar/MiniCalendar.vue
Normal file
|
|
@ -0,0 +1,368 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed } from 'vue'
|
||||||
|
import {
|
||||||
|
startOfMonth,
|
||||||
|
endOfMonth,
|
||||||
|
startOfWeek,
|
||||||
|
endOfWeek,
|
||||||
|
addDays,
|
||||||
|
addMonths,
|
||||||
|
subMonths,
|
||||||
|
isSameMonth,
|
||||||
|
isSameDay,
|
||||||
|
isToday,
|
||||||
|
isWithinInterval
|
||||||
|
} from 'date-fns'
|
||||||
|
import { ru } from 'date-fns/locale'
|
||||||
|
import { format } from 'date-fns'
|
||||||
|
import AppIcon from '../AppIcon.vue'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
selectedWeekStart: Date
|
||||||
|
selectedWeekEnd: Date
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{ dayClick: [date: Date] }>()
|
||||||
|
|
||||||
|
const viewMonth = ref(startOfMonth(props.selectedWeekStart))
|
||||||
|
|
||||||
|
const monthLabel = computed(() => format(viewMonth.value, 'LLLL yyyy', { locale: ru }))
|
||||||
|
|
||||||
|
const DOW_LABELS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс']
|
||||||
|
|
||||||
|
/** Build 6-week grid starting from Monday */
|
||||||
|
const grid = computed((): Date[] => {
|
||||||
|
const monthStart = startOfMonth(viewMonth.value)
|
||||||
|
const gridStart = startOfWeek(monthStart, { weekStartsOn: 1 })
|
||||||
|
const monthEnd = endOfMonth(viewMonth.value)
|
||||||
|
const gridEnd = endOfWeek(monthEnd, { weekStartsOn: 1 })
|
||||||
|
const days: Date[] = []
|
||||||
|
let cur = gridStart
|
||||||
|
while (cur <= gridEnd) {
|
||||||
|
days.push(cur)
|
||||||
|
cur = addDays(cur, 1)
|
||||||
|
}
|
||||||
|
return days
|
||||||
|
})
|
||||||
|
|
||||||
|
function isSelected(d: Date): boolean {
|
||||||
|
return isWithinInterval(d, { start: props.selectedWeekStart, end: props.selectedWeekEnd })
|
||||||
|
}
|
||||||
|
|
||||||
|
function isWeekStart(d: Date): boolean {
|
||||||
|
return isSameDay(d, props.selectedWeekStart)
|
||||||
|
}
|
||||||
|
|
||||||
|
function isWeekEnd(d: Date): boolean {
|
||||||
|
return isSameDay(d, props.selectedWeekEnd)
|
||||||
|
}
|
||||||
|
|
||||||
|
function prevMonth(): void {
|
||||||
|
viewMonth.value = subMonths(viewMonth.value, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextMonth(): void {
|
||||||
|
viewMonth.value = addMonths(viewMonth.value, 1)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mini-cal">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="mini-header">
|
||||||
|
<button class="mini-nav" @click="prevMonth">
|
||||||
|
<AppIcon name="chevron-right" :size="10" style="transform: rotate(180deg)" />
|
||||||
|
</button>
|
||||||
|
<span class="mini-month">{{ monthLabel }}</span>
|
||||||
|
<button class="mini-nav" @click="nextMonth">
|
||||||
|
<AppIcon name="chevron-right" :size="10" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Day-of-week labels -->
|
||||||
|
<div class="dow-row">
|
||||||
|
<span v-for="d in DOW_LABELS" :key="d" class="dow">{{ d }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Day grid -->
|
||||||
|
<div class="day-grid">
|
||||||
|
<button
|
||||||
|
v-for="(day, i) in grid"
|
||||||
|
:key="i"
|
||||||
|
class="day-cell"
|
||||||
|
:class="{
|
||||||
|
'other-month': !isSameMonth(day, viewMonth),
|
||||||
|
'is-today': isToday(day),
|
||||||
|
'in-range': isSelected(day),
|
||||||
|
'range-start': isWeekStart(day),
|
||||||
|
'range-end': isWeekEnd(day)
|
||||||
|
}"
|
||||||
|
@click="emit('dayClick', day)"
|
||||||
|
>
|
||||||
|
<span class="day-inner">{{ format(day, 'd') }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* ── Container ──────────────────────────────────────────────────────────── */
|
||||||
|
.mini-cal {
|
||||||
|
padding: 12px 8px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: linear-gradient(
|
||||||
|
160deg,
|
||||||
|
rgba(255, 255, 255, 0.045) 0%,
|
||||||
|
rgba(255, 255, 255, 0.018) 100%
|
||||||
|
);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.10),
|
||||||
|
0 4px 24px rgba(0, 0, 0, 0.28),
|
||||||
|
0 1px 6px rgba(0, 0, 0, 0.20);
|
||||||
|
backdrop-filter: blur(24px) saturate(1.6);
|
||||||
|
-webkit-backdrop-filter: blur(24px) saturate(1.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Header ─────────────────────────────────────────────────────────────── */
|
||||||
|
.mini-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 0 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-month {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-primary);
|
||||||
|
text-transform: capitalize;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
/* subtle text glow */
|
||||||
|
text-shadow: 0 0 20px rgba(255, 255, 255, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-nav {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
border-radius: 7px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
color: rgba(255, 255, 255, 0.4);
|
||||||
|
background: linear-gradient(
|
||||||
|
150deg,
|
||||||
|
rgba(255, 255, 255, 0.07) 0%,
|
||||||
|
rgba(255, 255, 255, 0.03) 100%
|
||||||
|
);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.10);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.12),
|
||||||
|
0 2px 4px rgba(0, 0, 0, 0.25);
|
||||||
|
transition:
|
||||||
|
background 150ms ease,
|
||||||
|
color 150ms ease,
|
||||||
|
border-color 150ms ease,
|
||||||
|
box-shadow 150ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-nav:hover {
|
||||||
|
background: linear-gradient(
|
||||||
|
150deg,
|
||||||
|
rgba(255, 255, 255, 0.13) 0%,
|
||||||
|
rgba(255, 255, 255, 0.06) 100%
|
||||||
|
);
|
||||||
|
border-color: rgba(255, 255, 255, 0.18);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.22),
|
||||||
|
0 2px 8px rgba(0, 0, 0, 0.35);
|
||||||
|
color: rgba(255, 255, 255, 0.75);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-nav:active {
|
||||||
|
background: rgba(255, 255, 255, 0.04);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 3px rgba(0, 0, 0, 0.3),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.06);
|
||||||
|
color: rgba(255, 255, 255, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Day-of-week labels ──────────────────────────────────────────────────── */
|
||||||
|
.dow-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(7, 1fr);
|
||||||
|
margin-bottom: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dow {
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-align: center;
|
||||||
|
color: rgba(255, 255, 255, 0.28);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
padding: 1px 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Day grid ────────────────────────────────────────────────────────────── */
|
||||||
|
.day-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(7, 1fr);
|
||||||
|
row-gap: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Each cell is position:relative so the range strip can be absolutely placed */
|
||||||
|
.day-cell {
|
||||||
|
position: relative;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The visible number circle */
|
||||||
|
.day-inner {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 78%;
|
||||||
|
height: 78%;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: rgba(255, 255, 255, 0.55);
|
||||||
|
border-radius: 50%;
|
||||||
|
transition:
|
||||||
|
background 140ms ease,
|
||||||
|
color 140ms ease,
|
||||||
|
box-shadow 140ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.day-cell:hover:not(.in-range) .day-inner {
|
||||||
|
background: linear-gradient(
|
||||||
|
160deg,
|
||||||
|
rgba(255, 255, 255, 0.10) 0%,
|
||||||
|
rgba(255, 255, 255, 0.05) 100%
|
||||||
|
);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.14),
|
||||||
|
0 1px 4px rgba(0, 0, 0, 0.25);
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Other-month days ───────────────────────────────────────────────────── */
|
||||||
|
.day-cell.other-month .day-inner {
|
||||||
|
color: rgba(255, 255, 255, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Today ──────────────────────────────────────────────────────────────── */
|
||||||
|
.day-cell.is-today:not(.in-range) .day-inner {
|
||||||
|
color: var(--accent);
|
||||||
|
font-weight: 700;
|
||||||
|
background: linear-gradient(
|
||||||
|
160deg,
|
||||||
|
rgba(168, 230, 0, 0.18) 0%,
|
||||||
|
rgba(168, 230, 0, 0.08) 100%
|
||||||
|
);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(168, 230, 0, 0.30),
|
||||||
|
0 0 0 1px rgba(168, 230, 0, 0.22),
|
||||||
|
0 2px 8px rgba(168, 230, 0, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Week range strip ────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
/*
|
||||||
|
Strip strategy:
|
||||||
|
- middle days → full-width glass band
|
||||||
|
- range-start → band covers right half only (circle sits over center)
|
||||||
|
- range-end → band covers left half only
|
||||||
|
- start==end → no band, just circle
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Shared strip base */
|
||||||
|
.day-cell.in-range:not(.range-start):not(.range-end)::before,
|
||||||
|
.day-cell.range-start:not(.range-end)::before,
|
||||||
|
.day-cell.range-end:not(.range-start)::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 11%; bottom: 11%;
|
||||||
|
z-index: 1;
|
||||||
|
background: linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
rgba(168, 230, 0, 0.16) 0%,
|
||||||
|
rgba(168, 230, 0, 0.09) 50%,
|
||||||
|
rgba(168, 230, 0, 0.13) 100%
|
||||||
|
);
|
||||||
|
border-top: 1px solid rgba(168, 230, 0, 0.22);
|
||||||
|
border-bottom: 1px solid rgba(168, 230, 0, 0.10);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Full-width for middle */
|
||||||
|
.day-cell.in-range:not(.range-start):not(.range-end)::before {
|
||||||
|
left: 0; right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Right half for start */
|
||||||
|
.day-cell.range-start:not(.range-end)::before {
|
||||||
|
left: 50%; right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Left half for end */
|
||||||
|
.day-cell.range-end:not(.range-start)::before {
|
||||||
|
left: 0; right: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Number color for mid-range days */
|
||||||
|
.day-cell.in-range:not(.range-start):not(.range-end) .day-inner {
|
||||||
|
color: rgba(168, 230, 0, 0.70);
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Glass accent circle for start and end */
|
||||||
|
.day-cell.range-start .day-inner,
|
||||||
|
.day-cell.range-end .day-inner {
|
||||||
|
background: linear-gradient(
|
||||||
|
150deg,
|
||||||
|
rgba(168, 230, 0, 0.92) 0%,
|
||||||
|
rgba(120, 185, 0, 0.78) 100%
|
||||||
|
);
|
||||||
|
color: rgba(8, 10, 4, 0.88);
|
||||||
|
font-weight: 700;
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.40),
|
||||||
|
inset 0 -1px 0 rgba(0, 0, 0, 0.15),
|
||||||
|
0 2px 12px rgba(168, 230, 0, 0.30),
|
||||||
|
0 0 0 1px rgba(168, 230, 0, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Today inside selected range (not endpoint) */
|
||||||
|
.day-cell.is-today.in-range:not(.range-start):not(.range-end) .day-inner {
|
||||||
|
color: var(--accent);
|
||||||
|
font-weight: 700;
|
||||||
|
background: rgba(168, 230, 0, 0.12);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(168, 230, 0, 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Today that is also a range endpoint */
|
||||||
|
.day-cell.is-today.range-start .day-inner,
|
||||||
|
.day-cell.is-today.range-end .day-inner {
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.42),
|
||||||
|
inset 0 -1px 0 rgba(0, 0, 0, 0.15),
|
||||||
|
0 2px 14px rgba(168, 230, 0, 0.45),
|
||||||
|
0 0 0 1px rgba(168, 230, 0, 0.30);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted, watch } from 'vue'
|
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
|
||||||
import { format, addDays, isSameDay, isToday } from 'date-fns'
|
import { format, addDays, isSameDay, isToday } from 'date-fns'
|
||||||
import { ru } from 'date-fns/locale'
|
import { ru } from 'date-fns/locale'
|
||||||
import EventBlock from './EventBlock.vue'
|
import EventBlock from './EventBlock.vue'
|
||||||
|
|
@ -9,12 +9,13 @@ const props = defineProps<{
|
||||||
weekStart: Date
|
weekStart: Date
|
||||||
events: CalendarEvent[]
|
events: CalendarEvent[]
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
|
calendarColors?: Record<string, string>
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits<{ eventClick: [event: CalendarEvent] }>()
|
const emit = defineEmits<{ eventClick: [event: CalendarEvent] }>()
|
||||||
|
|
||||||
const scrollEl = ref<HTMLElement | null>(null)
|
const scrollEl = ref<HTMLElement | null>(null)
|
||||||
const HOUR_HEIGHT = 56 // px per hour
|
const HOUR_HEIGHT = 60 // px per hour
|
||||||
const HOURS = Array.from({ length: 24 }, (_, i) => i)
|
const HOURS = Array.from({ length: 24 }, (_, i) => i)
|
||||||
|
|
||||||
// ── Days of the week ────────────────────────────────────────────────────────
|
// ── Days of the week ────────────────────────────────────────────────────────
|
||||||
|
|
@ -22,11 +23,11 @@ const HOURS = Array.from({ length: 24 }, (_, i) => i)
|
||||||
const days = computed(() =>
|
const days = computed(() =>
|
||||||
Array.from({ length: 7 }, (_, i) => {
|
Array.from({ length: 7 }, (_, i) => {
|
||||||
const date = addDays(props.weekStart, i)
|
const date = addDays(props.weekStart, i)
|
||||||
|
const raw = format(date, 'EEEE', { locale: ru })
|
||||||
return {
|
return {
|
||||||
date,
|
date,
|
||||||
dayName: format(date, 'EEE', { locale: ru }),
|
dayName: raw.charAt(0).toUpperCase() + raw.slice(1),
|
||||||
dayNum: format(date, 'd'),
|
dayNum: format(date, 'd'),
|
||||||
monthLabel: format(date, 'MMM', { locale: ru }),
|
|
||||||
isToday: isToday(date)
|
isToday: isToday(date)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -38,17 +39,14 @@ const now = ref(new Date())
|
||||||
let timerId: ReturnType<typeof setInterval>
|
let timerId: ReturnType<typeof setInterval>
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
timerId = setInterval(() => { now.value = new Date() }, 60_000)
|
timerId = setInterval(() => { now.value = new Date() }, 30_000)
|
||||||
// Scroll to business hours (8:00)
|
scrollEl.value?.scrollTo({ top: 8 * HOUR_HEIGHT - 30, behavior: 'smooth' })
|
||||||
scrollEl.value?.scrollTo({ top: 8 * HOUR_HEIGHT - 20, behavior: 'smooth' })
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Re-scroll when week changes
|
|
||||||
watch(() => props.weekStart, () => {
|
watch(() => props.weekStart, () => {
|
||||||
scrollEl.value?.scrollTo({ top: 8 * HOUR_HEIGHT - 20, behavior: 'smooth' })
|
scrollEl.value?.scrollTo({ top: 8 * HOUR_HEIGHT - 30, behavior: 'smooth' })
|
||||||
})
|
})
|
||||||
|
|
||||||
import { onUnmounted } from 'vue'
|
|
||||||
onUnmounted(() => clearInterval(timerId))
|
onUnmounted(() => clearInterval(timerId))
|
||||||
|
|
||||||
const nowTop = computed(() => {
|
const nowTop = computed(() => {
|
||||||
|
|
@ -72,18 +70,9 @@ interface LayoutEvent {
|
||||||
totalColumns: number
|
totalColumns: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const allDayEvents = computed(() => {
|
const allDayEvents = computed(() => props.events.filter((e) => e.isAllDay))
|
||||||
return props.events.filter((e) => e.isAllDay)
|
const timedEvents = computed(() => props.events.filter((e) => !e.isAllDay))
|
||||||
})
|
|
||||||
|
|
||||||
const timedEvents = computed(() => {
|
|
||||||
return props.events.filter((e) => !e.isAllDay)
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lay out timed events per day, detecting overlaps.
|
|
||||||
* Events in the same day that overlap in time are split into columns.
|
|
||||||
*/
|
|
||||||
const layoutEvents = computed((): LayoutEvent[] => {
|
const layoutEvents = computed((): LayoutEvent[] => {
|
||||||
const result: LayoutEvent[] = []
|
const result: LayoutEvent[] = []
|
||||||
|
|
||||||
|
|
@ -97,7 +86,6 @@ const layoutEvents = computed((): LayoutEvent[] => {
|
||||||
(eStart < dayDate && eEnd > dayDate)
|
(eStart < dayDate && eEnd > dayDate)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Simple overlap detection: group overlapping events
|
|
||||||
const columns: CalendarEvent[][] = []
|
const columns: CalendarEvent[][] = []
|
||||||
for (const ev of dayEvs) {
|
for (const ev of dayEvs) {
|
||||||
const eStart = new Date(ev.start).getTime()
|
const eStart = new Date(ev.start).getTime()
|
||||||
|
|
@ -116,13 +104,11 @@ const layoutEvents = computed((): LayoutEvent[] => {
|
||||||
if (!placed) columns.push([ev])
|
if (!placed) columns.push([ev])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build LayoutEvent for each event
|
|
||||||
for (let colIdx = 0; colIdx < columns.length; colIdx++) {
|
for (let colIdx = 0; colIdx < columns.length; colIdx++) {
|
||||||
for (const ev of columns[colIdx]) {
|
for (const ev of columns[colIdx]) {
|
||||||
const eStart = new Date(ev.start)
|
const eStart = new Date(ev.start)
|
||||||
const eEnd = new Date(ev.end)
|
const eEnd = new Date(ev.end)
|
||||||
|
|
||||||
// Clamp to day boundaries
|
|
||||||
const dayStart = new Date(dayDate)
|
const dayStart = new Date(dayDate)
|
||||||
dayStart.setHours(0, 0, 0, 0)
|
dayStart.setHours(0, 0, 0, 0)
|
||||||
const dayEnd = new Date(dayDate)
|
const dayEnd = new Date(dayDate)
|
||||||
|
|
@ -134,7 +120,6 @@ const layoutEvents = computed((): LayoutEvent[] => {
|
||||||
const startHours = clampedStart.getHours() + clampedStart.getMinutes() / 60
|
const startHours = clampedStart.getHours() + clampedStart.getMinutes() / 60
|
||||||
const durationHours = (clampedEnd.getTime() - clampedStart.getTime()) / 3_600_000
|
const durationHours = (clampedEnd.getTime() - clampedStart.getTime()) / 3_600_000
|
||||||
|
|
||||||
// Find how many columns this event belongs to (for width calculation)
|
|
||||||
const totalCols = columns.filter((col) => {
|
const totalCols = columns.filter((col) => {
|
||||||
const eS = new Date(ev.start).getTime()
|
const eS = new Date(ev.start).getTime()
|
||||||
const eE = new Date(ev.end).getTime()
|
const eE = new Date(ev.end).getTime()
|
||||||
|
|
@ -150,7 +135,7 @@ const layoutEvents = computed((): LayoutEvent[] => {
|
||||||
event: ev,
|
event: ev,
|
||||||
dayIndex,
|
dayIndex,
|
||||||
top: startHours * HOUR_HEIGHT,
|
top: startHours * HOUR_HEIGHT,
|
||||||
height: Math.max(durationHours * HOUR_HEIGHT, 18),
|
height: Math.max(durationHours * HOUR_HEIGHT, 22),
|
||||||
column: colIdx,
|
column: colIdx,
|
||||||
totalColumns: totalCols
|
totalColumns: totalCols
|
||||||
})
|
})
|
||||||
|
|
@ -161,7 +146,6 @@ const layoutEvents = computed((): LayoutEvent[] => {
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
|
||||||
/** Events per day index for rendering into the correct column. */
|
|
||||||
function eventsForDay(dayIndex: number): LayoutEvent[] {
|
function eventsForDay(dayIndex: number): LayoutEvent[] {
|
||||||
return layoutEvents.value.filter((e) => e.dayIndex === dayIndex)
|
return layoutEvents.value.filter((e) => e.dayIndex === dayIndex)
|
||||||
}
|
}
|
||||||
|
|
@ -176,7 +160,30 @@ function allDayEventsForDay(dayIndex: number): CalendarEvent[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatHour(h: number): string {
|
function formatHour(h: number): string {
|
||||||
return h === 0 ? '00:00' : `${String(h).padStart(2, '0')}:00`
|
return h === 0 ? '' : `${String(h).padStart(2, '0')}:00`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Per-day calendar summary ─────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const daySummary = computed(() =>
|
||||||
|
days.value.map((day) => {
|
||||||
|
const dayEvs = timedEvents.value.filter((e) => isSameDay(new Date(e.start), day.date))
|
||||||
|
const byCalendar: Record<string, number> = {}
|
||||||
|
for (const ev of dayEvs) {
|
||||||
|
const dur = (new Date(ev.end).getTime() - new Date(ev.start).getTime()) / 3_600_000
|
||||||
|
byCalendar[ev.calendarId] = (byCalendar[ev.calendarId] ?? 0) + dur
|
||||||
|
}
|
||||||
|
return Object.entries(byCalendar)
|
||||||
|
.filter(([, h]) => h > 0)
|
||||||
|
.map(([calId, hours]) => ({ calId, hours }))
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
function formatDuration(h: number): string {
|
||||||
|
if (h < 1) return `${Math.round(h * 60)}м`
|
||||||
|
const whole = Math.floor(h)
|
||||||
|
const mins = Math.round((h - whole) * 60)
|
||||||
|
return mins === 0 ? `${whole}ч` : `${whole}ч${mins}м`
|
||||||
}
|
}
|
||||||
|
|
||||||
function eventStyle(layout: LayoutEvent): Record<string, string> {
|
function eventStyle(layout: LayoutEvent): Record<string, string> {
|
||||||
|
|
@ -190,9 +197,9 @@ function eventStyle(layout: LayoutEvent): Record<string, string> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accent color palette for calendars (cycle through)
|
|
||||||
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
|
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
|
||||||
function calendarColor(calendarId: string): string {
|
function calendarColor(calendarId: string): string {
|
||||||
|
if (props.calendarColors?.[calendarId]) return props.calendarColors[calendarId]
|
||||||
let hash = 0
|
let hash = 0
|
||||||
for (let i = 0; i < calendarId.length; i++) hash = (hash * 31 + calendarId.charCodeAt(i)) & 0xffffff
|
for (let i = 0; i < calendarId.length; i++) hash = (hash * 31 + calendarId.charCodeAt(i)) & 0xffffff
|
||||||
return CAL_COLORS[Math.abs(hash) % CAL_COLORS.length]
|
return CAL_COLORS[Math.abs(hash) % CAL_COLORS.length]
|
||||||
|
|
@ -203,7 +210,12 @@ function calendarColor(calendarId: string): string {
|
||||||
<div class="week-view">
|
<div class="week-view">
|
||||||
<!-- Day header row -->
|
<!-- Day header row -->
|
||||||
<div class="day-headers">
|
<div class="day-headers">
|
||||||
<div class="time-gutter" />
|
<!-- Corner cell: event count badge -->
|
||||||
|
<div class="time-gutter corner-cell">
|
||||||
|
<span v-if="events.length > 0" class="corner-badge" :title="`Встреч на неделе: ${events.length}`">
|
||||||
|
{{ events.length }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="(day, i) in days"
|
v-for="(day, i) in days"
|
||||||
:key="i"
|
:key="i"
|
||||||
|
|
@ -211,18 +223,27 @@ function calendarColor(calendarId: string): string {
|
||||||
:class="{ today: day.isToday }"
|
:class="{ today: day.isToday }"
|
||||||
>
|
>
|
||||||
<span class="day-name">{{ day.dayName }}</span>
|
<span class="day-name">{{ day.dayName }}</span>
|
||||||
|
<div class="day-num-wrap" :class="{ today: day.isToday }">
|
||||||
<span class="day-num">{{ day.dayNum }}</span>
|
<span class="day-num">{{ day.dayNum }}</span>
|
||||||
<span class="month-label">{{ day.monthLabel }}</span>
|
</div>
|
||||||
|
<!-- Per-calendar hours summary -->
|
||||||
|
<div v-if="daySummary[i].length > 0" class="day-summary">
|
||||||
|
<span v-for="item in daySummary[i]" :key="item.calId" class="summary-item">
|
||||||
|
<span class="summary-dot" :style="{ background: calendarColor(item.calId) }" />
|
||||||
|
<span class="summary-hrs">{{ formatDuration(item.hours) }}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="day-summary-empty" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- All-day event row (shown only when there are all-day events) -->
|
<!-- All-day event row -->
|
||||||
<div
|
<div
|
||||||
v-if="events.some((e) => e.isAllDay)"
|
v-if="events.some((e) => e.isAllDay)"
|
||||||
class="allday-row"
|
class="allday-row"
|
||||||
>
|
>
|
||||||
<div class="time-gutter allday-gutter">
|
<div class="time-gutter allday-gutter">
|
||||||
<span class="allday-label">весь день</span>
|
<span class="allday-label">всё<br>время</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="(day, i) in days" :key="i" class="allday-col">
|
<div v-for="(day, i) in days" :key="i" class="allday-col">
|
||||||
<div
|
<div
|
||||||
|
|
@ -260,12 +281,16 @@ function calendarColor(calendarId: string): string {
|
||||||
:class="{ today: day.isToday }"
|
:class="{ today: day.isToday }"
|
||||||
>
|
>
|
||||||
<!-- Hour grid lines -->
|
<!-- Hour grid lines -->
|
||||||
|
<template v-for="h in HOURS" :key="h">
|
||||||
<div
|
<div
|
||||||
v-for="h in HOURS"
|
|
||||||
:key="h"
|
|
||||||
class="hour-row"
|
class="hour-row"
|
||||||
:style="{ top: `${h * HOUR_HEIGHT}px`, height: `${HOUR_HEIGHT}px` }"
|
:style="{ top: `${h * HOUR_HEIGHT}px`, height: `${HOUR_HEIGHT}px` }"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
class="half-hour-row"
|
||||||
|
:style="{ top: `${h * HOUR_HEIGHT + HOUR_HEIGHT / 2}px` }"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- Current time indicator -->
|
<!-- Current time indicator -->
|
||||||
<div
|
<div
|
||||||
|
|
@ -290,7 +315,7 @@ function calendarColor(calendarId: string): string {
|
||||||
|
|
||||||
<!-- Loading overlay -->
|
<!-- Loading overlay -->
|
||||||
<div v-if="loading" class="loading-overlay">
|
<div v-if="loading" class="loading-overlay">
|
||||||
<span class="spinner" />
|
<div class="loading-ring" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -308,69 +333,146 @@ function calendarColor(calendarId: string): string {
|
||||||
.day-headers {
|
.day-headers {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
border-bottom: 1px solid var(--glass-border);
|
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
background: rgba(10, 10, 18, 0.5);
|
background: rgba(10, 10, 18, 0.35);
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
overflow-y: auto;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-gutter {
|
.time-gutter {
|
||||||
width: 52px;
|
width: 56px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Corner cell: holds the event-count badge */
|
||||||
|
.corner-cell {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: center;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.corner-badge {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1;
|
||||||
|
padding: 2px 6px 3px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: rgba(168, 230, 0, 0.10);
|
||||||
|
border: 1px solid rgba(168, 230, 0, 0.22);
|
||||||
|
color: var(--accent);
|
||||||
|
letter-spacing: 0.2px;
|
||||||
|
box-shadow: inset 0 1px 0 rgba(168, 230, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
.day-header {
|
.day-header {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 8px 4px;
|
padding: 7px 4px 6px;
|
||||||
font-size: 11px;
|
border-left: 1px solid rgba(255, 255, 255, 0.05);
|
||||||
color: var(--text-muted);
|
|
||||||
border-left: 1px solid var(--glass-border);
|
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
transition: background var(--transition-fast);
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-header.today .day-num {
|
.day-header.today {
|
||||||
width: 26px;
|
background: rgba(168, 230, 0, 0.04);
|
||||||
height: 26px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--accent);
|
|
||||||
color: var(--accent-text);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-name {
|
.day-name {
|
||||||
text-transform: uppercase;
|
font-size: 9.5px;
|
||||||
letter-spacing: 0.5px;
|
font-weight: 600;
|
||||||
font-size: 10px;
|
color: var(--text-muted);
|
||||||
|
letter-spacing: 0.2px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-num {
|
.day-header.today .day-name {
|
||||||
font-size: 18px;
|
color: var(--accent);
|
||||||
font-weight: 300;
|
}
|
||||||
color: var(--text-primary);
|
|
||||||
line-height: 1;
|
.day-num-wrap {
|
||||||
|
width: 26px;
|
||||||
|
height: 26px;
|
||||||
|
border-radius: 50%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 26px;
|
transition: background var(--transition-fast), box-shadow var(--transition-fast);
|
||||||
height: 26px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.month-label {
|
.day-num-wrap.today {
|
||||||
font-size: 10px;
|
background: var(--accent);
|
||||||
|
box-shadow: 0 0 14px rgba(168, 230, 0, 0.42);
|
||||||
|
}
|
||||||
|
|
||||||
|
.day-num {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 300;
|
||||||
|
color: var(--text-primary);
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.day-num-wrap.today .day-num {
|
||||||
|
color: var(--accent-text);
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Per-day calendar summary ── */
|
||||||
|
.day-summary {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 4px;
|
||||||
|
margin-top: 2px;
|
||||||
|
min-height: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.day-summary-empty {
|
||||||
|
min-height: 14px;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-dot {
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
border-radius: 50%;
|
||||||
|
flex-shrink: 0;
|
||||||
|
box-shadow: 0 0 4px currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-hrs {
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 600;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
|
letter-spacing: 0.1px;
|
||||||
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── All-day row ── */
|
/* ── All-day row ── */
|
||||||
.allday-row {
|
.allday-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
border-bottom: 1px solid var(--glass-border);
|
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
min-height: 28px;
|
min-height: 30px;
|
||||||
|
background: rgba(255, 255, 255, 0.01);
|
||||||
|
overflow-y: auto;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
|
|
||||||
.allday-gutter {
|
.allday-gutter {
|
||||||
|
|
@ -381,16 +483,19 @@ function calendarColor(calendarId: string): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
.allday-label {
|
.allday-label {
|
||||||
font-size: 9px;
|
font-size: 8px;
|
||||||
|
font-weight: 600;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.4px;
|
letter-spacing: 0.4px;
|
||||||
|
text-align: right;
|
||||||
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.allday-col {
|
.allday-col {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-left: 1px solid var(--glass-border);
|
border-left: 1px solid rgba(255, 255, 255, 0.05);
|
||||||
padding: 2px 3px;
|
padding: 3px 4px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
|
|
@ -398,20 +503,23 @@ function calendarColor(calendarId: string): string {
|
||||||
|
|
||||||
.allday-event {
|
.allday-event {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
padding: 1px 6px;
|
font-weight: 500;
|
||||||
border-radius: 4px;
|
padding: 2px 7px;
|
||||||
background: color-mix(in srgb, var(--event-color) 22%, transparent);
|
border-radius: 5px;
|
||||||
border-left: 3px solid var(--event-color);
|
background: color-mix(in srgb, var(--event-color) 18%, transparent);
|
||||||
|
border: 1px solid color-mix(in srgb, var(--event-color) 35%, transparent);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
font-weight: 500;
|
backdrop-filter: blur(8px);
|
||||||
|
transition: filter var(--transition-fast), background var(--transition-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.allday-event:hover {
|
.allday-event:hover {
|
||||||
filter: brightness(1.15);
|
filter: brightness(1.2);
|
||||||
|
background: color-mix(in srgb, var(--event-color) 28%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Scrollable grid ── */
|
/* ── Scrollable grid ── */
|
||||||
|
|
@ -420,6 +528,22 @@ function calendarColor(calendarId: string): string {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: rgba(255,255,255,0.1) transparent;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-scroll::-webkit-scrollbar {
|
||||||
|
width: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-scroll::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-scroll::-webkit-scrollbar-thumb {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-grid {
|
.time-grid {
|
||||||
|
|
@ -429,44 +553,54 @@ function calendarColor(calendarId: string): string {
|
||||||
|
|
||||||
/* ── Time gutter column ── */
|
/* ── Time gutter column ── */
|
||||||
.time-gutter-col {
|
.time-gutter-col {
|
||||||
width: 52px;
|
width: 56px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hour-label {
|
.hour-label {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 8px;
|
right: 10px;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
font-weight: 500;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
user-select: none;
|
user-select: none;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Day column ── */
|
/* ── Day column ── */
|
||||||
.day-col {
|
.day-col {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
border-left: 1px solid var(--glass-border);
|
border-left: 1px solid rgba(255, 255, 255, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-col.today {
|
.day-col.today {
|
||||||
background: rgba(168, 230, 0, 0.022);
|
background: linear-gradient(
|
||||||
|
180deg,
|
||||||
|
rgba(168, 230, 0, 0.025) 0%,
|
||||||
|
rgba(168, 230, 0, 0.012) 100%
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Hour rows (grid lines) ── */
|
/* ── Hour / half-hour grid lines ── */
|
||||||
.hour-row {
|
.hour-row {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
border-top: 1px solid rgba(255, 255, 255, 0.05);
|
border-top: 1px solid rgba(255, 255, 255, 0.045);
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hour-row:nth-child(2n) {
|
.half-hour-row {
|
||||||
border-top-color: transparent;
|
position: absolute;
|
||||||
border-top: 1px dashed rgba(255, 255, 255, 0.03);
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 0;
|
||||||
|
border-top: 1px dashed rgba(255, 255, 255, 0.022);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Current time line ── */
|
/* ── Current time line ── */
|
||||||
|
|
@ -475,22 +609,35 @@ function calendarColor(calendarId: string): string {
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 2px;
|
height: 2px;
|
||||||
background: var(--accent);
|
|
||||||
opacity: 0.75;
|
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 4;
|
z-index: 5;
|
||||||
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
transparent 0%,
|
||||||
|
var(--accent) 8%,
|
||||||
|
var(--accent) 100%
|
||||||
|
);
|
||||||
|
box-shadow: 0 0 6px rgba(168, 230, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.now-dot {
|
.now-dot {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -4px;
|
left: -5px;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
width: 8px;
|
width: 10px;
|
||||||
height: 8px;
|
height: 10px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
box-shadow: 0 0 6px var(--accent);
|
box-shadow:
|
||||||
|
0 0 0 2px rgba(168, 230, 0, 0.25),
|
||||||
|
0 0 10px rgba(168, 230, 0, 0.7);
|
||||||
|
animation: pulse-dot 2s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse-dot {
|
||||||
|
0%, 100% { box-shadow: 0 0 0 2px rgba(168, 230, 0, 0.25), 0 0 10px rgba(168, 230, 0, 0.7); }
|
||||||
|
50% { box-shadow: 0 0 0 4px rgba(168, 230, 0, 0.15), 0 0 18px rgba(168, 230, 0, 0.5); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Loading overlay ── */
|
/* ── Loading overlay ── */
|
||||||
|
|
@ -500,18 +647,19 @@ function calendarColor(calendarId: string): string {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: rgba(9, 9, 14, 0.45);
|
background: rgba(9, 9, 14, 0.55);
|
||||||
backdrop-filter: blur(4px);
|
backdrop-filter: blur(6px);
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spinner {
|
.loading-ring {
|
||||||
width: 24px;
|
width: 28px;
|
||||||
height: 24px;
|
height: 28px;
|
||||||
border: 2px solid var(--glass-border);
|
|
||||||
border-top-color: var(--accent);
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
animation: spin 0.8s linear infinite;
|
border: 2px solid rgba(168, 230, 0, 0.15);
|
||||||
|
border-top-color: var(--accent);
|
||||||
|
animation: spin 0.75s linear infinite;
|
||||||
|
box-shadow: 0 0 12px rgba(168, 230, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
|
|
|
||||||
|
|
@ -1,600 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref, computed, watch, nextTick, onMounted, onUnmounted } from 'vue'
|
|
||||||
import { useComposeStore } from '../../stores/compose.store'
|
|
||||||
import AppIcon from '../AppIcon.vue'
|
|
||||||
|
|
||||||
const composeStore = useComposeStore()
|
|
||||||
|
|
||||||
// ── Адресные поля (token-input) ───────────────────────────
|
|
||||||
|
|
||||||
type Field = 'to' | 'cc' | 'bcc'
|
|
||||||
|
|
||||||
const toInput = ref('')
|
|
||||||
const ccInput = ref('')
|
|
||||||
const bccInput = ref('')
|
|
||||||
const showCc = ref(false)
|
|
||||||
const showBcc = ref(false)
|
|
||||||
|
|
||||||
const toInputEl = ref<HTMLInputElement | null>(null)
|
|
||||||
const bodyEl = ref<HTMLTextAreaElement | null>(null)
|
|
||||||
|
|
||||||
watch(() => composeStore.draft, (d) => {
|
|
||||||
if (!d) return
|
|
||||||
toInput.value = ''
|
|
||||||
ccInput.value = ''
|
|
||||||
bccInput.value = ''
|
|
||||||
showCc.value = d.cc.length > 0
|
|
||||||
showBcc.value = d.bcc.length > 0
|
|
||||||
nextTick(() => {
|
|
||||||
if (d.mode === 'new') {
|
|
||||||
toInputEl.value?.focus()
|
|
||||||
} else {
|
|
||||||
bodyEl.value?.focus()
|
|
||||||
// Ставим курсор в начало (перед цитатой)
|
|
||||||
bodyEl.value?.setSelectionRange(0, 0)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, { immediate: true })
|
|
||||||
|
|
||||||
function inputModel(field: Field): { value: string; update: (v: string) => void } {
|
|
||||||
if (field === 'to') return { value: toInput.value, update: (v) => { toInput.value = v } }
|
|
||||||
if (field === 'cc') return { value: ccInput.value, update: (v) => { ccInput.value = v } }
|
|
||||||
return { value: bccInput.value, update: (v) => { bccInput.value = v } }
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseEmails(raw: string): string[] {
|
|
||||||
return raw.split(/[,;\s]+/)
|
|
||||||
.map((s) => s.trim())
|
|
||||||
.filter((s) => s.includes('@'))
|
|
||||||
}
|
|
||||||
|
|
||||||
function commitInput(field: Field): void {
|
|
||||||
if (!composeStore.draft) return
|
|
||||||
const raw = field === 'to' ? toInput.value : field === 'cc' ? ccInput.value : bccInput.value
|
|
||||||
const emails = parseEmails(raw)
|
|
||||||
if (!emails.length) return
|
|
||||||
composeStore.draft[field] = [...composeStore.draft[field], ...emails]
|
|
||||||
if (field === 'to') toInput.value = ''
|
|
||||||
if (field === 'cc') ccInput.value = ''
|
|
||||||
if (field === 'bcc') bccInput.value = ''
|
|
||||||
}
|
|
||||||
|
|
||||||
function onAddressKeydown(e: KeyboardEvent, field: Field): void {
|
|
||||||
if (e.key === 'Enter' || e.key === 'Tab' || e.key === ',') {
|
|
||||||
e.preventDefault()
|
|
||||||
commitInput(field)
|
|
||||||
}
|
|
||||||
if (e.key === 'Backspace') {
|
|
||||||
const raw = field === 'to' ? toInput.value : field === 'cc' ? ccInput.value : bccInput.value
|
|
||||||
if (raw === '' && composeStore.draft) {
|
|
||||||
composeStore.draft[field].pop()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeAddr(field: Field, idx: number): void {
|
|
||||||
composeStore.draft?.[field].splice(idx, 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
function onAddressBlur(field: Field): void {
|
|
||||||
commitInput(field)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Отправка ──────────────────────────────────────────────
|
|
||||||
|
|
||||||
async function handleSend(): Promise<void> {
|
|
||||||
if (!composeStore.draft) return
|
|
||||||
// Сначала коммитим незаконченный ввод адресов
|
|
||||||
commitInput('to')
|
|
||||||
commitInput('cc')
|
|
||||||
commitInput('bcc')
|
|
||||||
await nextTick()
|
|
||||||
await composeStore.send()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Keyboard shortcut Ctrl/Cmd+Enter ─────────────────────
|
|
||||||
|
|
||||||
function onKeydown(e: KeyboardEvent): void {
|
|
||||||
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
|
|
||||||
e.preventDefault()
|
|
||||||
handleSend()
|
|
||||||
}
|
|
||||||
if (e.key === 'Escape') {
|
|
||||||
composeStore.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => document.addEventListener('keydown', onKeydown))
|
|
||||||
onUnmounted(() => document.removeEventListener('keydown', onKeydown))
|
|
||||||
|
|
||||||
// ── Title ─────────────────────────────────────────────────
|
|
||||||
|
|
||||||
const title = computed(() => {
|
|
||||||
switch (composeStore.draft?.mode) {
|
|
||||||
case 'reply': return 'Ответить'
|
|
||||||
case 'replyAll': return 'Ответить всем'
|
|
||||||
case 'forward': return 'Переслать'
|
|
||||||
default: return 'Новое письмо'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Transition name="compose">
|
|
||||||
<div v-if="composeStore.isOpen" class="compose-overlay" @mousedown.self="composeStore.close()">
|
|
||||||
<div class="compose-window" @keydown.stop>
|
|
||||||
<!-- Header -->
|
|
||||||
<div class="compose-header">
|
|
||||||
<span class="compose-title">{{ title }}</span>
|
|
||||||
<button class="compose-close" @click="composeStore.close()">
|
|
||||||
<AppIcon name="close" :size="11" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Fields -->
|
|
||||||
<div class="compose-fields" v-if="composeStore.draft">
|
|
||||||
<!-- To -->
|
|
||||||
<div class="field-row">
|
|
||||||
<span class="field-label">Кому</span>
|
|
||||||
<div class="addr-input-wrap">
|
|
||||||
<span
|
|
||||||
v-for="(addr, i) in composeStore.draft.to"
|
|
||||||
:key="i"
|
|
||||||
class="addr-token"
|
|
||||||
>
|
|
||||||
{{ addr }}
|
|
||||||
<button class="token-remove" @click="removeAddr('to', i)">×</button>
|
|
||||||
</span>
|
|
||||||
<input
|
|
||||||
ref="toInputEl"
|
|
||||||
class="addr-input"
|
|
||||||
:value="toInput"
|
|
||||||
placeholder="email@example.com"
|
|
||||||
@input="toInput = ($event.target as HTMLInputElement).value"
|
|
||||||
@keydown="onAddressKeydown($event, 'to')"
|
|
||||||
@blur="onAddressBlur('to')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="field-actions">
|
|
||||||
<button v-if="!showCc" class="toggle-field" @click="showCc = true">Копия</button>
|
|
||||||
<button v-if="!showBcc" class="toggle-field" @click="showBcc = true">Скрытая</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Cc -->
|
|
||||||
<div v-if="showCc" class="field-row">
|
|
||||||
<span class="field-label">Копия</span>
|
|
||||||
<div class="addr-input-wrap">
|
|
||||||
<span
|
|
||||||
v-for="(addr, i) in composeStore.draft.cc"
|
|
||||||
:key="i"
|
|
||||||
class="addr-token"
|
|
||||||
>
|
|
||||||
{{ addr }}
|
|
||||||
<button class="token-remove" @click="removeAddr('cc', i)">×</button>
|
|
||||||
</span>
|
|
||||||
<input
|
|
||||||
class="addr-input"
|
|
||||||
:value="ccInput"
|
|
||||||
placeholder="email@example.com"
|
|
||||||
@input="ccInput = ($event.target as HTMLInputElement).value"
|
|
||||||
@keydown="onAddressKeydown($event, 'cc')"
|
|
||||||
@blur="onAddressBlur('cc')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Bcc -->
|
|
||||||
<div v-if="showBcc" class="field-row">
|
|
||||||
<span class="field-label">Скрытая</span>
|
|
||||||
<div class="addr-input-wrap">
|
|
||||||
<span
|
|
||||||
v-for="(addr, i) in composeStore.draft.bcc"
|
|
||||||
:key="i"
|
|
||||||
class="addr-token"
|
|
||||||
>
|
|
||||||
{{ addr }}
|
|
||||||
<button class="token-remove" @click="removeAddr('bcc', i)">×</button>
|
|
||||||
</span>
|
|
||||||
<input
|
|
||||||
class="addr-input"
|
|
||||||
:value="bccInput"
|
|
||||||
placeholder="email@example.com"
|
|
||||||
@input="bccInput = ($event.target as HTMLInputElement).value"
|
|
||||||
@keydown="onAddressKeydown($event, 'bcc')"
|
|
||||||
@blur="onAddressBlur('bcc')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Subject -->
|
|
||||||
<div class="field-row">
|
|
||||||
<span class="field-label">Тема</span>
|
|
||||||
<input
|
|
||||||
class="subject-input"
|
|
||||||
v-model="composeStore.draft.subject"
|
|
||||||
placeholder="Тема письма"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Divider -->
|
|
||||||
<div class="compose-divider" />
|
|
||||||
|
|
||||||
<!-- Body -->
|
|
||||||
<textarea
|
|
||||||
ref="bodyEl"
|
|
||||||
class="compose-body"
|
|
||||||
v-model="composeStore.draft!.body"
|
|
||||||
placeholder="Напишите сообщение..."
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
|
||||||
<div class="compose-footer">
|
|
||||||
<div v-if="composeStore.sendError" class="send-error">
|
|
||||||
{{ composeStore.sendError }}
|
|
||||||
</div>
|
|
||||||
<div class="footer-actions">
|
|
||||||
<button class="btn-cancel" @click="composeStore.close()">Отмена</button>
|
|
||||||
<button
|
|
||||||
class="btn-send"
|
|
||||||
:disabled="composeStore.sending || !composeStore.draft?.to.length && !toInput"
|
|
||||||
@click="handleSend"
|
|
||||||
>
|
|
||||||
<span v-if="composeStore.sending" class="spinner-sm" />
|
|
||||||
<span class="send-icon" v-else><AppIcon name="send" :size="13" /></span>
|
|
||||||
{{ composeStore.sending ? 'Отправка...' : 'Отправить' }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Transition>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
/* ── Overlay ─────────────────────────────────────────────── */
|
|
||||||
.compose-overlay {
|
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
z-index: 200;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background: rgba(0, 0, 0, 0.45);
|
|
||||||
backdrop-filter: blur(4px);
|
|
||||||
-webkit-backdrop-filter: blur(4px);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Window ──────────────────────────────────────────────── */
|
|
||||||
.compose-window {
|
|
||||||
width: 660px;
|
|
||||||
max-width: calc(100vw - 48px);
|
|
||||||
max-height: calc(100vh - 80px);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
border-radius: 16px;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.13);
|
|
||||||
background:
|
|
||||||
linear-gradient(160deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.02) 100%),
|
|
||||||
rgba(12, 12, 22, 0.92);
|
|
||||||
backdrop-filter: blur(56px) saturate(2.2);
|
|
||||||
-webkit-backdrop-filter: blur(56px) saturate(2.2);
|
|
||||||
box-shadow:
|
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.18),
|
|
||||||
inset 0 0 0 1px rgba(255, 255, 255, 0.04),
|
|
||||||
0 24px 80px rgba(0, 0, 0, 0.65),
|
|
||||||
0 8px 24px rgba(0, 0, 0, 0.40);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Header ──────────────────────────────────────────────── */
|
|
||||||
.compose-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 14px 16px 12px;
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.07);
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compose-title {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text-primary);
|
|
||||||
letter-spacing: 0.01em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compose-close {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
border-radius: 50%;
|
|
||||||
color: var(--text-muted);
|
|
||||||
transition: background var(--transition-fast), color var(--transition-fast);
|
|
||||||
}
|
|
||||||
|
|
||||||
.compose-close:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.10);
|
|
||||||
color: var(--text-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Fields ──────────────────────────────────────────────── */
|
|
||||||
.compose-fields {
|
|
||||||
flex-shrink: 0;
|
|
||||||
padding: 4px 0;
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.07);
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-row {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
gap: 0;
|
|
||||||
padding: 6px 16px;
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
|
|
||||||
min-height: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-row:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-label {
|
|
||||||
flex-shrink: 0;
|
|
||||||
width: 60px;
|
|
||||||
font-size: 11px;
|
|
||||||
font-weight: 600;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.5px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
padding-top: 8px;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Address token input ─────────────────────────────────── */
|
|
||||||
.addr-input-wrap {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 4px;
|
|
||||||
align-items: center;
|
|
||||||
padding: 4px 0;
|
|
||||||
min-height: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.addr-token {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
|
||||||
padding: 2px 8px 2px 9px;
|
|
||||||
border-radius: 99px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
background: rgba(255, 255, 255, 0.08);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
||||||
white-space: nowrap;
|
|
||||||
max-width: 260px;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.token-remove {
|
|
||||||
flex-shrink: 0;
|
|
||||||
font-size: 13px;
|
|
||||||
line-height: 1;
|
|
||||||
color: var(--text-muted);
|
|
||||||
padding: 0 1px;
|
|
||||||
transition: color var(--transition-fast);
|
|
||||||
}
|
|
||||||
|
|
||||||
.token-remove:hover {
|
|
||||||
color: var(--danger);
|
|
||||||
}
|
|
||||||
|
|
||||||
.addr-input {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 140px;
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
color: var(--text-primary);
|
|
||||||
font-size: 13px;
|
|
||||||
padding: 3px 0;
|
|
||||||
caret-color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.addr-input::placeholder {
|
|
||||||
color: rgba(255, 255, 255, 0.20);
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-actions {
|
|
||||||
flex-shrink: 0;
|
|
||||||
display: flex;
|
|
||||||
gap: 4px;
|
|
||||||
padding-top: 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toggle-field {
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
padding: 1px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
transition: color var(--transition-fast), background var(--transition-fast);
|
|
||||||
}
|
|
||||||
|
|
||||||
.toggle-field:hover {
|
|
||||||
color: var(--text-secondary);
|
|
||||||
background: rgba(255, 255, 255, 0.06);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Subject input */
|
|
||||||
.subject-input {
|
|
||||||
flex: 1;
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
color: var(--text-primary);
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 500;
|
|
||||||
padding: 7px 0;
|
|
||||||
caret-color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.subject-input::placeholder {
|
|
||||||
color: rgba(255, 255, 255, 0.20);
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Divider ─────────────────────────────────────────────── */
|
|
||||||
.compose-divider {
|
|
||||||
height: 1px;
|
|
||||||
background: rgba(255, 255, 255, 0.06);
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Body ────────────────────────────────────────────────── */
|
|
||||||
.compose-body {
|
|
||||||
flex: 1;
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
resize: none;
|
|
||||||
color: var(--text-primary);
|
|
||||||
font-size: 13px;
|
|
||||||
line-height: 1.65;
|
|
||||||
padding: 14px 16px;
|
|
||||||
min-height: 220px;
|
|
||||||
caret-color: var(--accent);
|
|
||||||
font-family: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compose-body::placeholder {
|
|
||||||
color: rgba(255, 255, 255, 0.18);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Footer ──────────────────────────────────────────────── */
|
|
||||||
.compose-footer {
|
|
||||||
flex-shrink: 0;
|
|
||||||
padding: 10px 16px 14px;
|
|
||||||
border-top: 1px solid rgba(255, 255, 255, 0.07);
|
|
||||||
background: rgba(0, 0, 0, 0.12);
|
|
||||||
}
|
|
||||||
|
|
||||||
.send-error {
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--danger);
|
|
||||||
margin-bottom: 8px;
|
|
||||||
padding: 6px 10px;
|
|
||||||
background: rgba(255, 60, 60, 0.10);
|
|
||||||
border: 1px solid rgba(255, 60, 60, 0.20);
|
|
||||||
border-radius: 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-actions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-cancel {
|
|
||||||
padding: 7px 16px;
|
|
||||||
border-radius: var(--radius-full);
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
background: rgba(255, 255, 255, 0.05);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.09);
|
|
||||||
transition: background var(--transition-fast), color var(--transition-fast);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-cancel:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.09);
|
|
||||||
color: var(--text-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-send {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 7px;
|
|
||||||
padding: 7px 20px;
|
|
||||||
border-radius: var(--radius-full);
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--accent-text);
|
|
||||||
background: linear-gradient(
|
|
||||||
to bottom,
|
|
||||||
color-mix(in srgb, var(--accent) 88%, white 12%) 0%,
|
|
||||||
var(--accent) 100%
|
|
||||||
);
|
|
||||||
border: none;
|
|
||||||
box-shadow:
|
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.35),
|
|
||||||
0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent);
|
|
||||||
cursor: pointer;
|
|
||||||
transition:
|
|
||||||
background var(--transition-fast),
|
|
||||||
box-shadow var(--transition-fast),
|
|
||||||
transform var(--transition-fast),
|
|
||||||
opacity var(--transition-fast);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-send:hover:not(:disabled) {
|
|
||||||
background: linear-gradient(
|
|
||||||
to bottom,
|
|
||||||
color-mix(in srgb, var(--accent-hover) 88%, white 12%) 0%,
|
|
||||||
var(--accent-hover) 100%
|
|
||||||
);
|
|
||||||
box-shadow:
|
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.40),
|
|
||||||
0 4px 18px color-mix(in srgb, var(--accent) 45%, transparent);
|
|
||||||
transform: translateY(-1px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-send:active:not(:disabled) {
|
|
||||||
transform: translateY(0);
|
|
||||||
box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.20);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-send:disabled {
|
|
||||||
opacity: 0.45;
|
|
||||||
cursor: not-allowed;
|
|
||||||
transform: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.send-icon {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spinner-sm {
|
|
||||||
width: 13px;
|
|
||||||
height: 13px;
|
|
||||||
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 0.7s linear infinite;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Transitions ─────────────────────────────────────────── */
|
|
||||||
.compose-enter-active {
|
|
||||||
transition: opacity 180ms ease, transform 220ms cubic-bezier(0.34, 1.1, 0.64, 1);
|
|
||||||
}
|
|
||||||
.compose-leave-active {
|
|
||||||
transition: opacity 140ms ease, transform 160ms ease;
|
|
||||||
}
|
|
||||||
.compose-enter-from {
|
|
||||||
opacity: 0;
|
|
||||||
transform: scale(0.96) translateY(12px);
|
|
||||||
}
|
|
||||||
.compose-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
transform: scale(0.97) translateY(6px);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -5,6 +5,16 @@ import { useIpc } from '../composables/useIpc'
|
||||||
import { useAccountsStore } from './accounts.store'
|
import { useAccountsStore } from './accounts.store'
|
||||||
import type { CalendarInfo, CalendarEvent } from '@shared/types/calendar'
|
import type { CalendarInfo, CalendarEvent } from '@shared/types/calendar'
|
||||||
|
|
||||||
|
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
|
||||||
|
|
||||||
|
function hashCalendarColor(id: string): string {
|
||||||
|
let hash = 0
|
||||||
|
for (let i = 0; i < id.length; i++) hash = (hash * 31 + id.charCodeAt(i)) & 0xffffff
|
||||||
|
return CAL_COLORS[Math.abs(hash) % CAL_COLORS.length]
|
||||||
|
}
|
||||||
|
|
||||||
|
export { CAL_COLORS }
|
||||||
|
|
||||||
export const useCalendarStore = defineStore('calendar', () => {
|
export const useCalendarStore = defineStore('calendar', () => {
|
||||||
const { invoke } = useIpc()
|
const { invoke } = useIpc()
|
||||||
const accountsStore = useAccountsStore()
|
const accountsStore = useAccountsStore()
|
||||||
|
|
@ -20,6 +30,22 @@ export const useCalendarStore = defineStore('calendar', () => {
|
||||||
const loadingCalendars = ref(false)
|
const loadingCalendars = ref(false)
|
||||||
const error = ref<string | null>(null)
|
const error = ref<string | null>(null)
|
||||||
|
|
||||||
|
// ── Calendar colors (persisted to localStorage) ────────────────────────────
|
||||||
|
|
||||||
|
const COLORS_KEY = 'calendar-custom-colors'
|
||||||
|
const calendarColors = ref<Record<string, string>>(
|
||||||
|
JSON.parse(localStorage.getItem(COLORS_KEY) ?? '{}')
|
||||||
|
)
|
||||||
|
|
||||||
|
function resolveColor(calId: string): string {
|
||||||
|
return calendarColors.value[calId] ?? hashCalendarColor(calId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCalendarColor(calId: string, color: string): void {
|
||||||
|
calendarColors.value = { ...calendarColors.value, [calId]: color }
|
||||||
|
localStorage.setItem(COLORS_KEY, JSON.stringify(calendarColors.value))
|
||||||
|
}
|
||||||
|
|
||||||
// ── Computed ───────────────────────────────────────────────────────────────
|
// ── Computed ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const currentWeekEnd = computed(() => endOfWeek(currentWeekStart.value, { weekStartsOn: 1 }))
|
const currentWeekEnd = computed(() => endOfWeek(currentWeekStart.value, { weekStartsOn: 1 }))
|
||||||
|
|
@ -113,6 +139,11 @@ export const useCalendarStore = defineStore('calendar', () => {
|
||||||
selectedEvent.value = event
|
selectedEvent.value = event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function goToDate(date: Date): Promise<void> {
|
||||||
|
currentWeekStart.value = startOfWeek(date, { weekStartsOn: 1 })
|
||||||
|
await loadEvents()
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
calendars,
|
calendars,
|
||||||
events,
|
events,
|
||||||
|
|
@ -124,12 +155,16 @@ export const useCalendarStore = defineStore('calendar', () => {
|
||||||
loadingCalendars,
|
loadingCalendars,
|
||||||
error,
|
error,
|
||||||
visibleEvents,
|
visibleEvents,
|
||||||
|
calendarColors,
|
||||||
|
resolveColor,
|
||||||
|
setCalendarColor,
|
||||||
loadCalendars,
|
loadCalendars,
|
||||||
loadEvents,
|
loadEvents,
|
||||||
toggleCalendar,
|
toggleCalendar,
|
||||||
goToToday,
|
goToToday,
|
||||||
prevWeek,
|
prevWeek,
|
||||||
nextWeek,
|
nextWeek,
|
||||||
selectEvent
|
selectEvent,
|
||||||
|
goToDate
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,69 @@ import type { MessageEnvelope, MessageBody } from '@shared/types/message'
|
||||||
import { useAccountsStore } from './accounts.store'
|
import { useAccountsStore } from './accounts.store'
|
||||||
import { useIpc } from '../composables/useIpc'
|
import { useIpc } from '../composables/useIpc'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Стриппер HTML → plain text для цитирования.
|
||||||
|
* Применяется только как fallback когда body.text отсутствует (HTML-only письма
|
||||||
|
* до перезапуска main-процесса или из старого кеша).
|
||||||
|
*/
|
||||||
|
function htmlToText(html: string): string {
|
||||||
|
return html
|
||||||
|
.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '')
|
||||||
|
.replace(/<br\s*\/?>/gi, '\n')
|
||||||
|
.replace(/<\/p>/gi, '\n\n')
|
||||||
|
.replace(/<\/div>/gi, '\n')
|
||||||
|
.replace(/<\/li>/gi, '\n')
|
||||||
|
.replace(/<\/tr>/gi, '\n')
|
||||||
|
.replace(/<\/h[1-6]>/gi, '\n\n')
|
||||||
|
.replace(/<[^>]+>/g, '')
|
||||||
|
.replace(/ /g, ' ')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, "'")
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/\n{3,}/g, '\n\n')
|
||||||
|
.trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
function escHtml(s: string): string {
|
||||||
|
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Plain-text цитата оригинала (> строки с атрибуцией). Без ведущих \n\n. */
|
||||||
function quoteBody(envelope: MessageEnvelope, body: MessageBody | null): string {
|
function quoteBody(envelope: MessageEnvelope, body: MessageBody | null): string {
|
||||||
const date = envelope.date ? new Date(envelope.date).toLocaleString('ru') : ''
|
const date = envelope.date ? new Date(envelope.date).toLocaleString('ru') : ''
|
||||||
const from = envelope.from.name
|
const from = envelope.from.name
|
||||||
? `${envelope.from.name} <${envelope.from.email}>`
|
? `${envelope.from.name} <${envelope.from.email}>`
|
||||||
: envelope.from.email
|
: envelope.from.email
|
||||||
const text = body?.text ?? ''
|
const rawText = body?.text ?? (body?.html ? htmlToText(body.html) : '')
|
||||||
const lines = text.split('\n').map((l) => `> ${l}`).join('\n')
|
const lines = rawText
|
||||||
return `\n\n--- Оригинальное письмо ---\nОт: ${from}\nДата: ${date}\nТема: ${envelope.subject}\n\n${lines}`
|
? rawText.split('\n').map((l) => `> ${l}`).join('\n')
|
||||||
|
: ''
|
||||||
|
return `--- Оригинальное письмо ---\nОт: ${from}\nДата: ${date}\nТема: ${envelope.subject}\n\n${lines}`
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTML-блокквота оригинала (для рендера в compose + text/html часть).
|
||||||
|
* Возвращает undefined если оригинал — plain-text (тогда шлём только text/plain).
|
||||||
|
*/
|
||||||
|
function quoteBodyHtml(envelope: MessageEnvelope, body: MessageBody | null): string | undefined {
|
||||||
|
if (!body?.html) return undefined
|
||||||
|
const date = envelope.date ? new Date(envelope.date).toLocaleString('ru') : ''
|
||||||
|
const from = envelope.from.name
|
||||||
|
? `${escHtml(envelope.from.name)} <${escHtml(envelope.from.email)}>`
|
||||||
|
: escHtml(envelope.from.email)
|
||||||
|
return (
|
||||||
|
`<div style="font-size:12px;color:#888;margin-bottom:8px">` +
|
||||||
|
`— Оригинальное письмо —<br>` +
|
||||||
|
`От: ${from}<br>` +
|
||||||
|
`Дата: ${escHtml(date)}<br>` +
|
||||||
|
`Тема: ${escHtml(envelope.subject)}` +
|
||||||
|
`</div>` +
|
||||||
|
`<blockquote style="margin:0 0 0 .8ex;border-left:3px solid #ccc;padding-left:1ex">` +
|
||||||
|
body.html +
|
||||||
|
`</blockquote>`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useComposeStore = defineStore('compose', () => {
|
export const useComposeStore = defineStore('compose', () => {
|
||||||
|
|
@ -30,14 +85,14 @@ export const useComposeStore = defineStore('compose', () => {
|
||||||
|
|
||||||
function openNew(): void {
|
function openNew(): void {
|
||||||
const acc = getAccountSession()
|
const acc = getAccountSession()
|
||||||
if (!acc) return
|
if (!acc) { console.warn('[compose] no active account'); return }
|
||||||
const session: ComposeSession = {
|
const session: ComposeSession = {
|
||||||
...acc,
|
...acc,
|
||||||
mode: 'new',
|
mode: 'new',
|
||||||
to: [], cc: [], bcc: [],
|
to: [], cc: [], bcc: [],
|
||||||
subject: '', body: ''
|
subject: '', body: ''
|
||||||
}
|
}
|
||||||
invoke('compose:open', session)
|
invoke('compose:open', session).catch((e) => console.error('[compose:open]', e))
|
||||||
}
|
}
|
||||||
|
|
||||||
function openReply(envelope: MessageEnvelope, body: MessageBody | null, replyAll = false): void {
|
function openReply(envelope: MessageEnvelope, body: MessageBody | null, replyAll = false): void {
|
||||||
|
|
@ -56,15 +111,17 @@ export const useComposeStore = defineStore('compose', () => {
|
||||||
cc,
|
cc,
|
||||||
bcc: [],
|
bcc: [],
|
||||||
subject: envelope.subject.startsWith('Re:') ? envelope.subject : `Re: ${envelope.subject}`,
|
subject: envelope.subject.startsWith('Re:') ? envelope.subject : `Re: ${envelope.subject}`,
|
||||||
body: quoteBody(envelope, body),
|
body: '',
|
||||||
|
quotedText: quoteBody(envelope, body),
|
||||||
|
htmlBody: quoteBodyHtml(envelope, body),
|
||||||
inReplyTo: envelope.messageId,
|
inReplyTo: envelope.messageId,
|
||||||
references: envelope.messageId
|
references: envelope.messageId
|
||||||
? [envelope.inReplyTo, envelope.messageId].filter(Boolean).join(' ')
|
? [body?.references ?? envelope.inReplyTo, envelope.messageId].filter(Boolean).join(' ').trim() || undefined
|
||||||
: undefined,
|
: undefined,
|
||||||
replyToMessageId: envelope.id,
|
replyToMessageId: envelope.id,
|
||||||
replyToFolderId: envelope.folderId
|
replyToFolderId: envelope.folderId
|
||||||
}
|
}
|
||||||
invoke('compose:open', session)
|
invoke('compose:open', session).catch((e) => console.error('[compose:open]', e))
|
||||||
}
|
}
|
||||||
|
|
||||||
function openForward(envelope: MessageEnvelope, body: MessageBody | null): void {
|
function openForward(envelope: MessageEnvelope, body: MessageBody | null): void {
|
||||||
|
|
@ -75,9 +132,11 @@ export const useComposeStore = defineStore('compose', () => {
|
||||||
mode: 'forward',
|
mode: 'forward',
|
||||||
to: [], cc: [], bcc: [],
|
to: [], cc: [], bcc: [],
|
||||||
subject: envelope.subject.startsWith('Fwd:') ? envelope.subject : `Fwd: ${envelope.subject}`,
|
subject: envelope.subject.startsWith('Fwd:') ? envelope.subject : `Fwd: ${envelope.subject}`,
|
||||||
body: quoteBody(envelope, body)
|
body: '',
|
||||||
|
quotedText: quoteBody(envelope, body),
|
||||||
|
htmlBody: quoteBodyHtml(envelope, body)
|
||||||
}
|
}
|
||||||
invoke('compose:open', session)
|
invoke('compose:open', session).catch((e) => console.error('[compose:open]', e))
|
||||||
}
|
}
|
||||||
|
|
||||||
return { openNew, openReply, openForward }
|
return { openNew, openReply, openForward }
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
import { onMounted, watch, ref } from 'vue'
|
import { onMounted, watch, ref } from 'vue'
|
||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
import { ru } from 'date-fns/locale'
|
import { ru } from 'date-fns/locale'
|
||||||
import { useCalendarStore } from '../stores/calendar.store'
|
import { useCalendarStore, CAL_COLORS } from '../stores/calendar.store'
|
||||||
import { useAccountsStore } from '../stores/accounts.store'
|
import { useAccountsStore } from '../stores/accounts.store'
|
||||||
import AccountSwitcher from '../components/sidebar/AccountSwitcher.vue'
|
import AccountSwitcher from '../components/sidebar/AccountSwitcher.vue'
|
||||||
import WeekView from '../components/calendar/WeekView.vue'
|
import WeekView from '../components/calendar/WeekView.vue'
|
||||||
|
import MiniCalendar from '../components/calendar/MiniCalendar.vue'
|
||||||
import EventDetailPopup from '../components/calendar/EventDetailPopup.vue'
|
import EventDetailPopup from '../components/calendar/EventDetailPopup.vue'
|
||||||
import AddAccountDialog from '../components/accounts/AddAccountDialog.vue'
|
import AddAccountDialog from '../components/accounts/AddAccountDialog.vue'
|
||||||
import NotificationContainer from '../components/notifications/NotificationContainer.vue'
|
import NotificationContainer from '../components/notifications/NotificationContainer.vue'
|
||||||
|
|
@ -16,37 +17,10 @@ const calStore = useCalendarStore()
|
||||||
const accountsStore = useAccountsStore()
|
const accountsStore = useAccountsStore()
|
||||||
const showAddAccount = ref(false)
|
const showAddAccount = ref(false)
|
||||||
|
|
||||||
// CalDAV path probe
|
|
||||||
const probeResults = ref<{ path: string; status: number; note: string }[] | null>(null)
|
|
||||||
const probing = ref(false)
|
|
||||||
|
|
||||||
async function probeCalDAV(): Promise<void> {
|
|
||||||
if (!accountsStore.activeAccountId) return
|
|
||||||
probing.value = true
|
|
||||||
probeResults.value = null
|
|
||||||
try {
|
|
||||||
probeResults.value = await window.api.invoke('calendar:probe', { accountId: accountsStore.activeAccountId })
|
|
||||||
} catch (e) {
|
|
||||||
probeResults.value = [{ path: '(error)', status: 0, note: (e as Error).message }]
|
|
||||||
} finally {
|
|
||||||
probing.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calendar color palette, same as WeekView
|
|
||||||
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
|
|
||||||
function calendarColor(calendarId: string): string {
|
|
||||||
let hash = 0
|
|
||||||
for (let i = 0; i < calendarId.length; i++) hash = (hash * 31 + calendarId.charCodeAt(i)) & 0xffffff
|
|
||||||
return CAL_COLORS[Math.abs(hash) % CAL_COLORS.length]
|
|
||||||
}
|
|
||||||
|
|
||||||
const weekLabel = () => {
|
const weekLabel = () => {
|
||||||
const s = calStore.currentWeekStart
|
const s = calStore.currentWeekStart
|
||||||
const e = calStore.currentWeekEnd
|
const e = calStore.currentWeekEnd
|
||||||
const sStr = format(s, 'd MMM', { locale: ru })
|
return `${format(s, 'd MMM', { locale: ru })} – ${format(e, 'd MMM yyyy', { locale: ru })}`
|
||||||
const eStr = format(e, 'd MMM yyyy', { locale: ru })
|
|
||||||
return `${sStr} – ${eStr}`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reload(): Promise<void> {
|
async function reload(): Promise<void> {
|
||||||
|
|
@ -60,93 +34,144 @@ watch(() => accountsStore.activeAccountId, reload)
|
||||||
function handleEventClick(ev: CalendarEvent): void {
|
function handleEventClick(ev: CalendarEvent): void {
|
||||||
calStore.selectEvent(ev)
|
calStore.selectEvent(ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Color picker ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const pickerCalId = ref<string | null>(null)
|
||||||
|
const pickerPos = ref({ x: 0, y: 0 })
|
||||||
|
|
||||||
|
function openPicker(calId: string, e: MouseEvent): void {
|
||||||
|
e.stopPropagation()
|
||||||
|
if (pickerCalId.value === calId) { pickerCalId.value = null; return }
|
||||||
|
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect()
|
||||||
|
pickerPos.value = { x: rect.right + 8, y: rect.top - 2 }
|
||||||
|
pickerCalId.value = calId
|
||||||
|
}
|
||||||
|
|
||||||
|
function pickColor(color: string): void {
|
||||||
|
if (pickerCalId.value) calStore.setCalendarColor(pickerCalId.value, color)
|
||||||
|
pickerCalId.value = null
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="calendar-shell">
|
<div class="calendar-shell">
|
||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<!-- Account switcher (same as mail view) -->
|
<!-- Account switcher -->
|
||||||
<div class="account-bar">
|
<div class="account-bar">
|
||||||
<AccountSwitcher @add-account="showAddAccount = true" />
|
<AccountSwitcher @add-account="showAddAccount = true" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Calendar sidebar -->
|
<!-- Calendar sidebar -->
|
||||||
<div class="cal-sidebar">
|
<div class="cal-sidebar">
|
||||||
<div class="sidebar-header">
|
|
||||||
<AppIcon name="calendar" :size="15" class="cal-icon" />
|
|
||||||
<span>Календарь</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Error state -->
|
<!-- Error state -->
|
||||||
<div v-if="calStore.error" class="sidebar-error">
|
<div v-if="calStore.error" class="sidebar-error">
|
||||||
<p class="error-title">CalDAV недоступен</p>
|
<div class="error-icon-wrap">
|
||||||
|
<AppIcon name="warning" :size="20" class="error-icon" />
|
||||||
|
</div>
|
||||||
|
<p class="error-title">Календарь недоступен</p>
|
||||||
<p class="error-detail">{{ calStore.error }}</p>
|
<p class="error-detail">{{ calStore.error }}</p>
|
||||||
|
<div class="error-actions">
|
||||||
<button class="retry-btn" @click="reload">Повторить</button>
|
<button class="retry-btn" @click="reload">
|
||||||
<button class="retry-btn probe-btn" :disabled="probing" @click="probeCalDAV">
|
<AppIcon name="refresh" :size="12" />
|
||||||
{{ probing ? 'Сканирование…' : 'Найти CalDAV путь' }}
|
Повторить
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Probe results -->
|
<template v-else>
|
||||||
<div v-if="probeResults" class="probe-results">
|
<!-- Mini calendar navigator -->
|
||||||
<p class="probe-title">Результаты сканирования:</p>
|
<MiniCalendar
|
||||||
<div
|
:selected-week-start="calStore.currentWeekStart"
|
||||||
v-for="r in probeResults"
|
:selected-week-end="calStore.currentWeekEnd"
|
||||||
:key="r.path"
|
@day-click="calStore.goToDate($event)"
|
||||||
class="probe-row"
|
/>
|
||||||
:class="{ 'probe-ok': r.status === 207 || r.status === 200 }"
|
|
||||||
>
|
<div class="sidebar-divider" />
|
||||||
<span class="probe-path">{{ r.path }}</span>
|
|
||||||
<span class="probe-note">{{ r.note }}</span>
|
<!-- Calendar list header -->
|
||||||
</div>
|
<div class="cal-list-header">
|
||||||
<p class="probe-hint">Скопируйте путь со статусом 207 в настройки CalDAV → «Путь».</p>
|
<AppIcon name="calendar" :size="12" class="cal-list-icon" />
|
||||||
|
<span>Мои календари</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Loading state -->
|
||||||
|
<div v-if="calStore.loadingCalendars" class="sidebar-loading">
|
||||||
|
<span class="spinner" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Calendar list -->
|
<!-- Calendar list -->
|
||||||
<div v-else-if="!calStore.loadingCalendars" class="calendar-list">
|
<div v-else class="calendar-list">
|
||||||
<div
|
<div
|
||||||
v-for="cal in calStore.calendars"
|
v-for="cal in calStore.calendars"
|
||||||
:key="cal.id"
|
:key="cal.id"
|
||||||
class="cal-item"
|
class="cal-item"
|
||||||
:class="{ active: calStore.selectedCalendarIds.has(cal.id) }"
|
:class="{ active: calStore.selectedCalendarIds.has(cal.id) }"
|
||||||
@click="calStore.toggleCalendar(cal.id)"
|
@click="calStore.toggleCalendar(cal.id)"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
class="cal-dot-btn"
|
||||||
|
:title="'Изменить цвет'"
|
||||||
|
@click="openPicker(cal.id, $event)"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="cal-dot"
|
class="cal-dot"
|
||||||
:style="{ background: calendarColor(cal.id) }"
|
:style="{ background: calStore.resolveColor(cal.id) }"
|
||||||
|
:class="{ dimmed: !calStore.selectedCalendarIds.has(cal.id) }"
|
||||||
/>
|
/>
|
||||||
|
</button>
|
||||||
<span class="cal-name" :title="cal.name">{{ cal.name }}</span>
|
<span class="cal-name" :title="cal.name">{{ cal.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="calStore.calendars.length === 0 && !calStore.loadingCalendars && !calStore.error" class="no-calendars">
|
<div v-if="calStore.calendars.length === 0" class="no-calendars">
|
||||||
Нет доступных календарей
|
Нет доступных<br>календарей
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="sidebar-loading">
|
<!-- Color picker teleport -->
|
||||||
<span class="spinner" />
|
<Teleport to="body">
|
||||||
|
<div v-if="pickerCalId" class="picker-backdrop" @click="pickerCalId = null" />
|
||||||
|
<div
|
||||||
|
v-if="pickerCalId"
|
||||||
|
class="color-picker-popover"
|
||||||
|
:style="{ left: `${pickerPos.x}px`, top: `${pickerPos.y}px` }"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
v-for="c in CAL_COLORS"
|
||||||
|
:key="c"
|
||||||
|
class="color-swatch"
|
||||||
|
:class="{ selected: calStore.resolveColor(pickerCalId) === c }"
|
||||||
|
:style="{ background: c }"
|
||||||
|
@click="pickColor(c)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</Teleport>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Main calendar area -->
|
<!-- Main calendar area -->
|
||||||
<div class="calendar-main">
|
<div class="calendar-main">
|
||||||
<!-- Toolbar -->
|
<!-- Toolbar -->
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
|
<div class="toolbar-nav">
|
||||||
<button class="nav-btn" @click="calStore.prevWeek()">
|
<button class="nav-btn" @click="calStore.prevWeek()">
|
||||||
<AppIcon name="chevron-right" :size="14" style="transform: rotate(180deg)" />
|
<AppIcon name="chevron-right" :size="13" style="transform: rotate(180deg)" />
|
||||||
</button>
|
</button>
|
||||||
<button class="nav-btn today-btn" @click="calStore.goToToday()">Сегодня</button>
|
|
||||||
<button class="nav-btn" @click="calStore.nextWeek()">
|
<button class="nav-btn" @click="calStore.nextWeek()">
|
||||||
<AppIcon name="chevron-right" :size="14" />
|
<AppIcon name="chevron-right" :size="13" />
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<span class="week-label">{{ weekLabel() }}</span>
|
<button class="today-btn" @click="calStore.goToToday()">Сегодня</button>
|
||||||
|
|
||||||
<button class="nav-btn refresh-btn" :disabled="calStore.loading" @click="calStore.loadEvents()">
|
<h2 class="week-label">{{ weekLabel() }}</h2>
|
||||||
|
|
||||||
|
<div class="toolbar-right">
|
||||||
|
<button class="icon-btn" :disabled="calStore.loading" @click="calStore.loadEvents()" title="Обновить">
|
||||||
<AppIcon name="refresh" :size="14" :class="{ spinning: calStore.loading }" />
|
<AppIcon name="refresh" :size="14" :class="{ spinning: calStore.loading }" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Week view -->
|
<!-- Week view -->
|
||||||
<div class="week-wrap">
|
<div class="week-wrap">
|
||||||
|
|
@ -154,6 +179,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
:week-start="calStore.currentWeekStart"
|
:week-start="calStore.currentWeekStart"
|
||||||
:events="calStore.visibleEvents"
|
:events="calStore.visibleEvents"
|
||||||
:loading="calStore.loading"
|
:loading="calStore.loading"
|
||||||
|
:calendar-colors="calStore.calendarColors"
|
||||||
@event-click="handleEventClick"
|
@event-click="handleEventClick"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -164,6 +190,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
<EventDetailPopup
|
<EventDetailPopup
|
||||||
v-if="calStore.selectedEvent"
|
v-if="calStore.selectedEvent"
|
||||||
:event="calStore.selectedEvent"
|
:event="calStore.selectedEvent"
|
||||||
|
:color="calStore.resolveColor(calStore.selectedEvent.calendarId)"
|
||||||
@close="calStore.selectEvent(null)"
|
@close="calStore.selectEvent(null)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
@ -181,7 +208,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
>
|
>
|
||||||
<div class="empty-content">
|
<div class="empty-content">
|
||||||
<div class="empty-icon">
|
<div class="empty-icon">
|
||||||
<AppIcon name="calendar" :size="64" />
|
<AppIcon name="calendar" :size="56" />
|
||||||
</div>
|
</div>
|
||||||
<h2>Добро пожаловать в Aero Mail</h2>
|
<h2>Добро пожаловать в Aero Mail</h2>
|
||||||
<p>Добавьте почтовый аккаунт для просмотра календаря</p>
|
<p>Добавьте почтовый аккаунт для просмотра календаря</p>
|
||||||
|
|
@ -197,7 +224,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: #07070c;
|
background: var(--base-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-area {
|
.content-area {
|
||||||
|
|
@ -209,7 +236,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Account bar — same styling as in AppShell */
|
/* Account bar */
|
||||||
.account-bar {
|
.account-bar {
|
||||||
width: var(--sidebar-width);
|
width: var(--sidebar-width);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|
@ -232,64 +259,90 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
|
|
||||||
/* Calendar sidebar */
|
/* Calendar sidebar */
|
||||||
.cal-sidebar {
|
.cal-sidebar {
|
||||||
width: 200px;
|
width: 192px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||||
background:
|
background:
|
||||||
linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%),
|
linear-gradient(160deg, rgba(255, 255, 255, 0.065) 0%, rgba(255, 255, 255, 0.02) 100%),
|
||||||
rgba(9, 9, 15, 0.80);
|
rgba(10, 10, 17, 0.85);
|
||||||
backdrop-filter: blur(28px) saturate(1.8);
|
backdrop-filter: blur(32px) saturate(1.9);
|
||||||
-webkit-backdrop-filter: blur(28px) saturate(1.8);
|
-webkit-backdrop-filter: blur(32px) saturate(1.9);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.10),
|
inset 0 1px 0 rgba(255, 255, 255, 0.13),
|
||||||
0 8px 28px rgba(0, 0, 0, 0.40);
|
0 8px 28px rgba(0, 0, 0, 0.42);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-header {
|
.sidebar-divider {
|
||||||
|
height: 1px;
|
||||||
|
margin: 0 12px;
|
||||||
|
background: linear-gradient(90deg,
|
||||||
|
transparent,
|
||||||
|
rgba(255, 255, 255, 0.07) 20%,
|
||||||
|
rgba(255, 255, 255, 0.07) 80%,
|
||||||
|
transparent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Calendar list header */
|
||||||
|
.cal-list-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 7px;
|
gap: 6px;
|
||||||
padding: 14px 14px 10px;
|
padding: 10px 12px 6px;
|
||||||
font-size: 12px;
|
font-size: 10px;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
color: var(--text-secondary);
|
color: var(--text-muted);
|
||||||
letter-spacing: 0.3px;
|
letter-spacing: 0.6px;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
border-bottom: 1px solid var(--glass-border);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-icon {
|
.cal-list-icon {
|
||||||
color: var(--accent);
|
color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calendar list */
|
/* Calendar list */
|
||||||
.calendar-list {
|
.calendar-list {
|
||||||
padding: 8px 0;
|
padding: 2px 6px 8px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-item {
|
.cal-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 9px;
|
||||||
padding: 6px 14px;
|
padding: 5px 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin: 0 4px;
|
|
||||||
transition: background var(--transition-fast);
|
transition: background var(--transition-fast);
|
||||||
opacity: 0.55;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-item.active {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-item:hover {
|
.cal-item:hover {
|
||||||
background: var(--glass-bg-hover);
|
background: var(--glass-bg-hover);
|
||||||
opacity: 1;
|
}
|
||||||
|
|
||||||
|
.cal-dot-btn {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform var(--transition-fast);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cal-dot-btn:hover {
|
||||||
|
transform: scale(1.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-dot {
|
.cal-dot {
|
||||||
|
|
@ -297,15 +350,21 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
height: 10px;
|
height: 10px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
box-shadow: 0 0 4px currentColor;
|
transition: opacity var(--transition-fast);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cal-dot.dimmed {
|
||||||
|
opacity: 0.28;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-name {
|
.cal-name {
|
||||||
font-size: 13px;
|
font-size: 12px;
|
||||||
color: var(--text-secondary);
|
color: var(--text-muted);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
transition: color var(--transition-fast);
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-item.active .cal-name {
|
.cal-item.active .cal-name {
|
||||||
|
|
@ -313,18 +372,37 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-calendars {
|
.no-calendars {
|
||||||
padding: 16px;
|
padding: 12px 8px;
|
||||||
font-size: 12px;
|
font-size: 11px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Error state */
|
/* Error state */
|
||||||
.sidebar-error {
|
.sidebar-error {
|
||||||
padding: 12px 14px;
|
padding: 16px 14px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 6px;
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-icon-wrap {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(255, 85, 85, 0.12);
|
||||||
|
border: 1px solid rgba(255, 85, 85, 0.2);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-icon {
|
||||||
|
color: var(--danger);
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-title {
|
.error-title {
|
||||||
|
|
@ -334,85 +412,44 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-detail {
|
.error-detail {
|
||||||
font-size: 11px;
|
font-size: 10px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
-webkit-user-select: text;
|
-webkit-user-select: text;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
|
text-align: left;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error-actions {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 5px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.retry-btn {
|
.retry-btn {
|
||||||
align-self: flex-start;
|
display: flex;
|
||||||
font-size: 12px;
|
align-items: center;
|
||||||
padding: 4px 12px;
|
justify-content: center;
|
||||||
|
gap: 5px;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 11px;
|
||||||
|
padding: 5px 10px;
|
||||||
border-radius: var(--radius-sm);
|
border-radius: var(--radius-sm);
|
||||||
background: var(--glass-bg-raised);
|
background: var(--glass-bg-raised);
|
||||||
border: 1px solid var(--glass-border);
|
border: 1px solid var(--glass-border);
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
transition: background var(--transition-fast);
|
transition: background var(--transition-fast);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.retry-btn:hover:not(:disabled) {
|
||||||
|
background: var(--glass-bg-hover);
|
||||||
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
.retry-btn:hover:not(:disabled) { background: var(--glass-bg-hover); }
|
|
||||||
.retry-btn:disabled { opacity: 0.5; cursor: default; }
|
.retry-btn:disabled { opacity: 0.5; cursor: default; }
|
||||||
|
|
||||||
.probe-btn { margin-top: 2px; }
|
|
||||||
|
|
||||||
.probe-results {
|
|
||||||
margin-top: 6px;
|
|
||||||
border-top: 1px solid var(--glass-border);
|
|
||||||
padding-top: 8px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.probe-title {
|
|
||||||
font-size: 11px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
margin-bottom: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.probe-row {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1px;
|
|
||||||
padding: 3px 6px;
|
|
||||||
border-radius: 5px;
|
|
||||||
background: rgba(255,255,255,0.03);
|
|
||||||
}
|
|
||||||
|
|
||||||
.probe-row.probe-ok {
|
|
||||||
background: rgba(168, 230, 0, 0.08);
|
|
||||||
}
|
|
||||||
|
|
||||||
.probe-path {
|
|
||||||
font-size: 10px;
|
|
||||||
font-family: monospace;
|
|
||||||
color: var(--text-primary);
|
|
||||||
word-break: break-all;
|
|
||||||
user-select: text;
|
|
||||||
-webkit-user-select: text;
|
|
||||||
cursor: text;
|
|
||||||
}
|
|
||||||
|
|
||||||
.probe-note {
|
|
||||||
font-size: 10px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.probe-row.probe-ok .probe-note {
|
|
||||||
color: #a8e600;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.probe-hint {
|
|
||||||
font-size: 10px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
line-height: 1.5;
|
|
||||||
margin-top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-loading {
|
.sidebar-loading {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
@ -428,69 +465,110 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-radius: 14px;
|
border-radius: 16px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||||
background:
|
background:
|
||||||
linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%),
|
linear-gradient(160deg, rgba(255, 255, 255, 0.04) 0%, transparent 60%),
|
||||||
rgba(10, 10, 17, 0.55);
|
rgba(11, 11, 18, 0.60);
|
||||||
backdrop-filter: blur(18px) saturate(1.3);
|
backdrop-filter: blur(24px) saturate(1.5);
|
||||||
-webkit-backdrop-filter: blur(18px) saturate(1.3);
|
-webkit-backdrop-filter: blur(24px) saturate(1.5);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.08),
|
inset 0 1px 0 rgba(255, 255, 255, 0.10),
|
||||||
0 8px 28px rgba(0, 0, 0, 0.32);
|
0 8px 32px rgba(0, 0, 0, 0.36);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Toolbar */
|
/* Toolbar */
|
||||||
.toolbar {
|
.toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 8px;
|
||||||
padding: 10px 16px;
|
padding: 10px 16px 10px 14px;
|
||||||
border-bottom: 1px solid var(--glass-border);
|
border-bottom: 1px solid rgba(255, 255, 255, 0.07);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
background: rgba(255, 255, 255, 0.02);
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-nav {
|
||||||
|
display: flex;
|
||||||
|
gap: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-btn {
|
.nav-btn {
|
||||||
|
width: 28px;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
padding: 0 10px;
|
border-radius: 8px;
|
||||||
border-radius: var(--radius-sm);
|
|
||||||
background: var(--glass-bg);
|
background: var(--glass-bg);
|
||||||
border: 1px solid var(--glass-border);
|
border: 1px solid var(--glass-border);
|
||||||
color: var(--text-secondary);
|
color: var(--text-muted);
|
||||||
font-size: 12px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 4px;
|
transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
|
||||||
transition: background var(--transition-fast), color var(--transition-fast);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-btn:hover:not(:disabled) {
|
.nav-btn:hover {
|
||||||
background: var(--glass-bg-hover);
|
background: var(--glass-bg-raised);
|
||||||
|
border-color: var(--glass-border-strong);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-btn:disabled {
|
|
||||||
opacity: 0.4;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.today-btn {
|
.today-btn {
|
||||||
font-weight: 500;
|
height: 28px;
|
||||||
|
padding: 0 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--glass-bg-raised);
|
||||||
|
border: 1px solid var(--glass-border-strong);
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.2px;
|
||||||
|
transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
|
||||||
|
}
|
||||||
|
|
||||||
|
.today-btn:hover {
|
||||||
|
background: rgba(168, 230, 0, 0.12);
|
||||||
|
border-color: rgba(168, 230, 0, 0.3);
|
||||||
|
color: var(--accent);
|
||||||
|
box-shadow: 0 0 12px rgba(168, 230, 0, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
.week-label {
|
.week-label {
|
||||||
font-size: 14px;
|
font-size: 15px;
|
||||||
font-weight: 500;
|
font-weight: 600;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
margin-left: 4px;
|
margin: 0;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
letter-spacing: -0.2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.refresh-btn {
|
.toolbar-right {
|
||||||
margin-left: auto;
|
display: flex;
|
||||||
flex: none;
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-btn {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--glass-bg);
|
||||||
|
border: 1px solid var(--glass-border);
|
||||||
|
color: var(--text-muted);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: background var(--transition-fast), color var(--transition-fast);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-btn:hover:not(:disabled) {
|
||||||
|
background: var(--glass-bg-raised);
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-btn:disabled {
|
||||||
|
opacity: 0.4;
|
||||||
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
|
|
@ -517,48 +595,54 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
animation: spin 0.8s linear infinite;
|
animation: spin 0.8s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Empty state (no accounts) */
|
/* Empty state */
|
||||||
.empty-state {
|
.empty-state {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: transparent;
|
background: rgba(0, 0, 0, 0.3);
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-content {
|
.empty-content {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 64px 72px;
|
padding: 56px 64px;
|
||||||
width: 480px;
|
width: 460px;
|
||||||
background: rgba(255, 255, 255, 0.11);
|
border-radius: 24px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||||
|
background:
|
||||||
|
linear-gradient(145deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.04) 100%),
|
||||||
|
rgba(12, 12, 20, 0.92);
|
||||||
backdrop-filter: blur(72px) saturate(2.8);
|
backdrop-filter: blur(72px) saturate(2.8);
|
||||||
-webkit-backdrop-filter: blur(72px) saturate(2.8);
|
-webkit-backdrop-filter: blur(72px) saturate(2.8);
|
||||||
border-radius: 20px;
|
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.55),
|
inset 0 1px 0 rgba(255, 255, 255, 0.20),
|
||||||
0 8px 32px rgba(0, 0, 0, 0.45),
|
0 8px 32px rgba(0, 0, 0, 0.50),
|
||||||
0 32px 80px rgba(0, 0, 0, 0.65);
|
0 32px 80px rgba(0, 0, 0, 0.70);
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-icon {
|
.empty-icon {
|
||||||
margin-bottom: 24px;
|
margin-bottom: 20px;
|
||||||
opacity: 0.28;
|
opacity: 0.22;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-content h2 {
|
.empty-content h2 {
|
||||||
font-size: 22px;
|
font-size: 20px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
|
letter-spacing: -0.3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-content p {
|
.empty-content p {
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-size: 14px;
|
font-size: 13px;
|
||||||
margin-bottom: 32px;
|
margin-bottom: 28px;
|
||||||
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-btn {
|
.add-btn {
|
||||||
|
|
@ -571,10 +655,12 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
color: var(--accent-text);
|
color: var(--accent-text);
|
||||||
border-radius: var(--radius-md);
|
border-radius: var(--radius-md);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 14px;
|
font-size: 13px;
|
||||||
|
letter-spacing: 0.1px;
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.40),
|
inset 0 1px 0 rgba(255, 255, 255, 0.40),
|
||||||
0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent);
|
0 2px 12px color-mix(in srgb, var(--accent) 30%, transparent);
|
||||||
|
transition: background var(--transition-fast), box-shadow var(--transition-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-btn:hover {
|
.add-btn:hover {
|
||||||
|
|
@ -583,5 +669,61 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
color-mix(in srgb, var(--accent-hover) 88%, white 12%) 0%,
|
color-mix(in srgb, var(--accent-hover) 88%, white 12%) 0%,
|
||||||
var(--accent-hover) 100%
|
var(--accent-hover) 100%
|
||||||
);
|
);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.40),
|
||||||
|
0 2px 20px color-mix(in srgb, var(--accent) 45%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Color picker popover ─────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.picker-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-popover {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 201;
|
||||||
|
display: flex;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background:
|
||||||
|
linear-gradient(145deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.04) 100%),
|
||||||
|
rgba(18, 17, 30, 0.92);
|
||||||
|
backdrop-filter: blur(32px) saturate(2);
|
||||||
|
-webkit-backdrop-filter: blur(32px) saturate(2);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.13);
|
||||||
|
border-top-color: rgba(255, 255, 255, 0.22);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255,255,255,0.18),
|
||||||
|
0 8px 24px rgba(0,0,0,0.40),
|
||||||
|
0 2px 8px rgba(0,0,0,0.30);
|
||||||
|
animation: picker-in 150ms cubic-bezier(0.34, 1.4, 0.64, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes picker-in {
|
||||||
|
from { opacity: 0; transform: scale(0.88) translateY(-4px); }
|
||||||
|
to { opacity: 1; transform: scale(1) translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-swatch {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 120ms, border-color 120ms;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-swatch:hover {
|
||||||
|
transform: scale(1.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-swatch.selected {
|
||||||
|
border-color: rgba(255, 255, 255, 0.70);
|
||||||
|
transform: scale(1.12);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ const cc = ref<string[]>([])
|
||||||
const bcc = ref<string[]>([])
|
const bcc = ref<string[]>([])
|
||||||
const subject = ref('')
|
const subject = ref('')
|
||||||
const body = ref('')
|
const body = ref('')
|
||||||
|
const quotedText = ref('')
|
||||||
|
const htmlBody = ref('')
|
||||||
const showCc = ref(false)
|
const showCc = ref(false)
|
||||||
const showBcc = ref(false)
|
const showBcc = ref(false)
|
||||||
|
|
||||||
|
|
@ -27,11 +29,85 @@ const ccInputEl = ref<HTMLInputElement | null>(null)
|
||||||
const bccInputEl = ref<HTMLInputElement | null>(null)
|
const bccInputEl = ref<HTMLInputElement | null>(null)
|
||||||
const bodyEl = ref<HTMLTextAreaElement | null>(null)
|
const bodyEl = ref<HTMLTextAreaElement | null>(null)
|
||||||
|
|
||||||
|
// ── Quote ─────────────────────────────────────────────────
|
||||||
|
const quoteExpanded = ref(true)
|
||||||
|
const hasQuote = computed(() => !!(htmlBody.value || quotedText.value))
|
||||||
|
const isReplyOrForward = computed(() => {
|
||||||
|
const m = session.value?.mode
|
||||||
|
return m === 'reply' || m === 'replyAll' || m === 'forward'
|
||||||
|
})
|
||||||
|
|
||||||
|
/** srcdoc для iframe с оригинальным HTML-письмом */
|
||||||
|
const quoteSrcdoc = computed(() => {
|
||||||
|
if (htmlBody.value) {
|
||||||
|
return `<!DOCTYPE html>
|
||||||
|
<html><head><meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
body {
|
||||||
|
background: transparent;
|
||||||
|
color: rgba(255,255,255,0.88);
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.6;
|
||||||
|
padding: 14px 18px;
|
||||||
|
margin: 0;
|
||||||
|
word-wrap: break-word;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
a { color: #a8e600; text-decoration: none; }
|
||||||
|
a:hover { text-decoration: underline; }
|
||||||
|
img { max-width: 100%; height: auto; border-radius: 6px; }
|
||||||
|
table { max-width: 100%; border-collapse: collapse; }
|
||||||
|
blockquote {
|
||||||
|
border-left: 3px solid rgba(255,255,255,0.15);
|
||||||
|
margin: 8px 0;
|
||||||
|
padding: 4px 12px;
|
||||||
|
color: rgba(255,255,255,0.55);
|
||||||
|
}
|
||||||
|
hr { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 12px 0; }
|
||||||
|
::-webkit-scrollbar { width: 4px; }
|
||||||
|
::-webkit-scrollbar-track { background: transparent; }
|
||||||
|
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.13); border-radius: 9999px; }
|
||||||
|
</style>
|
||||||
|
</head><body>${htmlBody.value}</body></html>`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quotedText.value) {
|
||||||
|
const escaped = quotedText.value
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/\n/g, '<br>')
|
||||||
|
return `<!DOCTYPE html>
|
||||||
|
<html><head><meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: transparent;
|
||||||
|
color: rgba(255,255,255,0.55);
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.6;
|
||||||
|
padding: 14px 18px;
|
||||||
|
margin: 0;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar { width: 4px; }
|
||||||
|
::-webkit-scrollbar-track { background: transparent; }
|
||||||
|
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.13); border-radius: 9999px; }
|
||||||
|
</style>
|
||||||
|
</head><body>${escaped}</body></html>`
|
||||||
|
}
|
||||||
|
|
||||||
|
return ''
|
||||||
|
})
|
||||||
|
|
||||||
// ── Attachments ───────────────────────────────────────────
|
// ── Attachments ───────────────────────────────────────────
|
||||||
interface LocalAttachment extends ComposeAttachment { id: string }
|
interface LocalAttachment extends ComposeAttachment { id: string }
|
||||||
const attachments = ref<LocalAttachment[]>([])
|
const attachments = ref<LocalAttachment[]>([])
|
||||||
const isDragging = ref(false)
|
const isDragging = ref(false)
|
||||||
let dragCounter = 0 // track nested dragenter/dragleave
|
let dragCounter = 0
|
||||||
|
|
||||||
// ── Status ────────────────────────────────────────────────
|
// ── Status ────────────────────────────────────────────────
|
||||||
const sending = ref(false)
|
const sending = ref(false)
|
||||||
|
|
@ -47,15 +123,13 @@ onMounted(async () => {
|
||||||
bcc.value = [...(data.bcc ?? [])]
|
bcc.value = [...(data.bcc ?? [])]
|
||||||
subject.value = data.subject ?? ''
|
subject.value = data.subject ?? ''
|
||||||
body.value = data.body ?? ''
|
body.value = data.body ?? ''
|
||||||
|
quotedText.value = data.quotedText ?? ''
|
||||||
|
htmlBody.value = data.htmlBody ?? ''
|
||||||
showCc.value = cc.value.length > 0
|
showCc.value = cc.value.length > 0
|
||||||
showBcc.value = bcc.value.length > 0
|
showBcc.value = bcc.value.length > 0
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (data.mode === 'new') toInputEl.value?.focus()
|
|
||||||
else {
|
|
||||||
bodyEl.value?.focus()
|
bodyEl.value?.focus()
|
||||||
bodyEl.value?.setSelectionRange(0, 0)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -186,9 +260,11 @@ async function handleSend(): Promise<void> {
|
||||||
bcc: [...bcc.value],
|
bcc: [...bcc.value],
|
||||||
subject: subject.value,
|
subject: subject.value,
|
||||||
body: body.value,
|
body: body.value,
|
||||||
|
quotedText: quotedText.value || undefined,
|
||||||
|
htmlBody: htmlBody.value || undefined,
|
||||||
attachments: attachments.value.map(({ path, filename, size }) => ({ path, filename, size })),
|
attachments: attachments.value.map(({ path, filename, size }) => ({ path, filename, size })),
|
||||||
inReplyTo: sess.inReplyTo,
|
inReplyTo: sess.inReplyTo,
|
||||||
references: sess.references ? [...sess.references] : undefined,
|
references: sess.references || undefined,
|
||||||
replyToMessageId: sess.replyToMessageId,
|
replyToMessageId: sess.replyToMessageId,
|
||||||
replyToFolderId: sess.replyToFolderId
|
replyToFolderId: sess.replyToFolderId
|
||||||
}
|
}
|
||||||
|
|
@ -240,7 +316,7 @@ const totalAttachSize = computed(() =>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="session" class="header-from">
|
<div v-if="session" class="header-from">
|
||||||
<span class="from-dot" />
|
<span class="from-dot" />
|
||||||
<span class="from-label">{{ session.accountLabel || session.accountEmail }}</span>
|
<span class="from-label">{{ session.accountEmail }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -292,7 +368,7 @@ const totalAttachSize = computed(() =>
|
||||||
@blur="commitInput('cc')"
|
@blur="commitInput('cc')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button class="field-toggle close-field" @click="showCc = false; cc = []">✕</button>
|
<button class="field-toggle close-field" @click="showCc = false; cc = []">✕</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -317,7 +393,7 @@ const totalAttachSize = computed(() =>
|
||||||
@blur="commitInput('bcc')"
|
@blur="commitInput('bcc')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button class="field-toggle close-field" @click="showBcc = false; bcc = []">✕</button>
|
<button class="field-toggle close-field" @click="showBcc = false; bcc = []">✕</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -340,9 +416,31 @@ const totalAttachSize = computed(() =>
|
||||||
ref="bodyEl"
|
ref="bodyEl"
|
||||||
class="compose-body"
|
class="compose-body"
|
||||||
v-model="body"
|
v-model="body"
|
||||||
placeholder="Напишите сообщение…"
|
:placeholder="isReplyOrForward ? 'Напишите ответ…' : 'Напишите сообщение…'"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- ── Quote section (reply/forward) ─────────────── -->
|
||||||
|
<template v-if="hasQuote">
|
||||||
|
<button class="quote-toggle" @click="quoteExpanded = !quoteExpanded">
|
||||||
|
<span class="quote-toggle-line" />
|
||||||
|
<span class="quote-toggle-label">
|
||||||
|
<AppIcon name="chevron-right" :size="10" :style="{ transform: quoteExpanded ? 'rotate(90deg)' : 'none', transition: 'transform 0.15s' }" />
|
||||||
|
Оригинальное письмо
|
||||||
|
</span>
|
||||||
|
<span class="quote-toggle-line" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<Transition name="quote">
|
||||||
|
<div v-if="quoteExpanded" class="quote-frame-wrap">
|
||||||
|
<iframe
|
||||||
|
:srcdoc="quoteSrcdoc"
|
||||||
|
class="quote-frame"
|
||||||
|
sandbox="allow-same-origin"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- Drag-drop overlay -->
|
<!-- Drag-drop overlay -->
|
||||||
<Transition name="drag">
|
<Transition name="drag">
|
||||||
<div v-if="isDragging" class="drag-overlay">
|
<div v-if="isDragging" class="drag-overlay">
|
||||||
|
|
@ -447,6 +545,7 @@ const totalAttachSize = computed(() =>
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.12),
|
inset 0 1px 0 rgba(255, 255, 255, 0.12),
|
||||||
0 1px 0 rgba(0, 0, 0, 0.25);
|
0 1px 0 rgba(0, 0, 0, 0.25);
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
-webkit-app-region: drag;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-mode {
|
.header-mode {
|
||||||
|
|
@ -639,11 +738,14 @@ const totalAttachSize = computed(() =>
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
margin: 8px 0 0;
|
margin: 8px 0 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.compose-body {
|
.compose-body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
min-height: 120px;
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|
@ -651,19 +753,92 @@ const totalAttachSize = computed(() =>
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 1.7;
|
line-height: 1.7;
|
||||||
padding: 12px 18px 12px;
|
padding: 12px 18px;
|
||||||
caret-color: var(--accent);
|
caret-color: var(--accent);
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
backdrop-filter: none;
|
backdrop-filter: none;
|
||||||
-webkit-backdrop-filter: none;
|
-webkit-backdrop-filter: none;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.compose-body::placeholder {
|
.compose-body::placeholder {
|
||||||
color: rgba(255, 255, 255, 0.15);
|
color: rgba(255, 255, 255, 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Quote section ───────────────────────────────────────── */
|
||||||
|
.quote-toggle {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 4px 18px;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-toggle-line {
|
||||||
|
flex: 1;
|
||||||
|
height: 1px;
|
||||||
|
background: rgba(255, 255, 255, 0.07);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-toggle-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text-muted);
|
||||||
|
opacity: 0.6;
|
||||||
|
white-space: nowrap;
|
||||||
|
transition: opacity var(--transition-fast), color var(--transition-fast);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-toggle:hover .quote-toggle-label {
|
||||||
|
opacity: 1;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-frame-wrap {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 120px;
|
||||||
|
margin: 0 12px 8px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
|
background: rgba(10, 10, 16, 0.5);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-frame {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 120px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-enter-active {
|
||||||
|
transition: opacity 180ms ease, max-height 250ms ease;
|
||||||
|
max-height: 600px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.quote-leave-active {
|
||||||
|
transition: opacity 120ms ease, max-height 200ms ease;
|
||||||
|
max-height: 600px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.quote-enter-from {
|
||||||
|
opacity: 0;
|
||||||
|
max-height: 0;
|
||||||
|
}
|
||||||
|
.quote-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
max-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ── Drag overlay ────────────────────────────────────────── */
|
/* ── Drag overlay ────────────────────────────────────────── */
|
||||||
.drag-overlay {
|
.drag-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,15 @@ export interface CalendarInfo {
|
||||||
accountId: string
|
accountId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type AttendeeStatus = 'accepted' | 'declined' | 'tentative' | 'unknown'
|
||||||
|
|
||||||
|
export interface AttendeeInfo {
|
||||||
|
name: string
|
||||||
|
email: string
|
||||||
|
required: boolean
|
||||||
|
status: AttendeeStatus
|
||||||
|
}
|
||||||
|
|
||||||
export interface CalendarEvent {
|
export interface CalendarEvent {
|
||||||
id: string
|
id: string
|
||||||
uid: string
|
uid: string
|
||||||
|
|
@ -17,6 +26,6 @@ export interface CalendarEvent {
|
||||||
location?: string
|
location?: string
|
||||||
description?: string
|
description?: string
|
||||||
organizer?: string
|
organizer?: string
|
||||||
attendees: string[]
|
attendees: AttendeeInfo[]
|
||||||
status?: 'tentative' | 'confirmed' | 'cancelled'
|
status?: 'tentative' | 'confirmed' | 'cancelled'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ export interface IpcChannelMap {
|
||||||
|
|
||||||
'app:setZoom': [{ factor: number }, void]
|
'app:setZoom': [{ factor: number }, void]
|
||||||
'app:isEncryptionAvailable': [void, boolean]
|
'app:isEncryptionAvailable': [void, boolean]
|
||||||
|
'app:copyToClipboard': [{ text: string }, void]
|
||||||
|
|
||||||
'calendar:list': [{ accountId: string }, CalendarInfo[]]
|
'calendar:list': [{ accountId: string }, CalendarInfo[]]
|
||||||
'calendar:events': [
|
'calendar:events': [
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ export interface MessageBody {
|
||||||
id: string
|
id: string
|
||||||
html: string | null
|
html: string | null
|
||||||
text: string | null
|
text: string | null
|
||||||
|
references: string | null // References header (цепочка Message-ID для треда)
|
||||||
inlineImages: InlineImage[]
|
inlineImages: InlineImage[]
|
||||||
attachments: Attachment[]
|
attachments: Attachment[]
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +58,9 @@ export interface ComposeData {
|
||||||
cc: string[]
|
cc: string[]
|
||||||
bcc: string[]
|
bcc: string[]
|
||||||
subject: string
|
subject: string
|
||||||
body: string // plain text
|
body: string // Текст пользователя (без цитаты)
|
||||||
|
quotedText?: string // Plain-text цитата оригинала (> строки с атрибуцией)
|
||||||
|
htmlBody?: string // HTML-блокквота оригинала (для рендера в compose + text/html часть)
|
||||||
attachments?: ComposeAttachment[]
|
attachments?: ComposeAttachment[]
|
||||||
inReplyTo?: string // Message-ID оригинала (для ответа)
|
inReplyTo?: string // Message-ID оригинала (для ответа)
|
||||||
references?: string // References header
|
references?: string // References header
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue