2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2022-12-02 16:17:37 +00:00
|
|
|
<span v-if="currentUser" id="userBadge" class="profile">
|
2022-11-29 10:18:58 +00:00
|
|
|
<a class="view-profile" href="/#/profile" title="View/edit user profile">
|
2022-12-02 16:17:37 +00:00
|
|
|
<img :alt="`Avatar of ${currentUser.name}`" :src="currentUser.avatar" class="avatar">
|
2022-05-15 15:25:02 +00:00
|
|
|
<span class="name">{{ currentUser.name }}</span>
|
2022-04-15 14:24:30 +00:00
|
|
|
</a>
|
|
|
|
|
|
|
|
<a
|
|
|
|
class="logout control"
|
|
|
|
role="button"
|
2022-11-29 10:18:58 +00:00
|
|
|
title="Log out"
|
2022-04-23 21:48:19 +00:00
|
|
|
@click.prevent="logout"
|
2022-04-15 14:24:30 +00:00
|
|
|
>
|
2022-12-02 16:17:37 +00:00
|
|
|
<icon :icon="faSignOutAlt" />
|
2022-04-15 14:24:30 +00:00
|
|
|
</a>
|
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2022-07-15 07:23:55 +00:00
|
|
|
import { faSignOutAlt } from '@fortawesome/free-solid-svg-icons'
|
2022-04-15 14:24:30 +00:00
|
|
|
import { eventBus } from '@/utils'
|
2022-05-15 15:25:02 +00:00
|
|
|
import { useAuthorization } from '@/composables'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-05-15 15:25:02 +00:00
|
|
|
const { currentUser } = useAuthorization()
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
const logout = () => eventBus.emit('LOG_OUT')
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
#userBadge {
|
|
|
|
@include vertical-center();
|
|
|
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
.avatar {
|
|
|
|
width: 24px;
|
|
|
|
height: 24px;
|
|
|
|
border-radius: 50%;
|
|
|
|
margin-right: .5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.view-profile {
|
|
|
|
height: 100%;
|
|
|
|
@include vertical-center();
|
|
|
|
}
|
|
|
|
|
|
|
|
.logout {
|
|
|
|
height: 100%;
|
|
|
|
padding: 0 1.25rem;
|
|
|
|
@include vertical-center();
|
|
|
|
}
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
@media only screen and (max-width: 667px) {
|
2022-04-15 14:24:30 +00:00
|
|
|
flex: 0 0 96px;
|
|
|
|
margin-right: 0;
|
|
|
|
padding-right: 0;
|
|
|
|
align-content: stretch;
|
|
|
|
|
|
|
|
.name {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.view-profile, .logout {
|
|
|
|
flex: 0 0 40px;
|
|
|
|
font-size: 1.4rem;
|
|
|
|
margin-right: 0;
|
|
|
|
|
|
|
|
@include vertical-center();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|