-
Notifications
You must be signed in to change notification settings - Fork 429
Expand file tree
/
Copy pathdashboard.vue
More file actions
128 lines (120 loc) · 3.08 KB
/
dashboard.vue
File metadata and controls
128 lines (120 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<template>
<div class="normal-page !mt-8">
<div class="normal-page__sidebar">
<NavStack
:items="[
{ type: 'heading', label: formatMessage(messages.dashboard) },
{ link: '/dashboard', label: formatMessage(messages.overview), icon: DashboardIcon },
{
link: '/dashboard/notifications',
label: formatMessage(messages.notifications),
icon: NotificationsIcon,
},
{
link: '/dashboard/reports',
label: formatMessage(messages.activeReports),
icon: ReportIcon,
},
{
link: '/dashboard/collections',
label: formatMessage(commonMessages.collectionsLabel),
icon: LibraryIcon,
},
{ type: 'heading', label: formatMessage(messages.creators) },
{ link: '/dashboard/projects', label: formatMessage(messages.projects), icon: ListIcon },
{
link: '/dashboard/organizations',
label: formatMessage(messages.organizations),
icon: OrganizationIcon,
},
{
link: '/dashboard/analytics',
label: formatMessage(messages.analytics),
icon: ChartIcon,
},
{
link: '/dashboard/affiliate-links',
label: formatMessage(commonMessages.affiliateLinksButton),
icon: AffiliateIcon,
shown: !!isAffiliate,
},
{
link: '/dashboard/revenue',
label: formatMessage(messages.revenue),
icon: CurrencyIcon,
matchNested: true,
},
]"
/>
</div>
<div class="normal-page__content mt-4 lg:!mt-0">
<NuxtPage :route="route" />
</div>
</div>
</template>
<script setup lang="ts">
import {
AffiliateIcon,
BellIcon as NotificationsIcon,
ChartIcon,
CurrencyIcon,
DashboardIcon,
LibraryIcon,
ListIcon,
OrganizationIcon,
ReportIcon,
} from '@modrinth/assets'
import { commonMessages, defineMessages, useVIntl } from '@modrinth/ui'
import { type User, UserBadge } from '@modrinth/utils'
import NavStack from '~/components/ui/NavStack.vue'
const auth = (await useAuth()) as Ref<{ user: User | null }>
const isAffiliate = computed(() => {
return auth.value.user && auth.value.user.badges & UserBadge.AFFILIATE
})
const { formatMessage } = useVIntl()
const messages = defineMessages({
dashboard: {
id: 'dashboard.sidebar.label.dashboard',
defaultMessage: 'Dashboard',
},
overview: {
id: 'dashboard.sidebar.label.overview',
defaultMessage: 'Overview',
},
notifications: {
id: 'dashboard.sidebar.label.notifications',
defaultMessage: 'Notifications',
},
activeReports: {
id: 'dashboard.sidebar.label.activeReports',
defaultMessage: 'Active reports',
},
creators: {
id: 'dashboard.sidebar.label.creators',
defaultMessage: 'Creators',
},
projects: {
id: 'dashboard.sidebar.label.projects',
defaultMessage: 'Projects',
},
organizations: {
id: 'dashboard.sidebar.label.organizations',
defaultMessage: 'Organizations',
},
analytics: {
id: 'dashboard.sidebar.label.analytics',
defaultMessage: 'Analytics',
},
revenue: {
id: 'dashboard.sidebar.label.revenue',
defaultMessage: 'Revenue',
},
})
definePageMeta({
middleware: 'auth',
})
useSeoMeta({
robots: 'noindex',
})
const route = useNativeRoute()
</script>