gamebrary/src/components/PageHeader.vue

164 lines
3.8 KiB
Vue
Raw Normal View History

2018-10-18 22:15:28 -07:00
<template lang="html">
2020-09-25 17:09:20 -07:00
<nav
class="position-fixed d-flex flex-column p-0 vh-100 text-center border-right border-light"
>
2020-09-28 16:26:19 -07:00
<router-link :to="{ name: 'dashboard' }" class="mt-2 mb-3">
2020-09-25 17:09:20 -07:00
<!-- TODO: use svg, change color based on theme -->
<img :src="logoUrl" width="32" />
</router-link>
<template v-if="showBoardsDropdown">
<a id="boardSwitcher" >
2020-09-25 17:41:18 -07:00
<b-icon-arrow-left-right />
<b-popover
target="boardSwitcher"
:offset="10"
placement="right"
triggers="click blur"
>
<b-list-group flush>
<b-list-group-item
:to="`/board/${id}`"
:key="id"
v-for="{ name, id } in sortedBoards"
:active="board.id === id"
>
{{ name }}
</b-list-group-item>
</b-list-group>
</b-popover>
</a>
</template>
2020-09-25 17:41:18 -07:00
<b-button
v-else-if="showBoardTitle"
class="p-0 px-1"
variant="transparent"
>
{{ board.name }}
</b-button>
<div class="mt-auto">
2020-09-28 08:53:44 -07:00
<a id="settingsPopover" class="py-2 d-block">
<b-icon-gear />
</a>
<b-popover
target="settingsPopover"
:offset="10"
placement="right"
triggers="click blur"
>
<b-list-group flush>
<b-list-group-item
title="Tags"
v-b-tooltip.hover.right
:to="{ name: 'tags' }"
>
<b-icon-tags />
Tags
</b-list-group-item>
<b-list-group-item
title="Wallpapers"
v-b-tooltip.hover.right
:to="{ name: 'wallpapers' }"
>
<b-icon-file-richtext />
Wallpapers
</b-list-group-item>
<b-list-group-item
title="Language"
v-b-tooltip.hover.right
:to="{ name: 'language' }"
>
<b-icon-chat-left-text />
Language
</b-list-group-item>
<b-list-group-item
title="Themes"
v-b-tooltip.hover.right
:to="{ name: 'themes' }"
>
<b-icon-droplet />
Themes
</b-list-group-item>
<b-list-group-item
title="Releases"
v-b-tooltip.hover.right
:to="{ name: 'releases' }"
>
<b-icon-mailbox />
Releases
</b-list-group-item>
<b-list-group-item
title="About"
v-b-tooltip.hover.right
:to="{ name: 'about' }"
>
<b-icon-question />
About
</b-list-group-item>
</b-list-group>
</b-popover>
<router-link
title="Account"
v-b-tooltip.hover.right
:to="{ name: 'account' }"
class="mb-2 mt-3 d-block"
>
<b-avatar
v-if="user && user.photoURL"
variant="info"
small
:badge="notification"
badge-variant="danger"
:src="user.photoURL"
/>
</router-link>
</div>
2020-09-25 17:09:20 -07:00
</nav>
2018-10-18 22:15:28 -07:00
</template>
<script>
2020-09-01 10:47:56 -07:00
import { mapState, mapGetters } from 'vuex';
2018-10-18 22:15:28 -07:00
export default {
2019-11-08 12:56:03 -07:00
computed: {
2020-09-25 17:09:20 -07:00
...mapState(['board', 'user', 'notification', 'settings']),
2020-09-01 10:47:56 -07:00
...mapGetters(['sortedBoards']),
2020-08-24 21:23:34 -07:00
2020-09-25 17:09:20 -07:00
logoUrl() {
const { settings } = this;
// TODO: use optional chaining
const isDark = settings && settings.theme && settings.theme.dark;
return `/static/gamebrary-logo${isDark ? '' : '-dark'}.png`;
},
routeName() {
return this.$route.name;
},
2020-08-24 21:23:34 -07:00
showBoardTitle() {
return this.$route.name === 'board' && this.board.name;
},
2020-09-06 07:53:04 -07:00
showBoardsDropdown() {
return this.showBoardTitle && this.sortedBoards.length > 1;
},
2019-11-08 12:56:03 -07:00
},
2018-10-18 22:15:28 -07:00
};
</script>
2020-09-25 17:09:20 -07:00
<style lang="scss" rel="stylesheet/scss" scoped>
nav {
width: 50px;
}
</style>