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 { statSync } from 'node:fs'
|
||||
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 }
|
||||
})
|
||||
|
||||
ipcMain.handle('app:copyToClipboard', (_event, { text }: { text: string }) => {
|
||||
clipboard.writeText(text)
|
||||
})
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
await accountManager.initialize()
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import https from 'node:https'
|
|||
import http from 'node:http'
|
||||
import type { IncomingMessage } from 'node:http'
|
||||
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 {
|
||||
buildNegotiateHeader,
|
||||
parseChallenge,
|
||||
|
|
@ -226,7 +226,11 @@ export class CalDavProvider {
|
|||
</m:FindItem>`)
|
||||
|
||||
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 ───────────────────────────────────────────────────────────
|
||||
|
|
@ -260,6 +264,100 @@ export class CalDavProvider {
|
|||
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[] {
|
||||
const events: CalendarEvent[] = []
|
||||
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}>`))
|
||||
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="([^"]+)"/)
|
||||
if (!idM) continue
|
||||
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 isAllDay = get('IsAllDayEvent') === 'true'
|
||||
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({
|
||||
id: `ews::${idM[1]}`,
|
||||
uid: idM[1],
|
||||
|
|
@ -290,8 +403,8 @@ export class CalDavProvider {
|
|||
end: end.toISOString(),
|
||||
isAllDay,
|
||||
location: get('Location') || undefined,
|
||||
description: get('Body') || undefined,
|
||||
organizer: organizerM ? organizerM[1] : undefined,
|
||||
description: getBody(),
|
||||
organizer,
|
||||
attendees: [],
|
||||
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
|
||||
private notifiedUids = new Map<string, number>()
|
||||
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) {
|
||||
const creds = config.credentials as ImapCredentials
|
||||
|
|
@ -58,6 +60,8 @@ export class ImapProvider implements IEmailProvider {
|
|||
)
|
||||
await Promise.race([this.client.connect(), timeout])
|
||||
this.connected = true
|
||||
// Запускаем в фоне; промис await-ится в sendMessage() — гарантия что имя готово к отправке
|
||||
this.senderNamePromise = this.fetchSenderName().catch(() => null)
|
||||
}
|
||||
|
||||
async disconnect(): Promise<void> {
|
||||
|
|
@ -179,7 +183,7 @@ export class ImapProvider implements IEmailProvider {
|
|||
// imapflow использует BODY.PEEK[] (не BODY[]) для source-запросов — \Seen не ставится
|
||||
const download = await this.client.download(messageId, undefined, { uid: true })
|
||||
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)
|
||||
|
|
@ -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 {
|
||||
id: messageId,
|
||||
html: parsed.html ? sanitizeHtml(parsed.html) : null,
|
||||
text: parsed.text ?? null,
|
||||
html: sanitizedHtml,
|
||||
text,
|
||||
references,
|
||||
inlineImages,
|
||||
attachments
|
||||
}
|
||||
|
|
@ -288,10 +303,21 @@ export class ImapProvider implements IEmailProvider {
|
|||
? this.config.email
|
||||
: `${this.config.email}@${creds.host.replace(/^[^.]+\./, '')}`
|
||||
|
||||
const from = this.config.label
|
||||
? { name: this.config.label, address: emailAddress }
|
||||
// Имя отправителя: await-им промис из connect() — гарантирует что имя готово
|
||||
const senderName = await this.senderNamePromise
|
||||
const displayName = senderName ?? this.config.label
|
||||
const from = displayName
|
||||
? { name: displayName, address: 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',
|
||||
smtpHost, smtpPort, smtpSecure, from, compose.to)
|
||||
|
||||
|
|
@ -301,7 +327,8 @@ export class ImapProvider implements IEmailProvider {
|
|||
cc: compose.cc.length ? compose.cc.join(', ') : undefined,
|
||||
bcc: compose.bcc.length ? compose.bcc.join(', ') : undefined,
|
||||
subject: compose.subject,
|
||||
text: compose.body,
|
||||
text: fullText,
|
||||
html: fullHtml,
|
||||
inReplyTo: compose.inReplyTo,
|
||||
references: compose.references,
|
||||
attachments: compose.attachments?.map((a) => ({ path: a.path, filename: a.filename })) ?? []
|
||||
|
|
@ -343,13 +370,21 @@ export class ImapProvider implements IEmailProvider {
|
|||
): Promise<Buffer | null> {
|
||||
try {
|
||||
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({
|
||||
from,
|
||||
to: compose.to.join(', '),
|
||||
cc: compose.cc.length ? compose.cc.join(', ') : undefined,
|
||||
bcc: compose.bcc.length ? compose.bcc.join(', ') : undefined,
|
||||
subject: compose.subject,
|
||||
text: compose.body,
|
||||
text: fullText,
|
||||
html: fullHtml,
|
||||
messageId,
|
||||
inReplyTo: compose.inReplyTo,
|
||||
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 {
|
||||
if (!node) return false
|
||||
if (node.disposition === 'attachment') return true
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@ export type IconName =
|
|||
| 'image'
|
||||
| 'bell-off'
|
||||
| 'calendar'
|
||||
| 'warning'
|
||||
| 'location'
|
||||
| 'person'
|
||||
| 'people'
|
||||
| 'copy'
|
||||
| 'check'
|
||||
|
||||
const props = defineProps<{
|
||||
name: IconName
|
||||
|
|
@ -148,6 +154,32 @@ const paths: Record<IconName, string> = {
|
|||
<line x1="8" y1="2" x2="8" y2="6"/>
|
||||
<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>
|
||||
|
||||
|
|
|
|||
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 { useAccountsStore } from '../../stores/accounts.store'
|
||||
|
||||
const props = defineProps<{
|
||||
account: AccountConfig
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: []
|
||||
}>()
|
||||
const props = defineProps<{ account: AccountConfig }>()
|
||||
const emit = defineEmits<{ close: [] }>()
|
||||
|
||||
const accountsStore = useAccountsStore()
|
||||
|
||||
const step = ref<'credentials' | 'testing'>('credentials')
|
||||
const step = ref<'form' | 'testing'>('form')
|
||||
const error = ref('')
|
||||
const testing = ref(false)
|
||||
|
||||
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 imapPort = ref(creds.port ?? 993)
|
||||
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 smtpPort = ref(creds.smtpPort ?? 587)
|
||||
const smtpSecure = ref(creds.smtpSecure ?? false)
|
||||
const showSmtp = ref(!!creds.smtpHost)
|
||||
const smtpAllowSelfSigned = ref(creds.smtpAllowSelfSigned ?? false)
|
||||
|
||||
const caldavHost = ref(creds.caldavHost ?? '')
|
||||
const caldavPort = ref(creds.caldavPort ?? 443)
|
||||
const caldavSecure = ref(creds.caldavSecure ?? true)
|
||||
const caldavPath = ref(creds.caldavPath ?? '')
|
||||
const caldavAllowSelfSigned = ref(creds.caldavAllowSelfSigned ?? false)
|
||||
const showCaldav = ref(!!creds.caldavHost)
|
||||
// ── Testing checklist ─────────────────────────────────────────────────────
|
||||
type CheckStatus = 'idle' | 'checking' | 'ok' | 'error'
|
||||
const imapCheck = ref<CheckStatus>('idle')
|
||||
const smtpCheck = ref<CheckStatus>('idle')
|
||||
|
||||
// ── 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> {
|
||||
testing.value = true
|
||||
error.value = ''
|
||||
|
||||
try {
|
||||
const credentials: ImapCredentials = {
|
||||
host: imapHost.value,
|
||||
port: imapPort.value,
|
||||
secure: imapSecure.value,
|
||||
username: imapUsername.value,
|
||||
password: imapPassword.value,
|
||||
...(showSmtp.value && smtpHost.value
|
||||
? { smtpHost: smtpHost.value, smtpPort: smtpPort.value, smtpSecure: smtpSecure.value }
|
||||
: {}),
|
||||
...(showCaldav.value && caldavHost.value
|
||||
? {
|
||||
caldavHost: caldavHost.value,
|
||||
caldavPort: caldavPort.value,
|
||||
caldavSecure: caldavSecure.value,
|
||||
...(caldavPath.value.trim() ? { caldavPath: caldavPath.value.trim() } : {}),
|
||||
...(caldavAllowSelfSigned.value ? { caldavAllowSelfSigned: true } : {})
|
||||
}
|
||||
: {})
|
||||
username: email.value,
|
||||
password: password.value, // empty → backend restores existing
|
||||
...(smtpHost.value ? {
|
||||
smtpHost: smtpHost.value,
|
||||
smtpPort: smtpPort.value,
|
||||
smtpSecure: smtpSecure.value,
|
||||
...(smtpAllowSelfSigned.value ? { smtpAllowSelfSigned: true } : {})
|
||||
} : {})
|
||||
}
|
||||
const config: AccountConfig = {
|
||||
id: props.account.id,
|
||||
type: AccountType.IMAP,
|
||||
label: imapLabel.value || imapUsername.value,
|
||||
email: imapUsername.value,
|
||||
label: label.value || email.value,
|
||||
email: email.value,
|
||||
credentials
|
||||
}
|
||||
|
||||
// If password is provided, test connection first
|
||||
if (imapPassword.value !== '') {
|
||||
// Only test if password was changed
|
||||
if (password.value !== '') {
|
||||
step.value = 'testing'
|
||||
imapCheck.value = 'checking'
|
||||
smtpCheck.value = 'idle'
|
||||
|
||||
const testResult = await accountsStore.testConnection(config)
|
||||
if (!testResult.success) {
|
||||
error.value = testResult.error ?? 'Ошибка подключения'
|
||||
step.value = 'credentials'
|
||||
imapCheck.value = 'error'
|
||||
error.value = testResult.error ?? 'Ошибка подключения к IMAP'
|
||||
step.value = 'form'
|
||||
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)
|
||||
|
|
@ -87,149 +99,165 @@ async function handleSubmit(): Promise<void> {
|
|||
emit('close')
|
||||
} else {
|
||||
error.value = updateResult.error ?? 'Не удалось обновить аккаунт'
|
||||
step.value = 'credentials'
|
||||
}
|
||||
} catch (err) {
|
||||
error.value = (err as Error).message
|
||||
step.value = 'credentials'
|
||||
} finally {
|
||||
testing.value = false
|
||||
step.value = 'form'
|
||||
}
|
||||
}
|
||||
|
||||
const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
||||
const isFormValid = computed(() => email.value.trim() && imapHost.value && smtpHost.value)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="dialog-overlay" @click.self="emit('close')">
|
||||
<div class="dialog">
|
||||
|
||||
<!-- ── Form step ─────────────────────────────────────── -->
|
||||
<template v-if="step === 'form'">
|
||||
<div class="dialog-header">
|
||||
<h2>Редактировать аккаунт</h2>
|
||||
<button class="close-btn" @click="emit('close')">×</button>
|
||||
<div class="header-avatar">{{ avatarLetter }}</div>
|
||||
<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 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>
|
||||
|
||||
<form @submit.prevent="handleSubmit">
|
||||
<!-- Email + Password -->
|
||||
<div class="form-group">
|
||||
<label>Название (необязательно)</label>
|
||||
<input v-model="imapLabel" type="text" placeholder="Моя почта" />
|
||||
</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 />
|
||||
<label>Email / имя пользователя</label>
|
||||
<input v-model="email" type="text" placeholder="user@example.com" required />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<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>
|
||||
<!-- 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">
|
||||
<div class="form-row">
|
||||
<!-- IMAP section -->
|
||||
<div class="section-sep">
|
||||
<span class="section-label-text">IMAP</span>
|
||||
</div>
|
||||
<div class="server-row">
|
||||
<div class="form-group flex-1">
|
||||
<label>SMTP сервер</label>
|
||||
<input v-model="smtpHost" type="text" :placeholder="imapHost ? imapHost.replace(/^imap\./i, 'smtp.') : 'smtp.example.com'" />
|
||||
<label>Сервер</label>
|
||||
<input v-model="imapHost" type="text" placeholder="imap.example.com" required />
|
||||
</div>
|
||||
<div class="form-group" style="width: 80px">
|
||||
<div class="form-group port-group">
|
||||
<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 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" />
|
||||
SSL/TLS (порт 465)
|
||||
<span class="toggle-track" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 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">
|
||||
<div class="form-group" style="margin-top: -10px; margin-bottom: 14px;">
|
||||
<label class="checkbox-label">
|
||||
<input v-model="caldavSecure" 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" />
|
||||
<input v-model="smtpAllowSelfSigned" type="checkbox" />
|
||||
Разрешить самоподписанные сертификаты
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Display section -->
|
||||
<div class="section-sep">
|
||||
<span class="section-label-text">Отображение</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Название аккаунта (опционально)</label>
|
||||
<input v-model="label" type="text" :placeholder="email || 'Моя почта'" />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="submit-btn" :disabled="!isFormValid || testing">
|
||||
{{ testing ? 'Сохранение...' : 'Сохранить изменения' }}
|
||||
<button type="submit" class="submit-btn" :disabled="!isFormValid">
|
||||
Сохранить изменения
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="step === 'testing'" class="dialog-body testing-state">
|
||||
<div class="spinner" />
|
||||
<span>Проверка подключения...</span>
|
||||
<!-- ── Testing step ──────────────────────────────────── -->
|
||||
<template v-if="step === 'testing'">
|
||||
<div class="dialog-header">
|
||||
<div class="header-avatar">{{ avatarLetter }}</div>
|
||||
<div class="header-text">
|
||||
<h2>Проверка подключения</h2>
|
||||
<p>{{ email }}</p>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* ── Overlay ──────────────────────────────────────────────── */
|
||||
.dialog-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(9, 9, 14, 0.40);
|
||||
background: rgba(9, 9, 14, 0.45);
|
||||
backdrop-filter: blur(20px) saturate(1.6);
|
||||
-webkit-backdrop-filter: blur(20px) saturate(1.6);
|
||||
display: flex;
|
||||
|
|
@ -244,9 +272,11 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
|||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
/* ── Dialog ───────────────────────────────────────────────── */
|
||||
.dialog {
|
||||
position: relative;
|
||||
width: 560px;
|
||||
width: 520px;
|
||||
max-width: 96vw;
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
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);
|
||||
}
|
||||
|
||||
.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 {
|
||||
from { opacity: 0; transform: scale(0.92) translateY(14px); }
|
||||
to { opacity: 1; transform: scale(1) translateY(0); }
|
||||
}
|
||||
|
||||
.dialog::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
pointer-events: none;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
/* ── Header ───────────────────────────────────────────────── */
|
||||
.dialog-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 22px 28px;
|
||||
gap: 12px;
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
rgba(255, 255, 255, 0.10) 0%,
|
||||
rgba(255, 255, 255, 0.04) 100%
|
||||
);
|
||||
gap: 14px;
|
||||
padding: 20px 24px;
|
||||
background: linear-gradient(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);
|
||||
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;
|
||||
font-size: 17px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.header-text h2 {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
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 {
|
||||
|
|
@ -309,38 +366,28 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
color: var(--text-muted);
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.18),
|
||||
inset 0 -1px 0 rgba(0, 0, 0, 0.12);
|
||||
transition:
|
||||
background var(--transition-fast),
|
||||
color var(--transition-fast),
|
||||
box-shadow var(--transition-fast);
|
||||
box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -1px 0 rgba(0,0,0,0.12);
|
||||
transition: background var(--transition-fast), color var(--transition-fast);
|
||||
}
|
||||
|
||||
.close-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.16);
|
||||
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 {
|
||||
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 {
|
||||
padding: 10px 14px;
|
||||
user-select: text;
|
||||
|
|
@ -354,48 +401,47 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
|||
font-size: 12px;
|
||||
margin-bottom: 18px;
|
||||
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 {
|
||||
margin-bottom: 18px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
.form-group label:not(.checkbox-label):not(.toggle-switch) {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.40);
|
||||
margin-bottom: 7px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
color: rgba(255, 255, 255, 0.38);
|
||||
margin-bottom: 6px;
|
||||
text-transform: uppercase;
|
||||
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="password"],
|
||||
.form-group input[type="number"] {
|
||||
width: 100%;
|
||||
padding: 12px 14px;
|
||||
padding: 11px 13px;
|
||||
font-size: 14px;
|
||||
border-radius: var(--radius-md);
|
||||
background: rgba(0, 0, 0, 0.22);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border-top-color: rgba(0, 0, 0, 0.30);
|
||||
box-shadow:
|
||||
inset 0 2px 6px rgba(0, 0, 0, 0.28),
|
||||
0 1px 0 rgba(255, 255, 255, 0.07);
|
||||
backdrop-filter: none;
|
||||
transition:
|
||||
background var(--transition-fast),
|
||||
border-color var(--transition-fast),
|
||||
box-shadow var(--transition-fast);
|
||||
color: var(--text-primary);
|
||||
box-shadow: inset 0 2px 6px rgba(0,0,0,0.28), 0 1px 0 rgba(255,255,255,0.07);
|
||||
transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.form-group input[type="text"]:focus,
|
||||
.form-group input[type="password"]:focus,
|
||||
.form-group input[type="number"]:focus {
|
||||
.form-group input:focus {
|
||||
outline: none;
|
||||
background: rgba(0, 0, 0, 0.28);
|
||||
border-color: color-mix(in srgb, var(--accent) 50%, transparent);
|
||||
border-top-color: rgba(0, 0, 0, 0.25);
|
||||
|
|
@ -405,31 +451,119 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
|||
0 1px 0 rgba(255,255,255,0.06);
|
||||
}
|
||||
|
||||
.form-row {
|
||||
/* ── Section separator ────────────────────────────────────── */
|
||||
.section-sep {
|
||||
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; }
|
||||
|
||||
.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 {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
text-transform: none !important;
|
||||
letter-spacing: 0 !important;
|
||||
font-size: 12px !important;
|
||||
font-weight: 400 !important;
|
||||
color: var(--text-secondary) !important;
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.checkbox-label input[type="checkbox"] {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
min-width: 16px;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
min-width: 15px;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
|
|
@ -437,48 +571,36 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
|||
background: rgba(0, 0, 0, 0.22);
|
||||
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||
border-top-color: rgba(0, 0, 0, 0.28);
|
||||
box-shadow:
|
||||
inset 0 2px 4px rgba(0, 0, 0, 0.25),
|
||||
0 1px 0 rgba(255, 255, 255, 0.07);
|
||||
transition:
|
||||
background var(--transition-fast),
|
||||
box-shadow var(--transition-fast);
|
||||
box-shadow: inset 0 2px 4px rgba(0,0,0,0.25);
|
||||
transition: background var(--transition-fast);
|
||||
}
|
||||
|
||||
.checkbox-label input[type="checkbox"]:checked {
|
||||
background: var(--accent);
|
||||
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 {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 4px;
|
||||
top: 2px;
|
||||
width: 5px;
|
||||
height: 8px;
|
||||
border: 2px solid #0d1a00;
|
||||
top: 1px;
|
||||
width: 4px;
|
||||
height: 7px;
|
||||
border: 1.5px solid #0d1a00;
|
||||
border-top: none;
|
||||
border-left: none;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.checkbox-label input[type="checkbox"]:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* ── Submit ───────────────────────────────────────────────── */
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
padding: 14px;
|
||||
padding: 13px;
|
||||
border-radius: var(--radius-md);
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
margin-top: 8px;
|
||||
color: var(--accent-text);
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
|
|
@ -488,12 +610,8 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
|||
box-shadow:
|
||||
inset 0 1px 0 rgba(255,255,255,0.40),
|
||||
inset 0 -1px 0 rgba(0,0,0,0.12),
|
||||
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);
|
||||
0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent);
|
||||
transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
|
||||
}
|
||||
|
||||
.submit-btn:hover:not(:disabled) {
|
||||
|
|
@ -504,94 +622,75 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
|||
);
|
||||
box-shadow:
|
||||
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 1px 4px rgba(0, 0, 0, 0.22);
|
||||
0 4px 18px color-mix(in srgb, var(--accent) 40%, transparent);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.submit-btn:active:not(:disabled) {
|
||||
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:active:not(:disabled) { transform: translateY(0); }
|
||||
|
||||
.submit-btn:disabled {
|
||||
opacity: 0.35;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.testing-state {
|
||||
/* ── Testing step ─────────────────────────────────────────── */
|
||||
.testing-body {
|
||||
padding: 32px 24px 40px;
|
||||
}
|
||||
|
||||
.check-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 48px 20px;
|
||||
color: var(--text-muted);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
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%;
|
||||
.check-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 14px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: var(--text-muted);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
transition: background var(--transition-fast), color var(--transition-fast);
|
||||
gap: 14px;
|
||||
padding: 14px 16px;
|
||||
border-radius: 12px;
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid rgba(255,255,255,0.07);
|
||||
transition: border-color var(--transition-fast), background var(--transition-fast);
|
||||
}
|
||||
|
||||
.smtp-toggle:hover {
|
||||
.check-row.ok { background: rgba(168,230,0,0.07); border-color: rgba(168,230,0,0.20); }
|
||||
.check-row.error { background: rgba(255,85,85,0.08); border-color: rgba(255,85,85,0.22); }
|
||||
|
||||
.check-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255,255,255,0.07);
|
||||
color: var(--text-secondary);
|
||||
border: 1px solid rgba(255,255,255,0.10);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.smtp-fields {
|
||||
padding: 8px 14px 12px;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.07);
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
.check-spinner {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -12,12 +12,20 @@ const props = defineProps<{
|
|||
const emit = defineEmits<{ click: [event: CalendarEvent] }>()
|
||||
|
||||
const timeLabel = computed(() => {
|
||||
if (props.event.isAllDay) return 'All day'
|
||||
if (props.event.isAllDay) return 'Весь день'
|
||||
const start = new Date(props.event.start)
|
||||
const end = new Date(props.event.end)
|
||||
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(() => {
|
||||
if (props.event.status === 'cancelled') return 'cancelled'
|
||||
if (props.event.status === 'tentative') return 'tentative'
|
||||
|
|
@ -28,65 +36,166 @@ const statusClass = computed(() => {
|
|||
<template>
|
||||
<div
|
||||
class="event-block"
|
||||
:class="statusClass"
|
||||
:style="{ ...(style ?? {}), '--event-color': color ?? 'var(--accent)' }"
|
||||
:class="[statusClass, { 'event-short': isShort }]"
|
||||
:style="{ ...(style ?? {}), '--ev-color': color ?? 'var(--accent)' }"
|
||||
@click.stop="emit('click', event)"
|
||||
>
|
||||
<div class="event-title">{{ event.title }}</div>
|
||||
<div class="event-time">{{ timeLabel }}</div>
|
||||
<div v-if="event.location" class="event-location">{{ event.location }}</div>
|
||||
<!-- Specular highlight bar -->
|
||||
<div class="ev-specular" />
|
||||
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.event-block {
|
||||
position: absolute;
|
||||
left: 2px;
|
||||
right: 2px;
|
||||
border-radius: 6px;
|
||||
padding: 3px 6px;
|
||||
font-size: 11px;
|
||||
line-height: 1.3;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
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;
|
||||
|
||||
/* 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 {
|
||||
filter: brightness(1.15);
|
||||
transform: scale(1.01);
|
||||
transform: scaleX(1.008) scaleY(1.005);
|
||||
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 {
|
||||
opacity: 0.45;
|
||||
opacity: 0.38;
|
||||
text-decoration: line-through;
|
||||
filter: grayscale(0.4);
|
||||
}
|
||||
|
||||
.event-block.tentative {
|
||||
border-left-style: dashed;
|
||||
opacity: 0.75;
|
||||
opacity: 0.68;
|
||||
}
|
||||
|
||||
.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;
|
||||
color: var(--text-primary);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
line-height: 1.3;
|
||||
letter-spacing: -0.1px;
|
||||
}
|
||||
|
||||
.event-time,
|
||||
.event-location {
|
||||
.event-short .ev-title {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.ev-time {
|
||||
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;
|
||||
overflow: hidden;
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -1,200 +1,560 @@
|
|||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import { format } from 'date-fns'
|
||||
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 { useIpc } from '../../composables/useIpc'
|
||||
|
||||
const props = defineProps<{
|
||||
event: CalendarEvent
|
||||
color?: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{ close: [] }>()
|
||||
|
||||
// ── Date / time ───────────────────────────────────────────────────────────────
|
||||
|
||||
const dateLabel = computed(() => {
|
||||
const start = new Date(props.event.start)
|
||||
const end = new Date(props.event.end)
|
||||
|
||||
const s = new Date(props.event.start)
|
||||
const e = new Date(props.event.end)
|
||||
if (props.event.isAllDay) {
|
||||
const isSameDay = start.toDateString() === end.toDateString()
|
||||
if (isSameDay) return format(start, 'd MMMM yyyy', { locale: ru })
|
||||
const endAdjusted = new Date(end.getTime() - 1) // all-day end is exclusive
|
||||
return `${format(start, 'd MMMM', { locale: ru })} – ${format(endAdjusted, 'd MMMM yyyy', { locale: ru })}`
|
||||
if (s.toDateString() === e.toDateString()) return format(s, 'd MMMM yyyy', { locale: ru })
|
||||
const adj = new Date(e.getTime() - 1)
|
||||
return `${format(s, 'd MMMM', { locale: ru })} – ${format(adj, 'd MMMM yyyy', { locale: ru })}`
|
||||
}
|
||||
|
||||
const sameDay = start.toDateString() === end.toDateString()
|
||||
if (sameDay) {
|
||||
return `${format(start, 'd MMMM yyyy, HH:mm', { locale: ru })} – ${format(end, 'HH:mm')}`
|
||||
if (s.toDateString() === e.toDateString()) {
|
||||
return `${format(s, 'd MMMM yyyy', { locale: ru })}, ${format(s, 'HH:mm')} – ${format(e, '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> = {
|
||||
confirmed: 'Подтверждено',
|
||||
tentative: 'Предварительно',
|
||||
cancelled: 'Отменено'
|
||||
const durationLabel = computed(() => {
|
||||
if (props.event.isAllDay) return 'Весь день'
|
||||
const mins = Math.round((new Date(props.event.end).getTime() - new Date(props.event.start).getTime()) / 60_000)
|
||||
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>
|
||||
|
||||
<template>
|
||||
<div class="popup-backdrop" @click.self="emit('close')">
|
||||
<div class="popup">
|
||||
<div class="popup-header">
|
||||
<h3 class="popup-title">{{ event.title }}</h3>
|
||||
<div class="backdrop" @click.self="emit('close')">
|
||||
<div class="popup" :style="{ '--ev': evColor }">
|
||||
|
||||
<!-- top specular line -->
|
||||
<div class="specular" />
|
||||
|
||||
<!-- ─── Hero ─────────────────────────────────────────────────────── -->
|
||||
<div class="hero">
|
||||
<div class="hero-wash" />
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="popup-body">
|
||||
<div class="meta-row">
|
||||
<span class="meta-icon">📅</span>
|
||||
<span>{{ dateLabel }}</span>
|
||||
<!-- Compact: overlapping avatar stack -->
|
||||
<div v-if="!expanded" class="avatar-stack">
|
||||
<div
|
||||
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 v-if="event.status && event.status !== 'confirmed'" class="meta-row status" :class="event.status">
|
||||
<span class="meta-icon">●</span>
|
||||
<span>{{ statusLabel[event.status] ?? event.status }}</span>
|
||||
<!-- Expanded: full list -->
|
||||
<div v-else class="plist">
|
||||
<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 v-if="event.location" class="meta-row">
|
||||
<span class="meta-icon">📍</span>
|
||||
<span>{{ event.location }}</span>
|
||||
<div class="ptext">
|
||||
<div class="pname-row">
|
||||
<span class="pname">{{ a.name }}</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 v-if="event.organizer" class="meta-row">
|
||||
<span class="meta-icon">👤</span>
|
||||
<span>{{ event.organizer }}</span>
|
||||
</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 v-if="event.description" class="description">
|
||||
{{ event.description }}
|
||||
<!-- Description -->
|
||||
<div v-if="event.description" class="card desc-card">
|
||||
<p class="desc-text selectable">{{ event.description }}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.popup-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
backdrop-filter: blur(4px);
|
||||
/* ── Backdrop ─────────────────────────────────────────────────────────────── */
|
||||
|
||||
.backdrop {
|
||||
position: fixed; inset: 0; z-index: 100;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
background: rgba(0,0,0,0.38);
|
||||
backdrop-filter: blur(10px) brightness(0.82);
|
||||
-webkit-backdrop-filter: blur(10px) brightness(0.82);
|
||||
animation: fade-in 170ms ease;
|
||||
}
|
||||
@keyframes fade-in { from { opacity:0 } to { opacity:1 } }
|
||||
|
||||
/* ── Popup ────────────────────────────────────────────────────────────────── */
|
||||
|
||||
.popup {
|
||||
width: 400px;
|
||||
max-width: 90vw;
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
border-radius: var(--radius-xl);
|
||||
border: 1px solid var(--glass-border-strong);
|
||||
background:
|
||||
linear-gradient(160deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.03) 100%),
|
||||
rgba(14, 14, 22, 0.94);
|
||||
backdrop-filter: blur(48px) saturate(2);
|
||||
position: relative;
|
||||
width: 460px; max-width: 94vw; max-height: 86vh;
|
||||
overflow-y: auto; overflow-x: hidden;
|
||||
border-radius: 24px;
|
||||
isolation: isolate;
|
||||
|
||||
background: rgba(13,12,23,0.64);
|
||||
backdrop-filter: blur(72px) saturate(2.8);
|
||||
-webkit-backdrop-filter: blur(72px) saturate(2.8);
|
||||
|
||||
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:
|
||||
inset 0 1px 0 rgba(255,255,255,0.14),
|
||||
var(--shadow-xl);
|
||||
padding: 20px;
|
||||
0 0 0 0.5px rgba(0,0,0,0.55),
|
||||
0 4px 16px rgba(0,0,0,0.35),
|
||||
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 {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
margin-bottom: 16px;
|
||||
.specular {
|
||||
position: absolute; top:0; left:14px; right:14px; height:1px;
|
||||
pointer-events: none; z-index: 10;
|
||||
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.62) 28%, rgba(255,255,255,0.62) 72%, transparent);
|
||||
}
|
||||
|
||||
.popup-title {
|
||||
flex: 1;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
/* ── Hero ─────────────────────────────────────────────────────────────────── */
|
||||
|
||||
.hero {
|
||||
position: relative;
|
||||
padding: 22px 22px 24px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.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 {
|
||||
flex-shrink: 0;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--text-muted);
|
||||
background: var(--glass-bg);
|
||||
border: 1px solid var(--glass-border);
|
||||
transition: background var(--transition-fast), color var(--transition-fast);
|
||||
position: absolute; top:16px; right:16px;
|
||||
width:26px; height:26px; border-radius:50%;
|
||||
display:flex; align-items:center; justify-content:center;
|
||||
background: rgba(255,255,255,0.08);
|
||||
border: 1px solid rgba(255,255,255,0.11);
|
||||
color: rgba(255,255,255,0.38);
|
||||
transition: background 120ms, color 120ms;
|
||||
z-index: 2;
|
||||
}
|
||||
.close-btn:hover { background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.75) }
|
||||
|
||||
.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 {
|
||||
background: var(--glass-bg-hover);
|
||||
color: var(--text-secondary);
|
||||
/* Row card (location) */
|
||||
.row-card { display:flex; gap:11px; padding:13px 14px }
|
||||
|
||||
.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 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
.pgroup-head {
|
||||
display:flex; align-items:center; gap:5px; margin-bottom:10px;
|
||||
font-size:10px; font-weight:600; letter-spacing:0.6px; text-transform:uppercase;
|
||||
color: rgba(255,255,255,0.30);
|
||||
}
|
||||
|
||||
.meta-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
/* Chevron toggle button */
|
||||
.chevron-btn {
|
||||
margin-left:auto; width:26px; height:26px; border-radius:8px;
|
||||
display:flex; align-items:center; justify-content:center;
|
||||
background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.10);
|
||||
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 {
|
||||
flex-shrink: 0;
|
||||
font-size: 14px;
|
||||
line-height: 1.4;
|
||||
/* Wrapper for avatar + status dot */
|
||||
.ava-wrap { position:relative; flex-shrink:0 }
|
||||
|
||||
.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); }
|
||||
.meta-row.cancelled { color: var(--danger); }
|
||||
/* ── Avatar stack ─────────────────────────────────────────────────────────── */
|
||||
|
||||
.attendees {
|
||||
align-items: flex-start;
|
||||
.avatar-stack { display:flex; align-items:center; padding:2px 0 }
|
||||
|
||||
.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 {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
/* ── Person row ───────────────────────────────────────────────────────────── */
|
||||
|
||||
.prow { display:flex; align-items:center; gap:9px; padding:3px 0; border-radius:10px }
|
||||
|
||||
.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 {
|
||||
font-size: 11px;
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--glass-bg-raised);
|
||||
border: 1px solid var(--glass-border);
|
||||
color: var(--text-secondary);
|
||||
.optional-tag {
|
||||
font-size:10px; color:rgba(255,255,255,0.28); font-weight:500;
|
||||
background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.09);
|
||||
border-radius:4px; padding:0 5px; white-space:nowrap; flex-shrink:0;
|
||||
}
|
||||
|
||||
.description {
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
white-space: pre-wrap;
|
||||
line-height: 1.5;
|
||||
border-top: 1px solid var(--glass-border);
|
||||
padding-top: 10px;
|
||||
margin-top: 4px;
|
||||
.pemail {
|
||||
font-size:11px; color:rgba(255,255,255,0.30); line-height:1.3;
|
||||
overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
|
||||
}
|
||||
|
||||
/* Copy button — appears on row hover */
|
||||
.copy-btn {
|
||||
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>
|
||||
|
|
|
|||
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">
|
||||
import { ref, computed, onMounted, watch } from 'vue'
|
||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { format, addDays, isSameDay, isToday } from 'date-fns'
|
||||
import { ru } from 'date-fns/locale'
|
||||
import EventBlock from './EventBlock.vue'
|
||||
|
|
@ -9,12 +9,13 @@ const props = defineProps<{
|
|||
weekStart: Date
|
||||
events: CalendarEvent[]
|
||||
loading?: boolean
|
||||
calendarColors?: Record<string, string>
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{ eventClick: [event: CalendarEvent] }>()
|
||||
|
||||
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)
|
||||
|
||||
// ── Days of the week ────────────────────────────────────────────────────────
|
||||
|
|
@ -22,11 +23,11 @@ const HOURS = Array.from({ length: 24 }, (_, i) => i)
|
|||
const days = computed(() =>
|
||||
Array.from({ length: 7 }, (_, i) => {
|
||||
const date = addDays(props.weekStart, i)
|
||||
const raw = format(date, 'EEEE', { locale: ru })
|
||||
return {
|
||||
date,
|
||||
dayName: format(date, 'EEE', { locale: ru }),
|
||||
dayName: raw.charAt(0).toUpperCase() + raw.slice(1),
|
||||
dayNum: format(date, 'd'),
|
||||
monthLabel: format(date, 'MMM', { locale: ru }),
|
||||
isToday: isToday(date)
|
||||
}
|
||||
})
|
||||
|
|
@ -38,17 +39,14 @@ const now = ref(new Date())
|
|||
let timerId: ReturnType<typeof setInterval>
|
||||
|
||||
onMounted(() => {
|
||||
timerId = setInterval(() => { now.value = new Date() }, 60_000)
|
||||
// Scroll to business hours (8:00)
|
||||
scrollEl.value?.scrollTo({ top: 8 * HOUR_HEIGHT - 20, behavior: 'smooth' })
|
||||
timerId = setInterval(() => { now.value = new Date() }, 30_000)
|
||||
scrollEl.value?.scrollTo({ top: 8 * HOUR_HEIGHT - 30, behavior: 'smooth' })
|
||||
})
|
||||
|
||||
// Re-scroll when week changes
|
||||
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))
|
||||
|
||||
const nowTop = computed(() => {
|
||||
|
|
@ -72,18 +70,9 @@ interface LayoutEvent {
|
|||
totalColumns: number
|
||||
}
|
||||
|
||||
const allDayEvents = computed(() => {
|
||||
return props.events.filter((e) => e.isAllDay)
|
||||
})
|
||||
const allDayEvents = computed(() => 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 result: LayoutEvent[] = []
|
||||
|
||||
|
|
@ -97,7 +86,6 @@ const layoutEvents = computed((): LayoutEvent[] => {
|
|||
(eStart < dayDate && eEnd > dayDate)
|
||||
})
|
||||
|
||||
// Simple overlap detection: group overlapping events
|
||||
const columns: CalendarEvent[][] = []
|
||||
for (const ev of dayEvs) {
|
||||
const eStart = new Date(ev.start).getTime()
|
||||
|
|
@ -116,13 +104,11 @@ const layoutEvents = computed((): LayoutEvent[] => {
|
|||
if (!placed) columns.push([ev])
|
||||
}
|
||||
|
||||
// Build LayoutEvent for each event
|
||||
for (let colIdx = 0; colIdx < columns.length; colIdx++) {
|
||||
for (const ev of columns[colIdx]) {
|
||||
const eStart = new Date(ev.start)
|
||||
const eEnd = new Date(ev.end)
|
||||
|
||||
// Clamp to day boundaries
|
||||
const dayStart = new Date(dayDate)
|
||||
dayStart.setHours(0, 0, 0, 0)
|
||||
const dayEnd = new Date(dayDate)
|
||||
|
|
@ -134,7 +120,6 @@ const layoutEvents = computed((): LayoutEvent[] => {
|
|||
const startHours = clampedStart.getHours() + clampedStart.getMinutes() / 60
|
||||
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 eS = new Date(ev.start).getTime()
|
||||
const eE = new Date(ev.end).getTime()
|
||||
|
|
@ -150,7 +135,7 @@ const layoutEvents = computed((): LayoutEvent[] => {
|
|||
event: ev,
|
||||
dayIndex,
|
||||
top: startHours * HOUR_HEIGHT,
|
||||
height: Math.max(durationHours * HOUR_HEIGHT, 18),
|
||||
height: Math.max(durationHours * HOUR_HEIGHT, 22),
|
||||
column: colIdx,
|
||||
totalColumns: totalCols
|
||||
})
|
||||
|
|
@ -161,7 +146,6 @@ const layoutEvents = computed((): LayoutEvent[] => {
|
|||
return result
|
||||
})
|
||||
|
||||
/** Events per day index for rendering into the correct column. */
|
||||
function eventsForDay(dayIndex: number): LayoutEvent[] {
|
||||
return layoutEvents.value.filter((e) => e.dayIndex === dayIndex)
|
||||
}
|
||||
|
|
@ -176,7 +160,30 @@ function allDayEventsForDay(dayIndex: number): CalendarEvent[] {
|
|||
}
|
||||
|
||||
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> {
|
||||
|
|
@ -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']
|
||||
function calendarColor(calendarId: string): string {
|
||||
if (props.calendarColors?.[calendarId]) return props.calendarColors[calendarId]
|
||||
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]
|
||||
|
|
@ -203,7 +210,12 @@ function calendarColor(calendarId: string): string {
|
|||
<div class="week-view">
|
||||
<!-- Day header row -->
|
||||
<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
|
||||
v-for="(day, i) in days"
|
||||
:key="i"
|
||||
|
|
@ -211,18 +223,27 @@ function calendarColor(calendarId: string): string {
|
|||
:class="{ today: day.isToday }"
|
||||
>
|
||||
<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="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>
|
||||
|
||||
<!-- All-day event row (shown only when there are all-day events) -->
|
||||
<!-- All-day event row -->
|
||||
<div
|
||||
v-if="events.some((e) => e.isAllDay)"
|
||||
class="allday-row"
|
||||
>
|
||||
<div class="time-gutter allday-gutter">
|
||||
<span class="allday-label">весь день</span>
|
||||
<span class="allday-label">всё<br>время</span>
|
||||
</div>
|
||||
<div v-for="(day, i) in days" :key="i" class="allday-col">
|
||||
<div
|
||||
|
|
@ -260,12 +281,16 @@ function calendarColor(calendarId: string): string {
|
|||
:class="{ today: day.isToday }"
|
||||
>
|
||||
<!-- Hour grid lines -->
|
||||
<template v-for="h in HOURS" :key="h">
|
||||
<div
|
||||
v-for="h in HOURS"
|
||||
:key="h"
|
||||
class="hour-row"
|
||||
: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 -->
|
||||
<div
|
||||
|
|
@ -290,7 +315,7 @@ function calendarColor(calendarId: string): string {
|
|||
|
||||
<!-- Loading overlay -->
|
||||
<div v-if="loading" class="loading-overlay">
|
||||
<span class="spinner" />
|
||||
<div class="loading-ring" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -308,69 +333,146 @@ function calendarColor(calendarId: string): string {
|
|||
.day-headers {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
border-bottom: 1px solid var(--glass-border);
|
||||
background: rgba(10, 10, 18, 0.5);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||
background: rgba(10, 10, 18, 0.35);
|
||||
backdrop-filter: blur(8px);
|
||||
overflow-y: auto;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.time-gutter {
|
||||
width: 52px;
|
||||
width: 56px;
|
||||
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 {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 8px 4px;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
border-left: 1px solid var(--glass-border);
|
||||
padding: 7px 4px 6px;
|
||||
border-left: 1px solid rgba(255, 255, 255, 0.05);
|
||||
gap: 2px;
|
||||
user-select: none;
|
||||
transition: background var(--transition-fast);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.day-header.today .day-num {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border-radius: 50%;
|
||||
background: var(--accent);
|
||||
color: var(--accent-text);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 700;
|
||||
.day-header.today {
|
||||
background: rgba(168, 230, 0, 0.04);
|
||||
}
|
||||
|
||||
.day-name {
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
font-size: 10px;
|
||||
font-size: 9.5px;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
letter-spacing: 0.2px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.day-num {
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
color: var(--text-primary);
|
||||
line-height: 1;
|
||||
.day-header.today .day-name {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.day-num-wrap {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
transition: background var(--transition-fast), box-shadow var(--transition-fast);
|
||||
}
|
||||
|
||||
.month-label {
|
||||
font-size: 10px;
|
||||
.day-num-wrap.today {
|
||||
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);
|
||||
letter-spacing: 0.1px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/* ── All-day row ── */
|
||||
.allday-row {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
border-bottom: 1px solid var(--glass-border);
|
||||
min-height: 28px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||
min-height: 30px;
|
||||
background: rgba(255, 255, 255, 0.01);
|
||||
overflow-y: auto;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.allday-gutter {
|
||||
|
|
@ -381,16 +483,19 @@ function calendarColor(calendarId: string): string {
|
|||
}
|
||||
|
||||
.allday-label {
|
||||
font-size: 9px;
|
||||
font-size: 8px;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.4px;
|
||||
text-align: right;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.allday-col {
|
||||
flex: 1;
|
||||
border-left: 1px solid var(--glass-border);
|
||||
padding: 2px 3px;
|
||||
border-left: 1px solid rgba(255, 255, 255, 0.05);
|
||||
padding: 3px 4px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
|
|
@ -398,20 +503,23 @@ function calendarColor(calendarId: string): string {
|
|||
|
||||
.allday-event {
|
||||
font-size: 11px;
|
||||
padding: 1px 6px;
|
||||
border-radius: 4px;
|
||||
background: color-mix(in srgb, var(--event-color) 22%, transparent);
|
||||
border-left: 3px solid var(--event-color);
|
||||
font-weight: 500;
|
||||
padding: 2px 7px;
|
||||
border-radius: 5px;
|
||||
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);
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-weight: 500;
|
||||
backdrop-filter: blur(8px);
|
||||
transition: filter var(--transition-fast), background var(--transition-fast);
|
||||
}
|
||||
|
||||
.allday-event:hover {
|
||||
filter: brightness(1.15);
|
||||
filter: brightness(1.2);
|
||||
background: color-mix(in srgb, var(--event-color) 28%, transparent);
|
||||
}
|
||||
|
||||
/* ── Scrollable grid ── */
|
||||
|
|
@ -420,6 +528,22 @@ function calendarColor(calendarId: string): string {
|
|||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
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 {
|
||||
|
|
@ -429,44 +553,54 @@ function calendarColor(calendarId: string): string {
|
|||
|
||||
/* ── Time gutter column ── */
|
||||
.time-gutter-col {
|
||||
width: 52px;
|
||||
width: 56px;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.hour-label {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
right: 10px;
|
||||
font-size: 10px;
|
||||
font-weight: 500;
|
||||
color: var(--text-muted);
|
||||
transform: translateY(-50%);
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* ── Day column ── */
|
||||
.day-col {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
border-left: 1px solid var(--glass-border);
|
||||
border-left: 1px solid rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.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 {
|
||||
position: absolute;
|
||||
left: 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;
|
||||
}
|
||||
|
||||
.hour-row:nth-child(2n) {
|
||||
border-top-color: transparent;
|
||||
border-top: 1px dashed rgba(255, 255, 255, 0.03);
|
||||
.half-hour-row {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 0;
|
||||
border-top: 1px dashed rgba(255, 255, 255, 0.022);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* ── Current time line ── */
|
||||
|
|
@ -475,22 +609,35 @@ function calendarColor(calendarId: string): string {
|
|||
left: 0;
|
||||
right: 0;
|
||||
height: 2px;
|
||||
background: var(--accent);
|
||||
opacity: 0.75;
|
||||
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 {
|
||||
position: absolute;
|
||||
left: -4px;
|
||||
left: -5px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
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 ── */
|
||||
|
|
@ -500,18 +647,19 @@ function calendarColor(calendarId: string): string {
|
|||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(9, 9, 14, 0.45);
|
||||
backdrop-filter: blur(4px);
|
||||
background: rgba(9, 9, 14, 0.55);
|
||||
backdrop-filter: blur(6px);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border: 2px solid var(--glass-border);
|
||||
border-top-color: var(--accent);
|
||||
.loading-ring {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -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 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', () => {
|
||||
const { invoke } = useIpc()
|
||||
const accountsStore = useAccountsStore()
|
||||
|
|
@ -20,6 +30,22 @@ export const useCalendarStore = defineStore('calendar', () => {
|
|||
const loadingCalendars = ref(false)
|
||||
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 ───────────────────────────────────────────────────────────────
|
||||
|
||||
const currentWeekEnd = computed(() => endOfWeek(currentWeekStart.value, { weekStartsOn: 1 }))
|
||||
|
|
@ -113,6 +139,11 @@ export const useCalendarStore = defineStore('calendar', () => {
|
|||
selectedEvent.value = event
|
||||
}
|
||||
|
||||
async function goToDate(date: Date): Promise<void> {
|
||||
currentWeekStart.value = startOfWeek(date, { weekStartsOn: 1 })
|
||||
await loadEvents()
|
||||
}
|
||||
|
||||
return {
|
||||
calendars,
|
||||
events,
|
||||
|
|
@ -124,12 +155,16 @@ export const useCalendarStore = defineStore('calendar', () => {
|
|||
loadingCalendars,
|
||||
error,
|
||||
visibleEvents,
|
||||
calendarColors,
|
||||
resolveColor,
|
||||
setCalendarColor,
|
||||
loadCalendars,
|
||||
loadEvents,
|
||||
toggleCalendar,
|
||||
goToToday,
|
||||
prevWeek,
|
||||
nextWeek,
|
||||
selectEvent
|
||||
selectEvent,
|
||||
goToDate
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -4,14 +4,69 @@ import type { MessageEnvelope, MessageBody } from '@shared/types/message'
|
|||
import { useAccountsStore } from './accounts.store'
|
||||
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 {
|
||||
const date = envelope.date ? new Date(envelope.date).toLocaleString('ru') : ''
|
||||
const from = envelope.from.name
|
||||
? `${envelope.from.name} <${envelope.from.email}>`
|
||||
: envelope.from.email
|
||||
const text = body?.text ?? ''
|
||||
const lines = text.split('\n').map((l) => `> ${l}`).join('\n')
|
||||
return `\n\n--- Оригинальное письмо ---\nОт: ${from}\nДата: ${date}\nТема: ${envelope.subject}\n\n${lines}`
|
||||
const rawText = body?.text ?? (body?.html ? htmlToText(body.html) : '')
|
||||
const lines = rawText
|
||||
? 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', () => {
|
||||
|
|
@ -30,14 +85,14 @@ export const useComposeStore = defineStore('compose', () => {
|
|||
|
||||
function openNew(): void {
|
||||
const acc = getAccountSession()
|
||||
if (!acc) return
|
||||
if (!acc) { console.warn('[compose] no active account'); return }
|
||||
const session: ComposeSession = {
|
||||
...acc,
|
||||
mode: 'new',
|
||||
to: [], cc: [], bcc: [],
|
||||
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 {
|
||||
|
|
@ -56,15 +111,17 @@ export const useComposeStore = defineStore('compose', () => {
|
|||
cc,
|
||||
bcc: [],
|
||||
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,
|
||||
references: envelope.messageId
|
||||
? [envelope.inReplyTo, envelope.messageId].filter(Boolean).join(' ')
|
||||
? [body?.references ?? envelope.inReplyTo, envelope.messageId].filter(Boolean).join(' ').trim() || undefined
|
||||
: undefined,
|
||||
replyToMessageId: envelope.id,
|
||||
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 {
|
||||
|
|
@ -75,9 +132,11 @@ export const useComposeStore = defineStore('compose', () => {
|
|||
mode: 'forward',
|
||||
to: [], cc: [], bcc: [],
|
||||
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 }
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
import { onMounted, watch, ref } from 'vue'
|
||||
import { format } from 'date-fns'
|
||||
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 AccountSwitcher from '../components/sidebar/AccountSwitcher.vue'
|
||||
import WeekView from '../components/calendar/WeekView.vue'
|
||||
import MiniCalendar from '../components/calendar/MiniCalendar.vue'
|
||||
import EventDetailPopup from '../components/calendar/EventDetailPopup.vue'
|
||||
import AddAccountDialog from '../components/accounts/AddAccountDialog.vue'
|
||||
import NotificationContainer from '../components/notifications/NotificationContainer.vue'
|
||||
|
|
@ -16,37 +17,10 @@ const calStore = useCalendarStore()
|
|||
const accountsStore = useAccountsStore()
|
||||
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 s = calStore.currentWeekStart
|
||||
const e = calStore.currentWeekEnd
|
||||
const sStr = format(s, 'd MMM', { locale: ru })
|
||||
const eStr = format(e, 'd MMM yyyy', { locale: ru })
|
||||
return `${sStr} – ${eStr}`
|
||||
return `${format(s, 'd MMM', { locale: ru })} – ${format(e, 'd MMM yyyy', { locale: ru })}`
|
||||
}
|
||||
|
||||
async function reload(): Promise<void> {
|
||||
|
|
@ -60,93 +34,144 @@ watch(() => accountsStore.activeAccountId, reload)
|
|||
function handleEventClick(ev: CalendarEvent): void {
|
||||
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>
|
||||
|
||||
<template>
|
||||
<div class="calendar-shell">
|
||||
<div class="content-area">
|
||||
<!-- Account switcher (same as mail view) -->
|
||||
<!-- Account switcher -->
|
||||
<div class="account-bar">
|
||||
<AccountSwitcher @add-account="showAddAccount = true" />
|
||||
</div>
|
||||
|
||||
<!-- Calendar sidebar -->
|
||||
<div class="cal-sidebar">
|
||||
<div class="sidebar-header">
|
||||
<AppIcon name="calendar" :size="15" class="cal-icon" />
|
||||
<span>Календарь</span>
|
||||
</div>
|
||||
|
||||
<!-- Error state -->
|
||||
<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>
|
||||
|
||||
<button class="retry-btn" @click="reload">Повторить</button>
|
||||
<button class="retry-btn probe-btn" :disabled="probing" @click="probeCalDAV">
|
||||
{{ probing ? 'Сканирование…' : 'Найти CalDAV путь' }}
|
||||
<div class="error-actions">
|
||||
<button class="retry-btn" @click="reload">
|
||||
<AppIcon name="refresh" :size="12" />
|
||||
Повторить
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Probe results -->
|
||||
<div v-if="probeResults" class="probe-results">
|
||||
<p class="probe-title">Результаты сканирования:</p>
|
||||
<div
|
||||
v-for="r in probeResults"
|
||||
:key="r.path"
|
||||
class="probe-row"
|
||||
:class="{ 'probe-ok': r.status === 207 || r.status === 200 }"
|
||||
>
|
||||
<span class="probe-path">{{ r.path }}</span>
|
||||
<span class="probe-note">{{ r.note }}</span>
|
||||
</div>
|
||||
<p class="probe-hint">Скопируйте путь со статусом 207 в настройки CalDAV → «Путь».</p>
|
||||
<template v-else>
|
||||
<!-- Mini calendar navigator -->
|
||||
<MiniCalendar
|
||||
:selected-week-start="calStore.currentWeekStart"
|
||||
:selected-week-end="calStore.currentWeekEnd"
|
||||
@day-click="calStore.goToDate($event)"
|
||||
/>
|
||||
|
||||
<div class="sidebar-divider" />
|
||||
|
||||
<!-- Calendar list header -->
|
||||
<div class="cal-list-header">
|
||||
<AppIcon name="calendar" :size="12" class="cal-list-icon" />
|
||||
<span>Мои календари</span>
|
||||
</div>
|
||||
|
||||
<!-- Loading state -->
|
||||
<div v-if="calStore.loadingCalendars" class="sidebar-loading">
|
||||
<span class="spinner" />
|
||||
</div>
|
||||
|
||||
<!-- Calendar list -->
|
||||
<div v-else-if="!calStore.loadingCalendars" class="calendar-list">
|
||||
<div v-else class="calendar-list">
|
||||
<div
|
||||
v-for="cal in calStore.calendars"
|
||||
:key="cal.id"
|
||||
class="cal-item"
|
||||
:class="{ active: calStore.selectedCalendarIds.has(cal.id) }"
|
||||
@click="calStore.toggleCalendar(cal.id)"
|
||||
>
|
||||
<button
|
||||
class="cal-dot-btn"
|
||||
:title="'Изменить цвет'"
|
||||
@click="openPicker(cal.id, $event)"
|
||||
>
|
||||
<span
|
||||
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>
|
||||
</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 v-else class="sidebar-loading">
|
||||
<span class="spinner" />
|
||||
<!-- Color picker teleport -->
|
||||
<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>
|
||||
</Teleport>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- Main calendar area -->
|
||||
<div class="calendar-main">
|
||||
<!-- Toolbar -->
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-nav">
|
||||
<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 class="nav-btn today-btn" @click="calStore.goToToday()">Сегодня</button>
|
||||
<button class="nav-btn" @click="calStore.nextWeek()">
|
||||
<AppIcon name="chevron-right" :size="14" />
|
||||
<AppIcon name="chevron-right" :size="13" />
|
||||
</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 }" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Week view -->
|
||||
<div class="week-wrap">
|
||||
|
|
@ -154,6 +179,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
:week-start="calStore.currentWeekStart"
|
||||
:events="calStore.visibleEvents"
|
||||
:loading="calStore.loading"
|
||||
:calendar-colors="calStore.calendarColors"
|
||||
@event-click="handleEventClick"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -164,6 +190,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
<EventDetailPopup
|
||||
v-if="calStore.selectedEvent"
|
||||
:event="calStore.selectedEvent"
|
||||
:color="calStore.resolveColor(calStore.selectedEvent.calendarId)"
|
||||
@close="calStore.selectEvent(null)"
|
||||
/>
|
||||
|
||||
|
|
@ -181,7 +208,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
>
|
||||
<div class="empty-content">
|
||||
<div class="empty-icon">
|
||||
<AppIcon name="calendar" :size="64" />
|
||||
<AppIcon name="calendar" :size="56" />
|
||||
</div>
|
||||
<h2>Добро пожаловать в Aero Mail</h2>
|
||||
<p>Добавьте почтовый аккаунт для просмотра календаря</p>
|
||||
|
|
@ -197,7 +224,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
flex-direction: column;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: #07070c;
|
||||
background: var(--base-bg);
|
||||
}
|
||||
|
||||
.content-area {
|
||||
|
|
@ -209,7 +236,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
gap: 8px;
|
||||
}
|
||||
|
||||
/* Account bar — same styling as in AppShell */
|
||||
/* Account bar */
|
||||
.account-bar {
|
||||
width: var(--sidebar-width);
|
||||
flex-shrink: 0;
|
||||
|
|
@ -232,64 +259,90 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
|
||||
/* Calendar sidebar */
|
||||
.cal-sidebar {
|
||||
width: 200px;
|
||||
width: 192px;
|
||||
flex-shrink: 0;
|
||||
border-radius: 14px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%),
|
||||
rgba(9, 9, 15, 0.80);
|
||||
backdrop-filter: blur(28px) saturate(1.8);
|
||||
-webkit-backdrop-filter: blur(28px) saturate(1.8);
|
||||
linear-gradient(160deg, rgba(255, 255, 255, 0.065) 0%, rgba(255, 255, 255, 0.02) 100%),
|
||||
rgba(10, 10, 17, 0.85);
|
||||
backdrop-filter: blur(32px) saturate(1.9);
|
||||
-webkit-backdrop-filter: blur(32px) saturate(1.9);
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.10),
|
||||
0 8px 28px rgba(0, 0, 0, 0.40);
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.13),
|
||||
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;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
padding: 14px 14px 10px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
letter-spacing: 0.3px;
|
||||
gap: 6px;
|
||||
padding: 10px 12px 6px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
color: var(--text-muted);
|
||||
letter-spacing: 0.6px;
|
||||
text-transform: uppercase;
|
||||
border-bottom: 1px solid var(--glass-border);
|
||||
}
|
||||
|
||||
.cal-icon {
|
||||
.cal-list-icon {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
/* Calendar list */
|
||||
.calendar-list {
|
||||
padding: 8px 0;
|
||||
padding: 2px 6px 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
}
|
||||
|
||||
.cal-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 6px 14px;
|
||||
gap: 9px;
|
||||
padding: 5px 8px;
|
||||
cursor: pointer;
|
||||
border-radius: 8px;
|
||||
margin: 0 4px;
|
||||
transition: background var(--transition-fast);
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.cal-item.active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.cal-item: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 {
|
||||
|
|
@ -297,15 +350,21 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
height: 10px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
box-shadow: 0 0 4px currentColor;
|
||||
transition: opacity var(--transition-fast);
|
||||
}
|
||||
|
||||
.cal-dot.dimmed {
|
||||
opacity: 0.28;
|
||||
}
|
||||
|
||||
.cal-name {
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
transition: color var(--transition-fast);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.cal-item.active .cal-name {
|
||||
|
|
@ -313,18 +372,37 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
}
|
||||
|
||||
.no-calendars {
|
||||
padding: 16px;
|
||||
font-size: 12px;
|
||||
padding: 12px 8px;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
text-align: center;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* Error state */
|
||||
.sidebar-error {
|
||||
padding: 12px 14px;
|
||||
padding: 16px 14px;
|
||||
display: flex;
|
||||
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 {
|
||||
|
|
@ -334,85 +412,44 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
}
|
||||
|
||||
.error-detail {
|
||||
font-size: 11px;
|
||||
font-size: 10px;
|
||||
color: var(--text-muted);
|
||||
word-break: break-all;
|
||||
user-select: text;
|
||||
-webkit-user-select: text;
|
||||
cursor: text;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.error-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
align-self: flex-start;
|
||||
font-size: 12px;
|
||||
padding: 4px 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
width: 100%;
|
||||
font-size: 11px;
|
||||
padding: 5px 10px;
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--glass-bg-raised);
|
||||
border: 1px solid var(--glass-border);
|
||||
color: var(--text-secondary);
|
||||
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; }
|
||||
|
||||
.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 {
|
||||
flex: 1;
|
||||
|
|
@ -428,69 +465,110 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 14px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border-radius: 16px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%),
|
||||
rgba(10, 10, 17, 0.55);
|
||||
backdrop-filter: blur(18px) saturate(1.3);
|
||||
-webkit-backdrop-filter: blur(18px) saturate(1.3);
|
||||
linear-gradient(160deg, rgba(255, 255, 255, 0.04) 0%, transparent 60%),
|
||||
rgba(11, 11, 18, 0.60);
|
||||
backdrop-filter: blur(24px) saturate(1.5);
|
||||
-webkit-backdrop-filter: blur(24px) saturate(1.5);
|
||||
overflow: hidden;
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.08),
|
||||
0 8px 28px rgba(0, 0, 0, 0.32);
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.10),
|
||||
0 8px 32px rgba(0, 0, 0, 0.36);
|
||||
}
|
||||
|
||||
/* Toolbar */
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid var(--glass-border);
|
||||
gap: 8px;
|
||||
padding: 10px 16px 10px 14px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.07);
|
||||
flex-shrink: 0;
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
}
|
||||
|
||||
.toolbar-nav {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.nav-btn {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
padding: 0 10px;
|
||||
border-radius: var(--radius-sm);
|
||||
border-radius: 8px;
|
||||
background: var(--glass-bg);
|
||||
border: 1px solid var(--glass-border);
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
transition: background var(--transition-fast), color var(--transition-fast);
|
||||
transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
|
||||
}
|
||||
|
||||
.nav-btn:hover:not(:disabled) {
|
||||
background: var(--glass-bg-hover);
|
||||
.nav-btn:hover {
|
||||
background: var(--glass-bg-raised);
|
||||
border-color: var(--glass-border-strong);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.nav-btn:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.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 {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-left: 4px;
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
letter-spacing: -0.2px;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
margin-left: auto;
|
||||
flex: none;
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
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 {
|
||||
|
|
@ -517,48 +595,54 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
/* Empty state (no accounts) */
|
||||
/* Empty state */
|
||||
.empty-state {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: transparent;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
backdrop-filter: blur(8px);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.empty-content {
|
||||
text-align: center;
|
||||
padding: 64px 72px;
|
||||
width: 480px;
|
||||
background: rgba(255, 255, 255, 0.11);
|
||||
padding: 56px 64px;
|
||||
width: 460px;
|
||||
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);
|
||||
-webkit-backdrop-filter: blur(72px) saturate(2.8);
|
||||
border-radius: 20px;
|
||||
box-shadow:
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.55),
|
||||
0 8px 32px rgba(0, 0, 0, 0.45),
|
||||
0 32px 80px rgba(0, 0, 0, 0.65);
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.20),
|
||||
0 8px 32px rgba(0, 0, 0, 0.50),
|
||||
0 32px 80px rgba(0, 0, 0, 0.70);
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
margin-bottom: 24px;
|
||||
opacity: 0.28;
|
||||
margin-bottom: 20px;
|
||||
opacity: 0.22;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.empty-content h2 {
|
||||
font-size: 22px;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
|
||||
.empty-content p {
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
margin-bottom: 32px;
|
||||
font-size: 13px;
|
||||
margin-bottom: 28px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
|
|
@ -571,10 +655,12 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
color: var(--accent-text);
|
||||
border-radius: var(--radius-md);
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.1px;
|
||||
box-shadow:
|
||||
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 {
|
||||
|
|
@ -583,5 +669,61 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
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 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>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ const cc = ref<string[]>([])
|
|||
const bcc = ref<string[]>([])
|
||||
const subject = ref('')
|
||||
const body = ref('')
|
||||
const quotedText = ref('')
|
||||
const htmlBody = ref('')
|
||||
const showCc = ref(false)
|
||||
const showBcc = ref(false)
|
||||
|
||||
|
|
@ -27,11 +29,85 @@ const ccInputEl = ref<HTMLInputElement | null>(null)
|
|||
const bccInputEl = ref<HTMLInputElement | 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 ───────────────────────────────────────────
|
||||
interface LocalAttachment extends ComposeAttachment { id: string }
|
||||
const attachments = ref<LocalAttachment[]>([])
|
||||
const isDragging = ref(false)
|
||||
let dragCounter = 0 // track nested dragenter/dragleave
|
||||
let dragCounter = 0
|
||||
|
||||
// ── Status ────────────────────────────────────────────────
|
||||
const sending = ref(false)
|
||||
|
|
@ -47,15 +123,13 @@ onMounted(async () => {
|
|||
bcc.value = [...(data.bcc ?? [])]
|
||||
subject.value = data.subject ?? ''
|
||||
body.value = data.body ?? ''
|
||||
quotedText.value = data.quotedText ?? ''
|
||||
htmlBody.value = data.htmlBody ?? ''
|
||||
showCc.value = cc.value.length > 0
|
||||
showBcc.value = bcc.value.length > 0
|
||||
|
||||
nextTick(() => {
|
||||
if (data.mode === 'new') toInputEl.value?.focus()
|
||||
else {
|
||||
bodyEl.value?.focus()
|
||||
bodyEl.value?.setSelectionRange(0, 0)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
|
@ -186,9 +260,11 @@ async function handleSend(): Promise<void> {
|
|||
bcc: [...bcc.value],
|
||||
subject: subject.value,
|
||||
body: body.value,
|
||||
quotedText: quotedText.value || undefined,
|
||||
htmlBody: htmlBody.value || undefined,
|
||||
attachments: attachments.value.map(({ path, filename, size }) => ({ path, filename, size })),
|
||||
inReplyTo: sess.inReplyTo,
|
||||
references: sess.references ? [...sess.references] : undefined,
|
||||
references: sess.references || undefined,
|
||||
replyToMessageId: sess.replyToMessageId,
|
||||
replyToFolderId: sess.replyToFolderId
|
||||
}
|
||||
|
|
@ -240,7 +316,7 @@ const totalAttachSize = computed(() =>
|
|||
</div>
|
||||
<div v-if="session" class="header-from">
|
||||
<span class="from-dot" />
|
||||
<span class="from-label">{{ session.accountLabel || session.accountEmail }}</span>
|
||||
<span class="from-label">{{ session.accountEmail }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -292,7 +368,7 @@ const totalAttachSize = computed(() =>
|
|||
@blur="commitInput('cc')"
|
||||
/>
|
||||
</div>
|
||||
<button class="field-toggle close-field" @click="showCc = false; cc = []">✕</button>
|
||||
<button class="field-toggle close-field" @click="showCc = false; cc = []">✕</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -317,7 +393,7 @@ const totalAttachSize = computed(() =>
|
|||
@blur="commitInput('bcc')"
|
||||
/>
|
||||
</div>
|
||||
<button class="field-toggle close-field" @click="showBcc = false; bcc = []">✕</button>
|
||||
<button class="field-toggle close-field" @click="showBcc = false; bcc = []">✕</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -340,9 +416,31 @@ const totalAttachSize = computed(() =>
|
|||
ref="bodyEl"
|
||||
class="compose-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 -->
|
||||
<Transition name="drag">
|
||||
<div v-if="isDragging" class="drag-overlay">
|
||||
|
|
@ -447,6 +545,7 @@ const totalAttachSize = computed(() =>
|
|||
inset 0 1px 0 rgba(255, 255, 255, 0.12),
|
||||
0 1px 0 rgba(0, 0, 0, 0.25);
|
||||
user-select: none;
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
|
||||
.header-mode {
|
||||
|
|
@ -639,11 +738,14 @@ const totalAttachSize = computed(() =>
|
|||
position: relative;
|
||||
min-height: 0;
|
||||
margin: 8px 0 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.compose-body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 120px;
|
||||
background: none;
|
||||
border: none;
|
||||
outline: none;
|
||||
|
|
@ -651,19 +753,92 @@ const totalAttachSize = computed(() =>
|
|||
color: var(--text-primary);
|
||||
font-size: 13px;
|
||||
line-height: 1.7;
|
||||
padding: 12px 18px 12px;
|
||||
padding: 12px 18px;
|
||||
caret-color: var(--accent);
|
||||
font-family: inherit;
|
||||
box-shadow: none;
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
user-select: text;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.compose-body::placeholder {
|
||||
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 {
|
||||
position: absolute;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,15 @@ export interface CalendarInfo {
|
|||
accountId: string
|
||||
}
|
||||
|
||||
export type AttendeeStatus = 'accepted' | 'declined' | 'tentative' | 'unknown'
|
||||
|
||||
export interface AttendeeInfo {
|
||||
name: string
|
||||
email: string
|
||||
required: boolean
|
||||
status: AttendeeStatus
|
||||
}
|
||||
|
||||
export interface CalendarEvent {
|
||||
id: string
|
||||
uid: string
|
||||
|
|
@ -17,6 +26,6 @@ export interface CalendarEvent {
|
|||
location?: string
|
||||
description?: string
|
||||
organizer?: string
|
||||
attendees: string[]
|
||||
attendees: AttendeeInfo[]
|
||||
status?: 'tentative' | 'confirmed' | 'cancelled'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ export interface IpcChannelMap {
|
|||
|
||||
'app:setZoom': [{ factor: number }, void]
|
||||
'app:isEncryptionAvailable': [void, boolean]
|
||||
'app:copyToClipboard': [{ text: string }, void]
|
||||
|
||||
'calendar:list': [{ accountId: string }, CalendarInfo[]]
|
||||
'calendar:events': [
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ export interface MessageBody {
|
|||
id: string
|
||||
html: string | null
|
||||
text: string | null
|
||||
references: string | null // References header (цепочка Message-ID для треда)
|
||||
inlineImages: InlineImage[]
|
||||
attachments: Attachment[]
|
||||
}
|
||||
|
|
@ -57,7 +58,9 @@ export interface ComposeData {
|
|||
cc: string[]
|
||||
bcc: string[]
|
||||
subject: string
|
||||
body: string // plain text
|
||||
body: string // Текст пользователя (без цитаты)
|
||||
quotedText?: string // Plain-text цитата оригинала (> строки с атрибуцией)
|
||||
htmlBody?: string // HTML-блокквота оригинала (для рендера в compose + text/html часть)
|
||||
attachments?: ComposeAttachment[]
|
||||
inReplyTo?: string // Message-ID оригинала (для ответа)
|
||||
references?: string // References header
|
||||
|
|
|
|||
Loading…
Reference in a new issue