nav.toolbar(ng-controller='AuthCtrl', ng-class='{active: isToolbarHidden}')
  button.toolbar-toggle(ng-click='isToolbarHidden = !isToolbarHidden', ng-class='{active: isToolbarHidden}')
    span.glyphicon.glyphicon-remove-circle
    span.toggle-text.toggle-close=env.t('close')
    span.toggle-text.toggle-open=env.t('menu')
  .toolbar-container(ng-if='!isToolbarHidden')
    ul.toolbar-mobile-nav
      li.toolbar-mobile
        a(ng-click='expandMenu("mobile")', ng-class='{active: _expandedMenu=="mobile"}')
          span.glyphicon.glyphicon-align-justify
        div(ng-if='_expandedMenu=="mobile"', ng-click='expandMenu(null)')
          h4=env.t('menu')
          div
            ul.toolbar-submenu
              li
                a(ui-sref='tasks')=env.t('tasks')
            ul.toolbar-submenu
              li
                a(ui-sref='options.profile.avatar')=env.t('avatar')
              li
                a(ui-sref='options.profile.backgrounds')=env.t('backgrounds')
              li
                a(ui-sref='options.profile.stats')=env.t('stats')
              li
                a(ui-sref='options.profile.profile')=env.t('profile')
            ul.toolbar-submenu
              li
                a(ui-sref='options.social.inbox')
                  span.badge.badge-danger(ng-if='user.inbox.newMessages') {{user.inbox.newMessages}} &nbsp;
                  =env.t("inbox")
              li
                a(ui-sref='options.social.tavern')=env.t('tavern')
              li
                a(ui-sref='options.social.party')=env.t('party')
              li
                a(ui-sref='options.social.guilds.public')=env.t('guilds')
              li
                a(ui-sref='options.social.challenges')=env.t('challenges')
              li
                a(ui-sref='options.social.hall.heroes')=env.t('hall')
            ul.toolbar-submenu
              li
                a(ui-sref='options.inventory.drops')=env.t('market')
              li
                a(ui-sref='options.inventory.pets')=env.t('pets')
              li
                a(ui-sref='options.inventory.mounts')=env.t('mounts')
              li
                a(ui-sref='options.inventory.equipment')=env.t('equipment')
              li
                a(ui-sref='options.inventory.timetravelers')=env.t('timeTravelers')
              li
                a(ui-sref='options.inventory.seasonalshop')=env.t('seasonalShop')
            ul.toolbar-submenu
              li
                a(target="_blank" ng-href='http://data.habitrpg.com?uuid={{user._id}}')=env.t('dataTool')
              li
                a(ui-sref='options.settings.export')=env.t('exportData')
            ul.toolbar-submenu
              li
                a(target="_blank" href='http://habitrpg.wikia.com/wiki/FAQ')=env.t('FAQ')
              li
                a(target="_blank" href='https://github.com/HabitRPG/habitrpg/issues/2760')=env.t('reportBug')
              li
                a(target="_blank" href='https://habitrpg.com/#/options/groups/guilds/5481ccf3-5d2d-48a9-a871-70a7380cee5a')=env.t('askQuestion')
              li
                a(target="_blank" href='https://trello.com/c/odmhIqyW/440-read-first-table-of-contents')=env.t('requestAF')
              li
                a(target="_blank" href='http://habitrpg.wikia.com/wiki/Contributing_to_HabitRPG')=env.t('contributeToHRPG')
              li
                a(target="_blank" href='http://habitrpg.wikia.com/wiki/')=env.t('overview')
          ul.toolbar-controls
            li.toolbar-subscribe-button
              button(ng-if='!user.purchased.plan.customerId',ui-sref='options.settings.subscription',popover-trigger='mouseenter',popover-placement='bottom',popover-title=env.t('subscriptions'),popover=env.t('subDescription'),popover-append-to-body='true')=env.t('subscribe')
            li.toolbar-controls-button
              a(ng-click='expandMenu(null)')=env.t('close')
    ul.toolbar-nav
      li.toolbar-button
        a(ui-sref='tasks')
          span=env.t('tasks')
      li.toolbar-button-dropdown
        a(ui-sref='options.profile.avatar')
          span=env.t('user')
        a(ng-click='expandMenu("avatar")', ng-class='{active: _expandedMenu == "avatar"}')
          span &#9776;
        div(ng-if='_expandedMenu == "avatar"')
          ul.toolbar-submenu(ng-click='expandMenu(null)')
            li
              a(ui-sref='options.profile.avatar')=env.t('avatar')
            li
              a(ui-sref='options.profile.backgrounds')=env.t('backgrounds')
            li
              a(ui-sref='options.profile.stats')=env.t('stats')
            li
              a(ui-sref='options.profile.profile')=env.t('profile') 
      li.toolbar-button-dropdown
        a(ui-sref='options.social.inbox', ng-if='user.inbox.newMessages')
          span.badge.badge-danger {{user.inbox.newMessages}}
        a(ui-sref='options.social.tavern')
          span=env.t('social')
        a(ng-click='expandMenu("social")', ng-class='{active: _expandedMenu == "social"}')
          span &#9776;
        div(ng-if='_expandedMenu == "social"')
          ul.toolbar-submenu(ng-click='expandMenu(null)')
            li
              a(ui-sref='options.social.inbox')
                span.badge.badge-danger(ng-if='user.inbox.newMessages') {{user.inbox.newMessages}} &nbsp;
                =env.t("inbox")
            li
              a(ui-sref='options.social.tavern')=env.t('tavern')
            li
              a(ui-sref='options.social.party')=env.t('party')
            li
              a(ui-sref='options.social.guilds.public')=env.t('guilds')
            li
              a(ui-sref='options.social.challenges')=env.t('challenges')
            li
              a(ui-sref='options.social.hall.heroes')=env.t('hall')
      li.toolbar-button-dropdown
        a(ui-sref='options.inventory.drops')
          span=env.t('inventory')
        a(ng-click='expandMenu("inventory")', ng-class='{active: _expandedMenu == "inventory"}')
          span  &#9776;
        div(ng-if='_expandedMenu == "inventory"')
          ul.toolbar-submenu(ng-click='expandMenu(null)')
            li
              a(ui-sref='options.inventory.drops')=env.t('market')
            li
              a(ui-sref='options.inventory.pets')=env.t('pets')
            li
              a(ui-sref='options.inventory.mounts')=env.t('mounts')
            li
              a(ui-sref='options.inventory.equipment')=env.t('equipment')
            li
              a(ui-sref='options.inventory.timetravelers')=env.t('timeTravelers')
            li
              a(ui-sref='options.inventory.seasonalshop')=env.t('seasonalShop')
      li.toolbar-button-dropdown
        a(target="_blank" ng-href='http://data.habitrpg.com?uuid={{user._id}}')
          span=env.t('data')
        a(ng-click='expandMenu("data")', ng-class='{active: _expandedMenu == "data"}')
          span  &#9776;
        div(ng-if='_expandedMenu == "data"')
          ul.toolbar-submenu(ng-click='expandMenu(null)')
            li
              a(target="_blank" ng-href='http://data.habitrpg.com?uuid={{user._id}}')=env.t('dataTool')
            li
              a(ui-sref='options.settings.export')=env.t('exportData')
      li.toolbar-button-dropdown
        a(target="_blank" href='http://habitrpg.wikia.com/wiki/')
          span=env.t('help')
        a(ng-click='expandMenu("help")', ng-class='{active: _expandedMenu == "help"}')
          span  &#9776;
        div(ng-if='_expandedMenu == "help"')
          ul.toolbar-submenu(ng-click='expandMenu(null)')
            li
              a(target="_blank" href='http://habitrpg.wikia.com/wiki/FAQ')=env.t('FAQ')
            li
              a(target="_blank" href='https://github.com/HabitRPG/habitrpg/issues/2760')=env.t('reportBug')
            li
              a(target="_blank" href='https://habitrpg.com/#/options/groups/guilds/5481ccf3-5d2d-48a9-a871-70a7380cee5a')=env.t('askQuestion')
            li
              a(target="_blank" href='https://trello.com/c/odmhIqyW/440-read-first-table-of-contents')=env.t('requestAF')
            li
              a(target="_blank" href='http://habitrpg.wikia.com/wiki/Contributing_to_HabitRPG')=env.t('contributeToHRPG')
            li
              a(target="_blank" href='http://habitrpg.wikia.com/wiki/')=env.t('overview')
            //-li(ng-controller='SettingsCtrl')
              a(ng-click='showTour()', popover-placement='right', popover-trigger='mouseenter', popover=env.t('restartTour'))= env.t('showTour')
    ul.toolbar-subscribe(ng-if='!user.purchased.plan.customerId')
      li.toolbar-subscribe-button
        button(ui-sref='options.settings.subscription',popover-trigger='mouseenter',popover-placement='bottom',popover-title=env.t('subscriptions'),popover=env.t('subDescription'),popover-append-to-body='true')=env.t('subscribe')
    ul.toolbar-options  
      li.toolbar-notifs
        a(ng-click='expandMenu("notifs")')
          span.glyphicon(ng-class='iconClasses()')
        div(ng-if='_expandedMenu=="notifs"')
          h4=env.t('notifications')
          div
            ul.toolbar-notifs-notifs
              li.toolbar-notifs-no-messages(ng-if='hasNoNotifications()')=env.t('noNotifications')
              li(ng-if='user.purchased.plan.mysteryItems.length')
                a(ng-click='$state.go("options.inventory.drops"); expandMenu(null)')
                  span.glyphicon.glyphicon-gift
                  span=env.t('newSubscriberItem')
              li(ng-if='user.invitations.party.id')
                a(ui-sref='options.social.party', ng-click='expandMenu(null)')
                  span.glyphicon.glyphicon-user
                  span=env.t('invitedTo', {name: '{{user.invitations.party.name}}'})
              li(ng-repeat='guild in user.invitations.guilds')
                a(ui-sref='options.social.guilds.public', ng-click='expandMenu(null)')
                  span.glyphicon.glyphicon-user
                  span=env.t('invitedTo', {name: '{{guild.name}}'})
              li(ng-if='user.flags.classSelected && !user.preferences.disableClasses && user.stats.points')
                a(ui-sref='options.profile.stats', ng-click='expandMenu(null)')
                  span.glyphicon.glyphicon-plus-sign
                  span=env.t('haveUnallocated', {points: '{{user.stats.points}}'})
              li(ng-repeat='(k,v) in user.newMessages', ng-if='v.value')
                a(ng-click='k==party._id ? $state.go("options.social.party") : $state.go("options.social.guilds.detail",{gid:k}); expandMenu(null)')
                  span.glyphicon.glyphicon-comment
                  span {{v.name}}
                a(ng-click='Groups.seenMessage(k)', popover=env.t('clear'),popover-placement='right',popover-trigger='mouseenter',popover-append-to-body='true')
                  span.glyphicon.glyphicon-remove-circle
              // li(ng-if='user.items.special.valentineReceived[0] || user.items.special.nyeReceived[0]')
                a(ng-click='$state.go("options.inventory.drops"); expandMenu(null)')
                  span.glyphicon.glyphicon-envelope
                  span=env.t('holidayCard')

          ul.toolbar-controls
            //-li
              //-a(ng-click='') Clear all
            li.toolbar-controls-button
              a(ng-click='expandMenu(null)')=env.t('close')
      li.toolbar-audio
        a(ng-click='expandMenu("audio")')
          span.glyphicon(ng-class="{'glyphicon-volume-off':user.preferences.sound=='off', 'glyphicon-volume-up':user.preferences.sound!='off'}")
        div(ng-if='_expandedMenu=="audio"',style='min-width:150px')
          h4=env.t('audioTheme')
          div
            ul.toolbar-submenu(ng-click='expandMenu(null)')
              // Using [{k,v}] instead of {k:v,k:v} to maintain order ('off' at top)
              for theme in ['off','danielTheBard', 'wattsTheme']
                li
                  a(ng-class="{'bg-primary':user.preferences.sound=='#{theme}'}", ng-click="set({'preferences.sound':'#{theme}'})")=env.t('audioTheme_'+theme)

      li.toolbar-sync
        a(ng-click='User.sync()', popover=env.t('sync'),popover-placement='bottom',popover-trigger='mouseenter')
          span.glyphicon.glyphicon-refresh
      li.toolbar-settings
        a(ng-click='expandMenu("settings")')
          span.glyphicon.glyphicon-cog
        div(ng-if='_expandedMenu=="settings"')
          h4=env.t('settings')
          div
            ul.toolbar-submenu(ng-click='expandMenu(null)')
              li
                a(ng-click='logout()')=env.t('logout')
            ul.toolbar-submenu(ng-click='expandMenu(null)')
              li
                a(ui-sref='options.settings.settings')=env.t('site')
              li
                a(ui-sref='options.settings.api')=env.t('API')
              li
                a(ui-sref='options.settings.export')=env.t('export')
              li
                a(ui-sref='options.settings.promo')=env.t('promoCode')
              li
                a(ui-sref='options.settings.subscription')=env.t('subscription')
              li
                a(ui-sref='options.settings.notifications')=env.t('notifications')
            ul.toolbar-submenu(ng-click='expandMenu(null)')
              li
                a(href="http://habitrpg.wikia.com/wiki/FAQ", target='_blank')=env.t('FAQ')
              li
                a(href="https://vimeo.com/57654086", target='_blank')=env.t('tutorials')
          ul.toolbar-controls
            li.toolbar-controls-button
              a(ng-click='expandMenu(null)')=env.t('close')
    ul.toolbar-wallet
      li.toolbar-gems(popover-trigger='mouseenter', popover-title=env.t('gemsPopoverTitle'), popover=env.t('gemsWhatFor'), popover-placement='bottom',popover-append-to-body='true')
        a.gem-wallet(ng-click='openModal("buyGems",{track:"Gems > Toolbar"})')
          //-span.task-action-btn.tile.flush.bright.add-gems-btn ＋
          span.Pet_Currency_Gem2x.Gems
          span.gem-text {{user.balance * 4 | number:0}}
      li.toolbar-currency.gold(popover=env.t('gold') + ' ({{Shared.gold(user.stats.gp)}})', popover-placement='bottom',popover-trigger='mouseenter')
        span.shop_gold
        span {{Shared.gold(user.stats.gp) | goldRoundThousandsToK}}
      li.toolbar-currency.silver(popover=env.t('silver'), popover-placement='bottom',popover-trigger='mouseenter')
        span.shop_silver
        span {{Shared.silver(user.stats.gp)}}

    ul.toolbar-bailey(ng-class='{inactive: !_expandedMenu}')
      li.toolbar-bailey-container(ng-if='user.flags.tour.intro!=-2')
        .npc_justin_head.npc_bailey_head(popover="Continue Tour", popover-trigger='mouseenter', popover-placement='bottom', ng-click='Guide.goto("intro", user.flags.tour.intro, true)')

    ul.toolbar-bailey(ng-class='{inactive: !_expandedMenu}')
      li.toolbar-bailey-container(ng-if='user.flags.newStuff')
        .npc_bailey.npc_bailey_head(popover=env.t('psst'), popover-trigger='mouseenter', popover-placement='right', ng-click='openModal("newStuff",{size:"lg"})')
