Merge branch 'feature/calendar-redesign'

- Редизайн календаря: liquid glass UI/UX, MiniCalendar навигатор,
  WeekView улучшения (today glow, пульсирующий now-dot, half-hour lines),
  EventBlock liquid glass, EventDetailPopup анимация и accent-полоска
- Fix: выравнивание WeekView — scrollbar-gutter: stable + overflow-y: auto
- Убрать CalDAV из UI (диалоги аккаунта, CalendarView probe)
- Редизайн AddAccountDialog: автодетект хоста по email, IMAP+SMTP секции,
  toggle-switch для SSL, testing checklist, success-экран
- Редизайн EditAccountDialog: идентичная структура, умный тест пароля
This commit is contained in:
vodyanoysh 2026-04-16 21:57:33 +07:00
commit 6cba3ee78c
9 changed files with 2160 additions and 1160 deletions

View file

@ -25,6 +25,10 @@ export type IconName =
| 'image' | 'image'
| 'bell-off' | 'bell-off'
| 'calendar' | 'calendar'
| 'warning'
| 'location'
| 'person'
| 'people'
const props = defineProps<{ const props = defineProps<{
name: IconName name: IconName
@ -148,6 +152,25 @@ const paths: Record<IconName, string> = {
<line x1="8" y1="2" x2="8" y2="6"/> <line x1="8" y1="2" x2="8" y2="6"/>
<line x1="3" y1="10" x2="21" y2="10"/> <line x1="3" y1="10" x2="21" y2="10"/>
`, `,
warning: `
<path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>
<line x1="12" y1="9" x2="12" y2="13"/>
<line x1="12" y1="17" x2="12.01" y2="17" stroke-width="2.5"/>
`,
location: `
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/>
<circle cx="12" cy="10" r="3"/>
`,
person: `
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/>
<circle cx="12" cy="7" r="4"/>
`,
people: `
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
<circle cx="9" cy="7" r="4"/>
<path d="M23 21v-2a4 4 0 0 0-3-3.87"/>
<path d="M16 3.13a4 4 0 0 1 0 7.75"/>
`,
} }
</script> </script>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -12,12 +12,20 @@ const props = defineProps<{
const emit = defineEmits<{ click: [event: CalendarEvent] }>() const emit = defineEmits<{ click: [event: CalendarEvent] }>()
const timeLabel = computed(() => { const timeLabel = computed(() => {
if (props.event.isAllDay) return 'All day' if (props.event.isAllDay) return 'Весь день'
const start = new Date(props.event.start) const start = new Date(props.event.start)
const end = new Date(props.event.end) const end = new Date(props.event.end)
return `${format(start, 'HH:mm')} – ${format(end, 'HH:mm')}` return `${format(start, 'HH:mm')} – ${format(end, 'HH:mm')}`
}) })
const durationMinutes = computed(() => {
const start = new Date(props.event.start)
const end = new Date(props.event.end)
return (end.getTime() - start.getTime()) / 60_000
})
const isShort = computed(() => durationMinutes.value < 45)
const statusClass = computed(() => { const statusClass = computed(() => {
if (props.event.status === 'cancelled') return 'cancelled' if (props.event.status === 'cancelled') return 'cancelled'
if (props.event.status === 'tentative') return 'tentative' if (props.event.status === 'tentative') return 'tentative'
@ -28,65 +36,168 @@ const statusClass = computed(() => {
<template> <template>
<div <div
class="event-block" class="event-block"
:class="statusClass" :class="[statusClass, { 'event-short': isShort }]"
:style="{ ...(style ?? {}), '--event-color': color ?? 'var(--accent)' }" :style="{ ...(style ?? {}), '--ev-color': color ?? 'var(--accent)' }"
@click.stop="emit('click', event)" @click.stop="emit('click', event)"
> >
<div class="event-title">{{ event.title }}</div> <!-- Specular highlight bar -->
<div class="event-time">{{ timeLabel }}</div> <div class="ev-specular" />
<div v-if="event.location" class="event-location">{{ event.location }}</div>
<div class="ev-content">
<div class="ev-title">{{ event.title }}</div>
<div v-if="!isShort" class="ev-time">{{ timeLabel }}</div>
<div v-if="!isShort && event.location" class="ev-location">
<span class="ev-loc-dot">·</span>{{ event.location }}
</div>
</div>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.event-block { .event-block {
position: absolute; position: absolute;
left: 2px; border-radius: 8px;
right: 2px;
border-radius: 6px;
padding: 3px 6px;
font-size: 11px;
line-height: 1.3;
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
background: color-mix(in srgb, var(--event-color) 22%, transparent);
border-left: 3px solid var(--event-color);
color: var(--text-primary);
transition: filter var(--transition-fast), transform var(--transition-fast);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
z-index: 2; z-index: 2;
/* Liquid glass base */
background:
linear-gradient(
135deg,
color-mix(in srgb, var(--ev-color) 28%, rgba(255,255,255,0.06)) 0%,
color-mix(in srgb, var(--ev-color) 14%, transparent) 100%
);
border: 1px solid color-mix(in srgb, var(--ev-color) 45%, transparent);
border-top-color: color-mix(in srgb, var(--ev-color) 55%, rgba(255,255,255,0.4));
backdrop-filter: blur(12px) saturate(1.6);
-webkit-backdrop-filter: blur(12px) saturate(1.6);
box-shadow:
inset 0 1px 0 color-mix(in srgb, var(--ev-color) 20%, rgba(255,255,255,0.18)),
0 2px 8px rgba(0, 0, 0, 0.30),
0 0 0 0 color-mix(in srgb, var(--ev-color) 0%, transparent);
transition:
transform 100ms ease,
box-shadow 100ms ease,
filter 100ms ease;
}
.event-block::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 3px;
background: var(--ev-color);
box-shadow: 1px 0 8px color-mix(in srgb, var(--ev-color) 60%, transparent);
border-radius: 8px 0 0 8px;
} }
.event-block:hover { .event-block:hover {
filter: brightness(1.15); transform: scaleX(1.008) scaleY(1.005);
transform: scale(1.01);
z-index: 3; z-index: 3;
box-shadow:
inset 0 1px 0 color-mix(in srgb, var(--ev-color) 25%, rgba(255,255,255,0.22)),
0 4px 16px rgba(0, 0, 0, 0.40),
0 0 20px color-mix(in srgb, var(--ev-color) 22%, transparent);
filter: brightness(1.12);
} }
.event-block.cancelled { .event-block.cancelled {
opacity: 0.45; opacity: 0.38;
text-decoration: line-through; text-decoration: line-through;
filter: grayscale(0.4);
} }
.event-block.tentative { .event-block.tentative {
border-left-style: dashed; opacity: 0.68;
opacity: 0.75;
} }
.event-title { .event-block.tentative::before {
background: repeating-linear-gradient(
180deg,
var(--ev-color) 0px,
var(--ev-color) 4px,
transparent 4px,
transparent 8px
);
}
/* Specular top highlight */
.ev-specular {
position: absolute;
top: 0;
left: 4px;
right: 4px;
height: 1px;
background: linear-gradient(
90deg,
transparent,
color-mix(in srgb, var(--ev-color) 30%, rgba(255,255,255,0.50)) 30%,
color-mix(in srgb, var(--ev-color) 30%, rgba(255,255,255,0.50)) 70%,
transparent
);
pointer-events: none;
}
.ev-content {
padding: 4px 7px 4px 11px;
display: flex;
flex-direction: column;
gap: 1px;
height: 100%;
}
.event-short .ev-content {
padding-top: 3px;
padding-bottom: 3px;
justify-content: center;
}
.ev-title {
font-size: 11.5px;
font-weight: 600; font-weight: 600;
color: var(--text-primary);
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
line-height: 1.3;
letter-spacing: -0.1px;
} }
.event-time, .event-short .ev-title {
.event-location { font-size: 11px;
}
.ev-time {
font-size: 10px; font-size: 10px;
color: var(--text-secondary); font-weight: 500;
color: color-mix(in srgb, var(--ev-color) 75%, rgba(255,255,255,0.6));
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
line-height: 1.3;
}
.ev-location {
font-size: 10px;
color: rgba(255, 255, 255, 0.42);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.3;
display: flex;
align-items: center;
gap: 3px;
}
.ev-loc-dot {
font-size: 12px;
line-height: 1;
color: var(--ev-color);
opacity: 0.7;
} }
</style> </style>

View file

@ -7,6 +7,7 @@ import AppIcon from '../AppIcon.vue'
const props = defineProps<{ const props = defineProps<{
event: CalendarEvent event: CalendarEvent
color?: string
}>() }>()
const emit = defineEmits<{ close: [] }>() const emit = defineEmits<{ close: [] }>()
@ -18,62 +19,115 @@ const dateLabel = computed(() => {
if (props.event.isAllDay) { if (props.event.isAllDay) {
const isSameDay = start.toDateString() === end.toDateString() const isSameDay = start.toDateString() === end.toDateString()
if (isSameDay) return format(start, 'd MMMM yyyy', { locale: ru }) if (isSameDay) return format(start, 'd MMMM yyyy', { locale: ru })
const endAdjusted = new Date(end.getTime() - 1) // all-day end is exclusive const endAdjusted = new Date(end.getTime() - 1)
return `${format(start, 'd MMMM', { locale: ru })} – ${format(endAdjusted, 'd MMMM yyyy', { locale: ru })}` return `${format(start, 'd MMMM', { locale: ru })} – ${format(endAdjusted, 'd MMMM yyyy', { locale: ru })}`
} }
const sameDay = start.toDateString() === end.toDateString() const sameDay = start.toDateString() === end.toDateString()
if (sameDay) { if (sameDay) {
return `${format(start, 'd MMMM yyyy, HH:mm', { locale: ru })} – ${format(end, 'HH:mm')}` 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(start, 'd MMMM HH:mm', { locale: ru })} – ${format(end, 'd MMMM HH:mm yyyy', { locale: ru })}`
}) })
const statusLabel: Record<string, string> = { const durationLabel = computed(() => {
confirmed: 'Подтверждено', if (props.event.isAllDay) return 'Весь день'
tentative: 'Предварительно', const start = new Date(props.event.start)
cancelled: 'Отменено' const end = new Date(props.event.end)
const mins = Math.round((end.getTime() - start.getTime()) / 60_000)
if (mins < 60) return `${mins} мин`
const h = Math.floor(mins / 60)
const m = mins % 60
return m > 0 ? `${h} ч ${m} мин` : `${h} ч`
})
const statusConfig = {
confirmed: { label: 'Подтверждено', color: '#4ade80' },
tentative: { label: 'Предварительно', color: '#f0a500' },
cancelled: { label: 'Отменено', color: '#ff5555' }
} }
// CAL_COLORS palette (same as WeekView)
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
function calendarColor(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]
}
const evColor = computed(() => props.color ?? calendarColor(props.event.calendarId))
</script> </script>
<template> <template>
<div class="popup-backdrop" @click.self="emit('close')"> <div class="popup-backdrop" @click.self="emit('close')">
<div class="popup"> <div class="popup" :style="{ '--ev-color': evColor }">
<!-- Color accent strip -->
<div class="popup-accent" />
<!-- Header -->
<div class="popup-header"> <div class="popup-header">
<h3 class="popup-title">{{ event.title }}</h3> <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="14" /> <AppIcon name="close" :size="12" />
</button> </button>
</div> </div>
<!-- Metadata rows -->
<div class="popup-body"> <div class="popup-body">
<!-- Date & duration -->
<div class="meta-row"> <div class="meta-row">
<span class="meta-icon">📅</span> <div class="meta-icon-wrap">
<span>{{ dateLabel }}</span> <AppIcon name="calendar" :size="13" />
</div>
<div class="meta-text">
<span class="meta-primary">{{ dateLabel }}</span>
<span class="meta-secondary">{{ durationLabel }}</span>
</div>
</div> </div>
<div v-if="event.status && event.status !== 'confirmed'" class="meta-row status" :class="event.status"> <!-- Status (non-confirmed only) -->
<span class="meta-icon">●</span> <div
<span>{{ statusLabel[event.status] ?? event.status }}</span> v-if="event.status && event.status !== 'confirmed'"
class="meta-row status-row"
:style="{ '--status-color': statusConfig[event.status]?.color ?? '#888' }"
>
<div class="meta-icon-wrap status-icon">
<span class="status-dot" />
</div>
<span class="meta-primary">{{ statusConfig[event.status]?.label ?? event.status }}</span>
</div> </div>
<!-- Location -->
<div v-if="event.location" class="meta-row"> <div v-if="event.location" class="meta-row">
<span class="meta-icon">📍</span> <div class="meta-icon-wrap">
<span>{{ event.location }}</span> <AppIcon name="location" :size="13" />
</div>
<span class="meta-primary">{{ event.location }}</span>
</div> </div>
<!-- Organizer -->
<div v-if="event.organizer" class="meta-row"> <div v-if="event.organizer" class="meta-row">
<span class="meta-icon">👤</span> <div class="meta-icon-wrap">
<span>{{ event.organizer }}</span> <AppIcon name="person" :size="13" />
</div>
<span class="meta-primary">{{ event.organizer }}</span>
</div> </div>
<div v-if="event.attendees.length > 0" class="meta-row attendees"> <!-- Attendees -->
<span class="meta-icon">👥</span> <div v-if="event.attendees.length > 0" class="meta-row attendees-row">
<div class="meta-icon-wrap">
<AppIcon name="people" :size="13" />
</div>
<div class="attendee-list"> <div class="attendee-list">
<span v-for="a in event.attendees" :key="a" class="attendee-chip">{{ a }}</span> <span v-for="a in event.attendees" :key="a" class="attendee-chip">{{ a }}</span>
</div> </div>
</div> </div>
<!-- Description -->
<div v-if="event.description" class="description"> <div v-if="event.description" class="description">
{{ event.description }} {{ event.description }}
</div> </div>
@ -90,86 +144,193 @@ const statusLabel: Record<string, string> = {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: rgba(0, 0, 0, 0.45); background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(4px); backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
animation: backdrop-in 180ms ease;
}
@keyframes backdrop-in {
from { opacity: 0; }
to { opacity: 1; }
} }
.popup { .popup {
width: 400px; width: 420px;
max-width: 90vw; max-width: 92vw;
max-height: 80vh; max-height: 82vh;
overflow-y: auto; overflow-y: auto;
border-radius: var(--radius-xl); border-radius: 20px;
border: 1px solid var(--glass-border-strong); border: 1px solid rgba(255, 255, 255, 0.11);
border-top-color: rgba(255, 255, 255, 0.18);
background: background:
linear-gradient(160deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.03) 100%), linear-gradient(160deg, rgba(255, 255, 255, 0.095) 0%, rgba(255, 255, 255, 0.030) 50%, transparent 100%),
rgba(14, 14, 22, 0.94); rgba(14, 14, 24, 0.95);
backdrop-filter: blur(48px) saturate(2); backdrop-filter: blur(56px) saturate(2.2);
-webkit-backdrop-filter: blur(56px) saturate(2.2);
box-shadow: box-shadow:
inset 0 1px 0 rgba(255,255,255,0.14), inset 0 1px 0 rgba(255, 255, 255, 0.17),
var(--shadow-xl); 0 4px 24px rgba(0, 0, 0, 0.45),
padding: 20px; 0 24px 80px rgba(0, 0, 0, 0.70),
0 0 0 1px rgba(0, 0, 0, 0.3);
position: relative;
overflow: hidden;
animation: popup-in 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
} }
@keyframes popup-in {
from { opacity: 0; transform: scale(0.93) translateY(8px); }
to { opacity: 1; transform: scale(1) translateY(0); }
}
/* 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%
);
box-shadow: 0 0 20px color-mix(in srgb, var(--ev-color) 50%, transparent);
}
/* Header */
.popup-header { .popup-header {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
gap: 8px; gap: 10px;
margin-bottom: 16px; 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 { .popup-title {
flex: 1; font-size: 17px;
font-size: 16px;
font-weight: 600; font-weight: 600;
line-height: 1.3; line-height: 1.3;
color: var(--text-primary); color: var(--text-primary);
margin: 0; margin: 0;
letter-spacing: -0.3px;
} }
.close-btn { .close-btn {
flex-shrink: 0; flex-shrink: 0;
width: 24px; width: 26px;
height: 24px; height: 26px;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: var(--text-muted); color: var(--text-muted);
background: var(--glass-bg); background: rgba(255, 255, 255, 0.06);
border: 1px solid var(--glass-border); border: 1px solid rgba(255, 255, 255, 0.09);
transition: background var(--transition-fast), color var(--transition-fast); transition: background var(--transition-fast), color var(--transition-fast);
margin-top: 1px;
} }
.close-btn:hover { .close-btn:hover {
background: var(--glass-bg-hover); background: rgba(255, 255, 255, 0.11);
color: var(--text-secondary); color: var(--text-secondary);
} }
/* Body */
.popup-body { .popup-body {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 2px;
padding: 0 20px 20px;
} }
.meta-row { .meta-row {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
gap: 8px; gap: 10px;
font-size: 13px; padding: 7px 10px;
color: var(--text-secondary); border-radius: 10px;
transition: background var(--transition-fast);
} }
.meta-icon { .meta-row:hover {
background: rgba(255, 255, 255, 0.04);
}
.meta-icon-wrap {
width: 28px;
height: 28px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.08);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0; flex-shrink: 0;
font-size: 14px; color: var(--text-muted);
}
.meta-text {
display: flex;
flex-direction: column;
gap: 2px;
justify-content: center;
min-height: 28px;
}
.meta-primary {
font-size: 13px;
color: var(--text-primary);
line-height: 1.4; line-height: 1.4;
} }
.meta-row.tentative { color: var(--warning); } .meta-secondary {
.meta-row.cancelled { color: var(--danger); } font-size: 11px;
color: var(--text-muted);
line-height: 1.3;
}
.attendees { /* Status */
.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 {
width: 8px;
height: 8px;
border-radius: 50%;
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; align-items: flex-start;
} }
@ -177,24 +338,46 @@ const statusLabel: Record<string, string> = {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 4px; gap: 4px;
padding-top: 2px;
} }
.attendee-chip { .attendee-chip {
font-size: 11px; font-size: 11px;
padding: 2px 8px; padding: 3px 9px;
border-radius: var(--radius-full); border-radius: var(--radius-full);
background: var(--glass-bg-raised); background: rgba(255, 255, 255, 0.06);
border: 1px solid var(--glass-border); border: 1px solid rgba(255, 255, 255, 0.09);
color: var(--text-secondary); color: var(--text-secondary);
font-weight: 500;
} }
/* Description */
.description { .description {
font-size: 13px; font-size: 13px;
color: var(--text-secondary); color: var(--text-secondary);
white-space: pre-wrap; white-space: pre-wrap;
line-height: 1.5; line-height: 1.6;
border-top: 1px solid var(--glass-border); padding: 12px 10px;
padding-top: 10px;
margin-top: 4px; 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>

View file

@ -0,0 +1,221 @@
<script setup lang="ts">
import { ref, computed } from 'vue'
import {
startOfMonth,
endOfMonth,
startOfWeek,
endOfWeek,
addDays,
addMonths,
subMonths,
isSameMonth,
isSameDay,
isToday,
isWithinInterval
} from 'date-fns'
import { ru } from 'date-fns/locale'
import { format } from 'date-fns'
import AppIcon from '../AppIcon.vue'
const props = defineProps<{
selectedWeekStart: Date
selectedWeekEnd: Date
}>()
const emit = defineEmits<{ dayClick: [date: Date] }>()
const viewMonth = ref(startOfMonth(props.selectedWeekStart))
const monthLabel = computed(() => format(viewMonth.value, 'LLLL yyyy', { locale: ru }))
const DOW_LABELS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс']
/** Build 6-week grid starting from Monday */
const grid = computed((): Date[] => {
const monthStart = startOfMonth(viewMonth.value)
const gridStart = startOfWeek(monthStart, { weekStartsOn: 1 })
const monthEnd = endOfMonth(viewMonth.value)
const gridEnd = endOfWeek(monthEnd, { weekStartsOn: 1 })
const days: Date[] = []
let cur = gridStart
while (cur <= gridEnd) {
days.push(cur)
cur = addDays(cur, 1)
}
return days
})
function isSelected(d: Date): boolean {
return isWithinInterval(d, { start: props.selectedWeekStart, end: props.selectedWeekEnd })
}
function isWeekStart(d: Date): boolean {
return isSameDay(d, props.selectedWeekStart)
}
function isWeekEnd(d: Date): boolean {
return isSameDay(d, props.selectedWeekEnd)
}
function prevMonth(): void {
viewMonth.value = subMonths(viewMonth.value, 1)
}
function nextMonth(): void {
viewMonth.value = addMonths(viewMonth.value, 1)
}
</script>
<template>
<div class="mini-cal">
<div class="mini-header">
<button class="mini-nav" @click="prevMonth">
<AppIcon name="chevron-right" :size="11" style="transform: rotate(180deg)" />
</button>
<span class="mini-month">{{ monthLabel }}</span>
<button class="mini-nav" @click="nextMonth">
<AppIcon name="chevron-right" :size="11" />
</button>
</div>
<div class="dow-row">
<span v-for="d in DOW_LABELS" :key="d" class="dow">{{ d }}</span>
</div>
<div class="day-grid">
<button
v-for="(day, i) in grid"
:key="i"
class="day-cell"
:class="{
'other-month': !isSameMonth(day, viewMonth),
'is-today': isToday(day),
'in-range': isSelected(day),
'range-start': isWeekStart(day),
'range-end': isWeekEnd(day)
}"
@click="emit('dayClick', day)"
>
{{ format(day, 'd') }}
</button>
</div>
</div>
</template>
<style scoped>
.mini-cal {
padding: 10px 10px 8px;
}
.mini-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.mini-month {
font-size: 11px;
font-weight: 600;
color: var(--text-secondary);
text-transform: capitalize;
letter-spacing: 0.2px;
}
.mini-nav {
width: 20px;
height: 20px;
border-radius: var(--radius-sm);
display: flex;
align-items: center;
justify-content: center;
color: var(--text-muted);
background: transparent;
border: 1px solid transparent;
transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.mini-nav:hover {
background: var(--glass-bg-raised);
border-color: var(--glass-border);
color: var(--text-secondary);
}
.dow-row {
display: grid;
grid-template-columns: repeat(7, 1fr);
margin-bottom: 3px;
}
.dow {
font-size: 9px;
font-weight: 600;
text-align: center;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.3px;
padding: 2px 0;
}
.day-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 1px;
}
.day-cell {
aspect-ratio: 1;
font-size: 11px;
font-weight: 400;
color: var(--text-secondary);
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
background: transparent;
border: none;
transition: background var(--transition-fast), color var(--transition-fast);
position: relative;
z-index: 0;
}
.day-cell:hover {
background: var(--glass-bg-hover);
color: var(--text-primary);
}
.day-cell.other-month {
color: var(--text-muted);
opacity: 0.5;
}
.day-cell.is-today {
color: var(--accent);
font-weight: 700;
}
.day-cell.in-range {
background: rgba(168, 230, 0, 0.10);
color: var(--text-primary);
border-radius: 0;
}
.day-cell.range-start {
border-radius: 4px 0 0 4px;
background: rgba(168, 230, 0, 0.22);
color: var(--accent);
font-weight: 600;
}
.day-cell.range-end {
border-radius: 0 4px 4px 0;
background: rgba(168, 230, 0, 0.22);
color: var(--accent);
font-weight: 600;
}
.day-cell.range-start.range-end {
border-radius: 4px;
}
</style>

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted, watch } from 'vue' import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
import { format, addDays, isSameDay, isToday } from 'date-fns' import { format, addDays, isSameDay, isToday } from 'date-fns'
import { ru } from 'date-fns/locale' import { ru } from 'date-fns/locale'
import EventBlock from './EventBlock.vue' import EventBlock from './EventBlock.vue'
@ -14,7 +14,7 @@ const props = defineProps<{
const emit = defineEmits<{ eventClick: [event: CalendarEvent] }>() const emit = defineEmits<{ eventClick: [event: CalendarEvent] }>()
const scrollEl = ref<HTMLElement | null>(null) const scrollEl = ref<HTMLElement | null>(null)
const HOUR_HEIGHT = 56 // px per hour const HOUR_HEIGHT = 60 // px per hour
const HOURS = Array.from({ length: 24 }, (_, i) => i) const HOURS = Array.from({ length: 24 }, (_, i) => i)
// ── Days of the week ──────────────────────────────────────────────────────── // ── Days of the week ────────────────────────────────────────────────────────
@ -38,17 +38,14 @@ const now = ref(new Date())
let timerId: ReturnType<typeof setInterval> let timerId: ReturnType<typeof setInterval>
onMounted(() => { onMounted(() => {
timerId = setInterval(() => { now.value = new Date() }, 60_000) timerId = setInterval(() => { now.value = new Date() }, 30_000)
// Scroll to business hours (8:00) scrollEl.value?.scrollTo({ top: 8 * HOUR_HEIGHT - 30, behavior: 'smooth' })
scrollEl.value?.scrollTo({ top: 8 * HOUR_HEIGHT - 20, behavior: 'smooth' })
}) })
// Re-scroll when week changes
watch(() => props.weekStart, () => { watch(() => props.weekStart, () => {
scrollEl.value?.scrollTo({ top: 8 * HOUR_HEIGHT - 20, behavior: 'smooth' }) scrollEl.value?.scrollTo({ top: 8 * HOUR_HEIGHT - 30, behavior: 'smooth' })
}) })
import { onUnmounted } from 'vue'
onUnmounted(() => clearInterval(timerId)) onUnmounted(() => clearInterval(timerId))
const nowTop = computed(() => { const nowTop = computed(() => {
@ -72,18 +69,9 @@ interface LayoutEvent {
totalColumns: number totalColumns: number
} }
const allDayEvents = computed(() => { const allDayEvents = computed(() => props.events.filter((e) => e.isAllDay))
return props.events.filter((e) => e.isAllDay) const timedEvents = computed(() => props.events.filter((e) => !e.isAllDay))
})
const timedEvents = computed(() => {
return props.events.filter((e) => !e.isAllDay)
})
/**
* Lay out timed events per day, detecting overlaps.
* Events in the same day that overlap in time are split into columns.
*/
const layoutEvents = computed((): LayoutEvent[] => { const layoutEvents = computed((): LayoutEvent[] => {
const result: LayoutEvent[] = [] const result: LayoutEvent[] = []
@ -97,7 +85,6 @@ const layoutEvents = computed((): LayoutEvent[] => {
(eStart < dayDate && eEnd > dayDate) (eStart < dayDate && eEnd > dayDate)
}) })
// Simple overlap detection: group overlapping events
const columns: CalendarEvent[][] = [] const columns: CalendarEvent[][] = []
for (const ev of dayEvs) { for (const ev of dayEvs) {
const eStart = new Date(ev.start).getTime() const eStart = new Date(ev.start).getTime()
@ -116,13 +103,11 @@ const layoutEvents = computed((): LayoutEvent[] => {
if (!placed) columns.push([ev]) if (!placed) columns.push([ev])
} }
// Build LayoutEvent for each event
for (let colIdx = 0; colIdx < columns.length; colIdx++) { for (let colIdx = 0; colIdx < columns.length; colIdx++) {
for (const ev of columns[colIdx]) { for (const ev of columns[colIdx]) {
const eStart = new Date(ev.start) const eStart = new Date(ev.start)
const eEnd = new Date(ev.end) const eEnd = new Date(ev.end)
// Clamp to day boundaries
const dayStart = new Date(dayDate) const dayStart = new Date(dayDate)
dayStart.setHours(0, 0, 0, 0) dayStart.setHours(0, 0, 0, 0)
const dayEnd = new Date(dayDate) const dayEnd = new Date(dayDate)
@ -134,7 +119,6 @@ const layoutEvents = computed((): LayoutEvent[] => {
const startHours = clampedStart.getHours() + clampedStart.getMinutes() / 60 const startHours = clampedStart.getHours() + clampedStart.getMinutes() / 60
const durationHours = (clampedEnd.getTime() - clampedStart.getTime()) / 3_600_000 const durationHours = (clampedEnd.getTime() - clampedStart.getTime()) / 3_600_000
// Find how many columns this event belongs to (for width calculation)
const totalCols = columns.filter((col) => { const totalCols = columns.filter((col) => {
const eS = new Date(ev.start).getTime() const eS = new Date(ev.start).getTime()
const eE = new Date(ev.end).getTime() const eE = new Date(ev.end).getTime()
@ -150,7 +134,7 @@ const layoutEvents = computed((): LayoutEvent[] => {
event: ev, event: ev,
dayIndex, dayIndex,
top: startHours * HOUR_HEIGHT, top: startHours * HOUR_HEIGHT,
height: Math.max(durationHours * HOUR_HEIGHT, 18), height: Math.max(durationHours * HOUR_HEIGHT, 22),
column: colIdx, column: colIdx,
totalColumns: totalCols totalColumns: totalCols
}) })
@ -161,7 +145,6 @@ const layoutEvents = computed((): LayoutEvent[] => {
return result return result
}) })
/** Events per day index for rendering into the correct column. */
function eventsForDay(dayIndex: number): LayoutEvent[] { function eventsForDay(dayIndex: number): LayoutEvent[] {
return layoutEvents.value.filter((e) => e.dayIndex === dayIndex) return layoutEvents.value.filter((e) => e.dayIndex === dayIndex)
} }
@ -176,7 +159,7 @@ function allDayEventsForDay(dayIndex: number): CalendarEvent[] {
} }
function formatHour(h: number): string { function formatHour(h: number): string {
return h === 0 ? '00:00' : `${String(h).padStart(2, '0')}:00` return h === 0 ? '' : `${String(h).padStart(2, '0')}:00`
} }
function eventStyle(layout: LayoutEvent): Record<string, string> { function eventStyle(layout: LayoutEvent): Record<string, string> {
@ -190,7 +173,6 @@ function eventStyle(layout: LayoutEvent): Record<string, string> {
} }
} }
// Accent color palette for calendars (cycle through)
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171'] const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
function calendarColor(calendarId: string): string { function calendarColor(calendarId: string): string {
let hash = 0 let hash = 0
@ -211,18 +193,20 @@ function calendarColor(calendarId: string): string {
:class="{ today: day.isToday }" :class="{ today: day.isToday }"
> >
<span class="day-name">{{ day.dayName }}</span> <span class="day-name">{{ day.dayName }}</span>
<span class="day-num">{{ day.dayNum }}</span> <div class="day-num-wrap" :class="{ today: day.isToday }">
<span class="day-num">{{ day.dayNum }}</span>
</div>
<span class="month-label">{{ day.monthLabel }}</span> <span class="month-label">{{ day.monthLabel }}</span>
</div> </div>
</div> </div>
<!-- All-day event row (shown only when there are all-day events) --> <!-- All-day event row -->
<div <div
v-if="events.some((e) => e.isAllDay)" v-if="events.some((e) => e.isAllDay)"
class="allday-row" class="allday-row"
> >
<div class="time-gutter allday-gutter"> <div class="time-gutter allday-gutter">
<span class="allday-label">весь день</span> <span class="allday-label">всё<br>время</span>
</div> </div>
<div v-for="(day, i) in days" :key="i" class="allday-col"> <div v-for="(day, i) in days" :key="i" class="allday-col">
<div <div
@ -260,12 +244,16 @@ function calendarColor(calendarId: string): string {
:class="{ today: day.isToday }" :class="{ today: day.isToday }"
> >
<!-- Hour grid lines --> <!-- Hour grid lines -->
<div <template v-for="h in HOURS" :key="h">
v-for="h in HOURS" <div
:key="h" class="hour-row"
class="hour-row" :style="{ top: `${h * HOUR_HEIGHT}px`, height: `${HOUR_HEIGHT}px` }"
:style="{ top: `${h * HOUR_HEIGHT}px`, height: `${HOUR_HEIGHT}px` }" />
/> <div
class="half-hour-row"
:style="{ top: `${h * HOUR_HEIGHT + HOUR_HEIGHT / 2}px` }"
/>
</template>
<!-- Current time indicator --> <!-- Current time indicator -->
<div <div
@ -290,7 +278,7 @@ function calendarColor(calendarId: string): string {
<!-- Loading overlay --> <!-- Loading overlay -->
<div v-if="loading" class="loading-overlay"> <div v-if="loading" class="loading-overlay">
<span class="spinner" /> <div class="loading-ring" />
</div> </div>
</div> </div>
</div> </div>
@ -308,12 +296,18 @@ function calendarColor(calendarId: string): string {
.day-headers { .day-headers {
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
border-bottom: 1px solid var(--glass-border); border-bottom: 1px solid rgba(255, 255, 255, 0.06);
background: rgba(10, 10, 18, 0.5); background: rgba(10, 10, 18, 0.35);
backdrop-filter: blur(8px);
/* 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;
scrollbar-gutter: stable;
} }
.time-gutter { .time-gutter {
width: 52px; width: 56px;
flex-shrink: 0; flex-shrink: 0;
} }
@ -322,55 +316,72 @@ function calendarColor(calendarId: string): string {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding: 8px 4px; padding: 10px 4px 8px;
font-size: 11px; border-left: 1px solid rgba(255, 255, 255, 0.05);
color: var(--text-muted); gap: 3px;
border-left: 1px solid var(--glass-border);
gap: 2px;
user-select: none; user-select: none;
transition: background var(--transition-fast);
} }
.day-header.today .day-num { .day-header.today {
width: 26px; background: rgba(168, 230, 0, 0.04);
height: 26px;
border-radius: 50%;
background: var(--accent);
color: var(--accent-text);
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
} }
.day-name { .day-name {
text-transform: uppercase;
letter-spacing: 0.5px;
font-size: 10px; font-size: 10px;
font-weight: 700;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.6px;
} }
.day-num { .day-header.today .day-name {
font-size: 18px; color: var(--accent);
font-weight: 300; }
color: var(--text-primary);
line-height: 1; .day-num-wrap {
width: 30px;
height: 30px;
border-radius: 50%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 26px; transition: background var(--transition-fast), box-shadow var(--transition-fast);
height: 26px; }
.day-num-wrap.today {
background: var(--accent);
box-shadow: 0 0 16px rgba(168, 230, 0, 0.45);
}
.day-num {
font-size: 17px;
font-weight: 300;
color: var(--text-primary);
line-height: 1;
}
.day-num-wrap.today .day-num {
color: var(--accent-text);
font-weight: 700;
font-size: 16px;
} }
.month-label { .month-label {
font-size: 10px; font-size: 9px;
color: var(--text-muted); color: var(--text-muted);
text-transform: capitalize;
} }
/* ── All-day row ── */ /* ── All-day row ── */
.allday-row { .allday-row {
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
border-bottom: 1px solid var(--glass-border); border-bottom: 1px solid rgba(255, 255, 255, 0.06);
min-height: 28px; min-height: 30px;
background: rgba(255, 255, 255, 0.01);
overflow-y: auto;
scrollbar-gutter: stable;
} }
.allday-gutter { .allday-gutter {
@ -381,16 +392,19 @@ function calendarColor(calendarId: string): string {
} }
.allday-label { .allday-label {
font-size: 9px; font-size: 8px;
font-weight: 600;
color: var(--text-muted); color: var(--text-muted);
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.4px; letter-spacing: 0.4px;
text-align: right;
line-height: 1.4;
} }
.allday-col { .allday-col {
flex: 1; flex: 1;
border-left: 1px solid var(--glass-border); border-left: 1px solid rgba(255, 255, 255, 0.05);
padding: 2px 3px; padding: 3px 4px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 2px; gap: 2px;
@ -398,20 +412,23 @@ function calendarColor(calendarId: string): string {
.allday-event { .allday-event {
font-size: 11px; font-size: 11px;
padding: 1px 6px; font-weight: 500;
border-radius: 4px; padding: 2px 7px;
background: color-mix(in srgb, var(--event-color) 22%, transparent); border-radius: 5px;
border-left: 3px solid var(--event-color); background: color-mix(in srgb, var(--event-color) 18%, transparent);
border: 1px solid color-mix(in srgb, var(--event-color) 35%, transparent);
color: var(--text-primary); color: var(--text-primary);
cursor: pointer; cursor: pointer;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
font-weight: 500; backdrop-filter: blur(8px);
transition: filter var(--transition-fast), background var(--transition-fast);
} }
.allday-event:hover { .allday-event:hover {
filter: brightness(1.15); filter: brightness(1.2);
background: color-mix(in srgb, var(--event-color) 28%, transparent);
} }
/* ── Scrollable grid ── */ /* ── Scrollable grid ── */
@ -420,6 +437,22 @@ function calendarColor(calendarId: string): string {
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
position: relative; position: relative;
scrollbar-width: thin;
scrollbar-color: rgba(255,255,255,0.1) transparent;
scrollbar-gutter: stable;
}
.grid-scroll::-webkit-scrollbar {
width: 4px;
}
.grid-scroll::-webkit-scrollbar-track {
background: transparent;
}
.grid-scroll::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
border-radius: 2px;
} }
.time-grid { .time-grid {
@ -429,44 +462,54 @@ function calendarColor(calendarId: string): string {
/* ── Time gutter column ── */ /* ── Time gutter column ── */
.time-gutter-col { .time-gutter-col {
width: 52px; width: 56px;
flex-shrink: 0; flex-shrink: 0;
position: relative; position: relative;
} }
.hour-label { .hour-label {
position: absolute; position: absolute;
right: 8px; right: 10px;
font-size: 10px; font-size: 10px;
font-weight: 500;
color: var(--text-muted); color: var(--text-muted);
transform: translateY(-50%); transform: translateY(-50%);
user-select: none; user-select: none;
white-space: nowrap; white-space: nowrap;
opacity: 0.7;
} }
/* ── Day column ── */ /* ── Day column ── */
.day-col { .day-col {
flex: 1; flex: 1;
position: relative; position: relative;
border-left: 1px solid var(--glass-border); border-left: 1px solid rgba(255, 255, 255, 0.05);
} }
.day-col.today { .day-col.today {
background: rgba(168, 230, 0, 0.022); background: linear-gradient(
180deg,
rgba(168, 230, 0, 0.025) 0%,
rgba(168, 230, 0, 0.012) 100%
);
} }
/* ── Hour rows (grid lines) ── */ /* ── Hour / half-hour grid lines ── */
.hour-row { .hour-row {
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
border-top: 1px solid rgba(255, 255, 255, 0.05); border-top: 1px solid rgba(255, 255, 255, 0.045);
pointer-events: none; pointer-events: none;
} }
.hour-row:nth-child(2n) { .half-hour-row {
border-top-color: transparent; position: absolute;
border-top: 1px dashed rgba(255, 255, 255, 0.03); left: 0;
right: 0;
height: 0;
border-top: 1px dashed rgba(255, 255, 255, 0.022);
pointer-events: none;
} }
/* ── Current time line ── */ /* ── Current time line ── */
@ -475,22 +518,35 @@ function calendarColor(calendarId: string): string {
left: 0; left: 0;
right: 0; right: 0;
height: 2px; height: 2px;
background: var(--accent);
opacity: 0.75;
pointer-events: none; pointer-events: none;
z-index: 4; z-index: 5;
background: linear-gradient(
90deg,
transparent 0%,
var(--accent) 8%,
var(--accent) 100%
);
box-shadow: 0 0 6px rgba(168, 230, 0, 0.5);
} }
.now-dot { .now-dot {
position: absolute; position: absolute;
left: -4px; left: -5px;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
width: 8px; width: 10px;
height: 8px; height: 10px;
border-radius: 50%; border-radius: 50%;
background: var(--accent); background: var(--accent);
box-shadow: 0 0 6px var(--accent); box-shadow:
0 0 0 2px rgba(168, 230, 0, 0.25),
0 0 10px rgba(168, 230, 0, 0.7);
animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
0%, 100% { box-shadow: 0 0 0 2px rgba(168, 230, 0, 0.25), 0 0 10px rgba(168, 230, 0, 0.7); }
50% { box-shadow: 0 0 0 4px rgba(168, 230, 0, 0.15), 0 0 18px rgba(168, 230, 0, 0.5); }
} }
/* ── Loading overlay ── */ /* ── Loading overlay ── */
@ -500,18 +556,19 @@ function calendarColor(calendarId: string): string {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: rgba(9, 9, 14, 0.45); background: rgba(9, 9, 14, 0.55);
backdrop-filter: blur(4px); backdrop-filter: blur(6px);
z-index: 10; z-index: 10;
} }
.spinner { .loading-ring {
width: 24px; width: 28px;
height: 24px; height: 28px;
border: 2px solid var(--glass-border);
border-top-color: var(--accent);
border-radius: 50%; border-radius: 50%;
animation: spin 0.8s linear infinite; border: 2px solid rgba(168, 230, 0, 0.15);
border-top-color: var(--accent);
animation: spin 0.75s linear infinite;
box-shadow: 0 0 12px rgba(168, 230, 0, 0.2);
} }
@keyframes spin { @keyframes spin {

View file

@ -113,6 +113,11 @@ export const useCalendarStore = defineStore('calendar', () => {
selectedEvent.value = event selectedEvent.value = event
} }
async function goToDate(date: Date): Promise<void> {
currentWeekStart.value = startOfWeek(date, { weekStartsOn: 1 })
await loadEvents()
}
return { return {
calendars, calendars,
events, events,
@ -130,6 +135,7 @@ export const useCalendarStore = defineStore('calendar', () => {
goToToday, goToToday,
prevWeek, prevWeek,
nextWeek, nextWeek,
selectEvent selectEvent,
goToDate
} }
}) })

View file

@ -6,6 +6,7 @@ import { useCalendarStore } from '../stores/calendar.store'
import { useAccountsStore } from '../stores/accounts.store' import { useAccountsStore } from '../stores/accounts.store'
import AccountSwitcher from '../components/sidebar/AccountSwitcher.vue' import AccountSwitcher from '../components/sidebar/AccountSwitcher.vue'
import WeekView from '../components/calendar/WeekView.vue' import WeekView from '../components/calendar/WeekView.vue'
import MiniCalendar from '../components/calendar/MiniCalendar.vue'
import EventDetailPopup from '../components/calendar/EventDetailPopup.vue' import EventDetailPopup from '../components/calendar/EventDetailPopup.vue'
import AddAccountDialog from '../components/accounts/AddAccountDialog.vue' import AddAccountDialog from '../components/accounts/AddAccountDialog.vue'
import NotificationContainer from '../components/notifications/NotificationContainer.vue' import NotificationContainer from '../components/notifications/NotificationContainer.vue'
@ -16,24 +17,7 @@ const calStore = useCalendarStore()
const accountsStore = useAccountsStore() const accountsStore = useAccountsStore()
const showAddAccount = ref(false) const showAddAccount = ref(false)
// CalDAV path probe // Calendar color palette
const probeResults = ref<{ path: string; status: number; note: string }[] | null>(null)
const probing = ref(false)
async function probeCalDAV(): Promise<void> {
if (!accountsStore.activeAccountId) return
probing.value = true
probeResults.value = null
try {
probeResults.value = await window.api.invoke('calendar:probe', { accountId: accountsStore.activeAccountId })
} catch (e) {
probeResults.value = [{ path: '(error)', status: 0, note: (e as Error).message }]
} finally {
probing.value = false
}
}
// Calendar color palette, same as WeekView
const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171'] const CAL_COLORS = ['#a8e600', '#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171']
function calendarColor(calendarId: string): string { function calendarColor(calendarId: string): string {
let hash = 0 let hash = 0
@ -65,87 +49,99 @@ function handleEventClick(ev: CalendarEvent): void {
<template> <template>
<div class="calendar-shell"> <div class="calendar-shell">
<div class="content-area"> <div class="content-area">
<!-- Account switcher (same as mail view) --> <!-- Account switcher -->
<div class="account-bar"> <div class="account-bar">
<AccountSwitcher @add-account="showAddAccount = true" /> <AccountSwitcher @add-account="showAddAccount = true" />
</div> </div>
<!-- Calendar sidebar --> <!-- Calendar sidebar -->
<div class="cal-sidebar"> <div class="cal-sidebar">
<div class="sidebar-header">
<AppIcon name="calendar" :size="15" class="cal-icon" />
<span>Календарь</span>
</div>
<!-- Error state --> <!-- Error state -->
<div v-if="calStore.error" class="sidebar-error"> <div v-if="calStore.error" class="sidebar-error">
<p class="error-title">CalDAV недоступен</p> <div class="error-icon-wrap">
<AppIcon name="warning" :size="20" class="error-icon" />
</div>
<p class="error-title">Календарь недоступен</p>
<p class="error-detail">{{ calStore.error }}</p> <p class="error-detail">{{ calStore.error }}</p>
<div class="error-actions">
<button class="retry-btn" @click="reload">
<AppIcon name="refresh" :size="12" />
Повторить
</button>
</div>
</div>
<button class="retry-btn" @click="reload">Повторить</button> <template v-else>
<button class="retry-btn probe-btn" :disabled="probing" @click="probeCalDAV"> <!-- Mini calendar navigator -->
{{ probing ? 'Сканирование…' : 'Найти CalDAV путь' }} <MiniCalendar
</button> :selected-week-start="calStore.currentWeekStart"
:selected-week-end="calStore.currentWeekEnd"
@day-click="calStore.goToDate($event)"
/>
<!-- Probe results --> <div class="sidebar-divider" />
<div v-if="probeResults" class="probe-results">
<p class="probe-title">Результаты сканирования:</p> <!-- Calendar list header -->
<div class="cal-list-header">
<AppIcon name="calendar" :size="12" class="cal-list-icon" />
<span>Мои календари</span>
</div>
<!-- Loading state -->
<div v-if="calStore.loadingCalendars" class="sidebar-loading">
<span class="spinner" />
</div>
<!-- Calendar list -->
<div v-else class="calendar-list">
<div <div
v-for="r in probeResults" v-for="cal in calStore.calendars"
:key="r.path" :key="cal.id"
class="probe-row" class="cal-item"
:class="{ 'probe-ok': r.status === 207 || r.status === 200 }" :class="{ active: calStore.selectedCalendarIds.has(cal.id) }"
@click="calStore.toggleCalendar(cal.id)"
> >
<span class="probe-path">{{ r.path }}</span> <div class="cal-check" :class="{ checked: calStore.selectedCalendarIds.has(cal.id) }">
<span class="probe-note">{{ r.note }}</span> <span
class="cal-dot-inner"
:style="{ background: calendarColor(cal.id) }"
/>
</div>
<span class="cal-name" :title="cal.name">{{ cal.name }}</span>
</div> </div>
<p class="probe-hint">Скопируйте путь со статусом 207 в настройки CalDAV → «Путь».</p>
</div>
</div>
<!-- Calendar list --> <div v-if="calStore.calendars.length === 0" class="no-calendars">
<div v-else-if="!calStore.loadingCalendars" class="calendar-list"> Нет доступных<br>календарей
<div </div>
v-for="cal in calStore.calendars"
:key="cal.id"
class="cal-item"
:class="{ active: calStore.selectedCalendarIds.has(cal.id) }"
@click="calStore.toggleCalendar(cal.id)"
>
<span
class="cal-dot"
:style="{ background: calendarColor(cal.id) }"
/>
<span class="cal-name" :title="cal.name">{{ cal.name }}</span>
</div> </div>
</template>
<div v-if="calStore.calendars.length === 0 && !calStore.loadingCalendars && !calStore.error" class="no-calendars">
Нет доступных календарей
</div>
</div>
<div v-else class="sidebar-loading">
<span class="spinner" />
</div>
</div> </div>
<!-- Main calendar area --> <!-- Main calendar area -->
<div class="calendar-main"> <div class="calendar-main">
<!-- Toolbar --> <!-- Toolbar -->
<div class="toolbar"> <div class="toolbar">
<button class="nav-btn" @click="calStore.prevWeek()"> <div class="toolbar-nav">
<AppIcon name="chevron-right" :size="14" style="transform: rotate(180deg)" /> <button class="nav-btn" @click="calStore.prevWeek()">
</button> <AppIcon name="chevron-right" :size="13" style="transform: rotate(180deg)" />
<button class="nav-btn today-btn" @click="calStore.goToToday()">Сегодня</button> </button>
<button class="nav-btn" @click="calStore.nextWeek()"> <button class="nav-btn" @click="calStore.nextWeek()">
<AppIcon name="chevron-right" :size="14" /> <AppIcon name="chevron-right" :size="13" />
</button> </button>
</div>
<span class="week-label">{{ weekLabel() }}</span> <button class="today-btn" @click="calStore.goToToday()">Сегодня</button>
<button class="nav-btn refresh-btn" :disabled="calStore.loading" @click="calStore.loadEvents()"> <h2 class="week-label">{{ weekLabel() }}</h2>
<AppIcon name="refresh" :size="14" :class="{ spinning: calStore.loading }" />
</button> <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="Обновить">
<AppIcon name="refresh" :size="14" :class="{ spinning: calStore.loading }" />
</button>
</div>
</div> </div>
<!-- Week view --> <!-- Week view -->
@ -181,7 +177,7 @@ function handleEventClick(ev: CalendarEvent): void {
> >
<div class="empty-content"> <div class="empty-content">
<div class="empty-icon"> <div class="empty-icon">
<AppIcon name="calendar" :size="64" /> <AppIcon name="calendar" :size="56" />
</div> </div>
<h2>Добро пожаловать в Aero Mail</h2> <h2>Добро пожаловать в Aero Mail</h2>
<p>Добавьте почтовый аккаунт для просмотра календаря</p> <p>Добавьте почтовый аккаунт для просмотра календаря</p>
@ -197,7 +193,7 @@ function handleEventClick(ev: CalendarEvent): void {
flex-direction: column; flex-direction: column;
height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;
background: #07070c; background: var(--base-bg);
} }
.content-area { .content-area {
@ -209,7 +205,7 @@ function handleEventClick(ev: CalendarEvent): void {
gap: 8px; gap: 8px;
} }
/* Account bar — same styling as in AppShell */ /* Account bar */
.account-bar { .account-bar {
width: var(--sidebar-width); width: var(--sidebar-width);
flex-shrink: 0; flex-shrink: 0;
@ -232,80 +228,113 @@ function handleEventClick(ev: CalendarEvent): void {
/* Calendar sidebar */ /* Calendar sidebar */
.cal-sidebar { .cal-sidebar {
width: 200px; width: 192px;
flex-shrink: 0; flex-shrink: 0;
border-radius: 14px; border-radius: 14px;
border: 1px solid rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.09);
background: background:
linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%), linear-gradient(160deg, rgba(255, 255, 255, 0.065) 0%, rgba(255, 255, 255, 0.02) 100%),
rgba(9, 9, 15, 0.80); rgba(10, 10, 17, 0.85);
backdrop-filter: blur(28px) saturate(1.8); backdrop-filter: blur(32px) saturate(1.9);
-webkit-backdrop-filter: blur(28px) saturate(1.8); -webkit-backdrop-filter: blur(32px) saturate(1.9);
overflow-y: auto; overflow-y: auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-shadow: box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.13),
0 8px 28px rgba(0, 0, 0, 0.40); 0 8px 28px rgba(0, 0, 0, 0.42);
} }
.sidebar-header { .sidebar-divider {
height: 1px;
margin: 0 12px;
background: linear-gradient(90deg,
transparent,
rgba(255, 255, 255, 0.07) 20%,
rgba(255, 255, 255, 0.07) 80%,
transparent
);
}
/* Calendar list header */
.cal-list-header {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 7px; gap: 6px;
padding: 14px 14px 10px; padding: 10px 12px 6px;
font-size: 12px; font-size: 10px;
font-weight: 600; font-weight: 700;
color: var(--text-secondary); color: var(--text-muted);
letter-spacing: 0.3px; letter-spacing: 0.6px;
text-transform: uppercase; text-transform: uppercase;
border-bottom: 1px solid var(--glass-border);
} }
.cal-icon { .cal-list-icon {
color: var(--accent); color: var(--accent);
} }
/* Calendar list */ /* Calendar list */
.calendar-list { .calendar-list {
padding: 8px 0; padding: 2px 6px 8px;
display: flex;
flex-direction: column;
gap: 1px;
} }
.cal-item { .cal-item {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 9px;
padding: 6px 14px; padding: 5px 8px;
cursor: pointer; cursor: pointer;
border-radius: 8px; border-radius: 8px;
margin: 0 4px;
transition: background var(--transition-fast); transition: background var(--transition-fast);
opacity: 0.55;
}
.cal-item.active {
opacity: 1;
} }
.cal-item:hover { .cal-item:hover {
background: var(--glass-bg-hover); background: var(--glass-bg-hover);
opacity: 1;
} }
.cal-dot { .cal-check {
width: 10px; width: 16px;
height: 10px; height: 16px;
border-radius: 5px;
border: 1.5px solid rgba(255, 255, 255, 0.15);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
transition: border-color var(--transition-fast), background var(--transition-fast);
background: transparent;
}
.cal-item.active .cal-check {
border-color: transparent;
background: rgba(255, 255, 255, 0.08);
}
.cal-dot-inner {
width: 8px;
height: 8px;
border-radius: 50%; border-radius: 50%;
flex-shrink: 0; flex-shrink: 0;
box-shadow: 0 0 4px currentColor; transition: opacity var(--transition-fast), box-shadow var(--transition-fast);
opacity: 0;
}
.cal-item.active .cal-dot-inner {
opacity: 1;
box-shadow: 0 0 5px currentColor;
} }
.cal-name { .cal-name {
font-size: 13px; font-size: 12px;
color: var(--text-secondary); color: var(--text-muted);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
transition: color var(--transition-fast);
font-weight: 500;
} }
.cal-item.active .cal-name { .cal-item.active .cal-name {
@ -313,18 +342,37 @@ function handleEventClick(ev: CalendarEvent): void {
} }
.no-calendars { .no-calendars {
padding: 16px; padding: 12px 8px;
font-size: 12px; font-size: 11px;
color: var(--text-muted); color: var(--text-muted);
text-align: center; text-align: center;
line-height: 1.5;
} }
/* Error state */ /* Error state */
.sidebar-error { .sidebar-error {
padding: 12px 14px; padding: 16px 14px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 6px; align-items: center;
gap: 8px;
text-align: center;
}
.error-icon-wrap {
width: 40px;
height: 40px;
border-radius: 50%;
background: rgba(255, 85, 85, 0.12);
border: 1px solid rgba(255, 85, 85, 0.2);
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 2px;
}
.error-icon {
color: var(--danger);
} }
.error-title { .error-title {
@ -334,85 +382,44 @@ function handleEventClick(ev: CalendarEvent): void {
} }
.error-detail { .error-detail {
font-size: 11px; font-size: 10px;
color: var(--text-muted); color: var(--text-muted);
word-break: break-all; word-break: break-all;
user-select: text; user-select: text;
-webkit-user-select: text; -webkit-user-select: text;
cursor: text; cursor: text;
text-align: left;
width: 100%;
} }
.error-actions {
display: flex;
flex-direction: column;
gap: 5px;
width: 100%;
}
.retry-btn { .retry-btn {
align-self: flex-start; display: flex;
font-size: 12px; align-items: center;
padding: 4px 12px; justify-content: center;
gap: 5px;
width: 100%;
font-size: 11px;
padding: 5px 10px;
border-radius: var(--radius-sm); border-radius: var(--radius-sm);
background: var(--glass-bg-raised); background: var(--glass-bg-raised);
border: 1px solid var(--glass-border); border: 1px solid var(--glass-border);
color: var(--text-secondary); color: var(--text-secondary);
transition: background var(--transition-fast); transition: background var(--transition-fast);
font-weight: 500;
}
.retry-btn:hover:not(:disabled) {
background: var(--glass-bg-hover);
color: var(--text-primary);
} }
.retry-btn:hover:not(:disabled) { background: var(--glass-bg-hover); }
.retry-btn:disabled { opacity: 0.5; cursor: default; } .retry-btn:disabled { opacity: 0.5; cursor: default; }
.probe-btn { margin-top: 2px; }
.probe-results {
margin-top: 6px;
border-top: 1px solid var(--glass-border);
padding-top: 8px;
display: flex;
flex-direction: column;
gap: 3px;
}
.probe-title {
font-size: 11px;
font-weight: 600;
color: var(--text-secondary);
margin-bottom: 2px;
}
.probe-row {
display: flex;
flex-direction: column;
gap: 1px;
padding: 3px 6px;
border-radius: 5px;
background: rgba(255,255,255,0.03);
}
.probe-row.probe-ok {
background: rgba(168, 230, 0, 0.08);
}
.probe-path {
font-size: 10px;
font-family: monospace;
color: var(--text-primary);
word-break: break-all;
user-select: text;
-webkit-user-select: text;
cursor: text;
}
.probe-note {
font-size: 10px;
color: var(--text-muted);
}
.probe-row.probe-ok .probe-note {
color: #a8e600;
font-weight: 600;
}
.probe-hint {
font-size: 10px;
color: var(--text-muted);
line-height: 1.5;
margin-top: 4px;
}
.sidebar-loading { .sidebar-loading {
flex: 1; flex: 1;
@ -428,69 +435,121 @@ function handleEventClick(ev: CalendarEvent): void {
min-width: 0; min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border-radius: 14px; border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.09);
background: background:
linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%), linear-gradient(160deg, rgba(255, 255, 255, 0.04) 0%, transparent 60%),
rgba(10, 10, 17, 0.55); rgba(11, 11, 18, 0.60);
backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(24px) saturate(1.5);
-webkit-backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.5);
overflow: hidden; overflow: hidden;
box-shadow: box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.10),
0 8px 28px rgba(0, 0, 0, 0.32); 0 8px 32px rgba(0, 0, 0, 0.36);
} }
/* Toolbar */ /* Toolbar */
.toolbar { .toolbar {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 6px; gap: 8px;
padding: 10px 16px; padding: 10px 16px 10px 14px;
border-bottom: 1px solid var(--glass-border); border-bottom: 1px solid rgba(255, 255, 255, 0.07);
flex-shrink: 0; flex-shrink: 0;
background: rgba(255, 255, 255, 0.02);
}
.toolbar-nav {
display: flex;
gap: 2px;
} }
.nav-btn { .nav-btn {
width: 28px;
height: 28px; height: 28px;
padding: 0 10px; border-radius: 8px;
border-radius: var(--radius-sm);
background: var(--glass-bg); background: var(--glass-bg);
border: 1px solid var(--glass-border); border: 1px solid var(--glass-border);
color: var(--text-secondary); color: var(--text-muted);
font-size: 12px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 4px; transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
transition: background var(--transition-fast), color var(--transition-fast);
} }
.nav-btn:hover:not(:disabled) { .nav-btn:hover {
background: var(--glass-bg-hover); background: var(--glass-bg-raised);
border-color: var(--glass-border-strong);
color: var(--text-primary); color: var(--text-primary);
} }
.nav-btn:disabled {
opacity: 0.4;
cursor: default;
}
.today-btn { .today-btn {
font-weight: 500; height: 28px;
padding: 0 12px;
border-radius: 8px;
background: var(--glass-bg-raised);
border: 1px solid var(--glass-border-strong);
color: var(--text-secondary);
font-size: 12px;
font-weight: 600;
letter-spacing: 0.2px;
transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}
.today-btn:hover {
background: rgba(168, 230, 0, 0.12);
border-color: rgba(168, 230, 0, 0.3);
color: var(--accent);
box-shadow: 0 0 12px rgba(168, 230, 0, 0.12);
} }
.week-label { .week-label {
font-size: 14px; font-size: 15px;
font-weight: 500; font-weight: 600;
color: var(--text-primary); color: var(--text-primary);
margin-left: 4px; margin: 0;
flex: 1; flex: 1;
letter-spacing: -0.2px;
} }
.refresh-btn { .toolbar-right {
margin-left: auto; display: flex;
flex: none; align-items: center;
gap: 8px;
}
.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 {
width: 28px;
height: 28px;
border-radius: 8px;
background: var(--glass-bg);
border: 1px solid var(--glass-border);
color: var(--text-muted);
display: flex;
align-items: center;
justify-content: center;
transition: background var(--transition-fast), color var(--transition-fast);
}
.icon-btn:hover:not(:disabled) {
background: var(--glass-bg-raised);
color: var(--text-secondary);
}
.icon-btn:disabled {
opacity: 0.4;
cursor: default;
} }
@keyframes spin { @keyframes spin {
@ -517,48 +576,54 @@ function handleEventClick(ev: CalendarEvent): void {
animation: spin 0.8s linear infinite; animation: spin 0.8s linear infinite;
} }
/* Empty state (no accounts) */ /* Empty state */
.empty-state { .empty-state {
position: fixed; position: fixed;
inset: 0; inset: 0;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: transparent; background: rgba(0, 0, 0, 0.3);
backdrop-filter: blur(8px);
z-index: 10; z-index: 10;
} }
.empty-content { .empty-content {
text-align: center; text-align: center;
padding: 64px 72px; padding: 56px 64px;
width: 480px; width: 460px;
background: rgba(255, 255, 255, 0.11); border-radius: 24px;
border: 1px solid rgba(255, 255, 255, 0.12);
background:
linear-gradient(145deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.04) 100%),
rgba(12, 12, 20, 0.92);
backdrop-filter: blur(72px) saturate(2.8); backdrop-filter: blur(72px) saturate(2.8);
-webkit-backdrop-filter: blur(72px) saturate(2.8); -webkit-backdrop-filter: blur(72px) saturate(2.8);
border-radius: 20px;
box-shadow: box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.20),
0 8px 32px rgba(0, 0, 0, 0.45), 0 8px 32px rgba(0, 0, 0, 0.50),
0 32px 80px rgba(0, 0, 0, 0.65); 0 32px 80px rgba(0, 0, 0, 0.70);
} }
.empty-icon { .empty-icon {
margin-bottom: 24px; margin-bottom: 20px;
opacity: 0.28; opacity: 0.22;
color: var(--text-primary); color: var(--text-primary);
} }
.empty-content h2 { .empty-content h2 {
font-size: 22px; font-size: 20px;
font-weight: 600; font-weight: 600;
margin-bottom: 8px; margin-bottom: 8px;
color: var(--text-primary); color: var(--text-primary);
letter-spacing: -0.3px;
} }
.empty-content p { .empty-content p {
color: var(--text-secondary); color: var(--text-secondary);
font-size: 14px; font-size: 13px;
margin-bottom: 32px; margin-bottom: 28px;
line-height: 1.5;
} }
.add-btn { .add-btn {
@ -571,10 +636,12 @@ function handleEventClick(ev: CalendarEvent): void {
color: var(--accent-text); color: var(--accent-text);
border-radius: var(--radius-md); border-radius: var(--radius-md);
font-weight: 600; font-weight: 600;
font-size: 14px; font-size: 13px;
letter-spacing: 0.1px;
box-shadow: box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.40),
0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent); 0 2px 12px color-mix(in srgb, var(--accent) 30%, transparent);
transition: background var(--transition-fast), box-shadow var(--transition-fast);
} }
.add-btn:hover { .add-btn:hover {
@ -583,5 +650,8 @@ function handleEventClick(ev: CalendarEvent): void {
color-mix(in srgb, var(--accent-hover) 88%, white 12%) 0%, color-mix(in srgb, var(--accent-hover) 88%, white 12%) 0%,
var(--accent-hover) 100% var(--accent-hover) 100%
); );
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.40),
0 2px 20px color-mix(in srgb, var(--accent) 45%, transparent);
} }
</style> </style>