Skip to content
Snippets Groups Projects
Links.vue 8.79 KiB
Newer Older
<template>
  <ul class="nav nav-tabs">
moon's avatar
moon committed
    <li
      role="presentation"
      :class="{ active: $route.name === 'home' }"
      @mouseover="openCondensateSubMenu = false"
moon's avatar
moon committed
    >
moon's avatar
moon committed
      <router-link
        to="/"
        exact
      >
        <span class="text-2xl">Home</span>
moon's avatar
moon committed
      </router-link>
moon's avatar
moon committed
    <li
      role="presentation"
      :class="{ active: $route.name === 'about' }"
      @mouseover="openCondensateSubMenu = false"
moon's avatar
moon committed
    >
      <router-link to="/about">
        <span class="text-2xl">About</span>
moon's avatar
moon committed
      </router-link>
HongKee Moon's avatar
HongKee Moon committed
    <!--<li role="presentation" v-bind:class="{ active: $route.name === 'condensates' }">-->
    <!--<router-link to="/condensates">-->
    <!--Condensates-->
    <!--</router-link>-->
HongKee Moon's avatar
HongKee Moon committed
    <!--</li>-->
    <!--<li role="presentation" v-bind:class="{ active: $route.name === 'browse' }">-->
    <!--<router-link to="/browse">-->
    <!--Browse-->
    <!--</router-link>-->
    <li
      role="proteins"
      :class="{ active: $route.name === 'proteins' }"
      @mouseover="openCondensateSubMenu = false"
    >
      <router-link to="/proteins">
        <span class="text-2xl">Proteins</span>
      </router-link>
    </li>
      :class="{
        active:
          $route.name === 'condensates' ||
          $route.name === 'biomolecular' ||
          $route.name === 'synthetic',
      }"
      class="nav-item dropdown relative"
      @mouseover="openCondensateMenu"
      <router-link to="/condensates">
        <span class="text-2xl">Condensates</span>
moon's avatar
moon committed
      </router-link>
moon's avatar
moon committed
        v-if="openCondensateSubMenu"
        class="
          absolute
          z-50
          bg-white
          border
          rounded-b-lg
          border-gray-300
          divide-y
        "
        @mouseleave="openCondensateSubMenu = false"
      >
        <ul>
          <li role="presentation">
            <router-link
              to="/biomolecular"
              class="hover:no-underline dropdown-item h-16 pt-4"
            >
              <span class="text-2xl"> Biomolecular Condensates</span>
            </router-link>
          </li>
          <li role="presentation">
            <router-link
              to="/synthetic"
              class="dropdown-item hover:no-underline h-16 pt-4"
            >
              <span class="text-2xl">Synthetic Condensates</span>
            </router-link>
          </li>
        </ul>
    <!-- <div
        v-if="openCondensateSubMenu"
        @mouseleave="openCondensateSubMenu = false"
        class="
          absolute
          z-50
          w-full
          rounded-lg
          border border-gray-300
          rounded-b-lg
          shadow-lg
          bg-white
        "
      >
        <li
          role="presentation"
         :class="{ active: $route.name === 'biomolecular' }"
          class="
            py-4
            px-6
            text-2xl
            font-bold
            hover:bg-gray-300 hover:text-gray-500 hover:no-underline
          "
        >
          <router-link to="/biomolecular" class="hover:no-underline">
           Biomolecular Condensates
          </router-link>
        </li>
        <li
          role="presentation"
         :class="{ active: $route.name === 'synthetic' }"
          class="
            py-4
            px-6
            text-2xl
            font-bold
            hover:bg-gray-300 hover:text-gray-500 hover:no-underline
          "
        >
          <router-link to="/synthetic" class="hover:no-underline">
            Synthetic Condensates
          </router-link>
        </li>
      </div> -->

    <!-- <li
      class="flex relative"
      :class="{ active: $route.name === 'biomolecular' }"
      @mouseleave="openSubMenu = false"
      <router-link
        to="/biomolecular"
        @mouseover="openSubMenu = true"
        class="
          inline-block
          hover:bg-gray-300 hover:text-gray-500 hover:no-underline
          py-4
          px-6
          text-2xl
          font-bold
          text-center
          flex
        "
      >
        Biomolecular Condensates
        <span>
          <svg
            class="
              fill-current
              h-4
              w-4
              transform
              group-hover:-rotate-180 group-hover:text-red-900
              transition
              duration-150
              ease-in-out
            "
            xmlns="http://www.w3.org/2000/svg"
            viewBox="0 0 20 20"
          >
            <path
              d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"
            />
          </svg>
        </span>
moon's avatar
moon committed
      </router-link>
