diff --git a/src/renderer/src/components/AppIcon.vue b/src/renderer/src/components/AppIcon.vue index 72881f6..131c3f5 100644 --- a/src/renderer/src/components/AppIcon.vue +++ b/src/renderer/src/components/AppIcon.vue @@ -25,6 +25,10 @@ export type IconName = | 'image' | 'bell-off' | 'calendar' + | 'warning' + | 'location' + | 'person' + | 'people' const props = defineProps<{ name: IconName @@ -148,6 +152,25 @@ const paths: Record = { `, + warning: ` + + + + `, + location: ` + + + `, + person: ` + + + `, + people: ` + + + + + `, } diff --git a/src/renderer/src/components/calendar/EventBlock.vue b/src/renderer/src/components/calendar/EventBlock.vue index 47c2d76..7e2ff1b 100644 --- a/src/renderer/src/components/calendar/EventBlock.vue +++ b/src/renderer/src/components/calendar/EventBlock.vue @@ -12,12 +12,20 @@ const props = defineProps<{ const emit = defineEmits<{ click: [event: CalendarEvent] }>() const timeLabel = computed(() => { - if (props.event.isAllDay) return 'All day' + if (props.event.isAllDay) return 'Весь день' const start = new Date(props.event.start) const end = new Date(props.event.end) return `${format(start, 'HH:mm')} – ${format(end, 'HH:mm')}` }) +const durationMinutes = computed(() => { + const start = new Date(props.event.start) + const end = new Date(props.event.end) + return (end.getTime() - start.getTime()) / 60_000 +}) + +const isShort = computed(() => durationMinutes.value < 45) + const statusClass = computed(() => { if (props.event.status === 'cancelled') return 'cancelled' if (props.event.status === 'tentative') return 'tentative' @@ -28,65 +36,168 @@ const statusClass = computed(() => { diff --git a/src/renderer/src/components/calendar/EventDetailPopup.vue b/src/renderer/src/components/calendar/EventDetailPopup.vue index 6476f72..55d8a8b 100644 --- a/src/renderer/src/components/calendar/EventDetailPopup.vue +++ b/src/renderer/src/components/calendar/EventDetailPopup.vue @@ -7,6 +7,7 @@ import AppIcon from '../AppIcon.vue' const props = defineProps<{ event: CalendarEvent + color?: string }>() const emit = defineEmits<{ close: [] }>() @@ -18,62 +19,115 @@ const dateLabel = computed(() => { if (props.event.isAllDay) { const isSameDay = start.toDateString() === end.toDateString() if (isSameDay) return format(start, 'd MMMM yyyy', { locale: ru }) - const endAdjusted = new Date(end.getTime() - 1) // all-day end is exclusive + const endAdjusted = new Date(end.getTime() - 1) return `${format(start, 'd MMMM', { locale: ru })} – ${format(endAdjusted, 'd MMMM yyyy', { locale: ru })}` } const sameDay = start.toDateString() === end.toDateString() if (sameDay) { - return `${format(start, 'd MMMM yyyy, HH:mm', { locale: ru })} – ${format(end, 'HH:mm')}` + 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 })}` }) -const statusLabel: Record = { - confirmed: 'Подтверждено', - tentative: 'Предварительно', - cancelled: 'Отменено' +const durationLabel = computed(() => { + if (props.event.isAllDay) return 'Весь день' + const start = new Date(props.event.start) + 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))