Merge branch 'feature/calendar-event-detail'
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
d62608c7e7
11 changed files with 1076 additions and 426 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { app, BrowserWindow, shell, ipcMain, dialog, Menu, globalShortcut } from 'electron'
|
import { app, BrowserWindow, shell, ipcMain, dialog, Menu, globalShortcut, clipboard } from 'electron'
|
||||||
import { join, basename } from 'node:path'
|
import { join, basename } from 'node:path'
|
||||||
import { statSync } from 'node:fs'
|
import { statSync } from 'node:fs'
|
||||||
import { AccountManager } from './services/account-manager'
|
import { AccountManager } from './services/account-manager'
|
||||||
|
|
@ -136,6 +136,10 @@ ipcMain.handle('app:openFile', async (_event, { path }: { path: string }) => {
|
||||||
return err ? { success: false, error: err } : { success: true }
|
return err ? { success: false, error: err } : { success: true }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.handle('app:copyToClipboard', (_event, { text }: { text: string }) => {
|
||||||
|
clipboard.writeText(text)
|
||||||
|
})
|
||||||
|
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
await accountManager.initialize()
|
await accountManager.initialize()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import https from 'node:https'
|
||||||
import http from 'node:http'
|
import http from 'node:http'
|
||||||
import type { IncomingMessage } from 'node:http'
|
import type { IncomingMessage } from 'node:http'
|
||||||
import type { AccountConfig, ImapCredentials } from '@shared/types/account'
|
import type { AccountConfig, ImapCredentials } from '@shared/types/account'
|
||||||
import type { CalendarInfo, CalendarEvent } from '@shared/types/calendar'
|
import type { CalendarInfo, CalendarEvent, AttendeeInfo, AttendeeStatus } from '@shared/types/calendar'
|
||||||
import {
|
import {
|
||||||
buildNegotiateHeader,
|
buildNegotiateHeader,
|
||||||
parseChallenge,
|
parseChallenge,
|
||||||
|
|
@ -226,7 +226,11 @@ export class CalDavProvider {
|
||||||
</m:FindItem>`)
|
</m:FindItem>`)
|
||||||
|
|
||||||
if (result.status !== 200) return []
|
if (result.status !== 200) return []
|
||||||
return this.parseEwsEvents(result.body, accountId, calendarId)
|
const events = this.parseEwsEvents(result.body, accountId, calendarId)
|
||||||
|
if (events.length > 0) {
|
||||||
|
try { await this.enrichWithAttendees(events) } catch { /* non-fatal */ }
|
||||||
|
}
|
||||||
|
return events
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── EWS helpers ───────────────────────────────────────────────────────────
|
// ── EWS helpers ───────────────────────────────────────────────────────────
|
||||||
|
|
@ -260,6 +264,100 @@ export class CalDavProvider {
|
||||||
return distinguishedId === 'calendar' ? 'Календарь' : distinguishedId
|
return distinguishedId === 'calendar' ? 'Календарь' : distinguishedId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static htmlToText(html: string): string {
|
||||||
|
return html
|
||||||
|
.replace(/<br\s*\/?>/gi, '\n')
|
||||||
|
.replace(/<\/p\s*>/gi, '\n\n')
|
||||||
|
.replace(/<\/div\s*>/gi, '\n')
|
||||||
|
.replace(/<\/li\s*>/gi, '\n')
|
||||||
|
.replace(/<\/tr\s*>/gi, '\n')
|
||||||
|
.replace(/<[^>]+>/g, '')
|
||||||
|
.replace(/ /g, ' ')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/&#(\d+);/g, (_, n) => String.fromCharCode(parseInt(n, 10)))
|
||||||
|
.replace(/\n{3,}/g, '\n\n')
|
||||||
|
.trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
private async enrichWithAttendees(events: CalendarEvent[]): Promise<void> {
|
||||||
|
const eventMap = new Map<string, CalendarEvent>()
|
||||||
|
for (const e of events) eventMap.set(e.uid, e)
|
||||||
|
|
||||||
|
const idsXml = events.map((e) => `<t:ItemId Id="${e.uid}"/>`).join('\n ')
|
||||||
|
const result = await this.ewsReq('GetItem', `
|
||||||
|
<m:GetItem>
|
||||||
|
<m:ItemShape>
|
||||||
|
<t:BaseShape>IdOnly</t:BaseShape>
|
||||||
|
<t:AdditionalProperties>
|
||||||
|
<t:FieldURI FieldURI="calendar:RequiredAttendees"/>
|
||||||
|
<t:FieldURI FieldURI="calendar:OptionalAttendees"/>
|
||||||
|
</t:AdditionalProperties>
|
||||||
|
</m:ItemShape>
|
||||||
|
<m:ItemIds>${idsXml}</m:ItemIds>
|
||||||
|
</m:GetItem>`)
|
||||||
|
|
||||||
|
if (result.status !== 200) return
|
||||||
|
|
||||||
|
const responseRe = /<m:Items>([\s\S]*?)<\/m:Items>/g
|
||||||
|
let rm: RegExpExecArray | null
|
||||||
|
while ((rm = responseRe.exec(result.body)) !== null) {
|
||||||
|
const itemBlock = rm[1]
|
||||||
|
const idM = itemBlock.match(/<t:ItemId\s+Id="([^"]+)"/)
|
||||||
|
const target = idM ? eventMap.get(idM[1]) : undefined
|
||||||
|
if (target) {
|
||||||
|
target.attendees = this.parseAttendeesList(itemBlock)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static smtpEmail(raw: string): string | undefined {
|
||||||
|
const s = raw.replace(/^smtp:/i, '').trim()
|
||||||
|
return s.includes('@') ? s : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
private static parseRt(rt: string): AttendeeStatus {
|
||||||
|
switch (rt.toLowerCase()) {
|
||||||
|
case 'accept': return 'accepted'
|
||||||
|
case 'decline': return 'declined'
|
||||||
|
case 'tentative': return 'tentative'
|
||||||
|
default: return 'unknown'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseAttendeeSection(xml: string, required: boolean): AttendeeInfo[] {
|
||||||
|
const result: AttendeeInfo[] = []
|
||||||
|
const re = /<t:Attendee>([\s\S]*?)<\/t:Attendee>/g
|
||||||
|
let m: RegExpExecArray | null
|
||||||
|
while ((m = re.exec(xml)) !== null) {
|
||||||
|
const ab = m[1]
|
||||||
|
const nameM = ab.match(/<t:Name>([^<]+)<\/t:Name>/)
|
||||||
|
const emailM = ab.match(/<t:EmailAddress>([^<]+)<\/t:EmailAddress>/)
|
||||||
|
const rtM = ab.match(/<t:ResponseType>([^<]+)<\/t:ResponseType>/)
|
||||||
|
const email = emailM ? CalDavProvider.smtpEmail(emailM[1]) : undefined
|
||||||
|
const name = nameM ? nameM[1].trim() : undefined
|
||||||
|
if (!name && !email) continue
|
||||||
|
result.push({
|
||||||
|
name: name ?? email!,
|
||||||
|
email: email ?? '',
|
||||||
|
required,
|
||||||
|
status: rtM ? CalDavProvider.parseRt(rtM[1]) : 'unknown',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseAttendeesList(block: string): AttendeeInfo[] {
|
||||||
|
const req = block.match(/<t:RequiredAttendees>([\s\S]*?)<\/t:RequiredAttendees>/)
|
||||||
|
const opt = block.match(/<t:OptionalAttendees>([\s\S]*?)<\/t:OptionalAttendees>/)
|
||||||
|
return [
|
||||||
|
...(req ? this.parseAttendeeSection(req[1], true) : []),
|
||||||
|
...(opt ? this.parseAttendeeSection(opt[1], false) : []),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
private parseEwsEvents(xml: string, accountId: string, calendarId: string): CalendarEvent[] {
|
private parseEwsEvents(xml: string, accountId: string, calendarId: string): CalendarEvent[] {
|
||||||
const events: CalendarEvent[] = []
|
const events: CalendarEvent[] = []
|
||||||
const re = /<t:CalendarItem>([\s\S]*?)<\/t:CalendarItem>/g
|
const re = /<t:CalendarItem>([\s\S]*?)<\/t:CalendarItem>/g
|
||||||
|
|
@ -270,6 +368,12 @@ export class CalDavProvider {
|
||||||
const r = block.match(new RegExp(`<t:${tag}(?:\\s[^>]*)?>([\\s\\S]*?)<\\/t:${tag}>`))
|
const r = block.match(new RegExp(`<t:${tag}(?:\\s[^>]*)?>([\\s\\S]*?)<\\/t:${tag}>`))
|
||||||
return r ? r[1].replace(/<[^>]+>/g, '').trim() : ''
|
return r ? r[1].replace(/<[^>]+>/g, '').trim() : ''
|
||||||
}
|
}
|
||||||
|
const getBody = (): string | undefined => {
|
||||||
|
const r = block.match(/<t:Body(?:\s[^>]*)?>([\\s\\S]*?)<\/t:Body>/)
|
||||||
|
if (!r) return undefined
|
||||||
|
const text = CalDavProvider.htmlToText(r[1])
|
||||||
|
return text || undefined
|
||||||
|
}
|
||||||
const idM = block.match(/<t:ItemId\s+Id="([^"]+)"/)
|
const idM = block.match(/<t:ItemId\s+Id="([^"]+)"/)
|
||||||
if (!idM) continue
|
if (!idM) continue
|
||||||
const startStr = get('Start')
|
const startStr = get('Start')
|
||||||
|
|
@ -279,7 +383,16 @@ export class CalDavProvider {
|
||||||
const end = endStr ? new Date(endStr) : new Date(start.getTime() + 3_600_000)
|
const end = endStr ? new Date(endStr) : new Date(start.getTime() + 3_600_000)
|
||||||
const isAllDay = get('IsAllDayEvent') === 'true'
|
const isAllDay = get('IsAllDayEvent') === 'true'
|
||||||
const fbStatus = get('LegacyFreeBusyStatus').toLowerCase()
|
const fbStatus = get('LegacyFreeBusyStatus').toLowerCase()
|
||||||
const organizerM = block.match(/<t:Organizer>[\s\S]*?<t:EmailAddress>([^<]+)<\/t:EmailAddress>/)
|
const orgBlock = block.match(/<t:Organizer>([\s\S]*?)<\/t:Organizer>/)
|
||||||
|
const orgName = orgBlock ? (orgBlock[1].match(/<t:Name>([^<]+)<\/t:Name>/) ?? [])[1]?.trim() : undefined
|
||||||
|
const orgEmailRaw = orgBlock ? (orgBlock[1].match(/<t:EmailAddress>([^<]+)<\/t:EmailAddress>/) ?? [])[1]?.trim() : undefined
|
||||||
|
// Exchange sometimes returns X500/routing addresses — keep only SMTP emails
|
||||||
|
const orgEmail = orgEmailRaw?.replace(/^smtp:/i, '').includes('@')
|
||||||
|
? orgEmailRaw.replace(/^smtp:/i, '').trim()
|
||||||
|
: undefined
|
||||||
|
const organizer = orgName && orgEmail
|
||||||
|
? `${orgName} <${orgEmail}>`
|
||||||
|
: orgName ?? orgEmail
|
||||||
events.push({
|
events.push({
|
||||||
id: `ews::${idM[1]}`,
|
id: `ews::${idM[1]}`,
|
||||||
uid: idM[1],
|
uid: idM[1],
|
||||||
|
|
@ -290,8 +403,8 @@ export class CalDavProvider {
|
||||||
end: end.toISOString(),
|
end: end.toISOString(),
|
||||||
isAllDay,
|
isAllDay,
|
||||||
location: get('Location') || undefined,
|
location: get('Location') || undefined,
|
||||||
description: get('Body') || undefined,
|
description: getBody(),
|
||||||
organizer: organizerM ? organizerM[1] : undefined,
|
organizer,
|
||||||
attendees: [],
|
attendees: [],
|
||||||
status: fbStatus === 'tentative' ? 'tentative' : 'confirmed'
|
status: fbStatus === 'tentative' ? 'tentative' : 'confirmed'
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ export type IconName =
|
||||||
| 'location'
|
| 'location'
|
||||||
| 'person'
|
| 'person'
|
||||||
| 'people'
|
| 'people'
|
||||||
|
| 'copy'
|
||||||
|
| 'check'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
name: IconName
|
name: IconName
|
||||||
|
|
@ -171,6 +173,13 @@ const paths: Record<IconName, string> = {
|
||||||
<path d="M23 21v-2a4 4 0 0 0-3-3.87"/>
|
<path d="M23 21v-2a4 4 0 0 0-3-3.87"/>
|
||||||
<path d="M16 3.13a4 4 0 0 1 0 7.75"/>
|
<path d="M16 3.13a4 4 0 0 1 0 7.75"/>
|
||||||
`,
|
`,
|
||||||
|
copy: `
|
||||||
|
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
|
||||||
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
||||||
|
`,
|
||||||
|
check: `
|
||||||
|
<polyline points="20 6 9 17 4 12"/>
|
||||||
|
`,
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,6 @@ const statusClass = computed(() => {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 3px;
|
width: 3px;
|
||||||
background: var(--ev-color);
|
background: var(--ev-color);
|
||||||
box-shadow: 1px 0 8px color-mix(in srgb, var(--ev-color) 60%, transparent);
|
|
||||||
border-radius: 8px 0 0 8px;
|
border-radius: 8px 0 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,9 +100,8 @@ const statusClass = computed(() => {
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 1px 0 color-mix(in srgb, var(--ev-color) 25%, rgba(255,255,255,0.22)),
|
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),
|
0 4px 16px rgba(0, 0, 0, 0.40);
|
||||||
0 0 20px color-mix(in srgb, var(--ev-color) 22%, transparent);
|
filter: brightness(1.10);
|
||||||
filter: brightness(1.12);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-block.cancelled {
|
.event-block.cancelled {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
import { ru } from 'date-fns/locale'
|
import { ru } from 'date-fns/locale'
|
||||||
import type { CalendarEvent } from '@shared/types/calendar'
|
import type { CalendarEvent, AttendeeInfo } from '@shared/types/calendar'
|
||||||
import AppIcon from '../AppIcon.vue'
|
import AppIcon from '../AppIcon.vue'
|
||||||
|
import { useIpc } from '../../composables/useIpc'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
event: CalendarEvent
|
event: CalendarEvent
|
||||||
|
|
@ -12,372 +13,548 @@ const props = defineProps<{
|
||||||
|
|
||||||
const emit = defineEmits<{ close: [] }>()
|
const emit = defineEmits<{ close: [] }>()
|
||||||
|
|
||||||
|
// ── Date / time ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const dateLabel = computed(() => {
|
const dateLabel = computed(() => {
|
||||||
const start = new Date(props.event.start)
|
const s = new Date(props.event.start)
|
||||||
const end = new Date(props.event.end)
|
const e = new Date(props.event.end)
|
||||||
|
|
||||||
if (props.event.isAllDay) {
|
if (props.event.isAllDay) {
|
||||||
const isSameDay = start.toDateString() === end.toDateString()
|
if (s.toDateString() === e.toDateString()) return format(s, 'd MMMM yyyy', { locale: ru })
|
||||||
if (isSameDay) return format(start, 'd MMMM yyyy', { locale: ru })
|
const adj = new Date(e.getTime() - 1)
|
||||||
const endAdjusted = new Date(end.getTime() - 1)
|
return `${format(s, 'd MMMM', { locale: ru })} – ${format(adj, 'd MMMM yyyy', { locale: ru })}`
|
||||||
return `${format(start, 'd MMMM', { locale: ru })} – ${format(endAdjusted, 'd MMMM yyyy', { locale: ru })}`
|
|
||||||
}
|
}
|
||||||
|
if (s.toDateString() === e.toDateString()) {
|
||||||
const sameDay = start.toDateString() === end.toDateString()
|
return `${format(s, 'd MMMM yyyy', { locale: ru })}, ${format(s, 'HH:mm')} – ${format(e, 'HH:mm')}`
|
||||||
if (sameDay) {
|
|
||||||
return `${format(start, 'd MMMM yyyy', { locale: ru })}, ${format(start, 'HH:mm')} – ${format(end, 'HH:mm')}`
|
|
||||||
}
|
}
|
||||||
return `${format(start, 'd MMMM HH:mm', { locale: ru })} – ${format(end, 'd MMMM HH:mm yyyy', { locale: ru })}`
|
return `${format(s, 'd MMMM HH:mm', { locale: ru })} – ${format(e, 'd MMMM HH:mm yyyy', { locale: ru })}`
|
||||||
})
|
})
|
||||||
|
|
||||||
const durationLabel = computed(() => {
|
const durationLabel = computed(() => {
|
||||||
if (props.event.isAllDay) return 'Весь день'
|
if (props.event.isAllDay) return 'Весь день'
|
||||||
const start = new Date(props.event.start)
|
const mins = Math.round((new Date(props.event.end).getTime() - new Date(props.event.start).getTime()) / 60_000)
|
||||||
const end = new Date(props.event.end)
|
|
||||||
const mins = Math.round((end.getTime() - start.getTime()) / 60_000)
|
|
||||||
if (mins < 60) return `${mins} мин`
|
if (mins < 60) return `${mins} мин`
|
||||||
const h = Math.floor(mins / 60)
|
const h = Math.floor(mins / 60), m = mins % 60
|
||||||
const m = mins % 60
|
|
||||||
return m > 0 ? `${h} ч ${m} мин` : `${h} ч`
|
return m > 0 ? `${h} ч ${m} мин` : `${h} ч`
|
||||||
})
|
})
|
||||||
|
|
||||||
const statusConfig = {
|
// ── Status ────────────────────────────────────────────────────────────────────
|
||||||
confirmed: { label: 'Подтверждено', color: '#4ade80' },
|
|
||||||
tentative: { label: 'Предварительно', color: '#f0a500' },
|
const EVT_STATUS: Record<string, { label: string; color: string }> = {
|
||||||
cancelled: { label: 'Отменено', color: '#ff5555' }
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
// CAL_COLORS palette (same as WeekView)
|
function personFromString(raw: string): DisplayPerson {
|
||||||
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
|
const m = raw.match(/^(.+?)\s*<([^>]+)>$/)
|
||||||
function calendarColor(id: string): string {
|
if (m) {
|
||||||
let hash = 0
|
const name = m[1].trim(), email = m[2].trim()
|
||||||
for (let i = 0; i < id.length; i++) hash = (hash * 31 + id.charCodeAt(i)) & 0xffffff
|
const parts = name.split(/\s+/)
|
||||||
return CAL_COLORS[Math.abs(hash) % CAL_COLORS.length]
|
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) }
|
||||||
}
|
}
|
||||||
|
|
||||||
const evColor = computed(() => props.color ?? calendarColor(props.event.calendarId))
|
function personFromAttendee(a: AttendeeInfo): DisplayPerson {
|
||||||
|
const parts = a.name.split(/\s+/)
|
||||||
|
const initials = parts.length >= 2
|
||||||
|
? (parts[0][0] + parts[parts.length - 1][0]).toUpperCase()
|
||||||
|
: a.name.slice(0, 2).toUpperCase()
|
||||||
|
return { name: a.name, email: a.email, initials, color: hashColor(a.email || a.name) }
|
||||||
|
}
|
||||||
|
|
||||||
|
const organizer = computed(() => props.event.organizer ? personFromString(props.event.organizer) : null)
|
||||||
|
const attendees = computed(() => props.event.attendees)
|
||||||
|
|
||||||
|
// Avatar stack compact view
|
||||||
|
const STACK_MAX = 5
|
||||||
|
const stackSlice = computed(() => attendees.value.slice(0, STACK_MAX))
|
||||||
|
const stackExtra = computed(() => Math.max(0, attendees.value.length - STACK_MAX))
|
||||||
|
const expanded = ref(false)
|
||||||
|
|
||||||
|
function attendeesLabel(n: number) {
|
||||||
|
if (n === 1) return '1 участник'
|
||||||
|
if (n <= 4) return `${n} участника`
|
||||||
|
return `${n} участников`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attendee status config
|
||||||
|
const ATND_STATUS = {
|
||||||
|
accepted: { label: 'принял', color: '#4ade80' },
|
||||||
|
declined: { label: 'отклонил', color: '#f87171' },
|
||||||
|
tentative: { label: 'под вопросом',color: '#fbbf24' },
|
||||||
|
unknown: { label: null, color: null },
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Clipboard ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const { invoke } = useIpc()
|
||||||
|
const copiedEmail = ref<string | null>(null)
|
||||||
|
async function copyEmail(email: string) {
|
||||||
|
if (!email) return
|
||||||
|
await invoke('app:copyToClipboard', { text: email })
|
||||||
|
copiedEmail.value = email
|
||||||
|
setTimeout(() => { copiedEmail.value = null }, 1600)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="popup-backdrop" @click.self="emit('close')">
|
<div class="backdrop" @click.self="emit('close')">
|
||||||
<div class="popup" :style="{ '--ev-color': evColor }">
|
<div class="popup" :style="{ '--ev': evColor }">
|
||||||
<!-- Color accent strip -->
|
|
||||||
<div class="popup-accent" />
|
<!-- top specular line -->
|
||||||
|
<div class="specular" />
|
||||||
|
|
||||||
|
<!-- ─── Hero ─────────────────────────────────────────────────────── -->
|
||||||
|
<div class="hero">
|
||||||
|
<div class="hero-wash" />
|
||||||
|
|
||||||
<!-- Header -->
|
|
||||||
<div class="popup-header">
|
|
||||||
<div class="popup-title-wrap">
|
|
||||||
<div class="popup-color-dot" />
|
|
||||||
<h3 class="popup-title">{{ event.title }}</h3>
|
|
||||||
</div>
|
|
||||||
<button class="close-btn" @click="emit('close')">
|
<button class="close-btn" @click="emit('close')">
|
||||||
<AppIcon name="close" :size="12" />
|
<AppIcon name="close" :size="10" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div v-if="evtStatus" class="evt-badge" :style="{ '--sc': evtStatus.color }">
|
||||||
|
<span class="evt-pip" />{{ evtStatus.label }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 class="hero-title">{{ event.title }}</h2>
|
||||||
|
|
||||||
|
<div class="hero-sub">
|
||||||
|
<span class="hero-date">{{ dateLabel }}</span>
|
||||||
|
<span class="hero-bull">·</span>
|
||||||
|
<span class="hero-dur">{{ durationLabel }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ─── Body ─────────────────────────────────────────────────────── -->
|
||||||
|
<div class="body">
|
||||||
|
|
||||||
|
<!-- Location -->
|
||||||
|
<div v-if="event.location" class="card row-card">
|
||||||
|
<div class="row-icon"><AppIcon name="location" :size="13" /></div>
|
||||||
|
<div class="row-content">
|
||||||
|
<div class="row-label">Место проведения</div>
|
||||||
|
<p class="row-value selectable">
|
||||||
|
<template v-for="(p, i) in locationParts" :key="i">
|
||||||
|
<a v-if="p.url" class="loc-link" :href="p.url" @click.prevent="openUrl(p.url!)">{{ p.text }}</a>
|
||||||
|
<span v-else>{{ p.text }}</span>
|
||||||
|
</template>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- People card -->
|
||||||
|
<div v-if="organizer || attendees.length > 0" class="card people-card">
|
||||||
|
|
||||||
|
<!-- Organizer -->
|
||||||
|
<div v-if="organizer" class="pgroup">
|
||||||
|
<div class="pgroup-head">
|
||||||
|
<AppIcon name="person" :size="11" />
|
||||||
|
Организатор
|
||||||
|
</div>
|
||||||
|
<div class="prow">
|
||||||
|
<div class="ava-wrap">
|
||||||
|
<div class="ava" :style="{ '--ac': organizer.color }">{{ organizer.initials }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="ptext">
|
||||||
|
<span class="pname">{{ organizer.name }}</span>
|
||||||
|
<span v-if="organizer.email && organizer.email !== organizer.name" class="pemail">{{ organizer.email }}</span>
|
||||||
|
</div>
|
||||||
|
<button v-if="organizer.email" class="copy-btn" :class="{ ok: copiedEmail === organizer.email }" @click="copyEmail(organizer.email)">
|
||||||
|
<AppIcon :name="copiedEmail === organizer.email ? 'check' : 'copy'" :size="11" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="organizer && attendees.length > 0" class="psep" />
|
||||||
|
|
||||||
|
<!-- Attendees -->
|
||||||
|
<div v-if="attendees.length > 0" class="pgroup">
|
||||||
|
<div class="pgroup-head">
|
||||||
|
<AppIcon name="people" :size="11" />
|
||||||
|
{{ attendeesLabel(attendees.length) }}
|
||||||
|
<button class="chevron-btn" :class="{ open: expanded }" @click="expanded = !expanded">
|
||||||
|
<AppIcon name="chevron-right" :size="12" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Metadata rows -->
|
<!-- Compact: overlapping avatar stack -->
|
||||||
<div class="popup-body">
|
<div v-if="!expanded" class="avatar-stack">
|
||||||
|
|
||||||
<!-- Date & duration -->
|
|
||||||
<div class="meta-row">
|
|
||||||
<div class="meta-icon-wrap">
|
|
||||||
<AppIcon name="calendar" :size="13" />
|
|
||||||
</div>
|
|
||||||
<div class="meta-text">
|
|
||||||
<span class="meta-primary">{{ dateLabel }}</span>
|
|
||||||
<span class="meta-secondary">{{ durationLabel }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Status (non-confirmed only) -->
|
|
||||||
<div
|
<div
|
||||||
v-if="event.status && event.status !== 'confirmed'"
|
v-for="a in stackSlice"
|
||||||
class="meta-row status-row"
|
:key="a.email || a.name"
|
||||||
:style="{ '--status-color': statusConfig[event.status]?.color ?? '#888' }"
|
class="ava stack-ava"
|
||||||
>
|
:style="{ '--ac': personFromAttendee(a).color }"
|
||||||
<div class="meta-icon-wrap status-icon">
|
:title="a.email ? `${a.name} · ${a.email}` : a.name"
|
||||||
<span class="status-dot" />
|
>{{ personFromAttendee(a).initials }}</div>
|
||||||
</div>
|
<div v-if="stackExtra > 0" class="ava stack-ava stack-more">+{{ stackExtra }}</div>
|
||||||
<span class="meta-primary">{{ statusConfig[event.status]?.label ?? event.status }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Location -->
|
<!-- Expanded: full list -->
|
||||||
<div v-if="event.location" class="meta-row">
|
<div v-else class="plist">
|
||||||
<div class="meta-icon-wrap">
|
<div v-for="a in attendees" :key="a.email || a.name" class="prow">
|
||||||
<AppIcon name="location" :size="13" />
|
<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>
|
||||||
<span class="meta-primary">{{ 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>
|
</div>
|
||||||
|
<span v-if="a.email && a.email !== a.name" class="pemail">{{ a.email }}</span>
|
||||||
<!-- Organizer -->
|
|
||||||
<div v-if="event.organizer" class="meta-row">
|
|
||||||
<div class="meta-icon-wrap">
|
|
||||||
<AppIcon name="person" :size="13" />
|
|
||||||
</div>
|
</div>
|
||||||
<span class="meta-primary">{{ event.organizer }}</span>
|
<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>
|
||||||
|
|
||||||
<!-- Attendees -->
|
|
||||||
<div v-if="event.attendees.length > 0" class="meta-row attendees-row">
|
|
||||||
<div class="meta-icon-wrap">
|
|
||||||
<AppIcon name="people" :size="13" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="attendee-list">
|
|
||||||
<span v-for="a in event.attendees" :key="a" class="attendee-chip">{{ a }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Description -->
|
<!-- Description -->
|
||||||
<div v-if="event.description" class="description">
|
<div v-if="event.description" class="card desc-card">
|
||||||
{{ event.description }}
|
<p class="desc-text selectable">{{ event.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.popup-backdrop {
|
/* ── Backdrop ─────────────────────────────────────────────────────────────── */
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
z-index: 100;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background: rgba(0, 0, 0, 0.5);
|
|
||||||
backdrop-filter: blur(6px);
|
|
||||||
-webkit-backdrop-filter: blur(6px);
|
|
||||||
animation: backdrop-in 180ms ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes backdrop-in {
|
.backdrop {
|
||||||
from { opacity: 0; }
|
position: fixed; inset: 0; z-index: 100;
|
||||||
to { opacity: 1; }
|
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 {
|
.popup {
|
||||||
width: 420px;
|
|
||||||
max-width: 92vw;
|
|
||||||
max-height: 82vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
border-radius: 20px;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.11);
|
|
||||||
border-top-color: rgba(255, 255, 255, 0.18);
|
|
||||||
background:
|
|
||||||
linear-gradient(160deg, rgba(255, 255, 255, 0.095) 0%, rgba(255, 255, 255, 0.030) 50%, transparent 100%),
|
|
||||||
rgba(14, 14, 24, 0.95);
|
|
||||||
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.17),
|
|
||||||
0 4px 24px rgba(0, 0, 0, 0.45),
|
|
||||||
0 24px 80px rgba(0, 0, 0, 0.70),
|
|
||||||
0 0 0 1px rgba(0, 0, 0, 0.3);
|
|
||||||
position: relative;
|
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:
|
||||||
|
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) }
|
||||||
|
}
|
||||||
|
|
||||||
|
.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Hero ─────────────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
position: relative;
|
||||||
|
padding: 22px 22px 24px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
animation: popup-in 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
|
|
||||||
}
|
}
|
||||||
|
.hero-wash {
|
||||||
@keyframes popup-in {
|
position: absolute; inset: 0; pointer-events: none;
|
||||||
from { opacity: 0; transform: scale(0.93) translateY(8px); }
|
background: radial-gradient(
|
||||||
to { opacity: 1; transform: scale(1) translateY(0); }
|
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%,
|
||||||
/* Color accent strip at top */
|
|
||||||
.popup-accent {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
height: 3px;
|
|
||||||
background: linear-gradient(
|
|
||||||
90deg,
|
|
||||||
transparent 0%,
|
|
||||||
color-mix(in srgb, var(--ev-color) 70%, transparent) 20%,
|
|
||||||
var(--ev-color) 50%,
|
|
||||||
color-mix(in srgb, var(--ev-color) 70%, transparent) 80%,
|
|
||||||
transparent 100%
|
transparent 100%
|
||||||
);
|
);
|
||||||
box-shadow: 0 0 20px color-mix(in srgb, var(--ev-color) 50%, transparent);
|
|
||||||
}
|
}
|
||||||
|
.hero::after {
|
||||||
/* Header */
|
content:''; position:absolute; bottom:0; left:16px; right:16px; height:1px;
|
||||||
.popup-header {
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10) 25%, rgba(255,255,255,0.10) 75%, transparent);
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
gap: 10px;
|
|
||||||
padding: 20px 20px 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-title-wrap {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
gap: 10px;
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-color-dot {
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--ev-color);
|
|
||||||
box-shadow: 0 0 8px color-mix(in srgb, var(--ev-color) 70%, transparent);
|
|
||||||
flex-shrink: 0;
|
|
||||||
margin-top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-title {
|
|
||||||
font-size: 17px;
|
|
||||||
font-weight: 600;
|
|
||||||
line-height: 1.3;
|
|
||||||
color: var(--text-primary);
|
|
||||||
margin: 0;
|
|
||||||
letter-spacing: -0.3px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-btn {
|
.close-btn {
|
||||||
flex-shrink: 0;
|
position: absolute; top:16px; right:16px;
|
||||||
width: 26px;
|
width:26px; height:26px; border-radius:50%;
|
||||||
height: 26px;
|
display:flex; align-items:center; justify-content:center;
|
||||||
border-radius: 50%;
|
background: rgba(255,255,255,0.08);
|
||||||
display: flex;
|
border: 1px solid rgba(255,255,255,0.11);
|
||||||
align-items: center;
|
color: rgba(255,255,255,0.38);
|
||||||
justify-content: center;
|
transition: background 120ms, color 120ms;
|
||||||
color: var(--text-muted);
|
z-index: 2;
|
||||||
background: rgba(255, 255, 255, 0.06);
|
}
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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: 1px solid rgba(255,255,255,0.09);
|
||||||
transition: background var(--transition-fast), color var(--transition-fast);
|
border-top-color: rgba(255,255,255,0.14);
|
||||||
margin-top: 1px;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-btn:hover {
|
.pgroup-head {
|
||||||
background: rgba(255, 255, 255, 0.11);
|
display:flex; align-items:center; gap:5px; margin-bottom:10px;
|
||||||
color: var(--text-secondary);
|
font-size:10px; font-weight:600; letter-spacing:0.6px; text-transform:uppercase;
|
||||||
|
color: rgba(255,255,255,0.30);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Body */
|
/* Chevron toggle button */
|
||||||
.popup-body {
|
.chevron-btn {
|
||||||
display: flex;
|
margin-left:auto; width:26px; height:26px; border-radius:8px;
|
||||||
flex-direction: column;
|
display:flex; align-items:center; justify-content:center;
|
||||||
gap: 2px;
|
background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.10);
|
||||||
padding: 0 20px 20px;
|
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-row {
|
/* Wrapper for avatar + status dot */
|
||||||
display: flex;
|
.ava-wrap { position:relative; flex-shrink:0 }
|
||||||
align-items: flex-start;
|
|
||||||
gap: 10px;
|
.ava-status-dot {
|
||||||
padding: 7px 10px;
|
position:absolute; bottom:-1px; right:-1px;
|
||||||
border-radius: 10px;
|
width:9px; height:9px; border-radius:50%;
|
||||||
transition: background var(--transition-fast);
|
/* Gap ring matching the approximate card background color */
|
||||||
|
box-shadow: 0 0 0 1.5px rgb(22,21,36);
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-row:hover {
|
/* ── Avatar stack ─────────────────────────────────────────────────────────── */
|
||||||
background: rgba(255, 255, 255, 0.04);
|
|
||||||
|
.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-icon-wrap {
|
/* ── Person row ───────────────────────────────────────────────────────────── */
|
||||||
width: 28px;
|
|
||||||
height: 28px;
|
.prow { display:flex; align-items:center; gap:9px; padding:3px 0; border-radius:10px }
|
||||||
border-radius: 8px;
|
|
||||||
background: rgba(255, 255, 255, 0.06);
|
.plist { display:flex; flex-direction:column; gap:1px }
|
||||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
.plist .prow {
|
||||||
display: flex;
|
padding:4px 6px; margin:0 -6px;
|
||||||
align-items: center;
|
transition: background 110ms;
|
||||||
justify-content: center;
|
}
|
||||||
flex-shrink: 0;
|
.plist .prow:hover { background: rgba(255,255,255,0.05) }
|
||||||
color: var(--text-muted);
|
|
||||||
|
.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-text {
|
.optional-tag {
|
||||||
display: flex;
|
font-size:10px; color:rgba(255,255,255,0.28); font-weight:500;
|
||||||
flex-direction: column;
|
background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.09);
|
||||||
gap: 2px;
|
border-radius:4px; padding:0 5px; white-space:nowrap; flex-shrink:0;
|
||||||
justify-content: center;
|
|
||||||
min-height: 28px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-primary {
|
.pemail {
|
||||||
font-size: 13px;
|
font-size:11px; color:rgba(255,255,255,0.30); line-height:1.3;
|
||||||
color: var(--text-primary);
|
overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
|
||||||
line-height: 1.4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-secondary {
|
/* Copy button — appears on row hover */
|
||||||
font-size: 11px;
|
.copy-btn {
|
||||||
color: var(--text-muted);
|
flex-shrink:0; width:24px; height:24px; border-radius:7px;
|
||||||
line-height: 1.3;
|
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) }
|
||||||
|
|
||||||
/* Status */
|
/* ── Description ──────────────────────────────────────────────────────────── */
|
||||||
.status-row .meta-icon-wrap {
|
|
||||||
background: color-mix(in srgb, var(--status-color) 15%, transparent);
|
|
||||||
border-color: color-mix(in srgb, var(--status-color) 25%, transparent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-dot {
|
.desc-card { padding:16px }
|
||||||
width: 8px;
|
.desc-text {
|
||||||
height: 8px;
|
font-size:13px; color:rgba(255,255,255,0.52); white-space:pre-wrap;
|
||||||
border-radius: 50%;
|
line-height:1.7; margin:0; word-break:break-word;
|
||||||
background: var(--status-color);
|
|
||||||
box-shadow: 0 0 6px var(--status-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-row .meta-primary {
|
|
||||||
color: var(--status-color);
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Attendees */
|
|
||||||
.attendees-row {
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attendee-list {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 4px;
|
|
||||||
padding-top: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attendee-chip {
|
|
||||||
font-size: 11px;
|
|
||||||
padding: 3px 9px;
|
|
||||||
border-radius: var(--radius-full);
|
|
||||||
background: rgba(255, 255, 255, 0.06);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.09);
|
|
||||||
color: var(--text-secondary);
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Description */
|
|
||||||
.description {
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
white-space: pre-wrap;
|
|
||||||
line-height: 1.6;
|
|
||||||
padding: 12px 10px;
|
|
||||||
margin-top: 4px;
|
|
||||||
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scrollbar */
|
|
||||||
.popup {
|
|
||||||
scrollbar-width: thin;
|
|
||||||
scrollbar-color: rgba(255,255,255,0.1) transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup::-webkit-scrollbar {
|
|
||||||
width: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup::-webkit-scrollbar-track {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup::-webkit-scrollbar-thumb {
|
|
||||||
background: rgba(255, 255, 255, 0.1);
|
|
||||||
border-radius: 2px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -68,20 +68,23 @@ function nextMonth(): void {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="mini-cal">
|
<div class="mini-cal">
|
||||||
|
<!-- Header -->
|
||||||
<div class="mini-header">
|
<div class="mini-header">
|
||||||
<button class="mini-nav" @click="prevMonth">
|
<button class="mini-nav" @click="prevMonth">
|
||||||
<AppIcon name="chevron-right" :size="11" style="transform: rotate(180deg)" />
|
<AppIcon name="chevron-right" :size="10" style="transform: rotate(180deg)" />
|
||||||
</button>
|
</button>
|
||||||
<span class="mini-month">{{ monthLabel }}</span>
|
<span class="mini-month">{{ monthLabel }}</span>
|
||||||
<button class="mini-nav" @click="nextMonth">
|
<button class="mini-nav" @click="nextMonth">
|
||||||
<AppIcon name="chevron-right" :size="11" />
|
<AppIcon name="chevron-right" :size="10" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Day-of-week labels -->
|
||||||
<div class="dow-row">
|
<div class="dow-row">
|
||||||
<span v-for="d in DOW_LABELS" :key="d" class="dow">{{ d }}</span>
|
<span v-for="d in DOW_LABELS" :key="d" class="dow">{{ d }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Day grid -->
|
||||||
<div class="day-grid">
|
<div class="day-grid">
|
||||||
<button
|
<button
|
||||||
v-for="(day, i) in grid"
|
v-for="(day, i) in grid"
|
||||||
|
|
@ -96,126 +99,270 @@ function nextMonth(): void {
|
||||||
}"
|
}"
|
||||||
@click="emit('dayClick', day)"
|
@click="emit('dayClick', day)"
|
||||||
>
|
>
|
||||||
{{ format(day, 'd') }}
|
<span class="day-inner">{{ format(day, 'd') }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
/* ── Container ──────────────────────────────────────────────────────────── */
|
||||||
.mini-cal {
|
.mini-cal {
|
||||||
padding: 10px 10px 8px;
|
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 {
|
.mini-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 10px;
|
||||||
|
padding: 0 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mini-month {
|
.mini-month {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--text-secondary);
|
color: var(--text-primary);
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
letter-spacing: 0.2px;
|
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 {
|
.mini-nav {
|
||||||
width: 20px;
|
width: 22px;
|
||||||
height: 20px;
|
height: 22px;
|
||||||
border-radius: var(--radius-sm);
|
border-radius: 7px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: var(--text-muted);
|
flex-shrink: 0;
|
||||||
background: transparent;
|
color: rgba(255, 255, 255, 0.4);
|
||||||
border: 1px solid transparent;
|
background: linear-gradient(
|
||||||
transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
|
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 {
|
.mini-nav:hover {
|
||||||
background: var(--glass-bg-raised);
|
background: linear-gradient(
|
||||||
border-color: var(--glass-border);
|
150deg,
|
||||||
color: var(--text-secondary);
|
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 {
|
.dow-row {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(7, 1fr);
|
grid-template-columns: repeat(7, 1fr);
|
||||||
margin-bottom: 3px;
|
margin-bottom: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dow {
|
.dow {
|
||||||
font-size: 9px;
|
font-size: 9px;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: var(--text-muted);
|
color: rgba(255, 255, 255, 0.28);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.3px;
|
letter-spacing: 0.5px;
|
||||||
padding: 2px 0;
|
padding: 1px 0 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Day grid ────────────────────────────────────────────────────────────── */
|
||||||
.day-grid {
|
.day-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(7, 1fr);
|
grid-template-columns: repeat(7, 1fr);
|
||||||
gap: 1px;
|
row-gap: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Each cell is position:relative so the range strip can be absolutely placed */
|
||||||
.day-cell {
|
.day-cell {
|
||||||
|
position: relative;
|
||||||
aspect-ratio: 1;
|
aspect-ratio: 1;
|
||||||
font-size: 11px;
|
|
||||||
font-weight: 400;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
border-radius: 4px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
cursor: pointer;
|
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
transition: background var(--transition-fast), color var(--transition-fast);
|
cursor: pointer;
|
||||||
position: relative;
|
padding: 0;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell:hover {
|
/* The visible number circle */
|
||||||
background: var(--glass-bg-hover);
|
.day-inner {
|
||||||
color: var(--text-primary);
|
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.other-month {
|
.day-cell:hover:not(.in-range) .day-inner {
|
||||||
color: var(--text-muted);
|
background: linear-gradient(
|
||||||
opacity: 0.5;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell.is-today {
|
/* ── 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);
|
color: var(--accent);
|
||||||
font-weight: 700;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell.in-range {
|
/* ── Week range strip ────────────────────────────────────────────────────── */
|
||||||
background: rgba(168, 230, 0, 0.10);
|
|
||||||
color: var(--text-primary);
|
/*
|
||||||
border-radius: 0;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell.range-start {
|
/* Full-width for middle */
|
||||||
border-radius: 4px 0 0 4px;
|
.day-cell.in-range:not(.range-start):not(.range-end)::before {
|
||||||
background: rgba(168, 230, 0, 0.22);
|
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);
|
color: var(--accent);
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
|
background: rgba(168, 230, 0, 0.12);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(168, 230, 0, 0.22);
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell.range-end {
|
/* Today that is also a range endpoint */
|
||||||
border-radius: 0 4px 4px 0;
|
.day-cell.is-today.range-start .day-inner,
|
||||||
background: rgba(168, 230, 0, 0.22);
|
.day-cell.is-today.range-end .day-inner {
|
||||||
color: var(--accent);
|
box-shadow:
|
||||||
font-weight: 600;
|
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),
|
||||||
.day-cell.range-start.range-end {
|
0 0 0 1px rgba(168, 230, 0, 0.30);
|
||||||
border-radius: 4px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ const props = defineProps<{
|
||||||
weekStart: Date
|
weekStart: Date
|
||||||
events: CalendarEvent[]
|
events: CalendarEvent[]
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
|
calendarColors?: Record<string, string>
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits<{ eventClick: [event: CalendarEvent] }>()
|
const emit = defineEmits<{ eventClick: [event: CalendarEvent] }>()
|
||||||
|
|
@ -22,11 +23,11 @@ const HOURS = Array.from({ length: 24 }, (_, i) => i)
|
||||||
const days = computed(() =>
|
const days = computed(() =>
|
||||||
Array.from({ length: 7 }, (_, i) => {
|
Array.from({ length: 7 }, (_, i) => {
|
||||||
const date = addDays(props.weekStart, i)
|
const date = addDays(props.weekStart, i)
|
||||||
|
const raw = format(date, 'EEEE', { locale: ru })
|
||||||
return {
|
return {
|
||||||
date,
|
date,
|
||||||
dayName: format(date, 'EEE', { locale: ru }),
|
dayName: raw.charAt(0).toUpperCase() + raw.slice(1),
|
||||||
dayNum: format(date, 'd'),
|
dayNum: format(date, 'd'),
|
||||||
monthLabel: format(date, 'MMM', { locale: ru }),
|
|
||||||
isToday: isToday(date)
|
isToday: isToday(date)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -162,6 +163,29 @@ function formatHour(h: number): string {
|
||||||
return h === 0 ? '' : `${String(h).padStart(2, '0')}:00`
|
return h === 0 ? '' : `${String(h).padStart(2, '0')}:00`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Per-day calendar summary ─────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const daySummary = computed(() =>
|
||||||
|
days.value.map((day) => {
|
||||||
|
const dayEvs = timedEvents.value.filter((e) => isSameDay(new Date(e.start), day.date))
|
||||||
|
const byCalendar: Record<string, number> = {}
|
||||||
|
for (const ev of dayEvs) {
|
||||||
|
const dur = (new Date(ev.end).getTime() - new Date(ev.start).getTime()) / 3_600_000
|
||||||
|
byCalendar[ev.calendarId] = (byCalendar[ev.calendarId] ?? 0) + dur
|
||||||
|
}
|
||||||
|
return Object.entries(byCalendar)
|
||||||
|
.filter(([, h]) => h > 0)
|
||||||
|
.map(([calId, hours]) => ({ calId, hours }))
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
function formatDuration(h: number): string {
|
||||||
|
if (h < 1) return `${Math.round(h * 60)}м`
|
||||||
|
const whole = Math.floor(h)
|
||||||
|
const mins = Math.round((h - whole) * 60)
|
||||||
|
return mins === 0 ? `${whole}ч` : `${whole}ч${mins}м`
|
||||||
|
}
|
||||||
|
|
||||||
function eventStyle(layout: LayoutEvent): Record<string, string> {
|
function eventStyle(layout: LayoutEvent): Record<string, string> {
|
||||||
const colWidth = 100 / layout.totalColumns
|
const colWidth = 100 / layout.totalColumns
|
||||||
return {
|
return {
|
||||||
|
|
@ -175,6 +199,7 @@ function eventStyle(layout: LayoutEvent): Record<string, string> {
|
||||||
|
|
||||||
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
|
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
|
||||||
function calendarColor(calendarId: string): string {
|
function calendarColor(calendarId: string): string {
|
||||||
|
if (props.calendarColors?.[calendarId]) return props.calendarColors[calendarId]
|
||||||
let hash = 0
|
let hash = 0
|
||||||
for (let i = 0; i < calendarId.length; i++) hash = (hash * 31 + calendarId.charCodeAt(i)) & 0xffffff
|
for (let i = 0; i < calendarId.length; i++) hash = (hash * 31 + calendarId.charCodeAt(i)) & 0xffffff
|
||||||
return CAL_COLORS[Math.abs(hash) % CAL_COLORS.length]
|
return CAL_COLORS[Math.abs(hash) % CAL_COLORS.length]
|
||||||
|
|
@ -185,7 +210,12 @@ function calendarColor(calendarId: string): string {
|
||||||
<div class="week-view">
|
<div class="week-view">
|
||||||
<!-- Day header row -->
|
<!-- Day header row -->
|
||||||
<div class="day-headers">
|
<div class="day-headers">
|
||||||
<div class="time-gutter" />
|
<!-- Corner cell: event count badge -->
|
||||||
|
<div class="time-gutter corner-cell">
|
||||||
|
<span v-if="events.length > 0" class="corner-badge" :title="`Встреч на неделе: ${events.length}`">
|
||||||
|
{{ events.length }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="(day, i) in days"
|
v-for="(day, i) in days"
|
||||||
:key="i"
|
:key="i"
|
||||||
|
|
@ -196,7 +226,14 @@ function calendarColor(calendarId: string): string {
|
||||||
<div class="day-num-wrap" :class="{ today: day.isToday }">
|
<div class="day-num-wrap" :class="{ today: day.isToday }">
|
||||||
<span class="day-num">{{ day.dayNum }}</span>
|
<span class="day-num">{{ day.dayNum }}</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="month-label">{{ day.monthLabel }}</span>
|
<!-- Per-calendar hours summary -->
|
||||||
|
<div v-if="daySummary[i].length > 0" class="day-summary">
|
||||||
|
<span v-for="item in daySummary[i]" :key="item.calId" class="summary-item">
|
||||||
|
<span class="summary-dot" :style="{ background: calendarColor(item.calId) }" />
|
||||||
|
<span class="summary-hrs">{{ formatDuration(item.hours) }}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="day-summary-empty" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -299,9 +336,6 @@ function calendarColor(calendarId: string): string {
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
background: rgba(10, 10, 18, 0.35);
|
background: rgba(10, 10, 18, 0.35);
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(8px);
|
||||||
/* Reserve same scrollbar gutter as .grid-scroll.
|
|
||||||
scrollbar-gutter only works on scrollable elements (overflow != hidden/visible),
|
|
||||||
so overflow-y: auto is required even though .day-headers never actually scrolls. */
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
scrollbar-gutter: stable;
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
|
|
@ -311,16 +345,38 @@ function calendarColor(calendarId: string): string {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Corner cell: holds the event-count badge */
|
||||||
|
.corner-cell {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: center;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.corner-badge {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1;
|
||||||
|
padding: 2px 6px 3px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: rgba(168, 230, 0, 0.10);
|
||||||
|
border: 1px solid rgba(168, 230, 0, 0.22);
|
||||||
|
color: var(--accent);
|
||||||
|
letter-spacing: 0.2px;
|
||||||
|
box-shadow: inset 0 1px 0 rgba(168, 230, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
.day-header {
|
.day-header {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 10px 4px 8px;
|
padding: 7px 4px 6px;
|
||||||
border-left: 1px solid rgba(255, 255, 255, 0.05);
|
border-left: 1px solid rgba(255, 255, 255, 0.05);
|
||||||
gap: 3px;
|
gap: 2px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
transition: background var(--transition-fast);
|
transition: background var(--transition-fast);
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-header.today {
|
.day-header.today {
|
||||||
|
|
@ -328,11 +384,14 @@ function calendarColor(calendarId: string): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-name {
|
.day-name {
|
||||||
font-size: 10px;
|
font-size: 9.5px;
|
||||||
font-weight: 700;
|
font-weight: 600;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
text-transform: uppercase;
|
letter-spacing: 0.2px;
|
||||||
letter-spacing: 0.6px;
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-header.today .day-name {
|
.day-header.today .day-name {
|
||||||
|
|
@ -340,8 +399,8 @@ function calendarColor(calendarId: string): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-num-wrap {
|
.day-num-wrap {
|
||||||
width: 30px;
|
width: 26px;
|
||||||
height: 30px;
|
height: 26px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -351,11 +410,11 @@ function calendarColor(calendarId: string): string {
|
||||||
|
|
||||||
.day-num-wrap.today {
|
.day-num-wrap.today {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
box-shadow: 0 0 16px rgba(168, 230, 0, 0.45);
|
box-shadow: 0 0 14px rgba(168, 230, 0, 0.42);
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-num {
|
.day-num {
|
||||||
font-size: 17px;
|
font-size: 15px;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
|
@ -364,13 +423,45 @@ function calendarColor(calendarId: string): string {
|
||||||
.day-num-wrap.today .day-num {
|
.day-num-wrap.today .day-num {
|
||||||
color: var(--accent-text);
|
color: var(--accent-text);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 16px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.month-label {
|
/* ── 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-size: 9px;
|
||||||
|
font-weight: 600;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
text-transform: capitalize;
|
letter-spacing: 0.1px;
|
||||||
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── All-day row ── */
|
/* ── All-day row ── */
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,16 @@ import { useIpc } from '../composables/useIpc'
|
||||||
import { useAccountsStore } from './accounts.store'
|
import { useAccountsStore } from './accounts.store'
|
||||||
import type { CalendarInfo, CalendarEvent } from '@shared/types/calendar'
|
import type { CalendarInfo, CalendarEvent } from '@shared/types/calendar'
|
||||||
|
|
||||||
|
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
|
||||||
|
|
||||||
|
function hashCalendarColor(id: string): string {
|
||||||
|
let hash = 0
|
||||||
|
for (let i = 0; i < id.length; i++) hash = (hash * 31 + id.charCodeAt(i)) & 0xffffff
|
||||||
|
return CAL_COLORS[Math.abs(hash) % CAL_COLORS.length]
|
||||||
|
}
|
||||||
|
|
||||||
|
export { CAL_COLORS }
|
||||||
|
|
||||||
export const useCalendarStore = defineStore('calendar', () => {
|
export const useCalendarStore = defineStore('calendar', () => {
|
||||||
const { invoke } = useIpc()
|
const { invoke } = useIpc()
|
||||||
const accountsStore = useAccountsStore()
|
const accountsStore = useAccountsStore()
|
||||||
|
|
@ -20,6 +30,22 @@ export const useCalendarStore = defineStore('calendar', () => {
|
||||||
const loadingCalendars = ref(false)
|
const loadingCalendars = ref(false)
|
||||||
const error = ref<string | null>(null)
|
const error = ref<string | null>(null)
|
||||||
|
|
||||||
|
// ── Calendar colors (persisted to localStorage) ────────────────────────────
|
||||||
|
|
||||||
|
const COLORS_KEY = 'calendar-custom-colors'
|
||||||
|
const calendarColors = ref<Record<string, string>>(
|
||||||
|
JSON.parse(localStorage.getItem(COLORS_KEY) ?? '{}')
|
||||||
|
)
|
||||||
|
|
||||||
|
function resolveColor(calId: string): string {
|
||||||
|
return calendarColors.value[calId] ?? hashCalendarColor(calId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCalendarColor(calId: string, color: string): void {
|
||||||
|
calendarColors.value = { ...calendarColors.value, [calId]: color }
|
||||||
|
localStorage.setItem(COLORS_KEY, JSON.stringify(calendarColors.value))
|
||||||
|
}
|
||||||
|
|
||||||
// ── Computed ───────────────────────────────────────────────────────────────
|
// ── Computed ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const currentWeekEnd = computed(() => endOfWeek(currentWeekStart.value, { weekStartsOn: 1 }))
|
const currentWeekEnd = computed(() => endOfWeek(currentWeekStart.value, { weekStartsOn: 1 }))
|
||||||
|
|
@ -129,6 +155,9 @@ export const useCalendarStore = defineStore('calendar', () => {
|
||||||
loadingCalendars,
|
loadingCalendars,
|
||||||
error,
|
error,
|
||||||
visibleEvents,
|
visibleEvents,
|
||||||
|
calendarColors,
|
||||||
|
resolveColor,
|
||||||
|
setCalendarColor,
|
||||||
loadCalendars,
|
loadCalendars,
|
||||||
loadEvents,
|
loadEvents,
|
||||||
toggleCalendar,
|
toggleCalendar,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import { onMounted, watch, ref } from 'vue'
|
import { onMounted, watch, ref } from 'vue'
|
||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
import { ru } from 'date-fns/locale'
|
import { ru } from 'date-fns/locale'
|
||||||
import { useCalendarStore } from '../stores/calendar.store'
|
import { useCalendarStore, CAL_COLORS } from '../stores/calendar.store'
|
||||||
import { useAccountsStore } from '../stores/accounts.store'
|
import { useAccountsStore } from '../stores/accounts.store'
|
||||||
import AccountSwitcher from '../components/sidebar/AccountSwitcher.vue'
|
import AccountSwitcher from '../components/sidebar/AccountSwitcher.vue'
|
||||||
import WeekView from '../components/calendar/WeekView.vue'
|
import WeekView from '../components/calendar/WeekView.vue'
|
||||||
|
|
@ -17,20 +17,10 @@ const calStore = useCalendarStore()
|
||||||
const accountsStore = useAccountsStore()
|
const accountsStore = useAccountsStore()
|
||||||
const showAddAccount = ref(false)
|
const showAddAccount = ref(false)
|
||||||
|
|
||||||
// Calendar color palette
|
|
||||||
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
|
|
||||||
function calendarColor(calendarId: string): string {
|
|
||||||
let hash = 0
|
|
||||||
for (let i = 0; i < calendarId.length; i++) hash = (hash * 31 + calendarId.charCodeAt(i)) & 0xffffff
|
|
||||||
return CAL_COLORS[Math.abs(hash) % CAL_COLORS.length]
|
|
||||||
}
|
|
||||||
|
|
||||||
const weekLabel = () => {
|
const weekLabel = () => {
|
||||||
const s = calStore.currentWeekStart
|
const s = calStore.currentWeekStart
|
||||||
const e = calStore.currentWeekEnd
|
const e = calStore.currentWeekEnd
|
||||||
const sStr = format(s, 'd MMM', { locale: ru })
|
return `${format(s, 'd MMM', { locale: ru })} – ${format(e, 'd MMM yyyy', { locale: ru })}`
|
||||||
const eStr = format(e, 'd MMM yyyy', { locale: ru })
|
|
||||||
return `${sStr} – ${eStr}`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reload(): Promise<void> {
|
async function reload(): Promise<void> {
|
||||||
|
|
@ -44,6 +34,24 @@ watch(() => accountsStore.activeAccountId, reload)
|
||||||
function handleEventClick(ev: CalendarEvent): void {
|
function handleEventClick(ev: CalendarEvent): void {
|
||||||
calStore.selectEvent(ev)
|
calStore.selectEvent(ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Color picker ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const pickerCalId = ref<string | null>(null)
|
||||||
|
const pickerPos = ref({ x: 0, y: 0 })
|
||||||
|
|
||||||
|
function openPicker(calId: string, e: MouseEvent): void {
|
||||||
|
e.stopPropagation()
|
||||||
|
if (pickerCalId.value === calId) { pickerCalId.value = null; return }
|
||||||
|
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect()
|
||||||
|
pickerPos.value = { x: rect.right + 8, y: rect.top - 2 }
|
||||||
|
pickerCalId.value = calId
|
||||||
|
}
|
||||||
|
|
||||||
|
function pickColor(color: string): void {
|
||||||
|
if (pickerCalId.value) calStore.setCalendarColor(pickerCalId.value, color)
|
||||||
|
pickerCalId.value = null
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -101,12 +109,17 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
:class="{ active: calStore.selectedCalendarIds.has(cal.id) }"
|
:class="{ active: calStore.selectedCalendarIds.has(cal.id) }"
|
||||||
@click="calStore.toggleCalendar(cal.id)"
|
@click="calStore.toggleCalendar(cal.id)"
|
||||||
>
|
>
|
||||||
<div class="cal-check" :class="{ checked: calStore.selectedCalendarIds.has(cal.id) }">
|
<button
|
||||||
|
class="cal-dot-btn"
|
||||||
|
:title="'Изменить цвет'"
|
||||||
|
@click="openPicker(cal.id, $event)"
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
class="cal-dot-inner"
|
class="cal-dot"
|
||||||
:style="{ background: calendarColor(cal.id) }"
|
:style="{ background: calStore.resolveColor(cal.id) }"
|
||||||
|
:class="{ dimmed: !calStore.selectedCalendarIds.has(cal.id) }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</button>
|
||||||
<span class="cal-name" :title="cal.name">{{ cal.name }}</span>
|
<span class="cal-name" :title="cal.name">{{ cal.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -114,6 +127,25 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
Нет доступных<br>календарей
|
Нет доступных<br>календарей
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 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>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -135,9 +167,6 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
<h2 class="week-label">{{ weekLabel() }}</h2>
|
<h2 class="week-label">{{ weekLabel() }}</h2>
|
||||||
|
|
||||||
<div class="toolbar-right">
|
<div class="toolbar-right">
|
||||||
<span v-if="calStore.visibleEvents.length > 0" class="event-count-badge">
|
|
||||||
{{ calStore.visibleEvents.length }}
|
|
||||||
</span>
|
|
||||||
<button class="icon-btn" :disabled="calStore.loading" @click="calStore.loadEvents()" title="Обновить">
|
<button class="icon-btn" :disabled="calStore.loading" @click="calStore.loadEvents()" title="Обновить">
|
||||||
<AppIcon name="refresh" :size="14" :class="{ spinning: calStore.loading }" />
|
<AppIcon name="refresh" :size="14" :class="{ spinning: calStore.loading }" />
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -150,6 +179,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
:week-start="calStore.currentWeekStart"
|
:week-start="calStore.currentWeekStart"
|
||||||
:events="calStore.visibleEvents"
|
:events="calStore.visibleEvents"
|
||||||
:loading="calStore.loading"
|
:loading="calStore.loading"
|
||||||
|
:calendar-colors="calStore.calendarColors"
|
||||||
@event-click="handleEventClick"
|
@event-click="handleEventClick"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -160,6 +190,7 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
<EventDetailPopup
|
<EventDetailPopup
|
||||||
v-if="calStore.selectedEvent"
|
v-if="calStore.selectedEvent"
|
||||||
:event="calStore.selectedEvent"
|
:event="calStore.selectedEvent"
|
||||||
|
:color="calStore.resolveColor(calStore.selectedEvent.calendarId)"
|
||||||
@close="calStore.selectEvent(null)"
|
@close="calStore.selectEvent(null)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
@ -295,36 +326,35 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
background: var(--glass-bg-hover);
|
background: var(--glass-bg-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-check {
|
.cal-dot-btn {
|
||||||
width: 16px;
|
flex-shrink: 0;
|
||||||
height: 16px;
|
width: 20px;
|
||||||
border-radius: 5px;
|
height: 20px;
|
||||||
border: 1.5px solid rgba(255, 255, 255, 0.15);
|
border-radius: 50%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-shrink: 0;
|
|
||||||
transition: border-color var(--transition-fast), background var(--transition-fast);
|
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform var(--transition-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-item.active .cal-check {
|
.cal-dot-btn:hover {
|
||||||
border-color: transparent;
|
transform: scale(1.25);
|
||||||
background: rgba(255, 255, 255, 0.08);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-dot-inner {
|
.cal-dot {
|
||||||
width: 8px;
|
width: 10px;
|
||||||
height: 8px;
|
height: 10px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
transition: opacity var(--transition-fast), box-shadow var(--transition-fast);
|
transition: opacity var(--transition-fast);
|
||||||
opacity: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-item.active .cal-dot-inner {
|
.cal-dot.dimmed {
|
||||||
opacity: 1;
|
opacity: 0.28;
|
||||||
box-shadow: 0 0 5px currentColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-name {
|
.cal-name {
|
||||||
|
|
@ -518,17 +548,6 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-count-badge {
|
|
||||||
font-size: 11px;
|
|
||||||
font-weight: 600;
|
|
||||||
padding: 1px 7px;
|
|
||||||
border-radius: var(--radius-full);
|
|
||||||
background: rgba(168, 230, 0, 0.12);
|
|
||||||
border: 1px solid rgba(168, 230, 0, 0.25);
|
|
||||||
color: var(--accent);
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-btn {
|
.icon-btn {
|
||||||
width: 28px;
|
width: 28px;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
|
|
@ -654,4 +673,57 @@ function handleEventClick(ev: CalendarEvent): void {
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.40),
|
inset 0 1px 0 rgba(255, 255, 255, 0.40),
|
||||||
0 2px 20px color-mix(in srgb, var(--accent) 45%, transparent);
|
0 2px 20px color-mix(in srgb, var(--accent) 45%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Color picker popover ─────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.picker-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-popover {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 201;
|
||||||
|
display: flex;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background:
|
||||||
|
linear-gradient(145deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.04) 100%),
|
||||||
|
rgba(18, 17, 30, 0.92);
|
||||||
|
backdrop-filter: blur(32px) saturate(2);
|
||||||
|
-webkit-backdrop-filter: blur(32px) saturate(2);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.13);
|
||||||
|
border-top-color: rgba(255, 255, 255, 0.22);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255,255,255,0.18),
|
||||||
|
0 8px 24px rgba(0,0,0,0.40),
|
||||||
|
0 2px 8px rgba(0,0,0,0.30);
|
||||||
|
animation: picker-in 150ms cubic-bezier(0.34, 1.4, 0.64, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes picker-in {
|
||||||
|
from { opacity: 0; transform: scale(0.88) translateY(-4px); }
|
||||||
|
to { opacity: 1; transform: scale(1) translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-swatch {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 120ms, border-color 120ms;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-swatch:hover {
|
||||||
|
transform: scale(1.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-swatch.selected {
|
||||||
|
border-color: rgba(255, 255, 255, 0.70);
|
||||||
|
transform: scale(1.12);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,15 @@ export interface CalendarInfo {
|
||||||
accountId: string
|
accountId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type AttendeeStatus = 'accepted' | 'declined' | 'tentative' | 'unknown'
|
||||||
|
|
||||||
|
export interface AttendeeInfo {
|
||||||
|
name: string
|
||||||
|
email: string
|
||||||
|
required: boolean
|
||||||
|
status: AttendeeStatus
|
||||||
|
}
|
||||||
|
|
||||||
export interface CalendarEvent {
|
export interface CalendarEvent {
|
||||||
id: string
|
id: string
|
||||||
uid: string
|
uid: string
|
||||||
|
|
@ -17,6 +26,6 @@ export interface CalendarEvent {
|
||||||
location?: string
|
location?: string
|
||||||
description?: string
|
description?: string
|
||||||
organizer?: string
|
organizer?: string
|
||||||
attendees: string[]
|
attendees: AttendeeInfo[]
|
||||||
status?: 'tentative' | 'confirmed' | 'cancelled'
|
status?: 'tentative' | 'confirmed' | 'cancelled'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ export interface IpcChannelMap {
|
||||||
|
|
||||||
'app:setZoom': [{ factor: number }, void]
|
'app:setZoom': [{ factor: number }, void]
|
||||||
'app:isEncryptionAvailable': [void, boolean]
|
'app:isEncryptionAvailable': [void, boolean]
|
||||||
|
'app:copyToClipboard': [{ text: string }, void]
|
||||||
|
|
||||||
'calendar:list': [{ accountId: string }, CalendarInfo[]]
|
'calendar:list': [{ accountId: string }, CalendarInfo[]]
|
||||||
'calendar:events': [
|
'calendar:events': [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue