Skip to content
Snippets Groups Projects
Links.vue 2.99 KiB
Newer Older
<template>
  <ul class="nav nav-tabs">
    <li role="presentation" v-bind:class="{ active: $route.name === 'home' }">
      <router-link to="/">
        Home
      </router-link>
    </li>
    <li role="presentation" v-bind:class="{ active: $route.name === 'about' }">
      <router-link to="/about">
        About
      </router-link>
    </li>
HongKee Moon's avatar
HongKee Moon committed
    <!--<li role="presentation" v-bind:class="{ active: $route.name === 'condensates' }">-->
      <!--<router-link to="/condensates">-->
        <!--Condensates-->
HongKee Moon's avatar
HongKee Moon committed
      <!--</router-link>-->
    <!--</li>-->
    <!--<li role="presentation" v-bind:class="{ active: $route.name === 'browse' }">-->
      <!--<router-link to="/browse">-->
        <!--Browse-->
      <!--</router-link>-->
    <!--</li>-->
    <li role="presentation" v-bind:class="{ active: $route.name === 'biomolecular' }">
      <router-link to="/biomolecular">
        Biomolecular Condensates
      </router-link>
    </li>
    <li role="presentation" v-bind:class="{ active: $route.name === 'synthetic' }">
      <router-link to="/synthetic">
        Synthetic Condensates
HongKee Moon's avatar
HongKee Moon committed
      </router-link>
    </li>
HongKee Moon's avatar
HongKee Moon committed
    <!--<li role="presentation" v-bind:class="{ active: $route.name === 'condensate_example' }">-->
    <!--<router-link to="/condensate_example">-->
      <!--Condensate Example-->
    <!--</router-link>-->
    <!--</li>-->
    <!--<li role="presentation" v-bind:class="{ active: $route.name === 'protein_example' }">-->
      <!--<router-link to="/protein_example">-->
        <!--Protein Example-->
      <!--</router-link>-->
    <!--</li>-->
    <li role="presentation" v-bind:class="{ active: $route.name === 'statistics' }">
      <router-link to="/statistics">
        Statistics
      </router-link>
    </li>
    <li role="presentation" v-bind:class="{ active: $route.name === 'encyclopedia' }">
      <router-link to="/encyclopedia">
        Encyclopedia
      </router-link>
    </li>
moon's avatar
moon committed
    <li v-show="userData !== undefined" role="presentation" v-bind:class="{ active: $route.name === 'profile' }">
      <router-link to="/profile">
        Profile
      </router-link>
    </li>
    <li v-show="userData !== undefined" role="presentation">
      <router-link to="/login" v-on:click.native="signOut">
        <span class="fa fa-sign-out"/>
      </router-link>
    </li>
    <li v-show="userData === undefined" role="presentation" v-bind:class="{ active: $route.name === 'login' }">
      <router-link to="/login">
        Login
      </router-link>
    </li>
  </ul>
</template>

<script>
export default {
  name: "Links",
moon's avatar
moon committed
  data() {
    return {
      userData: undefined
    }
  },
  methods: {
    signOut() {
      const vm = this
      window.localStorage.removeItem('jwt');
      window.localStorage.removeItem('userData');
      vm.userData = undefined
    }
  },
  mounted: function () {
moon's avatar
moon committed
    const vm = this
    vm.userData = window.localStorage.getItem('userData')
    if(vm.userData === null) {
      vm.userData = undefined
    }

    // console.log(vm.userData)
    // console.log(this.$route.name)
  }
}
</script>