@dracul/customize-frontend 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dracul/customize-frontend",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "vue custom logo, custom theme, custom colors, i18n configuration}",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -18,10 +18,10 @@
18
18
  ],
19
19
  "author": "Cristian Incarnato",
20
20
  "license": "MIT",
21
- "gitHead": "9738c340cc32c1a3de1bed55e2d744704e60c842",
21
+ "gitHead": "0eed16977d33ffb602da49e4d57663b5df40a0c0",
22
22
  "dependencies": {
23
- "@dracul/common-frontend": "^1.13.0",
24
- "@dracul/user-frontend": "^1.13.0"
23
+ "@dracul/common-frontend": "^1.14.0",
24
+ "@dracul/user-frontend": "^1.14.0"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "apollo-cache-inmemory": "^1.6.6",
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <v-switch
3
+ :label="getLabel"
4
+ :dense="dense"
5
+ v-model="dark"
6
+ :color="color"
7
+ hide-details
8
+ ></v-switch>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ name: "DarkMode",
14
+ props: {
15
+ label: {type: String, default: 'customization.darkMode'},
16
+ color: {type: String, default: 'green'},
17
+ dense: {type: Boolean, default: true},
18
+
19
+ },
20
+ computed: {
21
+ dark: {
22
+ get() {
23
+ return this.$vuetify.theme.dark
24
+ },
25
+ set(val) {
26
+ this.$store.commit('darkMode', val)
27
+ this.$vuetify.theme.dark = val
28
+ }
29
+ },
30
+ getLabel() {
31
+ return this.$te(this.label) ? this.$t(this.label) : this.label
32
+ }
33
+ }
34
+ }
35
+ </script>
36
+
37
+ <style scoped>
38
+
39
+ </style>
@@ -0,0 +1,4 @@
1
+ import DarkMode from "./DarkMode";
2
+
3
+ export {DarkMode}
4
+ export default DarkMode
@@ -4,13 +4,18 @@ const messages = {
4
4
  title: 'Customization',
5
5
  preview: 'Preview',
6
6
  applyButton: 'Apply',
7
+ darkMode: 'Dark mode',
7
8
  colors: {
8
9
  title: 'Colors',
9
- subtitle: 'Platform color settings',
10
+ lightTitle: 'Light Theme Colors',
11
+ lightSubtitle: 'Platform light theme color settings',
12
+ darkTitle: 'Dark Theme Colors',
13
+ darkSubtitle: 'Platform dark theme color settings',
10
14
  primary: 'Primary',
11
15
  onPrimary: 'On Primary',
12
16
  secondary: 'Secondary',
13
17
  onSecondary: 'On Secondary',
18
+ background: 'background',
14
19
 
15
20
  },
16
21
  lang: {
@@ -53,13 +58,18 @@ const messages = {
53
58
  title: 'Personalización',
54
59
  preview: 'Vista previa',
55
60
  applyButton: 'Aplicar',
61
+ darkMode: 'Modo oscuro',
56
62
  colors: {
57
63
  title: 'Colores',
58
- subtitle: 'Configuracion de los colores de la plataforma',
64
+ lightTitle: 'Tema Claro',
65
+ lightSubtitle: 'Configuración de colores en tema claro',
66
+ darkTitle: 'Tema Oscuro',
67
+ darkSubtitle: 'Configuración de colores en tema oscuro',
59
68
  primary: 'Primario',
60
69
  onPrimary: 'En Primario',
61
70
  secondary: 'Secundario',
62
71
  onSecondary: 'En Secundario',
72
+ background: 'Fondo'
63
73
  },
64
74
  lang: {
65
75
  title: 'Idioma',
@@ -100,13 +110,18 @@ const messages = {
100
110
  title: 'Costumização',
101
111
  preview: 'Vista prévia',
102
112
  applyButton: 'Aplique',
113
+ darkMode: 'Dark mode',
103
114
  colors: {
104
- title: 'Cores',
105
- subtitle: 'Configurações de cores da plataforma',
115
+ title: 'Colors',
116
+ lightTitle: 'Luz do tema',
117
+ lightSubtitle: 'Configurações de cores luz do tema',
118
+ darkTitle: 'Tema Escuro',
119
+ darkSubtitle: 'Configuración de cores tema escuro',
106
120
  primary: 'Primário',
107
121
  onPrimary: 'No primário',
108
122
  secondary: 'Secundário',
109
123
  onSecondary: 'No secundário',
124
+ background: 'Fondo'
110
125
  },
111
126
  lang: {
112
127
  title: 'Linguagem',
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import CustomConfigPage from "./pages/CustomConfigPage/CustomConfigPage";
2
2
  import LogoToolbar from "./components/LogoToolbar";
3
+ import DarkMode from "./components/DarkMode";
3
4
  import TitleToolbar from "./components/TitleToolbar";
4
5
  import LogoPreview from "./components/LogoPreview";
5
6
  import LanguageCombobox from "./components/LanguageCombobox";
@@ -13,6 +14,7 @@ export {
13
14
  CustomConfigPage,
14
15
  //Components
15
16
  LogoToolbar,
17
+ DarkMode,
16
18
  TitleToolbar,
17
19
  LogoPreview,
18
20
  LanguageCombobox,
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <v-row justify="center" align-content="center">
3
+ <v-col cols="12" md="4" lg="4">
4
+ <v-card class="pa-6" :style="{backgroundColor: background}">
5
+ <v-card-title class="mb-3 justify-center" :style="{color: primary}">
6
+ <div v-t="'customization.preview'"></div>
7
+ </v-card-title>
8
+ <v-card-text class="text-center">
9
+ <v-row>
10
+ <v-col cols="6" :style="{backgroundColor: primary, color: onPrimary}">
11
+ {{ $t('customization.colors.primary') }}
12
+ </v-col>
13
+ <v-col cols="6" :style="{backgroundColor: secondary, color: onSecondary}">
14
+ {{ $t('customization.colors.secondary') }}
15
+ </v-col>
16
+ </v-row>
17
+
18
+ </v-card-text>
19
+ </v-card>
20
+ </v-col>
21
+ </v-row>
22
+ </template>
23
+ <script>
24
+ export default {
25
+ name: 'colors-preview',
26
+ props: {
27
+ background: {type: String},
28
+ primary: {type: String},
29
+ onPrimary: {type: String},
30
+ secondary: {type: String},
31
+ onSecondary: {type: String},
32
+ }
33
+ }
34
+ </script>
@@ -1,124 +1,194 @@
1
1
  <template>
2
- <v-card outlined>
3
- <v-card-title>
4
- <div v-t="'customization.colors.title'"></div>
5
- <br>
6
- </v-card-title>
7
- <v-card-subtitle v-t="'customization.colors.subtitle'">
8
- </v-card-subtitle>
9
- <v-card-text class="pb-0 ">
10
- <v-form ref="colorsForm" autocomplete="off" @submit.prevent="$emit('save')">
11
-
12
- <v-row>
13
- <v-col cols="12" sm="6" md="3" class="pb-0">
14
- <color-input v-model="formColors.primary"
15
- :label="$t('customization.colors.primary')"
16
- color="secondary"
17
- :rules="[rules.required]"
18
- />
19
- </v-col>
20
-
21
- <v-col cols="12" sm="6" md="3">
22
- <color-input v-model="formColors.onPrimary"
23
- :label="$t('customization.colors.onPrimary')"
24
- color="secondary"
25
- :rules="[rules.required]"
26
- />
27
- </v-col>
28
-
29
- <v-col cols="12" sm="6" md="3">
30
- <color-input v-model="formColors.secondary"
31
- :label="$t('customization.colors.secondary')"
32
- color="secondary"
33
- :rules="[rules.required]"
34
- />
35
- </v-col>
36
-
37
- <v-col cols="12" sm="6" md="3">
38
- <color-input v-model="formColors.onSecondary"
39
- :label="$t('customization.colors.onSecondary')"
40
- color="secondary"
41
- :rules="[rules.required]"
42
- />
43
- </v-col>
44
-
45
- </v-row>
46
- </v-form>
47
-
48
- </v-card-text>
49
-
50
- <v-card-text class="pt-0 ">
51
- <v-row justify="center" align-content="center">
52
- <v-col cols="12" md="4" lg="4">
53
- <v-card>
54
- <v-card-title>
55
- <div v-t="'customization.preview'"></div>
56
- </v-card-title>
57
- <v-card-text class="text-center">
58
- <v-row>
59
- <v-col cols="6" :style="getStyleColor('primary','onPrimary')">
60
- {{$t('customization.colors.primary')}}
61
- </v-col>
62
- <v-col cols="6" :style="getStyleColor('secondary','onSecondary')">
63
- {{$t('customization.colors.secondary')}}
64
- </v-col>
65
- </v-row>
66
-
67
- </v-card-text>
68
- </v-card>
69
- </v-col>
70
- </v-row>
71
- </v-card-text>
72
-
73
- <v-divider></v-divider>
74
-
75
- <v-card-actions>
76
- <v-btn @click="saveColors" text color="blue darken-4" v-t="'customization.applyButton'"></v-btn>
77
- </v-card-actions>
2
+ <v-container fluid>
3
+ <v-card v-if="formColors.lightTheme" outlined>
4
+ <v-card-title>
5
+ <div v-t="'customization.colors.lightTitle'"></div>
6
+ <br>
7
+ </v-card-title>
8
+ <v-card-subtitle v-t="'customization.colors.lightSubtitle'">
9
+ </v-card-subtitle>
10
+ <v-card-text class="pb-0 ">
11
+ <v-form ref="colorsForm" autocomplete="off" @submit.prevent="$emit('save')">
12
+
13
+ <v-row>
14
+ <v-col cols="12" sm="4" md="2" class="pb-0">
15
+ <color-input v-model="formColors.lightTheme.background"
16
+ :label="$t('customization.colors.background')"
17
+ color="secondary"
18
+ :rules="[rules.required]"
19
+ />
20
+ </v-col>
21
+
22
+ <v-col cols="12" sm="4" md="2" class="pb-0">
23
+ <color-input v-model="formColors.lightTheme.primary"
24
+ :label="$t('customization.colors.primary')"
25
+ color="secondary"
26
+ :rules="[rules.required]"
27
+ />
28
+ </v-col>
29
+
30
+ <v-col cols="12" sm="4" md="2">
31
+ <color-input v-model="formColors.lightTheme.onPrimary"
32
+ :label="$t('customization.colors.onPrimary')"
33
+ color="secondary"
34
+ :rules="[rules.required]"
35
+ />
36
+ </v-col>
37
+
38
+ <v-col cols="12" sm="4" md="2">
39
+ <color-input v-model="formColors.lightTheme.secondary"
40
+ :label="$t('customization.colors.secondary')"
41
+ color="secondary"
42
+ :rules="[rules.required]"
43
+ />
44
+ </v-col>
45
+
46
+ <v-col cols="12" sm="4" md="2">
47
+ <color-input v-model="formColors.lightTheme.onSecondary"
48
+ :label="$t('customization.colors.onSecondary')"
49
+ color="secondary"
50
+ :rules="[rules.required]"
51
+ />
52
+ </v-col>
53
+
54
+ </v-row>
55
+ </v-form>
56
+
57
+ </v-card-text>
58
+
59
+ <v-card-text class="pt-0 ">
60
+
61
+ <colors-preview
62
+ :background="formColors.lightTheme.background"
63
+ :primary="formColors.lightTheme.primary"
64
+ :on-primary="formColors.lightTheme.onPrimary"
65
+ :secondary="formColors.lightTheme.secondary"
66
+ :on-secondary="formColors.lightTheme.onSecondary"
67
+
68
+ />
69
+ </v-card-text>
70
+
71
+ </v-card>
72
+
73
+
74
+ <v-card v-if="formColors.darkTheme" outlined class="mt-3">
75
+ <v-card-title>
76
+ <div v-t="'customization.colors.darkTitle'"></div>
77
+ <br>
78
+ </v-card-title>
79
+ <v-card-subtitle v-t="'customization.colors.darkSubtitle'">
80
+ </v-card-subtitle>
81
+ <v-card-text class="pb-0 ">
82
+ <v-form ref="colorsForm" autocomplete="off" @submit.prevent="$emit('save')">
83
+
84
+ <v-row>
85
+ <v-col cols="12" sm="4" md="2" class="pb-0">
86
+ <color-input v-model="formColors.darkTheme.background"
87
+ :label="$t('customization.colors.background')"
88
+ color="secondary"
89
+ :rules="[rules.required]"
90
+ />
91
+ </v-col>
92
+
93
+ <v-col cols="12" sm="4" md="2" class="pb-0">
94
+ <color-input v-model="formColors.darkTheme.primary"
95
+ :label="$t('customization.colors.primary')"
96
+ color="secondary"
97
+ :rules="[rules.required]"
98
+ />
99
+ </v-col>
100
+
101
+ <v-col cols="12" sm="4" md="2">
102
+ <color-input v-model="formColors.darkTheme.onPrimary"
103
+ :label="$t('customization.colors.onPrimary')"
104
+ color="secondary"
105
+ :rules="[rules.required]"
106
+ />
107
+ </v-col>
108
+
109
+ <v-col cols="12" sm="4" md="2">
110
+ <color-input v-model="formColors.darkTheme.secondary"
111
+ :label="$t('customization.colors.secondary')"
112
+ color="secondary"
113
+ :rules="[rules.required]"
114
+ />
115
+ </v-col>
116
+
117
+ <v-col cols="12" sm="4" md="2">
118
+ <color-input v-model="formColors.darkTheme.onSecondary"
119
+ :label="$t('customization.colors.onSecondary')"
120
+ color="secondary"
121
+ :rules="[rules.required]"
122
+ />
123
+ </v-col>
124
+
125
+ </v-row>
126
+ </v-form>
127
+
128
+ </v-card-text>
129
+
130
+ <v-card-text class="pt-0 ">
131
+ <colors-preview
132
+ :background="formColors.darkTheme.background"
133
+ :primary="formColors.darkTheme.primary"
134
+ :on-primary="formColors.darkTheme.onPrimary"
135
+ :secondary="formColors.darkTheme.secondary"
136
+ :on-secondary="formColors.darkTheme.onSecondary"
137
+
138
+ />
139
+ </v-card-text>
78
140
 
79
141
  </v-card>
142
+
143
+ <v-card>
144
+ <v-card-actions>
145
+ <v-btn @click="saveColors" text color="blue darken-4" v-t="'customization.applyButton'"></v-btn>
146
+ </v-card-actions>
147
+ </v-card>
148
+ </v-container>
80
149
  </template>
81
150
  <script>
82
- import ColorInput from "./ColorInput"
83
- import CustomizationProvider from "../../../../providers/CustomizationProvider";
84
- import {ClientError} from "@dracul/user-frontend";
85
- import {mapMutations} from "vuex";
86
-
87
- export default {
88
- name: 'customization-colors',
89
- components: {ColorInput},
90
- props: {
91
- formColors: {},
92
- },
93
- methods: {
94
- ...mapMutations([
95
- 'setColors'
96
- ]),
97
- saveColors() {
98
- if (this.$refs.colorsForm.validate()) {
99
- CustomizationProvider.updateColors(this.formColors).then(r => {
100
- this.setColors(r.data.colorsUpdate)
101
- }
102
- ).catch(error => {
103
- let clientError = new ClientError(error)
104
- this.inputErrors = clientError.inputErrors
105
- this.errorMessage = clientError.showMessage
106
- })
107
- }
108
- },
109
- },
110
- computed: {
111
- getStyleColor() {
112
- return (color, onColor) => "background-color: " + this.formColors[color] + "; color: " + this.formColors[onColor]
113
- },
114
- },
115
- data() {
116
- return {
117
- inputErrors: [],
118
- rules: {
119
- required: value => !!value || 'Requerido'
120
- },
151
+ import ColorInput from "./ColorInput"
152
+ import CustomizationProvider from "../../../../providers/CustomizationProvider";
153
+ import {ClientError} from "@dracul/user-frontend";
154
+ import {mapMutations} from "vuex";
155
+ import ColorsPreview from "./ColorsPreview";
156
+
157
+ export default {
158
+ name: 'customization-colors',
159
+ components: {ColorsPreview, ColorInput},
160
+ props: {
161
+ formColors: {},
162
+ },
163
+ methods: {
164
+ ...mapMutations([
165
+ 'setColors'
166
+ ]),
167
+ saveColors() {
168
+ if (this.$refs.colorsForm.validate()) {
169
+ CustomizationProvider.updateColors(this.formColors).then(r => {
170
+ this.setColors(r.data.colorsUpdate)
121
171
  }
122
- }
172
+ ).catch(error => {
173
+ let clientError = new ClientError(error)
174
+ this.inputErrors = clientError.inputErrors
175
+ this.errorMessage = clientError.showMessage
176
+ })
177
+ }
178
+ },
179
+ },
180
+ computed: {
181
+ getStyleColor() {
182
+ return (theme, color, onColor) => "background-color: " + this.formColors[theme][color] + "; color: " + this.formColors[theme][onColor]
183
+ },
184
+ },
185
+ data() {
186
+ return {
187
+ inputErrors: [],
188
+ rules: {
189
+ required: value => !!value || 'Requerido'
190
+ },
123
191
  }
192
+ }
193
+ }
124
194
  </script>
@@ -1,101 +1,112 @@
1
1
  <template>
2
- <v-row v-if="!loading">
2
+ <v-row v-if="!loading">
3
3
 
4
- <v-col cols="12" md="3">
5
- <customization-menu v-model="selected"/>
6
- </v-col>
4
+ <v-col cols="12" md="3">
5
+ <customization-menu v-model="selected"/>
6
+ </v-col>
7
7
 
8
- <v-col cols="12" md="9">
9
- <customization-lang v-if="selected === 0"
10
- :form-lang="formLang"
11
- :langs="langs"
12
- />
8
+ <v-col cols="12" md="9">
9
+ <customization-lang v-if="selected === 0"
10
+ :form-lang="formLang"
11
+ :langs="langs"
12
+ />
13
13
 
14
- <customization-colors v-if="selected === 1"
15
- :form-colors="formColors"
16
- />
14
+ <customization-colors v-if="selected === 1"
15
+ :form-colors="formColors"
16
+ />
17
17
 
18
- <customization-logo v-if="selected === 2"
19
- :form-logo="formLogo"
20
- />
18
+ <customization-logo v-if="selected === 2"
19
+ :form-logo="formLogo"
20
+ />
21
21
 
22
- </v-col>
22
+ </v-col>
23
23
 
24
- </v-row>
24
+ </v-row>
25
25
  </template>
26
26
 
27
27
  <script>
28
- import CustomizationProvider from "../../../providers/CustomizationProvider";
29
- import {LOGO_MODE_ONLYTITLE} from '../../../constants'
30
- import CustomizationMenu from "./CustomizationMenu";
31
- import CustomizationColors from "./CustomizationColors";
32
- import CustomizationLogo from "./CustomizationLogo";
33
- import CustomizationLang from "./CustomizationLang";
34
-
35
- export default {
36
- name: "CustomizationManagement",
37
- components: {CustomizationLang, CustomizationLogo, CustomizationColors, CustomizationMenu},
38
- created() {
39
- this.loading = true
40
- CustomizationProvider.customization().then(r => {
41
- this.formColors.primary = r.data.customization.colors.primary
42
- this.formColors.onPrimary = r.data.customization.colors.onPrimary
43
- this.formColors.secondary = r.data.customization.colors.secondary
44
- this.formColors.onSecondary = r.data.customization.colors.onSecondary
45
-
46
- this.formLogo.mode = r.data.customization.logo.mode
47
- this.formLogo.title = r.data.customization.logo.title
48
- this.formLogo.url = r.data.customization.logo.url
49
-
50
- this.formLang.language = r.data.customization.language
51
-
52
- }).finally(() => this.loading = false)
53
- },
54
- data() {
55
- return {
56
- modal: false,
57
- selected: 0,
58
- title: "Creando Customization",
59
- errorMessage: '',
60
- inputErrors: {},
61
- loading: false,
62
- menu: {
63
- primary: false,
64
- onPrimary: false,
65
- secondary: false,
66
- onSecondary: false,
67
- },
68
- langs: [{value: 'es', text:'Español'},{value: 'en', text: 'English'} ,{value: 'pt', text: 'Português'}],
69
-
70
- formLang: {
71
- language: null,
72
- },
73
-
74
- formLogo: {
75
- mode: LOGO_MODE_ONLYTITLE,
76
- title: 'APP',
77
- url: null
78
- },
79
- formColors: {
80
- primary: null,
81
- onPrimary: null,
82
- secondary: null,
83
- onSecondary: null,
84
- },
85
- rules: {
86
- required: value => !!value || 'Requerido'
87
- },
88
-
89
- }
28
+ import CustomizationProvider from "../../../providers/CustomizationProvider";
29
+ import {LOGO_MODE_ONLYTITLE} from '../../../constants'
30
+ import CustomizationMenu from "./CustomizationMenu";
31
+ import CustomizationColors from "./CustomizationColors";
32
+ import CustomizationLogo from "./CustomizationLogo";
33
+ import CustomizationLang from "./CustomizationLang";
34
+
35
+ export default {
36
+ name: "CustomizationManagement",
37
+ components: {CustomizationLang, CustomizationLogo, CustomizationColors, CustomizationMenu},
38
+ created() {
39
+ this.loading = true
40
+ CustomizationProvider.customization().then(r => {
41
+ this.formColors.lightTheme = r.data.customization.lightTheme
42
+ delete this.formColors.lightTheme.__typename
43
+ this.formColors.darkTheme = r.data.customization.darkTheme
44
+ delete this.formColors.darkTheme.__typename
45
+
46
+ this.formLogo.mode = r.data.customization.logo.mode
47
+ this.formLogo.title = r.data.customization.logo.title
48
+ this.formLogo.url = r.data.customization.logo.url
49
+
50
+ this.formLang.language = r.data.customization.language
51
+
52
+ }).finally(() => this.loading = false)
53
+ },
54
+ data() {
55
+ return {
56
+ modal: false,
57
+ selected: 0,
58
+ title: "Creando Customization",
59
+ errorMessage: '',
60
+ inputErrors: {},
61
+ loading: false,
62
+ menu: {
63
+ primary: false,
64
+ onPrimary: false,
65
+ secondary: false,
66
+ onSecondary: false,
67
+ },
68
+ langs: [{value: 'es', text: 'Español'}, {value: 'en', text: 'English'}, {value: 'pt', text: 'Português'}],
69
+
70
+ formLang: {
71
+ language: null,
72
+ },
73
+
74
+ formLogo: {
75
+ mode: LOGO_MODE_ONLYTITLE,
76
+ title: 'APP',
77
+ url: null
78
+ },
79
+ formColors: {
80
+ lightTheme: {
81
+ primary: null,
82
+ onPrimary: null,
83
+ secondary: null,
84
+ onSecondary: null,
85
+ background: null
90
86
  },
87
+ darkTheme: {
88
+ primary: null,
89
+ onPrimary: null,
90
+ secondary: null,
91
+ onSecondary: null,
92
+ background: null
93
+ }
94
+
95
+ },
96
+ rules: {
97
+ required: value => !!value || 'Requerido'
98
+ },
91
99
 
92
100
  }
101
+ },
102
+
103
+ }
93
104
  </script>
94
105
 
95
106
  <style scoped>
96
- .colorBox {
97
- border: 1px solid grey;
98
- font-weight: bold;
99
- padding: 5px;
100
- }
107
+ .colorBox {
108
+ border: 1px solid grey;
109
+ font-weight: bold;
110
+ padding: 5px;
111
+ }
101
112
  </style>
@@ -14,8 +14,8 @@ class CustomizationProvider {
14
14
  query: require('./gql/customization.graphql')
15
15
  })
16
16
  }
17
-
18
-
17
+
18
+
19
19
 
20
20
  updateCustomization(form) {
21
21
  return this.gqlc.mutate({
@@ -24,10 +24,10 @@ class CustomizationProvider {
24
24
  })
25
25
  }
26
26
 
27
- updateColors(form) {
27
+ updateColors(input) {
28
28
  return this.gqlc.mutate({
29
29
  mutation: require('./gql/colorsUpdate.graphql'),
30
- variables: form
30
+ variables: {input}
31
31
  })
32
32
  }
33
33
 
@@ -1,9 +1,19 @@
1
- mutation colorsUpdate($primary:String!, $onPrimary:String!, $secondary:String!, $onSecondary:String!){
2
- colorsUpdate(input: {primary: $primary, onPrimary: $onPrimary, secondary: $secondary, onSecondary: $onSecondary }){
3
- primary
4
- onPrimary
5
- secondary
6
- onSecondary
1
+ mutation colorsUpdate($input: ColorsUpdateInput ){
2
+ colorsUpdate(input: $input){
3
+ lightTheme{
4
+ primary
5
+ onPrimary
6
+ secondary
7
+ onSecondary
8
+ background
9
+ }
10
+ darkTheme{
11
+ primary
12
+ onPrimary
13
+ secondary
14
+ onSecondary
15
+ background
16
+ }
7
17
  }
8
18
  }
9
19
 
@@ -1,10 +1,18 @@
1
1
  query customization{
2
2
  customization{
3
- colors{
3
+ lightTheme{
4
4
  primary
5
5
  onPrimary
6
6
  secondary
7
7
  onSecondary
8
+ background
9
+ }
10
+ darkTheme{
11
+ primary
12
+ onPrimary
13
+ secondary
14
+ onSecondary
15
+ background
8
16
  }
9
17
  logo{
10
18
  mode
@@ -1,10 +1,17 @@
1
- mutation customizationUpdate($id: ID!, $primary:String!, $onPrimary:String!, $secondary:String!, $onSecondary:String!, $logo:String!, $language:String!){
2
- customizationUpdate(id: $id, input: {primary: $primary, onPrimary: $onPrimary, secondary: $secondary, onSecondary: $onSecondary, logo: $logo, language: $language }){
3
- id
4
- primary
5
- onPrimary
6
- secondary
7
- onSecondary
1
+ mutation customizationUpdate($input: CustomizationInput){
2
+ customizationUpdate(input: CustomizationInput){
3
+ lightTheme{
4
+ primary
5
+ onPrimary
6
+ secondary
7
+ onSecondary
8
+ }
9
+ darkTheme{
10
+ primary
11
+ onPrimary
12
+ secondary
13
+ onSecondary
14
+ }
8
15
  logo
9
16
  language
10
17
  }
@@ -2,12 +2,21 @@ import CustomizationProvider from "../providers/CustomizationProvider";
2
2
 
3
3
  const customizationStore = {
4
4
  state: {
5
+ darkMode: false,
5
6
  vuetifyInstance: null,
6
- colors: {
7
+ lightTheme: {
7
8
  primary: '#3F51B5',
8
9
  onPrimary: '#FFFFFF',
9
10
  secondary: '#1565C0',
10
- onSecondary: '#FFFFFF'
11
+ onSecondary: '#FFFFFF',
12
+ background: '#F5F5F5'
13
+ },
14
+ darkTheme: {
15
+ primary: '#3F51B5',
16
+ onPrimary: '#FFFFFF',
17
+ secondary: '#1565C0',
18
+ onSecondary: '#FFFFFF',
19
+ background: '#F5F5F5'
11
20
  },
12
21
  logo: {
13
22
  mode: 'OnlyTitle',
@@ -17,11 +26,20 @@ const customizationStore = {
17
26
  language: 'en'
18
27
  },
19
28
  getters: {
29
+ darkMode: (state) => {
30
+ return state.darkMode
31
+ },
20
32
  getLogo: state => {
21
33
  return state.logo
22
34
  },
23
35
  getColors: state => {
24
- return state.colors
36
+ return state.lightTheme
37
+ },
38
+ getLigthTheme: state => {
39
+ return state.lightTheme
40
+ },
41
+ getDarkTheme: state => {
42
+ return state.darkTheme
25
43
  },
26
44
  getLanguage: state => {
27
45
  return state.language
@@ -33,7 +51,7 @@ const customizationStore = {
33
51
 
34
52
  CustomizationProvider.customization()
35
53
  .then(r => {
36
- commit('setColors', r.data.customization.colors)
54
+ commit('setColors', r.data.customization)
37
55
  commit('setLogo', r.data.customization.logo)
38
56
  commit('setLanguage', r.data.customization.language)
39
57
  resolve(r.data.customization)
@@ -46,6 +64,7 @@ const customizationStore = {
46
64
  commit('setLogo', logo)
47
65
  },
48
66
  setColors({commit}, colors) {
67
+ console.log(colors)
49
68
  commit('setColors', colors)
50
69
  },
51
70
  setLanguage({commit}, language) {
@@ -53,6 +72,9 @@ const customizationStore = {
53
72
  }
54
73
  },
55
74
  mutations: {
75
+ darkMode(state, val){
76
+ state.darkMode = val
77
+ },
56
78
  setVuetifyInstance(state, vuetifyInstance) {
57
79
  state.vuetifyInstance = vuetifyInstance
58
80
  },
@@ -61,22 +83,31 @@ const customizationStore = {
61
83
  state.logo.title = title
62
84
  state.logo.url = url
63
85
  },
64
- setColors(state, {primary, onPrimary, secondary, onSecondary}) {
65
- state.colors.primary = primary
66
- state.colors.onPrimary = onPrimary
67
- state.colors.secondary = secondary
68
- state.colors.onSecondary = onSecondary
86
+ setColors(state, {lightTheme, darkTheme}) {
87
+ state.lightTheme.primary = lightTheme.primary
88
+ state.lightTheme.onPrimary = lightTheme.onPrimary
89
+ state.lightTheme.secondary = lightTheme.secondary
90
+ state.lightTheme.onSecondary = lightTheme.onSecondary
91
+ state.lightTheme.background = lightTheme.background
92
+
93
+ state.darkTheme.primary = darkTheme.primary
94
+ state.darkTheme.onPrimary = darkTheme.onPrimary
95
+ state.darkTheme.secondary = darkTheme.secondary
96
+ state.darkTheme.onSecondary = darkTheme.onSecondary
97
+ state.darkTheme.background = darkTheme.background
69
98
 
70
99
  if (state.vuetifyInstance) {
71
- state.vuetifyInstance.framework.theme.themes.light.primary = primary
72
- state.vuetifyInstance.framework.theme.themes.light.onPrimary = onPrimary
73
- state.vuetifyInstance.framework.theme.themes.light.secondary = secondary
74
- state.vuetifyInstance.framework.theme.themes.light.onSecondary = onSecondary
100
+ state.vuetifyInstance.framework.theme.themes.light.primary = lightTheme.primary
101
+ state.vuetifyInstance.framework.theme.themes.light.onPrimary = lightTheme.onPrimary
102
+ state.vuetifyInstance.framework.theme.themes.light.secondary = lightTheme.secondary
103
+ state.vuetifyInstance.framework.theme.themes.light.onSecondary = lightTheme.onSecondary
104
+ state.vuetifyInstance.framework.theme.themes.light.background = lightTheme.background
75
105
 
76
- state.vuetifyInstance.framework.theme.themes.dark.primary = primary
77
- state.vuetifyInstance.framework.theme.themes.dark.onPrimary = onPrimary
78
- state.vuetifyInstance.framework.theme.themes.dark.secondary = secondary
79
- state.vuetifyInstance.framework.theme.themes.dark.onSecondary = onSecondary
106
+ state.vuetifyInstance.framework.theme.themes.dark.primary = darkTheme.primary
107
+ state.vuetifyInstance.framework.theme.themes.dark.onPrimary = darkTheme.onPrimary
108
+ state.vuetifyInstance.framework.theme.themes.dark.secondary = darkTheme.secondary
109
+ state.vuetifyInstance.framework.theme.themes.dark.onSecondary = darkTheme.onSecondary
110
+ state.vuetifyInstance.framework.theme.themes.dark.background = darkTheme.background
80
111
  }
81
112
 
82
113
  },