import React from 'react';
import { Modal } from '../ui/Modal';
import { UserAvatar } from '../ui/UserAvatar';
import { MentionText } from './mentions';
import { formatDayLong, formatEventRange, parseSqlDateTime } from './calendarUtils';
import { eventColor, userColor, type AppUser, type CalendarEvent, type Lead } from '../../types';
interface EventDetailModalProps {
event: CalendarEvent;
leads: Lead[];
users: AppUser[];
canModify: boolean;
onEdit: () => void;
onDelete: () => void;
onClose: () => void;
onOpenLead: (leadId: number) => void;
onOpenUser: (userId: number) => void;
}
const Row: React.FC<{ icon: string; children: React.ReactNode }> = ({ icon, children }) => (
);
/** Leseansicht eines Termins - hier sind die @-Mentions anklickbar. */
export const EventDetailModal: React.FC = ({
event,
leads,
users,
canModify,
onEdit,
onDelete,
onClose,
onOpenLead,
onOpenUser,
}) => {
const color = eventColor(event);
const start = parseSqlDateTime(event.starts_at);
return (
{canModify && (
<>
>
)}
}
>
{event.created_by !== null && (
)}
Angelegt von
{event.created_by_name ?? 'unbekannt'}
{formatDayLong(start)}
· {formatEventRange(event)}
{event.location && (
{event.location}
)}
{event.participants.length === 0 ? (
Keine Teilnehmer eingetragen.
) : (
{event.participants.map((participant) => {
const tint = userColor(participant);
return (
);
})}
)}
Beschreibung
{event.description ? (
) : (
Keine Beschreibung hinterlegt.
)}
);
};