Skip to content

Commit 0d107b9

Browse files
committed
Update to nuxt3 and vuetify3
1 parent e5f5111 commit 0d107b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+738
-725
lines changed

.dockerignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.git
2+
.nuxt
3+
.output
14
node_modules
2-
npm-debug*
3-
.nuxt
5+
tmp

.editorconfig

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,43 @@
11
[*]
2-
charset = utf-8
3-
end_of_line = lf
4-
indent_style = space
5-
indent_size = 4
6-
insert_final_newline = true
7-
trim_trailing_whitespace = true
2+
charset=utf-8
3+
end_of_line=lf
4+
insert_final_newline=false
5+
indent_style=space
6+
tab_width=4
87

9-
[*.md]
10-
trim_trailing_whitespace = false
8+
[*.vue]
9+
indent_style=space
10+
indent_size=4
11+
12+
[*.scss]
13+
indent_style=space
14+
indent_size=4
15+
16+
[*.json]
17+
indent_style=space
18+
indent_size=4
19+
20+
[{phpunit.xml.dist,*.jhm,*.xslt,*.xul,*.rng,*.xsl,*.xsd,*.ant,*.tld,*.fxml,*.jrxml,*.xml,*.jnlp,*.wsdl}]
21+
indent_style=space
22+
indent_size=4
23+
24+
[*.svg]
25+
indent_style=space
26+
indent_size=4
27+
28+
[.editorconfig]
29+
indent_style=space
30+
indent_size=4
31+
32+
[{*.gy,*.groovy,*.gant,*.gdsl}]
33+
indent_style=space
34+
indent_size=4
35+
36+
[{*.ats,*.ts}]
37+
indent_style=space
38+
indent_size=4
1139

1240
[{*.yml,*.yaml}]
13-
indent_size = 2
41+
indent_style=space
42+
indent_size=2
43+

.eslintrc.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
module.exports = {
22
env: {
33
browser: true,
4-
es6: true,
4+
es2021: true,
55
node: true,
66
},
7-
extends: ['eslint:recommended', 'plugin:vue/essential', 'plugin:nuxt/recommended', '@vue/prettier'],
8-
globals: {
9-
Atomics: 'readonly',
10-
SharedArrayBuffer: 'readonly',
11-
},
7+
extends: [
8+
'plugin:@typescript-eslint/recommended',
9+
'plugin:nuxt/recommended',
10+
'plugin:vue/vue3-recommended',
11+
'prettier',
12+
],
1213
parserOptions: {
13-
ecmaVersion: 2018,
14+
ecmaVersion: 'latest',
15+
parser: '@typescript-eslint/parser',
1416
sourceType: 'module',
1517
},
16-
plugins: ['vue'],
18+
plugins: ['@typescript-eslint'],
1719
rules: {
18-
'no-console': 'off',
19-
'vue/multiline-html-element-content-newline': [
20-
2,
21-
{
22-
ignoreWhenEmpty: true,
23-
ignores: ['pre', 'textarea'],
24-
allowEmptyLines: false,
25-
},
26-
],
20+
'vue/html-indent': 'off',
21+
'vue/html-self-closing': 'off',
22+
'vue/multi-word-component-names': 'off',
2723
},
2824
};

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*.sln text eol=lf
1111
*.php text eol=lf
1212
*.js text eol=lf
13+
*.ts text eol=lf
1314
*.json text eol=lf
1415
*.vue text eol=lf
1516
*.css text eol=lf

.gitignore

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Dependencies
2-
node_modules/
3-
jspm_packages/
2+
node_modules
3+
.output
4+
.nitro
5+
jspm_packages
46
vendor
57

68
# Only keep yarn.lock in the root
@@ -10,7 +12,7 @@ composer.lock
1012

1113
# Logs
1214
/logs
13-
*.log
15+
*.log*
1416
npm-debug.log*
1517
yarn-debug.log*
1618
yarn-error.log*
@@ -126,3 +128,6 @@ dist
126128

