2021-01-22 03:47:58 +08:00
|
|
|
<template>
|
|
|
|
<v-app-bar fixed app>
|
2021-01-22 05:12:12 +08:00
|
|
|
<v-menu bottom offset-y open-on-hover transition="slide-y-transition" close-delay="100">
|
2021-01-22 03:47:58 +08:00
|
|
|
<template #activator="{ on, attrs }">
|
2021-02-08 06:06:06 +08:00
|
|
|
<v-btn text x-large class="align-self-center px-1" v-bind="attrs" :ripple="false" v-on="on">
|
|
|
|
<NuxtLink class="float-left" to="/" exact>
|
|
|
|
<v-img height="55" width="220" src="https://papermc.io/images/logo-marker.svg" alt="Paper logo" />
|
2021-01-22 05:12:12 +08:00
|
|
|
</NuxtLink>
|
2021-02-08 06:06:06 +08:00
|
|
|
|
|
|
|
<v-icon>mdi-chevron-down</v-icon>
|
|
|
|
</v-btn>
|
2021-01-22 03:47:58 +08:00
|
|
|
</template>
|
2021-02-04 17:34:24 +08:00
|
|
|
<Dropdown :controls="dropdown" />
|
2021-01-22 03:47:58 +08:00
|
|
|
</v-menu>
|
2021-02-09 04:45:54 +08:00
|
|
|
|
|
|
|
<v-spacer></v-spacer>
|
|
|
|
|
2021-02-10 12:40:34 +08:00
|
|
|
<v-menu v-if="$util.isLoggedIn()" bottom offset-y transition="slide-y-transition" open-on-hover>
|
2021-02-08 07:19:16 +08:00
|
|
|
<template #activator="{ on, attrs }">
|
2021-02-13 14:36:53 +08:00
|
|
|
<v-btn v-bind="attrs" color="primary" class="mr-1" v-on="on">
|
2021-02-08 07:19:16 +08:00
|
|
|
{{ $t('nav.createNew') }}
|
2021-02-10 12:40:34 +08:00
|
|
|
<v-icon right>mdi-chevron-down</v-icon>
|
2021-02-08 07:19:16 +08:00
|
|
|
</v-btn>
|
|
|
|
</template>
|
|
|
|
<Dropdown :controls="newControls" />
|
|
|
|
</v-menu>
|
2021-01-22 05:12:12 +08:00
|
|
|
|
2021-02-08 07:19:16 +08:00
|
|
|
<v-tooltip bottom>
|
|
|
|
<template #activator="{ on }">
|
2021-02-13 14:36:53 +08:00
|
|
|
<v-btn icon to="/authors" nuxt class="mr-1" v-on="on"><v-icon>mdi-account-group</v-icon></v-btn>
|
2021-02-08 07:19:16 +08:00
|
|
|
</template>
|
|
|
|
<span>{{ $t('pages.authors') }}</span>
|
|
|
|
</v-tooltip>
|
|
|
|
<v-tooltip bottom>
|
|
|
|
<template #activator="{ on }">
|
2021-02-13 14:36:53 +08:00
|
|
|
<v-btn icon to="/staff" nuxt class="mr-1" v-on="on"><v-icon>mdi-account-tie</v-icon></v-btn>
|
2021-02-08 07:19:16 +08:00
|
|
|
</template>
|
|
|
|
<span>{{ $t('pages.staff') }}</span>
|
|
|
|
</v-tooltip>
|
2021-01-22 05:12:12 +08:00
|
|
|
|
2021-02-08 07:19:16 +08:00
|
|
|
<v-menu v-if="$util.isLoggedIn()" bottom offset-y transition="slide-y-transition" close-delay="100">
|
|
|
|
<template #activator="{ on, attrs }">
|
2021-02-12 11:33:01 +08:00
|
|
|
<v-btn color="info" text class="px-3 text-transform-unset" x-large v-bind="attrs" v-on="on">
|
2021-03-21 10:06:09 +08:00
|
|
|
{{ currentUser.name }}
|
2021-03-21 12:22:10 +08:00
|
|
|
<v-badge overlap :content="totalNotificationCount" :value="totalNotificationCount">
|
2021-04-06 00:28:09 +08:00
|
|
|
<UserAvatar :username="currentUser.name" clazz="user-avatar-sm" :avatar-url="$util.avatarUrl(currentUser.name)"> </UserAvatar>
|
2021-02-08 07:19:16 +08:00
|
|
|
</v-badge>
|
|
|
|
</v-btn>
|
|
|
|
</template>
|
2021-03-21 13:56:00 +08:00
|
|
|
<Dropdown :controls="userControls" />
|
2021-02-08 07:19:16 +08:00
|
|
|
</v-menu>
|
2021-01-22 05:12:12 +08:00
|
|
|
<template v-else>
|
2021-01-23 09:44:41 +08:00
|
|
|
<v-btn href="/signup" class="mr-2" color="primary">{{ $t('nav.signup') }}</v-btn>
|
|
|
|
<v-btn color="secondary" @click="$auth.login($route.fullPath)">{{ $t('nav.login') }}</v-btn>
|
2021-01-22 05:12:12 +08:00
|
|
|
</template>
|
2021-01-22 03:47:58 +08:00
|
|
|
</v-app-bar>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-03-21 10:06:09 +08:00
|
|
|
import { Component } from 'nuxt-property-decorator';
|
2021-02-04 17:34:24 +08:00
|
|
|
import Dropdown, { Control } from '~/components/layouts/Dropdown.vue';
|
2021-03-21 10:06:09 +08:00
|
|
|
import { HangarComponent } from '~/components/mixins';
|
2021-04-06 00:28:09 +08:00
|
|
|
import UserAvatar from '~/components/users/UserAvatar.vue';
|
2021-01-22 03:47:58 +08:00
|
|
|
|
2021-02-04 17:34:24 +08:00
|
|
|
@Component({
|
|
|
|
components: {
|
2021-04-06 00:28:09 +08:00
|
|
|
UserAvatar,
|
2021-02-04 17:34:24 +08:00
|
|
|
Dropdown,
|
|
|
|
},
|
|
|
|
})
|
2021-03-21 10:06:09 +08:00
|
|
|
export default class Header extends HangarComponent {
|
2021-01-22 06:24:50 +08:00
|
|
|
get dropdown(): Control[] {
|
|
|
|
const controls: Control[] = [];
|
|
|
|
controls.push({
|
|
|
|
link: 'https://www.papermc.io',
|
|
|
|
icon: 'mdi-home',
|
2021-01-23 05:06:44 +08:00
|
|
|
title: this.$t('nav.hangar.home'),
|
2021-01-22 06:24:50 +08:00
|
|
|
});
|
|
|
|
controls.push({
|
|
|
|
link: 'https://papermc.io/forums',
|
|
|
|
icon: 'mdi-comment-multiple',
|
2021-01-23 05:06:44 +08:00
|
|
|
title: this.$t('nav.hangar.forums'),
|
2021-01-22 06:24:50 +08:00
|
|
|
});
|
|
|
|
controls.push({
|
|
|
|
link: 'https://github.com/PaperMC',
|
|
|
|
icon: 'mdi-code-braces',
|
2021-01-23 05:06:44 +08:00
|
|
|
title: this.$t('nav.hangar.code'),
|
2021-01-22 06:24:50 +08:00
|
|
|
});
|
|
|
|
controls.push({
|
|
|
|
link: 'https://paper.readthedocs.io',
|
|
|
|
icon: 'mdi-book',
|
2021-01-23 05:06:44 +08:00
|
|
|
title: this.$t('nav.hangar.docs'),
|
2021-01-22 06:24:50 +08:00
|
|
|
});
|
|
|
|
controls.push({
|
|
|
|
link: 'https://papermc.io/javadocs',
|
|
|
|
icon: 'mdi-school',
|
2021-01-23 05:06:44 +08:00
|
|
|
title: this.$t('nav.hangar.javadocs'),
|
2021-01-22 06:24:50 +08:00
|
|
|
});
|
|
|
|
controls.push({
|
|
|
|
link: '/',
|
|
|
|
icon: 'mdi-home',
|
2021-01-23 05:06:44 +08:00
|
|
|
title: this.$t('nav.hangar.hangar'),
|
2021-01-22 06:24:50 +08:00
|
|
|
});
|
|
|
|
controls.push({
|
|
|
|
link: 'https://papermc.io/downloads',
|
|
|
|
icon: 'mdi-download',
|
2021-01-23 05:06:44 +08:00
|
|
|
title: this.$t('nav.hangar.downloads'),
|
2021-01-22 06:24:50 +08:00
|
|
|
});
|
|
|
|
controls.push({
|
|
|
|
link: 'https://papermc.io/community',
|
|
|
|
icon: 'mdi-comment',
|
2021-01-23 05:06:44 +08:00
|
|
|
title: this.$t('nav.hangar.community'),
|
2021-01-22 06:24:50 +08:00
|
|
|
});
|
|
|
|
return controls;
|
|
|
|
}
|
|
|
|
|
|
|
|
get newControls(): Control[] {
|
|
|
|
const controls: Control[] = [];
|
|
|
|
controls.push({
|
|
|
|
link: '/new',
|
|
|
|
icon: 'mdi-book',
|
2021-01-23 05:06:44 +08:00
|
|
|
title: this.$t('nav.new.project'),
|
2021-01-22 06:24:50 +08:00
|
|
|
});
|
2021-03-20 08:00:38 +08:00
|
|
|
// TODO get user orgs count
|
|
|
|
if (0 - 1 < this.validations.maxOrgCount) {
|
|
|
|
controls.push({
|
|
|
|
link: '/organizations/new',
|
|
|
|
icon: 'mdi-account-group',
|
|
|
|
title: this.$t('nav.new.organization'),
|
|
|
|
});
|
|
|
|
}
|
2021-01-22 06:24:50 +08:00
|
|
|
return controls;
|
|
|
|
}
|
|
|
|
|
|
|
|
get userControls(): Control[] {
|
|
|
|
const controls: Control[] = [];
|
2021-03-21 13:56:00 +08:00
|
|
|
controls.push({
|
2021-03-22 14:39:06 +08:00
|
|
|
link: `/${this.currentUser!.name}`,
|
2021-03-21 13:56:00 +08:00
|
|
|
icon: 'mdi-account',
|
2021-03-22 14:39:06 +08:00
|
|
|
title: this.currentUser!.name,
|
2021-03-21 13:56:00 +08:00
|
|
|
});
|
|
|
|
controls.push({
|
|
|
|
link: '/notifications',
|
|
|
|
icon: 'mdi-bell',
|
|
|
|
title: this.$t('nav.user.notifications'),
|
|
|
|
badge: true,
|
2021-03-22 14:39:06 +08:00
|
|
|
badgeContent: this.currentUser!.headerData.unansweredInvites + this.currentUser!.headerData.unreadNotifications,
|
2021-03-21 13:56:00 +08:00
|
|
|
});
|
|
|
|
controls.push({
|
|
|
|
isDivider: true,
|
|
|
|
});
|
2021-03-12 15:59:36 +08:00
|
|
|
if (this.$perms.canAccessModNotesAndFlags) {
|
2021-02-07 13:44:53 +08:00
|
|
|
controls.push({
|
|
|
|
link: '/admin/flags',
|
|
|
|
icon: 'mdi-flag',
|
|
|
|
title: this.$t('nav.user.flags'),
|
2021-03-21 13:56:00 +08:00
|
|
|
badge: true,
|
2021-03-22 14:39:06 +08:00
|
|
|
badgeContent: this.currentUser!.headerData.unresolvedFlags,
|
2021-02-07 13:44:53 +08:00
|
|
|
});
|
|
|
|
controls.push({
|
|
|
|
link: '/admin/approval/projects',
|
|
|
|
icon: 'mdi-thumb-up',
|
|
|
|
title: this.$t('nav.user.projectApprovals'),
|
2021-03-21 13:56:00 +08:00
|
|
|
badge: true,
|
2021-03-22 14:39:06 +08:00
|
|
|
badgeContent: this.currentUser!.headerData.projectApprovals,
|
2021-02-07 13:44:53 +08:00
|
|
|
});
|
|
|
|
}
|
2021-03-12 15:59:36 +08:00
|
|
|
if (this.$perms.isReviewer) {
|
2021-02-07 13:44:53 +08:00
|
|
|
controls.push({
|
|
|
|
link: '/admin/approval/versions',
|
|
|
|
icon: 'mdi-thumb-up-outline',
|
|
|
|
title: this.$t('nav.user.versionApprovals'),
|
2021-03-21 13:56:00 +08:00
|
|
|
badge: true,
|
2021-03-22 14:39:06 +08:00
|
|
|
badgeContent: this.currentUser!.headerData.reviewQueueCount,
|
2021-02-07 13:44:53 +08:00
|
|
|
});
|
|
|
|
}
|
2021-03-12 15:59:36 +08:00
|
|
|
if (this.$perms.canViewStats) {
|
2021-02-07 13:44:53 +08:00
|
|
|
controls.push({
|
|
|
|
link: '/admin/stats',
|
|
|
|
icon: 'mdi-chart-line',
|
|
|
|
title: this.$t('nav.user.stats'),
|
|
|
|
});
|
|
|
|
}
|
2021-03-12 15:59:36 +08:00
|
|
|
if (this.$perms.canViewHealth) {
|
2021-02-07 13:44:53 +08:00
|
|
|
controls.push({
|
|
|
|
link: '/admin/health',
|
|
|
|
icon: 'mdi-heart-plus',
|
|
|
|
title: this.$t('nav.user.health'),
|
|
|
|
});
|
|
|
|
}
|
2021-03-12 15:59:36 +08:00
|
|
|
if (this.$perms.canViewLogs) {
|
2021-02-07 13:44:53 +08:00
|
|
|
controls.push({
|
|
|
|
link: '/admin/log',
|
|
|
|
icon: 'mdi-format-list-bulleted',
|
|
|
|
title: this.$t('nav.user.log'),
|
|
|
|
});
|
|
|
|
}
|
2021-03-12 15:59:36 +08:00
|
|
|
if (this.$perms.canDoManualValueChanges) {
|
2021-02-07 13:44:53 +08:00
|
|
|
controls.push({
|
|
|
|
link: '/admin/versions',
|
|
|
|
icon: 'mdi-tag-multiple',
|
|
|
|
title: this.$t('nav.user.platformVersions'),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (controls.length > 3) {
|
|
|
|
controls.push({
|
|
|
|
isDivider: true,
|
|
|
|
});
|
|
|
|
}
|
2021-01-22 06:24:50 +08:00
|
|
|
controls.push({
|
2021-01-22 11:11:24 +08:00
|
|
|
action: () => this.$auth.logout(),
|
2021-01-22 06:24:50 +08:00
|
|
|
icon: 'mdi-logout',
|
2021-01-23 05:06:44 +08:00
|
|
|
title: this.$t('nav.user.logout'),
|
2021-01-22 06:24:50 +08:00
|
|
|
});
|
|
|
|
return controls;
|
|
|
|
}
|
2021-03-21 12:22:10 +08:00
|
|
|
|
|
|
|
get totalNotificationCount() {
|
|
|
|
return (
|
2021-03-22 14:39:06 +08:00
|
|
|
this.currentUser!.headerData.unreadNotifications +
|
|
|
|
this.currentUser!.headerData.unansweredInvites +
|
|
|
|
this.currentUser!.headerData.unresolvedFlags +
|
|
|
|
this.currentUser!.headerData.reviewQueueCount +
|
|
|
|
this.currentUser!.headerData.projectApprovals
|
2021-03-21 12:22:10 +08:00
|
|
|
);
|
|
|
|
}
|
2021-01-22 05:12:12 +08:00
|
|
|
}
|
2021-01-22 03:47:58 +08:00
|
|
|
</script>
|
|
|
|
|
2021-02-08 06:06:06 +08:00
|
|
|
<style lang="scss">
|
|
|
|
.v-badge--bordered.header-badge .v-badge__badge::after {
|
|
|
|
border-color: #272727 !important;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<style lang="scss">
|
|
|
|
.avatar-button {
|
|
|
|
//border: 2px white solid;
|
2021-01-22 03:47:58 +08:00
|
|
|
}
|
|
|
|
</style>
|