feat: убрать CalDAV из UI, редизайн диалогов аккаунта
CalDAV: - CalendarView: удалён probe (probeCalDAV, probeResults, probe-UI и стили) - AddAccountDialog: удалена CalDAV-секция и все caldav* refs - EditAccountDialog: то же самое - EWS-backend (caldav.provider.ts) не тронут — auto-fallback на IMAP host AddAccountDialog (полный рефакторинг): - Шаги: form → testing → success - IMAP + SMTP секции всегда видны (section-sep разделители) - Автодетект хоста по домену email (Gmail/Outlook/Yahoo/iCloud/generic) - SSL-поля заменены на toggle-switch вместо checkbox - Testing: checklist с иконками статуса для IMAP и SMTP - Success: экран с аватаром + email + провайдер, авто-закрытие ~2s EditAccountDialog (полный рефакторинг): - Идентичная структура секций с AddAccountDialog - Header: аватар + имя аккаунта + IMAP-хост - Пароль: placeholder «не менять», тест только если изменён - Шаги: form → testing (без success, диалог закрывается сразу) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3eed873bc7
commit
4174971f1e
3 changed files with 1082 additions and 844 deletions
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,82 +401,169 @@ 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);
|
||||
box-shadow:
|
||||
inset 0 2px 6px rgba(0, 0, 0, 0.22),
|
||||
inset 0 2px 6px rgba(0,0,0,0.22),
|
||||
0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent),
|
||||
0 1px 0 rgba(255, 255, 255, 0.06);
|
||||
0 1px 0 rgba(255,255,255,0.06);
|
||||
}
|
||||
|
||||
.form-row {
|
||||
/* ── Section separator ────────────────────────────────────── */
|
||||
.section-sep {
|
||||
display: flex;
|
||||
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,
|
||||
|
|
@ -486,14 +608,10 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
|||
var(--accent) 100%
|
||||
);
|
||||
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);
|
||||
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);
|
||||
transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
|
||||
}
|
||||
|
||||
.submit-btn:hover:not(:disabled) {
|
||||
|
|
@ -503,95 +621,76 @@ const isFormValid = computed(() => imapHost.value && imapUsername.value)
|
|||
var(--accent-hover) 100%
|
||||
);
|
||||
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);
|
||||
inset 0 1px 0 rgba(255,255,255,0.45),
|
||||
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 {
|
||||
background: rgba(255, 255, 255, 0.07);
|
||||
color: var(--text-secondary);
|
||||
.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);
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -17,23 +17,6 @@ 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
|
||||
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
|
||||
function calendarColor(calendarId: string): string {
|
||||
|
|
@ -78,31 +61,13 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
<div class="error-icon-wrap">
|
||||
<AppIcon name="warning" :size="20" class="error-icon" />
|
||||
</div>
|
||||
<p class="error-title">CalDAV недоступен</p>
|
||||
<p class="error-title">Календарь недоступен</p>
|
||||
<p class="error-detail">{{ calStore.error }}</p>
|
||||
<div class="error-actions">
|
||||
<button class="retry-btn" @click="reload">
|
||||
<AppIcon name="refresh" :size="12" />
|
||||
Повторить
|
||||
</button>
|
||||
<button class="retry-btn" :disabled="probing" @click="probeCalDAV">
|
||||
<AppIcon name="search" :size="12" />
|
||||
{{ probing ? 'Сканирование…' : 'Найти путь' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -455,62 +420,6 @@ function handleEventClick(ev: CalendarEvent): void {
|
|||
}
|
||||
.retry-btn:disabled { opacity: 0.5; cursor: default; }
|
||||
|
||||
.probe-results {
|
||||
width: 100%;
|
||||
border-top: 1px solid var(--glass-border);
|
||||
padding-top: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.probe-title {
|
||||
font-size: 10px;
|
||||
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: 9px;
|
||||
font-family: monospace;
|
||||
color: var(--text-primary);
|
||||
word-break: break-all;
|
||||
user-select: text;
|
||||
-webkit-user-select: text;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.probe-note {
|
||||
font-size: 9px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.probe-row.probe-ok .probe-note {
|
||||
color: #a8e600;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.probe-hint {
|
||||
font-size: 9px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.5;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.sidebar-loading {
|
||||
flex: 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue