<commit_before>import {
  MinimalEventProps, BaseComponent, ComponentContext, h,
  Seg, isMultiDayRange, DateFormatter, buildSegTimeText, createFormatter, EventMeta, EventRoot, ComponentChildren, RenderHook, Fragment
} from "@fullcalendar/core"


const DEFAULT_TIME_FORMAT = {
  hour: 'numeric',
  minute: '2-digit',
  meridiem: 'short'
}


export default class ListViewEventRow extends BaseComponent<MinimalEventProps> {

  render(props: MinimalEventProps, state: {}, context: ComponentContext) {
    let { options } = context
    let { seg } = props

    // TODO: avoid createFormatter, cache!!! see TODO in StandardEvent
    let timeFormat = createFormatter(
      options.eventTimeFormat || DEFAULT_TIME_FORMAT,
      options.defaultRangeSeparator
    )

    return (
      <EventRoot
        seg={seg}
        timeText={'' /* BAD. because of all-day content */}
        disableDragging={true}
        disableResizing={true}
        defaultContent={renderEventInnerContent}
        isPast={props.isPast}
        isFuture={props.isFuture}
        isToday={props.isToday}
        isSelected={props.isSelected}
        isDragging={props.isDragging}
        isResizing={props.isResizing}
        isDateSelecting={props.isDateSelecting}
      >
        {(rootElRef, classNames, style, innerElRef, innerContent, hookProps) => (
          <tr className={[ 'fc-list-event', hookProps.event.url ? 'fc-event-forced-url' : '' ].concat(classNames).join(' ')} ref={rootElRef}>
            {buildTimeContent(seg, timeFormat, context)}
            <td class='fc-list-event-graphic'>
              <span class='fc-list-event-dot fc-dot' style={{
                backgroundColor: hookProps.event.backgroundColor
              }} />
            </td>
            <td class='fc-list-event-title' ref={innerElRef}>
              {innerContent}
            </td>
          </tr>
        )}
      </EventRoot>
    )
  }

}


function renderEventInnerContent(props: EventMeta) {
  let { event } = props
  let url = event.url
  let anchorAttrs = url ? { href: url } : {}

  return (
    <a {...anchorAttrs}>{/* TODO: document how whole row become clickable */}
      {event.title || <Fragment>&nbsp;</Fragment>}
    </a>
  )
}


function buildTimeContent(seg: Seg, timeFormat: DateFormatter, context: ComponentContext): ComponentChildren {
  let { displayEventTime } = context.options

  if (displayEventTime !== false) {<commit_msg>fix list view event rendering<commit_after>import {
  MinimalEventProps, BaseComponent, ComponentContext, h,
  Seg, isMultiDayRange, DateFormatter, buildSegTimeText, createFormatter, EventMeta, EventRoot, ComponentChildren, RenderHook
} from "@fullcalendar/core"


const DEFAULT_TIME_FORMAT = {
  hour: 'numeric',
  minute: '2-digit',
  meridiem: 'short'
}


export default class ListViewEventRow extends BaseComponent<MinimalEventProps> {

  render(props: MinimalEventProps, state: {}, context: ComponentContext) {
    let { options } = context
    let { seg } = props

    // TODO: avoid createFormatter, cache!!! see TODO in StandardEvent
    let timeFormat = createFormatter(
      options.eventTimeFormat || DEFAULT_TIME_FORMAT,
      options.defaultRangeSeparator
    )

    return (
      <EventRoot
        seg={seg}
        timeText={'' /* BAD. because of all-day content */}
        disableDragging={true}
        disableResizing={true}
        defaultContent={renderEventInnerContent}
        isPast={props.isPast}
        isFuture={props.isFuture}
        isToday={props.isToday}
        isSelected={props.isSelected}
        isDragging={props.isDragging}
        isResizing={props.isResizing}
        isDateSelecting={props.isDateSelecting}
      >
        {(rootElRef, classNames, style, innerElRef, innerContent, hookProps) => (
          <tr className={[ 'fc-list-event', hookProps.event.url ? 'fc-event-forced-url' : '' ].concat(classNames).join(' ')} ref={rootElRef}>
            {buildTimeContent(seg, timeFormat, context)}
            <td class='fc-list-event-graphic'>
              <span class='fc-list-event-dot fc-dot' style={{
                backgroundColor: hookProps.event.backgroundColor
              }} />
            </td>
            <td class='fc-list-event-title' ref={innerElRef}>
              {innerContent}
            </td>
          </tr>
        )}
      </EventRoot>
    )
  }

}


function renderEventInnerContent(props: EventMeta) {
  let { event } = props
  let url = event.url
  let anchorAttrs = url ? { href: url } : {}

  return (
    <a {...anchorAttrs}>{/* TODO: document how whole row become clickable */}
      {event.title}
    </a>
  )
}


function buildTimeContent(seg: Seg, timeFormat: DateFormatter, context: ComponentContext): ComponentChildren {
  let { displayEventTime } = context.options

  if (displayEventTime !== false) {
{'fraction_non_alphanumeric': 0.12289106436159133, 'fraction_numerical': 0.00041657987919183504, 'mean_word_length': 2.869460112812248, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5435587', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1382, 'n_words': 298}