include ./channel-card
include ./channel-list-item

mixin renderVenueChannelGrid (channels, options)
  -
    var onlineChannels = channels.filter((channel) => channel.currentStatus && (channel.currentStatus.status === 'live'))
    var offlineChannels = channels.filter((channel) => !channel.currentStatus || (channel.currentStatus.status !== 'live'))
    options = Object.assign({ withDescription: false }, options);

  div(uk-grid)
    div(class="uk-width-1-1 uk-width-2-3@s")
      +renderSectionTitle('Live Channels')
      .uk-margin-small
        if Array.isArray(onlineChannels) && (onlineChannels.length > 0)
          div(uk-grid).uk-grid-small
            each channel of onlineChannels
              div(class="uk-width-1-1 uk-width-1-2@s uk-width-1-3@l")
                +renderVenueChannelCard(channel, options)
        else
          div There are no live channels. Please check back later!

    div(class="uk-width-1-1 uk-width-1-3@s")
      +renderSectionTitle('Offline Channels')
      .uk-margin-small
        if Array.isArray(offlineChannels) && (offlineChannels.length > 0)
          ul.uk-list.uk-list-divider
            each channel of offlineChannels
              li
                +renderVenueChannelListItem(channel, options)
        else
          div There are no offline channels.