-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.vue
156 lines (137 loc) · 4.34 KB
/
app.vue
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<script setup lang="ts">
const leftDrawerOpen = ref(true);
const { isAdmin, authorize } = useAuth();
authorize();
const { data: settings } = await useFetch('/api/settings/admin');
const toolbarTitle = ref(settings.value?.toolbarTitle || 'Księgozbiór');
function toggleLeftDrawer() {
leftDrawerOpen.value = !leftDrawerOpen.value;
}
function logout() {
const token = useCookie('token');
token.value = '';
reloadNuxtApp({
path: '/',
ttl: 1000,
});
}
</script>
<template>
<q-layout view="lHh Lpr lFf" id="layout">
<VitePwaManifest />
<q-header elevated>
<q-toolbar class="bg-indigo">
<q-btn flat dense round icon="menu" aria-label="Menu" @click="toggleLeftDrawer" />
<q-toolbar-title class="toolbar-title"> {{ toolbarTitle }} </q-toolbar-title>
<div v-if="isAdmin">
<q-btn icon="logout" size="sm" color="indigo-10" @click="logout">
<q-tooltip>Wyloguj</q-tooltip>
</q-btn>
</div>
<div v-else>
<q-btn icon="login" size="sm" color="indigo-10" to="/login">
<q-tooltip>Zaloguj</q-tooltip>
</q-btn>
</div>
</q-toolbar>
</q-header>
<q-drawer id="drawer" bordered v-model="leftDrawerOpen" :width="210" show-if-above elevated>
<q-list>
<q-item-label header> Menu </q-item-label>
<q-item to="/" clickable>
<q-item-section avatar>
<q-icon name="home" />
</q-item-section>
<q-item-section>
<q-item-label>Home</q-item-label>
</q-item-section>
</q-item>
<q-item to="/books" clickable>
<q-item-section avatar>
<q-icon name="import_contacts" />
</q-item-section>
<q-item-section>
<q-item-label>Książki</q-item-label>
</q-item-section>
</q-item>
<q-item v-if="isAdmin" to="/book/add" clickable>
<q-item-section avatar>
<q-icon name="library_add" />
</q-item-section>
<q-item-section>
<q-item-label>Dodaj książkę</q-item-label>
</q-item-section>
</q-item>
<q-item to="/shelves" clickable>
<q-item-section avatar>
<q-icon name="shelves" />
</q-item-section>
<q-item-section>
<q-item-label>Półki</q-item-label>
</q-item-section>
</q-item>
<q-item v-if="isAdmin" to="/lending" clickable>
<q-item-section avatar>
<q-icon name="autorenew" />
</q-item-section>
<q-item-section>
<q-item-label>Wypożyczenia</q-item-label>
</q-item-section>
</q-item>
<q-item to="/quotes" clickable>
<q-item-section avatar>
<q-icon name="format_quote" />
</q-item-section>
<q-item-section>
<q-item-label>Cytaty </q-item-label>
</q-item-section>
</q-item>
<q-item v-if="isAdmin" to="/quote/add" clickable>
<q-item-section avatar>
<q-icon name="add" />
</q-item-section>
<q-item-section>
<q-item-label>Dodaj cytat</q-item-label>
</q-item-section>
</q-item>
<q-item to="/statistics" clickable>
<q-item-section avatar>
<q-icon name="bar_chart" />
</q-item-section>
<q-item-section>
<q-item-label>Statystyki</q-item-label>
</q-item-section>
</q-item>
<q-item v-if="isAdmin" to="/admin" clickable>
<q-item-section avatar>
<q-icon name="settings" />
</q-item-section>
<q-item-section>
<q-item-label>Panel admina</q-item-label>
</q-item-section>
</q-item>
<q-item to="/info" clickable>
<q-item-section avatar>
<q-icon name="info" />
</q-item-section>
<q-item-section>
<q-item-label>Info</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-drawer>
<q-page-container>
<NuxtPage />
</q-page-container>
</q-layout>
</template>
<style lang="scss">
@use '~/layouts/global.scss';
#layout {
// background-image: linear-gradient(to bottom right, rgb(68, 64, 64), rgb(238, 238, 238));
}
#drawer {
background-color: rgb(215, 231, 231);
border-color: black;
}
</style>