HongKee Moon's avatar
HongKee Moon committed
    </li>

    <li role="presentation" :class="{ active: $route.name === 'synthetic' }">
      <router-link
        to="/synthetic"
        class="
          inline-block
          hover:bg-gray-300 hover:text-gray-500 hover:no-underline
          py-4
          px-6
          text-2xl
          font-bold
          text-center
        "
      >
        Synthetic Condensates
      </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">-->
HongKee Moon's avatar
HongKee Moon committed
    <!--</router-link>-->
    <!--</li>-->
    <!--<li role="presentation" v-bind:class="{ active: $route.name === 'protein_example' }">-->
    <!--<router-link to="/protein_example">-->
    <!--Protein Example-->
    <!--</router-link>-->
HongKee Moon's avatar
HongKee Moon committed
    <!--</li>-->
moon's avatar
moon committed
      :class="{ active: $route.name === 'statistics' }"
      @mouseover="openCondensateSubMenu = false"
moon's avatar
moon committed
      <router-link to="/statistics">
        <span class="text-2xl">Statistics</span>
moon's avatar
moon committed
      </router-link>
moon's avatar
moon committed
    <li
      role="presentation"
      @mouseover="openCondensateSubMenu = false"
    >
moon's avatar
moon committed
      <a href="https://wiki.cd-code.org">
        <span class="text-2xl">Encyclopedia</span>
moon's avatar
moon committed
          (userRole === 'Contributor' || userRole === 'Maintainer')
moon's avatar
moon committed
      role="presentation"
      :class="{ active: $route.name === 'updateItems' }"
      @mouseover="openCondensateSubMenu = false"
moon's avatar
moon committed
      <router-link to="/updateItems">
        {{
          userRole === "Maintainer"
            ? "All Submitted Changes"
            : "My Submitted Changes"
        }}
moon's avatar
moon committed
      </router-link>
    <li
      role="presentation"
      :class="{ active: $route.name === 'help' }"
      @mouseover="openCondensateSubMenu = false"
    >
      <router-link to="/help">
        <span class="text-2xl">Help</span>
      </router-link>
    </li>
<!--    <li-->
<!--      role="presentation"-->
<!--      :class="{ active: $route.name === 'test' }"-->
<!--      @mouseover="openCondensateSubMenu = false"-->
<!--    >-->
<!--      <router-link to="/test/P62750">-->
<!--        <span class="text-2xl">Test</span>-->
<!--      </router-link>-->
<!--    </li>-->
moon's avatar
moon committed
      v-show="userData !== null"
      role="presentation"
      :class="{ active: $route.name === 'profile' }"
      @mouseover="openCondensateSubMenu = false"
moon's avatar
moon committed
    >
      <router-link to="/profile">
        <span class="text-2xl">Profile</span>
moon's avatar
moon committed
      </router-link>
moon's avatar
moon committed
    </li>
moon's avatar
moon committed
    <li
      v-show="userData !== null"
      role="presentation"
      @mouseover="openCondensateSubMenu = false"
moon's avatar
moon committed
    >
moon's avatar
moon committed
      <router-link
        to="/login"
        @click.native="signOut"
      >
moon's avatar
moon committed
      </router-link>
    </li>
    <li
      v-show="userData === null"
      role="presentation"
moon's avatar
moon committed
      :class="{ active: $route.name === 'login' }"
      @mouseover="openCondensateSubMenu = false"
moon's avatar
moon committed
      <router-link to="/login">
        <span class="text-2xl">Login</span>
moon's avatar
moon committed
      </router-link>
moon's avatar
moon committed
    </li>
  </ul>
</template>

<script>
export default {
moon's avatar
moon committed
  name: 'Links',
moon's avatar
moon committed
  data() {
    return {
      // userData: this.$store.getters['User/userData']
  computed: {
    userData: function () {
moon's avatar
moon committed
      return this.$store.getters['User/userData'];
moon's avatar
moon committed
      return this.$store.getters['User/userRole'];
  mounted: function () {
moon's avatar
moon committed

    // console.log(vm.userData)
    // console.log(this.$route.name)
    // if(vm.userData !== null) {
    //   vm.$router.push('/profile')
    // }
  },
moon's avatar
moon committed
  methods: {
    openCondensateMenu() {
      this.openCondensateSubMenu = true;
    },
moon's avatar
moon committed
    signOut() {
      const vm = this;
moon's avatar
moon committed
      window.localStorage.removeItem('jwt');
      window.localStorage.removeItem('userData');
      window.localStorage.removeItem('roleName');
      vm.$store.dispatch('User/logOut');
      vm.$router.push('/login');
moon's avatar
moon committed
    },
  },
  color: black;
}

a:hover {
  color: #ef0087 !important;
  color: #ef0087 !important;