extends ../layouts/main
block content

  include ../../venue/components/channel-list-item

  -
    var onlineChannels = channels.filter((channel) => channel.lastUpdate && (channel.lastUpdate.status === 'live'))
    var offlineChannels = channels.filter((channel) => !channel.lastUpdate || (channel.lastUpdate.status !== 'live'))

  .uk-margin
    div(uk-grid)
      div(class="uk-width-1-1 uk-width-expand@m")
        .uk-text-large #{site.name} Stream Channels
      div(class="uk-width-1-1 uk-width-auto@m")
        a(href="/admin/venue/channel").uk-button.dtp-button-default.uk-button-small.uk-border-rounded
          span
            i.fas.fa-cog
          span.uk-margin-small-left Manage Channels

  if Array.isArray(offlineChannels) && (channels.length > 0)
    uk.uk-list.uk-list-divider
      each channel of offlineChannels
        li
          +renderVenueChannelListItem(channel, { baseUrl: '/admin/venue/channel' })
  else
    div There are no channels integrated with #{site.name}.