127129
# Robots Files
128130
robots.txt
131+
132+
# Ignore Service Worker
133+
sw.*

Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
FROM node:14.16
1+
FROM node:18.12.0-alpine
22

3-
WORKDIR /var/www
3+
# create destination directory
4+
RUN mkdir -p /home/nuxt
5+
WORKDIR /home/nuxt
46

5-
COPY . /var/www
6-
7-
RUN npm install \
8-
&& npm run build
7+
# copy the app, note .dockerignore
8+
COPY . /home/nuxt/
9+
RUN npm install
10+
RUN npm run build
911

1012
EXPOSE 3000
1113

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# nuxt-vuetify-dashboard
1+
# nuxt3-vuetify3-dashboard
22

3-
> Nuxt.js + Vuetify.js + Material Dashboard
3+
> Nuxt 3 + Vuetify 3 + Material Dashboard
44
5-
![alt text](http://rekryt.ru/files/nuxt-vuetify-dashboard.png)
5+
![alt text](http://rekryt.ru/files/nuxt3-vuetify3-dashboard.png)
66

77
## Build Setup
88

@@ -19,10 +19,7 @@ Open http://localhost:3000
1919
```shell
2020
# build for production and launch server
2121
$ npm run build
22-
$ npm start
23-
24-
# or generate static project
25-
# npm run generate
22+
$ npm run start
2623
```
2724

2825
## Docker
@@ -33,6 +30,6 @@ $ docker run -it -e HOST=0.0.0.0 -p 3000:3000 nuxt_dashboard
3330
Open http://`docker-machine ip`:3000
3431

3532
For detailed explanation on how things work, check out:
36-
- [Material-dashboard](https://demos.creative-tim.com/material-dashboard/docs/2.1/getting-started/introduction.html) documentation
37-
- [Vuetify.js](https://vuetifyjs.com/) documentation
38-
- [Nuxt.js](https://github.com/nuxt/nuxt.js)
33+
- [Vuetify 3](https://vuetifyjs.com/) documentation
34+
- [Nuxt 3](https://nuxt.com)
35+
- [Material-dashboard](https://demos.creative-tim.com/material-dashboard/docs/2.1/getting-started/introduction.html) old documentation

assets/less/blocks/editor.less

Lines changed: 0 additions & 5 deletions
This file was deleted.

assets/less/main.less

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/scss/default.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
min-width: 320px;
3+
}

components/core/AppBar.vue

Lines changed: 56 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,47 @@
11
<template>
2-
<v-app-bar id="core-app-bar" absolute app color="transparent" flat height="88">
3-
<v-toolbar-title class="tertiary--text font-weight-light align-self-center">
4-
<v-btn v-if="responsive" dark icon @click.stop="onClick">
2+
<v-app-bar id="core-app-bar" absolute color="transparent" flat height="88">
3+
<v-toolbar-title class="font-weight-light align-self-center">
4+
<v-btn v-show="!responsive" icon @click.stop="onClick">
55
<v-icon>mdi-view-list</v-icon>
66
</v-btn>
77
{{ title }}
88
</v-toolbar-title>
99

1010
<v-spacer />
1111

12-
<v-toolbar-items>
12+
<v-toolbar-items class="flex-fill">
1313
<v-row align="center" class="mx-0">
1414
<v-text-field class="mr-4 purple-input" color="purple" label="Search..." hide-details />
1515

16-
<v-btn icon to="/">
16+
<v-btn height="48" to="/" icon>
1717
<v-icon color="tertiary">mdi-view-dashboard</v-icon>
1818
</v-btn>
1919

20-
<v-menu bottom left offset-y transition="slide-y-transition">
21-
<template v-slot:activator="{ attrs, on }">
22-
<v-btn class="toolbar-items" icon to="/notifications" v-bind="attrs" v-on="on">
23-
<v-badge color="error" overlap>
24-
<template slot="badge">
25-
{{ notifications.length }}
26-
</template>
27-
<v-icon color="tertiary">mdi-bell</v-icon>
28-
</v-badge>
29-
</v-btn>
30-
</template>
31-
32-
<v-card>
33-
<v-list dense>
34-
<v-list-item v-for="notification in notifications" :key="notification" @click="onClick">
35-
<v-list-item-title v-text="notification" />
20+
<client-only>
21+
<v-menu bottom left offset-y transition="slide-y-transition">
22+
<template #activator="{ props }">
23+
<v-btn class="toolbar-items" height="48" to="/notifications" v-bind="props" icon>
24+
<v-badge color="error">
25+
<template #badge>
26+
{{ notifications.length }}
27+
</template>
28+
<v-icon color="tertiary">mdi-bell</v-icon>
29+
</v-badge>
30+
</v-btn>
31+
</template>
32+
<v-list>
33+
<v-list-item v-for="(item, index) in notifications" :key="index" :value="index">
34+
<v-list-item-title>{{ item }}</v-list-item-title>
3635
</v-list-item>
3736
</v-list>
38-
</v-card>
39-
</v-menu>
37+
</v-menu>
38+
</client-only>
4039

41-
<v-btn to="/user-profile" icon>
40+
<v-btn height="48" icon @click="toggleTheme">
41+
<v-icon color="tertiary">mdi-theme-light-dark</v-icon>
42+
</v-btn>
43+
44+
<v-btn to="/user-profile" height="48" icon>
4245
<v-icon color="tertiary">mdi-account</v-icon>
4346
</v-btn>
4447
</v-row>
@@ -48,9 +51,25 @@
4851

4952
<script>
5053
// Utilities
51-
import { mapMutations } from 'vuex';
54+
import { mapActions } from 'pinia';
55+
import { useAppStore } from '../../stores/app';
56+
import { useDisplay, useTheme } from 'vuetify';
5257
5358
export default {
59+
setup() {
60+
const theme = useTheme();
61+
const cookieTheme = useCookieTheme();
62+
63+
return {
64+
theme,
65+
toggleTheme: () => {
66+
const themeValue = theme.global.current.value.dark ? 'light' : 'dark';
67+
theme.global.name.value = themeValue;
68+
cookieTheme.value = themeValue;
69+
},
70+
};
71+
},
72+
5473
data: () => ({
5574
notifications: [
5675
'Mike, John responded to your email',
@@ -60,34 +79,30 @@ export default {
6079
'Another One',
6180
],
6281
title: null,
63-
responsive: false,
6482
}),
6583
84+
computed: {
85+
responsive() {
86+
const display = useDisplay();
87+
return display.lg.value;
88+
},
89+
},
90+
6691
watch: {
6792
$route(val) {
6893
this.title = val.name;
6994
},
7095
},
7196
72-
mounted() {
73-
this.onResponsiveInverted();
74-
window.addEventListener('resize', this.onResponsiveInverted);
75-
},
76-
beforeDestroy() {
77-
window.removeEventListener('resize', this.onResponsiveInverted);
97+
created() {
98+
this.setDrawer(this.responsive);
99+
this.title = this.$route.name;
78100
},
79101
80102
methods: {
81-
...mapMutations('app', ['setDrawer', 'toggleDrawer']),
103+
...mapActions(useAppStore, ['setDrawer', 'toggleDrawer']),
82104
onClick() {
83-
this.setDrawer(!this.$store.state.app.drawer);
84-
},
85-
onResponsiveInverted() {
86-
if (window.innerWidth < 991) {
87-
this.responsive = true;
88-
} else {
89-
this.responsive = false;
90-
}
105+
this.setDrawer(!useAppStore().drawer);
91106
},
92107
},
93108
};

0 commit comments

Comments
 (0)