<template>
  <div
    id="app"
    :style="bgAppStyle"
  >
    <div
      class="app-bg-wrapper"
      :style="bgStyle"
    />
    <MobileNav v-if="isMobileLayout" />
    <nav
      v-else
      id="nav"
      class="nav-bar container"
      @click="scrollToTop()"
    >
      <div
        class="logo"
        :style="logoBgStyle"
      >
        <div
          class="mask"
          :style="logoMaskStyle"
        />
        <img
          :src="logo"
          :style="logoStyle"
        >
      </div>
      <div class="inner-nav">
        <div class="item">
          <router-link
            class="site-name"
            :to="{ name: 'root' }"
            active-class="home"
          >
            {{ sitename }}
          </router-link>
        </div>
        <div class="item right">
          <search-bar
            class="nav-icon mobile-hidden"
            @toggled="onSearchBarToggled"
            @click.stop.native
          />
          <router-link
            class="mobile-hidden"
            :to="{ name: 'settings'}"
          >
            <i
              class="button-icon icon-cog nav-icon"
              :title="$t('nav.preferences')"
            />
          </router-link>
          <a
            v-if="currentUser"
            href="#"
            class="mobile-hidden"
            @click.prevent="logout"
          ><i
            class="button-icon icon-logout nav-icon"
            :title="$t('login.logout')"
          /></a>
        </div>
      </div>
    </nav>
    <div
      id="content"
      class="container"
    >
      <div class="sidebar-flexer mobile-hidden">
        <div class="sidebar-bounds">
          <div class="sidebar-scroller">
            <div class="sidebar">
              <user-panel />
              <div v-if="!isMobileLayout">
                <nav-panel />
                <instance-specific-panel v-if="showInstanceSpecificPanel" />
                <features-panel v-if="!currentUser && showFeaturesPanel" />
                <who-to-follow-panel v-if="currentUser && suggestionsEnabled" />
                <notifications v-if="currentUser" />
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="main">
        <div
          v-if="!currentUser"
          class="login-hint panel panel-default"
        >
          <router-link
            :to="{ name: 'login' }"
            class="panel-body"
          >
            {{ $t("login.hint") }}
          </router-link>
        </div>
        <transition name="fade">
          <router-view />
        </transition>
      </div>
      <media-modal />
    </div>
    <chat-panel
      v-if="currentUser && chat"
      :floating="true"
      class="floating-chat mobile-hidden"
    />
    <MobilePostStatusModal />
    <UserReportingModal />
    <portal-target name="modal" />
  </div>
</template>

<script src="./App.js"></script>
<style lang="scss" src="./App.scss"></style>
