feat(calendar): информационное окно вхождения — статус, кнопка «Редактировать» для владельца
Some checks failed
CI / backend (push) Has been cancelled
CI / frontend (push) Has been cancelled

ConferenceOccurrenceDialog расширен под общий информационный диалог (клик по
чипу — и для чужих, и для своих конференций): статус-бейдж (общая логика
occurrenceBadge вынесена в lib/occurrenceStatus.ts, переиспользуется с
ConferenceCalendar), кнопка «Редактировать», открывающая модалку формы —
только когда передан ownedConference (текущий пользователь — организатор).
Плюс Escape и возврат фокуса (useModalDismiss).
This commit is contained in:
2026-07-26 23:35:10 +03:00
parent 66935b04f8
commit c897f40363
2 changed files with 59 additions and 12 deletions

View File

@@ -0,0 +1,24 @@
import { CheckCircle2, Clock, Play, Repeat } from 'lucide-react'
import type { OccurrenceOut } from '@/api/conferences'
export type OccurrenceBadgeKind = 'scheduled' | 'pinned' | 'live' | 'ended'
/** Общая логика статус-бейджа вхождения — используется чипом календаря и информационным окном (`ConferenceOccurrenceDialog`). */
export function occurrenceBadge(
occ: OccurrenceOut,
start: Date | null,
end: Date | null,
): { kind: OccurrenceBadgeKind; label: string } {
const now = new Date()
if (start && end && now >= start && now <= end) return { kind: 'live', label: 'Идёт сейчас' }
if (end && now > end) return { kind: 'ended', label: 'Завершена' }
if (occ.is_pinned) return { kind: 'pinned', label: 'Закреплена' }
return { kind: 'scheduled', label: 'Запланирована' }
}
export const OCCURRENCE_BADGE_ICON: Record<OccurrenceBadgeKind, typeof Clock> = {
scheduled: Clock,
pinned: Repeat,
live: Play,
ended: CheckCircle2,
}