import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { DateTime } from 'luxon';
import { ClockIcon } from '../../../lib/icons/Clock.js';
export function NoiseSensorEventItem({ event, }) {
    const date = formatDate(event.created_at);
    const time = formatTime(event.created_at);
    return (_jsxs("div", { className: 'seam-noise-sensor-event-item', children: [_jsxs("div", { className: 'seam-noise-sensor-event-item-column-wrap', children: [_jsx(ClockIcon, {}), _jsxs("div", { className: 'seam-noise-sensor-event-item-datetime-wrap', children: [_jsx("p", { className: 'seam-noise-sensor-event-item-date', children: date }), _jsx("p", { className: 'seam-noise-sensor-event-item-time', children: time })] })] }), _jsxs("div", { className: 'seam-noise-sensor-event-item-context-wrap', children: [_jsx("p", { className: 'seam-noise-sensor-event-item-context-label', children: t.noiseThresholdTriggered }), getContextSublabel(event) != null && (_jsx("p", { className: 'seam-noise-sensor-event-item-context-sublabel', children: getContextSublabel(event) }))] }), _jsx("div", { className: 'seam-noise-sensor-event-item-right-block' })] }));
}
const getContextSublabel = (event) => {
    if (event.noise_threshold_name != null) {
        return event.noise_threshold_name;
    }
    if (event.noise_level_decibels != null) {
        return `${event.noise_level_decibels} ${t.decibel}`;
    }
    return null;
};
const formatDate = (dateTime) => DateTime.fromISO(dateTime).toLocaleString(DateTime.DATE_FULL);
const formatTime = (dateTime) => DateTime.fromISO(dateTime).toLocaleString(DateTime.TIME_SIMPLE);
const t = {
    decibel: 'dB',
    noiseThresholdTriggered: 'Noise threshold triggered',
};
//# sourceMappingURL=NoiseSensorEventItem.js.map