2020-09-11 03:17:29 -07:00
|
|
|
<template>
|
2020-10-28 08:22:29 -07:00
|
|
|
<header v-if="config.header" class="mb-4">
|
2020-09-29 07:27:37 -07:00
|
|
|
<div class="mb-3 d-flex justify-content-between align-items-center flex-column flex-md-row">
|
|
|
|
<h1 class="text-nowrap">
|
|
|
|
<nuxt-link to="/">
|
|
|
|
<Icon v="tags"/>
|
|
|
|
<T>title</T>
|
|
|
|
</nuxt-link>
|
|
|
|
</h1>
|
2020-10-28 08:22:29 -07:00
|
|
|
<ul v-if="Object.keys(locales).length > 1" class="list-inline small mb-0">
|
2020-09-29 07:27:37 -07:00
|
|
|
<li v-for="(options, locale) in locales" :key="locale" class="list-inline-item">
|
|
|
|
<strong v-if="locale === config.locale">
|
|
|
|
{{options.name}}
|
|
|
|
</strong>
|
|
|
|
<a v-else :href="options.url">
|
|
|
|
{{options.name}}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2020-09-23 11:34:35 -07:00
|
|
|
<div class="d-block d-md-none">
|
|
|
|
<div class="btn-group-vertical btn-block nav-custom mb-2">
|
2020-09-23 12:34:37 -07:00
|
|
|
<nuxt-link v-for="link in links" :key="link.link" :to="link.link" :class="`btn btn-sm ${isActiveRoute(link) ? 'active' : ''}`">
|
2020-09-23 11:34:35 -07:00
|
|
|
<Icon :v="link.icon"/>
|
|
|
|
{{ link.textLong || link.text }}
|
|
|
|
</nuxt-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="d-none d-md-block">
|
|
|
|
<div class="btn-group btn-block nav-custom mb-2">
|
2020-09-23 12:34:37 -07:00
|
|
|
<nuxt-link v-for="link in links" :key="link.link" :to="link.link" :class="`btn btn-sm ${isActiveRoute(link) ? 'active' : ''}`">
|
2020-09-25 03:17:02 -07:00
|
|
|
<Icon :v="link.icon" size="1.6"/>
|
|
|
|
<br/>
|
|
|
|
<span class="text-nowrap">{{ link.text }}</span>
|
2020-09-23 11:34:35 -07:00
|
|
|
</nuxt-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-11 03:17:29 -07:00
|
|
|
</header>
|
2020-10-28 08:22:29 -07:00
|
|
|
<header v-else class="mb-4">
|
|
|
|
<h1 class="text-nowrap">
|
|
|
|
<nuxt-link to="/">
|
|
|
|
<Icon v="tags"/>
|
|
|
|
<T>title</T>
|
|
|
|
</nuxt-link>
|
|
|
|
</h1>
|
|
|
|
</header>
|
2020-09-11 03:17:29 -07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-10-15 09:50:32 -07:00
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
2020-09-11 03:17:29 -07:00
|
|
|
export default {
|
2020-10-15 09:50:32 -07:00
|
|
|
computed: {
|
|
|
|
...mapState([
|
|
|
|
'user',
|
|
|
|
]),
|
|
|
|
links() {
|
|
|
|
const links = [];
|
|
|
|
|
|
|
|
links.push({
|
|
|
|
link: '/',
|
|
|
|
icon: 'home',
|
|
|
|
text: this.$t('home.header'),
|
|
|
|
textLong: this.$t('home.headerLong'),
|
2020-11-29 02:03:01 -08:00
|
|
|
extra: ['all', '/' + this.config.pronouns.any, this.config.pronouns.avoiding ? '/' + this.config.pronouns.avoiding : null ],
|
2020-10-15 09:50:32 -07:00
|
|
|
});
|
2020-09-28 09:29:13 -07:00
|
|
|
|
2020-10-15 09:50:32 -07:00
|
|
|
if (this.config.sources.enabled) {
|
|
|
|
links.push({
|
|
|
|
link: '/' + this.config.sources.route,
|
|
|
|
icon: 'books',
|
|
|
|
text: this.$t('sources.header'),
|
|
|
|
textLong: this.$t('sources.headerLong'),
|
|
|
|
});
|
|
|
|
}
|
2020-09-28 09:29:13 -07:00
|
|
|
|
2020-10-15 09:50:32 -07:00
|
|
|
if (this.config.nouns.enabled) {
|
|
|
|
links.push({
|
|
|
|
link: '/' + this.config.nouns.route,
|
|
|
|
icon: 'atom-alt',
|
|
|
|
text: this.$t('nouns.header'),
|
|
|
|
textLong: this.$t('nouns.headerLong'),
|
|
|
|
});
|
|
|
|
}
|
2020-09-28 09:29:13 -07:00
|
|
|
|
2020-10-15 09:50:32 -07:00
|
|
|
if (this.config.names.enabled) {
|
|
|
|
links.push({
|
|
|
|
link: '/' + this.config.names.route,
|
|
|
|
icon: 'signature',
|
|
|
|
text: this.$t('names.header'),
|
|
|
|
textLong: this.$t('names.headerLong'),
|
|
|
|
});
|
|
|
|
}
|
2020-09-29 08:59:23 -07:00
|
|
|
|
2020-10-15 09:50:32 -07:00
|
|
|
if (this.config.faq.enabled) {
|
|
|
|
links.push({
|
|
|
|
link: '/' + this.config.faq.route,
|
|
|
|
icon: 'map-marker-question',
|
|
|
|
text: this.$t('faq.header'),
|
|
|
|
textLong: this.$t('faq.headerLong'),
|
|
|
|
});
|
|
|
|
}
|
2020-10-10 09:31:31 -07:00
|
|
|
|
2020-10-15 09:50:32 -07:00
|
|
|
if (this.config.links.enabled) {
|
|
|
|
links.push({
|
|
|
|
link: '/' + this.config.links.route,
|
|
|
|
icon: 'bookmark',
|
|
|
|
text: this.$t('links.header'),
|
|
|
|
textLong: this.$t('links.headerLong'),
|
|
|
|
});
|
|
|
|
}
|
2020-09-28 09:29:13 -07:00
|
|
|
|
2020-10-15 09:50:32 -07:00
|
|
|
if (this.config.people.enabled) {
|
|
|
|
links.push({
|
|
|
|
link: '/' + this.config.people.route,
|
|
|
|
icon: 'user-friends',
|
|
|
|
text: this.$t('people.header'),
|
|
|
|
textLong: this.$t('people.headerLong'),
|
|
|
|
});
|
|
|
|
}
|
2020-09-29 10:11:46 -07:00
|
|
|
|
2020-10-15 09:50:32 -07:00
|
|
|
if (this.config.english.enabled) {
|
|
|
|
links.push({
|
|
|
|
link: '/' + this.config.english.route,
|
|
|
|
icon: 'globe-americas',
|
|
|
|
text: this.$t('english.header'),
|
|
|
|
textLong: this.$t('english.headerLong'),
|
|
|
|
});
|
|
|
|
}
|
2020-09-29 09:34:47 -07:00
|
|
|
|
2020-10-15 09:50:32 -07:00
|
|
|
if (this.config.contact.enabled) {
|
|
|
|
links.push({
|
|
|
|
link: '/' + this.config.contact.route,
|
|
|
|
icon: 'comment-alt-smile',
|
|
|
|
text: this.$t('contact.header'),
|
|
|
|
});
|
|
|
|
}
|
2020-09-28 09:29:13 -07:00
|
|
|
|
2020-10-16 11:17:50 -07:00
|
|
|
if (this.config.user.enabled) {
|
|
|
|
links.push({
|
|
|
|
link: '/' + this.config.user.route,
|
|
|
|
icon: 'user',
|
|
|
|
text: this.user ? '@' + this.user.username : this.$t('user.header'),
|
|
|
|
textLong: this.user ? '@' + this.user.username : this.$t('user.headerLong'),
|
2020-11-16 13:32:17 -08:00
|
|
|
extra: ['/editor', this.$user() ? '/@' + this.$user().username : null],
|
2020-10-16 11:17:50 -07:00
|
|
|
});
|
|
|
|
}
|
2020-10-13 12:49:08 -07:00
|
|
|
|
2020-10-15 09:50:32 -07:00
|
|
|
return links;
|
|
|
|
},
|
2020-09-23 11:34:35 -07:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
isActiveRoute(link) {
|
2020-11-16 13:32:17 -08:00
|
|
|
return decodeURIComponent(this.$route.path) === link.link
|
2020-10-24 12:50:08 -07:00
|
|
|
|| (link.extra || []).includes(this.$route.name)
|
2020-11-16 13:32:17 -08:00
|
|
|
|| (link.extra || []).includes(decodeURIComponent(this.$route.path));
|
2020-09-23 11:34:35 -07:00
|
|
|
},
|
|
|
|
},
|
2020-09-11 03:17:29 -07:00
|
|
|
}
|
|
|
|
</script>
|
2020-09-23 11:34:35 -07:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-11-11 13:53:55 -08:00
|
|
|
@import "assets/variables";
|
2020-09-23 11:34:35 -07:00
|
|
|
|
|
|
|
@include media-breakpoint-down('sm', $grid-breakpoints) {
|
|
|
|
.nav-custom {
|
|
|
|
.btn {
|
|
|
|
border-left: 1px solid $gray-500;
|
|
|
|
border-radius: 0;
|
|
|
|
|
|
|
|
&:hover, &:focus, &.active {
|
|
|
|
border-left: 3px solid $primary;
|
|
|
|
padding-left: calc(#{$btn-padding-x-sm} - 2px);
|
|
|
|
color: $primary;
|
|
|
|
}
|
|
|
|
|
|
|
|
text-align: left;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@include media-breakpoint-up('md', $grid-breakpoints) {
|
|
|
|
.nav-custom {
|
|
|
|
.btn {
|
|
|
|
border-bottom: 1px solid $gray-500;
|
|
|
|
border-radius: 0;
|
|
|
|
|
|
|
|
&:hover, &:focus, &.active {
|
|
|
|
border-bottom: 3px solid $primary;
|
|
|
|
padding-bottom: calc(#{$btn-padding-y-sm} - 2px);
|
|
|
|
color: $primary;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</style>
|