2018-01-09 17:52:26 +01:00
|
|
|
<template>
|
2022-07-12 10:55:28 +02:00
|
|
|
<nav class="bg-white border-gray-200 px-2 sm:px-4 py-2.5 dark:bg-gray-900">
|
2022-08-12 16:46:44 +02:00
|
|
|
<div class="container mx-auto flex flex-wrap items-center mx-auto gap-4">
|
2022-07-12 10:55:28 +02:00
|
|
|
<router-link :to="{ name: RouteName.HOME }" class="flex items-center">
|
2022-07-12 10:55:28 +02:00
|
|
|
<MobilizonLogo class="w-40" />
|
2022-07-12 10:55:28 +02:00
|
|
|
</router-link>
|
2022-08-12 16:46:44 +02:00
|
|
|
<div class="flex items-center md:order-2 ml-auto" v-if="currentActor?.id">
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-dropdown>
|
|
|
|
<template #trigger>
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="flex mr-3 text-sm rounded-full md:mr-0 focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600"
|
|
|
|
id="user-menu-button"
|
|
|
|
aria-expanded="false"
|
|
|
|
>
|
|
|
|
<span class="sr-only">{{ t("Open user menu") }}</span>
|
|
|
|
<figure class="" v-if="currentActor?.avatar">
|
|
|
|
<img
|
|
|
|
class="rounded-full"
|
|
|
|
alt=""
|
|
|
|
:src="currentActor?.avatar.url"
|
|
|
|
width="32"
|
|
|
|
height="32"
|
|
|
|
/>
|
|
|
|
</figure>
|
|
|
|
<AccountCircle :size="32" />
|
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<!-- Dropdown menu -->
|
|
|
|
<div
|
|
|
|
class="z-50 mt-4 text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700 dark:divide-gray-600"
|
|
|
|
position="bottom-left"
|
|
|
|
>
|
|
|
|
<o-dropdown-item aria-role="listitem">
|
|
|
|
<div class="">
|
|
|
|
<span class="block text-sm text-gray-900 dark:text-white">{{
|
|
|
|
displayName(currentActor)
|
|
|
|
}}</span>
|
|
|
|
<span
|
|
|
|
class="block text-sm font-medium text-gray-500 truncate dark:text-gray-400"
|
|
|
|
>{{ currentUser?.role }}</span
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</o-dropdown-item>
|
|
|
|
<o-dropdown-item
|
|
|
|
aria-role="listitem"
|
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.SETTINGS }"
|
|
|
|
>
|
|
|
|
<span
|
|
|
|
class="block py-2 px-4 text-sm text-gray-700 dark:text-gray-200 dark:hover:text-white"
|
|
|
|
>{{ t("My account") }}</span
|
|
|
|
>
|
|
|
|
</o-dropdown-item>
|
|
|
|
<o-dropdown-item
|
|
|
|
aria-role="listitem"
|
|
|
|
v-if="currentUser?.role === ICurrentUserRole.ADMINISTRATOR"
|
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.ADMIN_DASHBOARD }"
|
|
|
|
>
|
|
|
|
<span
|
|
|
|
class="block py-2 px-4 text-sm text-gray-700 dark:text-gray-200 dark:hover:text-white"
|
|
|
|
>{{ t("Administration") }}</span
|
|
|
|
>
|
|
|
|
</o-dropdown-item>
|
|
|
|
<o-dropdown-item
|
|
|
|
aria-role="listitem"
|
|
|
|
@click="logout"
|
|
|
|
@keyup.enter="logout"
|
|
|
|
>
|
|
|
|
<span
|
|
|
|
class="block py-2 px-4 text-sm text-gray-700 dark:text-gray-200 dark:hover:text-white"
|
|
|
|
>{{ t("Log out") }}</span
|
|
|
|
>
|
|
|
|
</o-dropdown-item>
|
|
|
|
</div>
|
|
|
|
</o-dropdown>
|
|
|
|
</div>
|
|
|
|
<button
|
2022-08-12 16:46:44 +02:00
|
|
|
@click="showMobileMenu = !showMobileMenu"
|
2022-07-12 10:55:28 +02:00
|
|
|
type="button"
|
|
|
|
class="inline-flex items-center p-2 ml-1 text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
|
|
|
|
aria-controls="mobile-menu-2"
|
|
|
|
aria-expanded="false"
|
|
|
|
>
|
|
|
|
<span class="sr-only">{{ t("Open main menu") }}</span>
|
|
|
|
<svg
|
|
|
|
class="w-6 h-6"
|
|
|
|
aria-hidden="true"
|
|
|
|
fill="currentColor"
|
|
|
|
viewBox="0 0 20 20"
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
>
|
|
|
|
<path
|
|
|
|
fill-rule="evenodd"
|
|
|
|
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
|
|
|
|
clip-rule="evenodd"
|
|
|
|
></path>
|
|
|
|
</svg>
|
|
|
|
</button>
|
|
|
|
<div
|
|
|
|
class="justify-between items-center w-full md:flex md:w-auto md:order-1"
|
|
|
|
id="mobile-menu-2"
|
|
|
|
:class="{ hidden: !showMobileMenu }"
|
|
|
|
>
|
|
|
|
<ul
|
|
|
|
class="flex flex-col md:flex-row md:space-x-8 mt-2 md:mt-0 md:text-sm md:font-medium"
|
|
|
|
>
|
2022-08-12 16:46:44 +02:00
|
|
|
<li v-if="currentActor?.id">
|
|
|
|
<router-link
|
|
|
|
:to="{ name: RouteName.MY_EVENTS }"
|
|
|
|
class="block py-2 pr-4 pl-3 text-gray-700 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-gray-400 md:dark:hover:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700"
|
|
|
|
>{{ t("My events") }}</router-link
|
|
|
|
>
|
|
|
|
</li>
|
|
|
|
<li v-if="currentActor?.id">
|
|
|
|
<router-link
|
|
|
|
:to="{ name: RouteName.MY_GROUPS }"
|
|
|
|
class="block py-2 pr-4 pl-3 text-gray-700 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-gray-400 md:dark:hover:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700"
|
|
|
|
>{{ t("My groups") }}</router-link
|
|
|
|
>
|
|
|
|
</li>
|
2022-07-12 10:55:28 +02:00
|
|
|
<li v-if="!currentActor?.id">
|
|
|
|
<router-link
|
|
|
|
:to="{ name: RouteName.LOGIN }"
|
|
|
|
class="block py-2 pr-4 pl-3 text-gray-700 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-gray-400 md:dark:hover:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700"
|
|
|
|
>{{ t("Login") }}</router-link
|
|
|
|
>
|
|
|
|
</li>
|
|
|
|
<li v-if="!currentActor?.id">
|
|
|
|
<router-link
|
|
|
|
:to="{ name: RouteName.REGISTER }"
|
|
|
|
class="block py-2 pr-4 pl-3 text-gray-700 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-gray-400 md:dark:hover:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700"
|
|
|
|
>{{ t("Register") }}</router-link
|
|
|
|
>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
<!-- <o-navbar
|
2021-10-10 16:24:12 +02:00
|
|
|
id="navbar"
|
2020-11-30 10:24:11 +01:00
|
|
|
type="is-secondary"
|
2022-07-12 10:55:28 +02:00
|
|
|
wrapper-class="container mx-auto"
|
|
|
|
v-model:active="mobileNavbarActive"
|
2020-11-30 10:24:11 +01:00
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<template #brand>
|
|
|
|
<o-navbar-item
|
2020-11-30 10:24:11 +01:00
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.HOME }"
|
|
|
|
:aria-label="$t('Home')"
|
|
|
|
>
|
2020-02-18 08:57:00 +01:00
|
|
|
<logo />
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-navbar-item>
|
2019-09-20 18:22:25 +02:00
|
|
|
</template>
|
2022-07-12 10:55:28 +02:00
|
|
|
<template #start>
|
|
|
|
<o-navbar-item tag="router-link" :to="{ name: RouteName.SEARCH }">{{
|
2020-02-18 08:57:00 +01:00
|
|
|
$t("Explore")
|
2022-07-12 10:55:28 +02:00
|
|
|
}}</o-navbar-item>
|
|
|
|
<o-navbar-item
|
|
|
|
v-if="currentActor.id && currentUser?.isLoggedIn"
|
2021-05-18 11:01:30 +02:00
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.MY_EVENTS }"
|
2022-07-12 10:55:28 +02:00
|
|
|
>{{ $t("My events") }}</o-navbar-item
|
2021-05-18 11:01:30 +02:00
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-navbar-item
|
2020-06-08 16:47:57 +02:00
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.MY_GROUPS }"
|
2021-05-18 11:01:30 +02:00
|
|
|
v-if="
|
|
|
|
config &&
|
|
|
|
config.features.groups &&
|
|
|
|
currentActor.id &&
|
2022-07-12 10:55:28 +02:00
|
|
|
currentUser?.isLoggedIn
|
2021-05-18 11:01:30 +02:00
|
|
|
"
|
2022-07-12 10:55:28 +02:00
|
|
|
>{{ $t("My groups") }}</o-navbar-item
|
2020-06-08 16:47:57 +02:00
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-navbar-item
|
2021-05-18 11:01:30 +02:00
|
|
|
tag="span"
|
|
|
|
v-if="
|
|
|
|
config &&
|
|
|
|
config.features.eventCreation &&
|
|
|
|
currentActor.id &&
|
2022-07-12 10:55:28 +02:00
|
|
|
currentUser?.isLoggedIn
|
2021-05-18 11:01:30 +02:00
|
|
|
"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-button
|
2021-10-06 18:00:50 +02:00
|
|
|
v-if="!hideCreateEventsButton"
|
2020-11-30 10:24:11 +01:00
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.CREATE_EVENT }"
|
2022-07-12 10:55:28 +02:00
|
|
|
variant="primary"
|
|
|
|
>{{ $t("Create") }}</o-button
|
2020-11-30 10:24:11 +01:00
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-navbar-item>
|
2019-09-20 18:22:25 +02:00
|
|
|
</template>
|
2022-07-12 10:55:28 +02:00
|
|
|
<template #end>
|
|
|
|
<o-navbar-item tag="div">
|
2020-08-18 15:26:11 +02:00
|
|
|
<search-field @navbar-search="mobileNavbarActive = false" />
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-navbar-item>
|
2019-09-20 18:22:25 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-navbar-dropdown
|
|
|
|
v-if="currentActor.id && currentUser?.isLoggedIn"
|
2021-06-11 18:31:13 +02:00
|
|
|
right
|
|
|
|
collapsible
|
2021-10-10 16:24:12 +02:00
|
|
|
ref="user-dropdown"
|
|
|
|
tabindex="0"
|
|
|
|
tag="span"
|
|
|
|
@keyup.enter="toggleMenu"
|
2021-06-11 18:31:13 +02:00
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<template #label v-if="currentActor">
|
2021-06-11 18:31:13 +02:00
|
|
|
<div class="identity-wrapper">
|
|
|
|
<div>
|
|
|
|
<figure class="image is-32x32" v-if="currentActor.avatar">
|
|
|
|
<img
|
|
|
|
class="is-rounded"
|
|
|
|
alt="avatarUrl"
|
|
|
|
:src="currentActor.avatar.url"
|
|
|
|
/>
|
|
|
|
</figure>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-icon v-else icon="account-circle" />
|
2021-06-11 18:31:13 +02:00
|
|
|
</div>
|
|
|
|
<div class="media-content is-hidden-desktop">
|
|
|
|
<span>{{ displayName(currentActor) }}</span>
|
|
|
|
<span class="has-text-grey-dark" v-if="currentActor.name"
|
|
|
|
>@{{ currentActor.preferredUsername }}</span
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-09-20 18:22:25 +02:00
|
|
|
</template>
|
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
No identities dropdown if no identities
|
|
|
|
<span v-if="identities.length <= 1"></span>
|
|
|
|
<o-navbar-item
|
2020-02-18 08:57:00 +01:00
|
|
|
tag="span"
|
|
|
|
v-for="identity in identities"
|
|
|
|
v-else
|
|
|
|
:active="identity.id === currentActor.id"
|
|
|
|
:key="identity.id"
|
2021-10-10 16:24:12 +02:00
|
|
|
tabindex="0"
|
2022-07-12 10:55:28 +02:00
|
|
|
@click="setIdentity({
|
|
|
|
preferredUsername: identity.preferredUsername,
|
|
|
|
})"
|
|
|
|
@keyup.enter="setIdentity({
|
|
|
|
preferredUsername: identity.preferredUsername,
|
|
|
|
})"
|
2020-02-18 08:57:00 +01:00
|
|
|
>
|
2021-10-10 16:24:12 +02:00
|
|
|
<span>
|
2019-09-20 18:22:25 +02:00
|
|
|
<div class="media-left">
|
|
|
|
<figure class="image is-32x32" v-if="identity.avatar">
|
2021-06-15 17:25:33 +02:00
|
|
|
<img
|
|
|
|
class="is-rounded"
|
|
|
|
loading="lazy"
|
|
|
|
:src="identity.avatar.url"
|
|
|
|
alt
|
|
|
|
/>
|
2019-06-17 17:15:27 +02:00
|
|
|
</figure>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-icon v-else size="is-medium" icon="account-circle" />
|
2019-04-03 17:29:03 +02:00
|
|
|
</div>
|
2019-04-01 11:49:54 +02:00
|
|
|
|
2019-09-20 18:22:25 +02:00
|
|
|
<div class="media-content">
|
2021-06-11 18:31:13 +02:00
|
|
|
<span>{{ displayName(identity) }}</span>
|
|
|
|
<span class="has-text-grey-dark" v-if="identity.name"
|
2020-02-18 08:57:00 +01:00
|
|
|
>@{{ identity.preferredUsername }}</span
|
|
|
|
>
|
2019-04-03 17:29:03 +02:00
|
|
|
</div>
|
2019-09-20 18:22:25 +02:00
|
|
|
</span>
|
|
|
|
|
2021-10-10 16:24:12 +02:00
|
|
|
<hr class="navbar-divider" role="presentation" />
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-navbar-item>
|
2019-09-20 18:22:25 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-navbar-item
|
2020-11-30 10:24:11 +01:00
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.UPDATE_IDENTITY }"
|
2022-07-12 10:55:28 +02:00
|
|
|
>{{ $t("My account") }}</o-navbar-item
|
2020-11-30 10:24:11 +01:00
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-navbar-item
|
2020-02-18 08:57:00 +01:00
|
|
|
v-if="currentUser.role === ICurrentUserRole.ADMINISTRATOR"
|
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.ADMIN_DASHBOARD }"
|
2022-07-12 10:55:28 +02:00
|
|
|
>{{ $t("Administration") }}</o-navbar-item
|
2020-02-18 08:57:00 +01:00
|
|
|
>
|
2019-09-20 18:22:25 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-navbar-item
|
2021-10-10 16:24:12 +02:00
|
|
|
tag="span"
|
|
|
|
tabindex="0"
|
|
|
|
@click="logout"
|
|
|
|
@keyup.enter="logout"
|
|
|
|
>
|
|
|
|
<span>{{ $t("Log out") }}</span>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-navbar-item>
|
|
|
|
</o-navbar-dropdown>
|
2019-09-20 18:22:25 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-navbar-item v-else tag="div">
|
2019-09-20 18:22:25 +02:00
|
|
|
<div class="buttons">
|
2020-02-18 08:57:00 +01:00
|
|
|
<router-link
|
|
|
|
class="button is-primary"
|
|
|
|
v-if="config && config.registrationsOpen"
|
|
|
|
:to="{ name: RouteName.REGISTER }"
|
|
|
|
>
|
|
|
|
<strong>{{ $t("Sign up") }}</strong>
|
2019-09-20 18:22:25 +02:00
|
|
|
</router-link>
|
|
|
|
|
2020-11-30 10:24:11 +01:00
|
|
|
<router-link
|
|
|
|
class="button is-light"
|
|
|
|
:to="{ name: RouteName.LOGIN }"
|
|
|
|
>{{ $t("Log in") }}</router-link
|
|
|
|
>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-navbar-item>
|
2019-09-20 18:22:25 +02:00
|
|
|
</template>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-navbar> -->
|
2018-01-09 17:52:26 +01:00
|
|
|
</template>
|
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
<script lang="ts" setup>
|
2022-07-12 10:55:28 +02:00
|
|
|
import MobilizonLogo from "@/components/MobilizonLogo.vue";
|
2020-11-27 19:27:44 +01:00
|
|
|
import { ICurrentUserRole } from "@/types/enums";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { logout } from "../utils/auth";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { displayName } from "../types/actor";
|
2020-02-18 08:57:00 +01:00
|
|
|
import RouteName from "../router/name";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { ref, watch } from "vue";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { useRouter } from "vue-router";
|
|
|
|
import { useI18n } from "vue-i18n";
|
|
|
|
import AccountCircle from "vue-material-design-icons/AccountCircle.vue";
|
|
|
|
// import { useProgrammatic } from "@oruga-ui/oruga-next";
|
|
|
|
import { useCurrentUserClient } from "@/composition/apollo/user";
|
2022-07-12 10:55:28 +02:00
|
|
|
import {
|
|
|
|
useCurrentActorClient,
|
|
|
|
useCurrentUserIdentities,
|
|
|
|
} from "@/composition/apollo/actor";
|
2022-07-12 10:55:28 +02:00
|
|
|
// import { useRestrictions } from "@/composition/apollo/config";
|
2019-08-12 16:04:16 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const { currentUser } = useCurrentUserClient();
|
|
|
|
const { currentActor } = useCurrentActorClient();
|
|
|
|
// const { restrictions } = useRestrictions();
|
2021-10-10 16:25:50 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
// const userDropdown = ref();
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const router = useRouter();
|
|
|
|
// const route = useRoute();
|
2020-10-28 18:58:43 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const { identities } = useCurrentUserIdentities();
|
2019-10-08 18:13:06 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
// const mobileNavbarActive = ref(false);
|
2019-09-11 09:59:01 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
// const toggleMenu = (): void => {
|
|
|
|
// console.debug("called toggleMenu");
|
|
|
|
// userDropdown.value.showMenu();
|
|
|
|
// };
|
|
|
|
|
|
|
|
const { t } = useI18n({ useScope: "global" });
|
2021-10-06 18:00:50 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
watch(identities, () => {
|
2022-07-12 10:55:28 +02:00
|
|
|
// If we don't have any identities, the user has validated their account,
|
|
|
|
// is logging for the first time but didn't create an identity somehow
|
2022-07-12 10:55:28 +02:00
|
|
|
if (identities.value && identities.value.length === 0) {
|
|
|
|
console.debug(
|
|
|
|
"We have no identities listed for current user",
|
|
|
|
identities.value
|
|
|
|
);
|
2022-07-12 10:55:28 +02:00
|
|
|
console.debug("Pushing route to REGISTER_PROFILE");
|
2022-07-12 10:55:28 +02:00
|
|
|
router.push({
|
|
|
|
name: RouteName.REGISTER_PROFILE,
|
|
|
|
params: {
|
|
|
|
email: currentUser.value?.email,
|
|
|
|
userAlreadyActivated: "true",
|
|
|
|
},
|
|
|
|
});
|
2021-10-06 18:00:50 +02:00
|
|
|
}
|
2022-07-12 10:55:28 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// watch(loggedUser, () => {
|
|
|
|
// if (loggedUser.value?.locale) {
|
|
|
|
// console.debug("Setting locale from navbar");
|
|
|
|
// loadLanguageAsync(loggedUser.value?.locale);
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
|
|
|
|
// const handleErrors = async (errors: GraphQLError[]): Promise<void> => {
|
|
|
|
// if (
|
|
|
|
// errors.length > 0 &&
|
|
|
|
// errors[0].message ===
|
|
|
|
// "You need to be logged-in to view your list of identities"
|
|
|
|
// ) {
|
|
|
|
// await doLogout();
|
|
|
|
// }
|
|
|
|
// };
|
|
|
|
|
|
|
|
// const { oruga } = useProgrammatic();
|
|
|
|
|
|
|
|
// const doLogout = async (): Promise<void> => {
|
|
|
|
// await logout();
|
|
|
|
// oruga.notification.open({
|
|
|
|
// message: t("You have been disconnected"),
|
|
|
|
// variant: "success",
|
|
|
|
// position: "is-bottom-right",
|
|
|
|
// duration: 5000,
|
|
|
|
// });
|
|
|
|
|
|
|
|
// if (route.name === RouteName.HOME) return;
|
|
|
|
// await router.push({ name: RouteName.HOME });
|
|
|
|
// };
|
|
|
|
|
|
|
|
// const { onDone, mutate: setIdentity } = useMutation(UPDATE_DEFAULT_ACTOR);
|
|
|
|
|
|
|
|
// onDone(() => {
|
|
|
|
// changeIdentity(identity);
|
|
|
|
// });
|
|
|
|
|
|
|
|
// const hideCreateEventsButton = computed((): boolean => {
|
|
|
|
// return !!restrictions.value?.onlyGroupsCanCreateEvents;
|
|
|
|
// });
|
|
|
|
|
|
|
|
// @Component({
|
|
|
|
// apollo: {
|
|
|
|
// currentUser: CURRENT_USER_CLIENT,
|
|
|
|
// currentActor: CURRENT_ACTOR_CLIENT,
|
|
|
|
// // identities: {
|
|
|
|
// // query: IDENTITIES,
|
|
|
|
// // update: ({ identities }) =>
|
|
|
|
// // identities
|
|
|
|
// // ? identities.map((identity: IPerson) => new Person(identity))
|
|
|
|
// // : [],
|
|
|
|
// // skip() {
|
|
|
|
// // return this.currentUser.isLoggedIn === false;
|
|
|
|
// // },
|
|
|
|
// // error({ graphQLErrors }) {
|
|
|
|
// // this.handleErrors(graphQLErrors);
|
|
|
|
// // },
|
|
|
|
// // },
|
|
|
|
// config: CONFIG,
|
|
|
|
// loggedUser: {
|
|
|
|
// query: USER_SETTINGS,
|
|
|
|
// skip() {
|
|
|
|
// return !this.currentUser || this.currentUser.isLoggedIn === false;
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// })
|
|
|
|
// export default class NavBar extends Vue {
|
|
|
|
// currentActor!: IPerson;
|
|
|
|
|
|
|
|
// config!: IConfig;
|
|
|
|
|
|
|
|
// currentUser!: ICurrentUser;
|
|
|
|
|
|
|
|
// loggedUser!: IUser;
|
|
|
|
|
|
|
|
// ICurrentUserRole = ICurrentUserRole;
|
|
|
|
|
|
|
|
// identities: IPerson[] = [];
|
|
|
|
|
|
|
|
// RouteName = RouteName;
|
|
|
|
|
|
|
|
// mobileNavbarActive = false;
|
|
|
|
|
|
|
|
// displayName = displayName;
|
|
|
|
|
|
|
|
// // @Ref("user-dropdown") userDropDown!: any;
|
|
|
|
|
|
|
|
// // toggleMenu(): void {
|
|
|
|
// // console.debug("called toggleMenu");
|
|
|
|
// // this.userDropDown.showMenu();
|
|
|
|
// // }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
const showMobileMenu = ref(false);
|
2018-12-21 15:41:34 +01:00
|
|
|
</script>
|