mixin renderMenuItem (iconClass, label)
  div(uk-grid).uk-grid-collapse
    .uk-width-auto
      .app-menu-icon
        i(class=`fas ${iconClass}`)
    .uk-width-expand= label

#dtp-offcanvas(uk-offcanvas="mode: slide; overlay: true; bg-close: true;")
  .uk-offcanvas-bar
    .uk-margin
      a(href="/").uk-display-block
        .uk-text-large= site.name
      .uk-text-small.uk-text-muted= site.description

    ul.uk-nav.uk-nav-default.dtp-app-menu

      li.uk-nav-header Site Menu

      li(class={ "uk-active": (currentView === 'home') })
        a(href='/').uk-display-block
          +renderMenuItem('fa-home', 'Home')

      if site.shingWidgetKey
        li(class={ "uk-active": (currentView === 'venue') })
          a(href='/venue').uk-display-block
            +renderMenuItem('fa-tv', 'Watch Live')

      li(class={ "uk-active": (currentView === 'newsroom') })
        a(href='/newsroom').uk-display-block
          +renderMenuItem('fa-newspaper', 'Newsroom')

      li(class={ "uk-active": (currentView === 'announcement') })
        a(href='/announcement').uk-display-block
          +renderMenuItem('fa-bullhorn', 'Announcements')
      
      li(class={ "uk-active": (currentView === 'authors') })
          a(href=`/post/authors`).uk-display-block
            div(uk-grid).uk-grid-collapse
              .uk-width-auto
                .app-menu-icon
                  i.fas.fa-user
              .uk-width-expand All Authors

      if Array.isArray(mainMenu)
        li.uk-nav-header Pages
        each menuItem in mainMenu
          li(class={ 'uk-active': (pageSlug === menuItem.slug) })
            a(href= menuItem.url, title= menuItem.label)
              +renderMenuItem(menuItem.icon || 'fa-file', menuItem.label)
            if Array.isArray(menuItem.children) && (menuItem.children.length > 0)
              each child in menuItem.children
                li(class={ 'uk-active': (pageSlug === child.slug) })
                  a(href= child.url, title= child.label)
                    +renderButtonIcon(child.icon || 'fa-file', child.label)

      if user
        li.uk-nav-header Member Menu

        if user.hasAuthorDashboard
          li(class={ "uk-active": (currentView === 'author') })
            a(href='/author').uk-display-block
              div(uk-grid).uk-grid-collapse
                .uk-width-auto
                  .app-menu-icon
                    i.fas.fa-user
                .uk-width-expand Author Dashboard

        li(class={ "uk-active": (currentView === 'chat') })
          a(href=`/chat`).uk-display-block
            div(uk-grid).uk-grid-collapse
              .uk-width-auto
                .app-menu-icon
                  i.fas.fa-comment-alt
              .uk-width-expand Chat

        li(class={ "uk-active": (currentView === 'user-settings') })
          a(href=`/user/${user.username}`).uk-display-block
            div(uk-grid).uk-grid-collapse
              .uk-width-auto
                .app-menu-icon
                  i.fas.fa-user
              .uk-width-expand Profile

        li(class={ "uk-active": (currentView === 'user-settings') })
          a(href=`/user/${user.username}/settings`).uk-display-block
            div(uk-grid).uk-grid-collapse
              .uk-width-auto
                .app-menu-icon
                  i.fas.fa-cog
              .uk-width-expand Settings

        if user.permissions.isAdmin
          a(href="/admin").uk-display-block
            li(class={ "uk-active": currentView === 'admin' })
              div(uk-grid).uk-grid-collapse
                .uk-width-auto
                  .app-menu-icon
                    i.fas.fa-user-shield
                .uk-width-expand Admin

        li
          a(href="/auth/logout").uk-display-block
            div(uk-grid).uk-grid-collapse
              .uk-width-auto
                .app-menu-icon
                  i.fas.fa-sign-out-alt
              .uk-width-expand Logout

      if Array.isArray(links) && (links.length > 0)
        li.uk-nav-header Site Links
        each link in links
          li
            +renderSiteLink(link)
            //- a(href= link.url)= link.label

      li.uk-nav-header Legal

      li
        a(href="/policy/terms-of-service").uk-display-block
          div(uk-grid).uk-grid-collapse
            .uk-width-auto
              .app-menu-icon
                i.fas.fa-balance-scale
            .uk-width-expand Terms of Service
      li
        a(href="/policy/privacy").uk-display-block
          div(uk-grid).uk-grid-collapse
            .uk-width-auto
              .app-menu-icon
                i.fas.fa-balance-scale
            .uk-width-expand Privacy Policy

    .uk-text-small.uk-margin-medium
      div #{pkg.name} v#{pkg.version}
      div &copy; #{moment().format('YYYY')} #{site.company}
      div Made In USA 🇺🇸
