gancio-upstream/components/NavHeader.vue

118 lines
4.3 KiB
Vue
Raw Normal View History

2022-11-24 01:00:30 +01:00
<template>
<div class='d-flex pa-4'>
2022-11-24 17:27:47 +01:00
<v-btn icon large nuxt to='/'>
<img src='/logo.png' height='40' />
</v-btn>
2022-11-24 01:00:30 +01:00
<v-spacer/>
<div class='d-flex'>
<v-btn icon large href='/about' :title='$t("common.about")' :aria-label='$t("common.about")'>
2022-11-24 01:00:30 +01:00
<v-icon v-text='mdiInformation' />
</v-btn>
2024-01-19 00:39:16 +01:00
<v-btn icon large @click='toggleDark'>
<v-icon v-text='mdiContrastCircle' />
</v-btn>
2022-11-24 01:00:30 +01:00
<client-only>
<v-menu offset-y transition="slide-y-transition">
<template v-slot:activator="{ on, attrs }">
2022-11-24 17:27:47 +01:00
<v-btn icon large v-bind='attrs' v-on='on' aria-label='Language' v-text="$i18n.locale" />
2022-11-24 01:00:30 +01:00
</template>
2023-10-04 15:02:31 +02:00
<v-list dense>
2022-11-24 01:00:30 +01:00
<v-list-item v-for='locale in $i18n.locales' @click.prevent.stop="$i18n.setLocale(locale.code)" :key='locale.code'>
<v-list-item-content>
<v-list-item-title v-text='locale.name' />
</v-list-item-content>
</v-list-item>
<v-list-item nuxt target='_blank' href='https://hosted.weblate.org/engage/gancio/'>
<v-list-item-content>
<v-list-item-subtitle v-text='$t("common.help_translate")' />
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
2022-11-24 17:27:47 +01:00
<v-btn slot='placeholder' large icon arial-label='Language'>{{$i18n.locale}}</v-btn>
2022-11-24 01:00:30 +01:00
</client-only>
<client-only>
<v-menu v-if='$auth.loggedIn' offset-y transition="slide-y-transition">
<template v-slot:activator="{ on, attrs }">
2022-11-24 17:27:47 +01:00
<v-btn class='mr-0' large icon v-bind='attrs' v-on='on' title='Menu' aria-label='Menu'>
2022-11-24 01:00:30 +01:00
<v-icon v-text='mdiDotsVertical' />
</v-btn>
</template>
<v-list>
<v-list-item nuxt to='/settings'>
<v-list-item-icon><v-icon v-text='mdiCog'></v-icon></v-list-item-icon>
<v-list-item-content>
<v-list-item-title v-text="$t('common.settings')"/>
</v-list-item-content>
</v-list-item>
<v-list-item nuxt to='/my_events'>
<v-list-item-icon><v-icon v-text='mdiCalendarAccount'></v-icon></v-list-item-icon>
<v-list-item-content>
<v-list-item-title v-text="$t('common.my_events')"/>
</v-list-item-content>
</v-list-item>
2024-02-09 22:33:27 +01:00
<v-list-item v-if='$auth.user.is_admin || $auth.user.is_editor' nuxt to='/admin'>
2022-11-24 01:00:30 +01:00
<v-list-item-icon>
<v-icon v-text='mdiAccount' />
</v-list-item-icon>
<v-list-item-content>
2024-02-09 22:33:27 +01:00
<v-list-item-title v-text="$t(`common.${$auth.user.role}`)" />
2022-11-24 01:00:30 +01:00
</v-list-item-content>
</v-list-item>
<v-list-item @click='logout'>
<v-list-item-icon>
<v-icon v-text='mdiLogout' />
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title v-text="$t('common.logout')" />
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
<template #placeholder>
2022-11-24 17:27:47 +01:00
<v-btn v-if='$auth.loggedIn' large icon aria-label='Menu' title='Menu'>
2022-11-24 01:00:30 +01:00
<v-icon v-text='mdiDotsVertical' />
</v-btn>
</template>
</client-only>
<!-- login button -->
2022-11-24 17:27:47 +01:00
<v-btn class='mr-0' v-if='!$auth.loggedIn' large icon nuxt to='/login' :title='$t("common.login")' :aria-label='$t("common.login")'>
2022-11-24 01:00:30 +01:00
<v-icon v-text='mdiLogin' />
</v-btn>
</div>
</div>
</template>
<script>
import { mdiLogin, mdiDotsVertical, mdiLogout, mdiAccount, mdiCog, mdiInformation, mdiContrastCircle, mdiCalendarAccount } from '@mdi/js'
2024-01-19 00:39:16 +01:00
import { mapActions, mapGetters } from 'vuex'
2022-11-24 01:00:30 +01:00
export default {
data () {
return { mdiLogin, mdiDotsVertical, mdiLogout, mdiAccount, mdiCog, mdiInformation, mdiContrastCircle, mdiCalendarAccount }
2022-11-24 01:00:30 +01:00
},
2024-01-19 00:39:16 +01:00
computed: {
...mapGetters(['hide_thumbs', 'is_dark']),
},
2022-11-24 01:00:30 +01:00
methods: {
2024-01-19 00:39:16 +01:00
...mapActions(['setLocalSetting']),
async toggleDark() {
this.$vuetify.theme.dark = !this.$vuetify.theme.dark
this.setLocalSetting({ key: 'theme.is_dark', value: !this.is_dark })
},
2022-11-24 01:00:30 +01:00
logout () {
this.$root.$message('common.logout_ok')
this.$auth.logout()
}
}
}
</script>