diff --git a/client/web/admin/src/components/Settings/UI/CUIBrandingEditor.vue b/client/web/admin/src/components/Settings/UI/CUIBrandingEditor.vue index 8b9e25308..bcdb8bf57 100644 --- a/client/web/admin/src/components/Settings/UI/CUIBrandingEditor.vue +++ b/client/web/admin/src/components/Settings/UI/CUIBrandingEditor.vue @@ -51,9 +51,7 @@ cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="themeVariables" + :theme-settings="settings['ui.studio.themes']" /> @@ -225,12 +223,6 @@ export default { const [year, month] = VERSION.split('.') return `https://docs.cortezaproject.org/corteza-docs/${year}.${month}/integrator-guide/corteza-studio/index.html` }, - colorSchemeTooltips () { - return this.themeVariables.reduce((acc, label) => { - acc[label] = this.$t(`theme.variables.${label}`) - return acc - }, {}) - }, }, watch: { @@ -240,16 +232,11 @@ export default { const themes = settings['ui.studio.themes'] || [] const customCSS = settings['ui.studio.custom-css'] || [] - this.themeColors = themes.map(theme => { - theme.values = JSON.parse(theme.values) - return theme - }) - this.themes = this.themeTabs.map((id) => { const { title, values = '' } = themes.find(t => t.id === id) || {} const defaultCustomCSS = customCSS.find(t => t.id === id) || {} - let variables = values + let variables = JSON.parse(values || '{}') let defaultVariables if (['light', 'dark'].includes(id)) { diff --git a/client/web/admin/src/components/User/CUserEditorAvatar.vue b/client/web/admin/src/components/User/CUserEditorAvatar.vue index 605444050..45f8acad7 100644 --- a/client/web/admin/src/components/User/CUserEditorAvatar.vue +++ b/client/web/admin/src/components/User/CUserEditorAvatar.vue @@ -62,9 +62,7 @@ cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" /> @@ -87,9 +85,7 @@ cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" /> @@ -145,48 +141,13 @@ export default { }, }, - data () { - return { - swatcherLabels: [ - 'black', - 'white', - 'primary', - 'secondary', - 'success', - 'warning', - 'danger', - 'light', - 'extra-light', - 'body-bg', - 'sidebar-bg', - 'topbar-bg', - ], - } - }, - computed: { isKindAvatar () { return this.user.meta.avatarKind === 'avatar' }, - colorSchemeTooltips () { - return this.swatcherLabels.reduce((acc, label) => { - acc[label] = this.$t(`ui.settings:editor.corteza-studio.theme.variables.${label}`) - return acc - }, {}) - }, - - themeColors () { - const theme = this.$Settings.get('ui.studio.themes', []) - if (!theme.length) { - return theme - } - - return theme.map(theme => { - console.log(theme.values) - theme.values = JSON.parse(theme.values) - return theme - }) + themeSettings () { + return this.$Settings.get('ui.studio.themes', []) }, }, diff --git a/client/web/compose/src/components/ModuleFields/Configurator/File.vue b/client/web/compose/src/components/ModuleFields/Configurator/File.vue index 31618d379..69c5fab90 100644 --- a/client/web/compose/src/components/ModuleFields/Configurator/File.vue +++ b/client/web/compose/src/components/ModuleFields/Configurator/File.vue @@ -169,14 +169,12 @@ v-model="f.options.backgroundColor" :translations="{ modalTitle: $t('kind.file.view.colorPicker'), - light: $t('general:swatchers.labels.light'), - dark: $t('general:swatchers.labels.dark'), + light: $t('general:themes.labels.light'), + dark: $t('general:themes.labels.dark'), cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" /> @@ -201,25 +199,6 @@ export default { extends: base, - data () { - return { - swatcherLabels: [ - 'black', - 'white', - 'primary', - 'secondary', - 'success', - 'warning', - 'danger', - 'light', - 'extra-light', - 'body-bg', - 'sidebar-bg', - 'topbar-bg', - ], - } - }, - computed: { modes () { return [ @@ -233,23 +212,8 @@ export default { return mode === 'gallery' }, - colorSchemeTooltips () { - return this.swatcherLabels.reduce((acc, label) => { - acc[label] = this.$t(`general:swatchers.tooltips.${label}`) - return acc - }, {}) - }, - - themeColors () { - const theme = this.$Settings.get('ui.studio.themes', []) - if (!theme.length) { - return theme - } - - return theme.map(theme => { - theme.values = JSON.parse(theme.values) - return theme - }) + themeSettings () { + return this.$Settings.get('ui.studio.themes', []) }, }, } diff --git a/client/web/compose/src/components/PageBlocks/CalendarConfigurator/FeedSource/configs/Record.vue b/client/web/compose/src/components/PageBlocks/CalendarConfigurator/FeedSource/configs/Record.vue index 3c0d6c2ff..4526bba73 100644 --- a/client/web/compose/src/components/PageBlocks/CalendarConfigurator/FeedSource/configs/Record.vue +++ b/client/web/compose/src/components/PageBlocks/CalendarConfigurator/FeedSource/configs/Record.vue @@ -32,14 +32,12 @@ v-model="feed.options.color" :translations="{ modalTitle: $t('calendar.recordFeed.colorPicker'), - light: $t('general:swatchers.labels.light'), - dark: $t('general:swatchers.labels.dark'), + light: $t('general:themes.labels.light'), + dark: $t('general:themes.labels.dark'), cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" /> @@ -159,25 +157,6 @@ export default { extends: base, - data () { - return { - swatcherLabels: [ - 'black', - 'white', - 'primary', - 'secondary', - 'success', - 'warning', - 'danger', - 'light', - 'extra-light', - 'body-bg', - 'sidebar-bg', - 'topbar-bg', - ], - } - }, - computed: { /** * Finds the module, this feed configurator should use @@ -242,23 +221,8 @@ export default { ].filter(f => f.kind === 'DateTime' && !f.isMulti) }, - colorSchemeTooltips () { - return this.swatcherLabels.reduce((acc, label) => { - acc[label] = this.$t(`general:swatchers.tooltips.${label}`) - return acc - }, {}) - }, - - themeColors () { - const theme = this.$Settings.get('ui.studio.themes', []) - if (!theme.length) { - return theme - } - - return theme.map(theme => { - theme.values = JSON.parse(theme.values) - return theme - }) + themeSettings () { + return this.$Settings.get('ui.studio.themes', []) }, }, } diff --git a/client/web/compose/src/components/PageBlocks/CalendarConfigurator/FeedSource/configs/Reminder.vue b/client/web/compose/src/components/PageBlocks/CalendarConfigurator/FeedSource/configs/Reminder.vue index 327281848..febeadb76 100644 --- a/client/web/compose/src/components/PageBlocks/CalendarConfigurator/FeedSource/configs/Reminder.vue +++ b/client/web/compose/src/components/PageBlocks/CalendarConfigurator/FeedSource/configs/Reminder.vue @@ -11,14 +11,12 @@ v-model="feed.options.color" :translations="{ modalTitle: $t('calendar.recordFeed.colorPicker'), - light: $t('general:swatchers.labels.light'), - dark: $t('general:swatchers.labels.dark'), + light: $t('general:themes.labels.light'), + dark: $t('general:themes.labels.dark'), cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" /> @@ -40,43 +38,9 @@ export default { extends: base, - data () { - return { - swatcherLabels: [ - 'black', - 'white', - 'primary', - 'secondary', - 'success', - 'warning', - 'danger', - 'light', - 'extra-light', - 'body-bg', - 'sidebar-bg', - 'topbar-bg', - ], - } - }, - computed: { - colorSchemeTooltips () { - return this.swatcherLabels.reduce((acc, label) => { - acc[label] = this.$t(`general:swatchers.tooltips.${label}`) - return acc - }, {}) - }, - - themeColors () { - const theme = this.$Settings.get('ui.studio.themes', []) - if (!theme.length) { - return theme - } - - return theme.map(theme => { - theme.values = JSON.parse(theme.values) - return theme - }) + themeSettings () { + return this.$Settings.get('ui.studio.themes', []) }, }, } diff --git a/client/web/compose/src/components/PageBlocks/FileConfigurator.vue b/client/web/compose/src/components/PageBlocks/FileConfigurator.vue index 771cbe2de..9e7051a20 100644 --- a/client/web/compose/src/components/PageBlocks/FileConfigurator.vue +++ b/client/web/compose/src/components/PageBlocks/FileConfigurator.vue @@ -173,14 +173,12 @@ v-model="options.backgroundColor" :translations="{ modalTitle: $t('kind.file.view.colorPicker'), - light: $t('general:swatchers.labels.light'), - dark: $t('general:swatchers.labels.dark'), + light: $t('general:themes.labels.light'), + dark: $t('general:themes.labels.dark'), cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" /> @@ -210,25 +208,6 @@ export default { extends: base, - data () { - return { - swatcherLabels: [ - 'black', - 'white', - 'primary', - 'secondary', - 'success', - 'warning', - 'danger', - 'light', - 'extra-light', - 'body-bg', - 'sidebar-bg', - 'topbar-bg', - ], - } - }, - computed: { endpoint () { const { pageID } = this.page @@ -251,23 +230,8 @@ export default { return mode === 'gallery' }, - colorSchemeTooltips () { - return this.swatcherLabels.reduce((acc, label) => { - acc[label] = this.$t(`general:swatchers.tooltips.${label}`) - return acc - }, {}) - }, - - themeColors () { - const theme = this.$Settings.get('ui.studio.themes', []) - if (!theme.length) { - return theme - } - - return theme.map(theme => { - theme.values = JSON.parse(theme.values) - return theme - }) + themeSettings () { + return this.$Settings.get('ui.studio.themes', []) }, }, diff --git a/client/web/compose/src/components/PageBlocks/GeometryConfigurator/FeedSource/configs/Record.vue b/client/web/compose/src/components/PageBlocks/GeometryConfigurator/FeedSource/configs/Record.vue index fa6701f4c..44ddef80d 100644 --- a/client/web/compose/src/components/PageBlocks/GeometryConfigurator/FeedSource/configs/Record.vue +++ b/client/web/compose/src/components/PageBlocks/GeometryConfigurator/FeedSource/configs/Record.vue @@ -84,14 +84,12 @@ v-model="feed.options.color" :translations="{ modalTitle: $t('geometry.recordFeed.colorPicker'), - light: $t('general:swatchers.labels.light'), - dark: $t('general:swatchers.labels.dark'), + light: $t('general:themes.labels.light'), + dark: $t('general:themes.labels.dark'), cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + theme-settings="themeSettings" /> @@ -145,25 +143,6 @@ export default { extends: base, - data () { - return { - swatcherLabels: [ - 'black', - 'white', - 'primary', - 'secondary', - 'success', - 'warning', - 'danger', - 'light', - 'extra-light', - 'body-bg', - 'sidebar-bg', - 'topbar-bg', - ], - } - }, - computed: { /** * Finds the module, this feed configurator should use @@ -230,23 +209,8 @@ export default { ].filter(f => f.kind === 'Geometry') }, - colorSchemeTooltips () { - return this.swatcherLabels.reduce((acc, label) => { - acc[label] = this.$t(`general:swatchers.tooltips.${label}`) - return acc - }, {}) - }, - - themeColors () { - const theme = this.$Settings.get('ui.studio.themes', []) - if (!theme.length) { - return theme - } - - return theme.map(theme => { - theme.values = JSON.parse(theme.values) - return theme - }) + themeSettings () { + return this.$Settings.get('ui.studio.themes', []) }, }, } diff --git a/client/web/compose/src/components/PageBlocks/MetricConfigurator/MStyle.vue b/client/web/compose/src/components/PageBlocks/MetricConfigurator/MStyle.vue index 2b650148b..4c04db806 100644 --- a/client/web/compose/src/components/PageBlocks/MetricConfigurator/MStyle.vue +++ b/client/web/compose/src/components/PageBlocks/MetricConfigurator/MStyle.vue @@ -11,14 +11,12 @@ v-model="options.color" :translations="{ modalTitle: $t('metric.editStyle.colorPicker'), - light: $t('general:swatchers.labels.light'), - dark: $t('general:swatchers.labels.dark'), + light: $t('general:themes.labels.light'), + dark: $t('general:themes.labels.dark'), cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" class="mb-1" /> @@ -31,14 +29,12 @@ v-model="options.backgroundColor" :translations="{ modalTitle: $t('geometry.recordFeed.colorPicker'), - light: $t('general:swatchers.labels.light'), - dark: $t('general:swatchers.labels.dark'), + light: $t('general:themes.labels.light'), + dark: $t('general:themes.labels.dark'), cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" class="mb-1" /> @@ -81,43 +77,9 @@ export default { }, }, - data () { - return { - swatcherLabels: [ - 'black', - 'white', - 'primary', - 'secondary', - 'success', - 'warning', - 'danger', - 'light', - 'extra-light', - 'body-bg', - 'sidebar-bg', - 'topbar-bg', - ], - } - }, - computed: { - colorSchemeTooltips () { - return this.swatcherLabels.reduce((acc, label) => { - acc[label] = this.$t(`general:swatchers.tooltips.${label}`) - return acc - }, {}) - }, - - themeColors () { - const theme = this.$Settings.get('ui.studio.themes', []) - if (!theme.length) { - return theme - } - - return theme.map(theme => { - theme.values = JSON.parse(theme.values) - return theme - }) + themeSettings () { + return this.$Settings.get('ui.studio.themes', []) }, }, } diff --git a/client/web/compose/src/components/PageBlocks/Navigation/Configurator.vue b/client/web/compose/src/components/PageBlocks/Navigation/Configurator.vue index a6f016af4..43add775d 100644 --- a/client/web/compose/src/components/PageBlocks/Navigation/Configurator.vue +++ b/client/web/compose/src/components/PageBlocks/Navigation/Configurator.vue @@ -146,14 +146,12 @@ v-model="item.options.textColor" :translations="{ modalTitle: $t('navigation.colorPicker'), - light: $t('general:swatchers.labels.light'), - dark: $t('general:swatchers.labels.dark'), + light: $t('general:themes.labels.light'), + dark: $t('general:themes.labels.dark'), cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" class="w-100" /> @@ -163,14 +161,12 @@ v-model="item.options.backgroundColor" :translations="{ modalTitle: $t('navigation.colorPicker'), - light: $t('general:swatchers.labels.light'), - dark: $t('general:swatchers.labels.dark'), + light: $t('general:themes.labels.light'), + dark: $t('general:themes.labels.dark'), cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" class="w-100" /> @@ -292,42 +288,12 @@ export default { { value: 'dropdown', text: this.$t('navigation.dropdown') }, { value: 'text-section', text: this.$t('navigation.text') }, ], - - swatcherLabels: [ - 'black', - 'white', - 'primary', - 'secondary', - 'success', - 'warning', - 'danger', - 'light', - 'extra-light', - 'body-bg', - 'sidebar-bg', - 'topbar-bg', - ], } }, computed: { - colorSchemeTooltips () { - return this.swatcherLabels.reduce((acc, label) => { - acc[label] = this.$t(`general:swatchers.tooltips.${label}`) - return acc - }, {}) - }, - - themeColors () { - const theme = this.$Settings.get('ui.studio.themes', []) - if (!theme.length) { - return theme - } - - return theme.map(theme => { - theme.values = JSON.parse(theme.values) - return theme - }) + themeSettings () { + return this.$Settings.get('ui.studio.themes', []) }, }, diff --git a/client/web/compose/src/views/Admin/Charts/Edit.vue b/client/web/compose/src/views/Admin/Charts/Edit.vue index 07d54f2d1..c8e02a2bf 100644 --- a/client/web/compose/src/views/Admin/Charts/Edit.vue +++ b/client/web/compose/src/views/Admin/Charts/Edit.vue @@ -363,14 +363,12 @@ data-test-id="input-scheme-color" :translations="{ modalTitle: $t('colorScheme.pickAColor'), - light: $t('general:swatchers.labels.light'), - dark: $t('general:swatchers.labels.dark'), + light: $t('general:themes.labels.light'), + dark: $t('general:themes.labels.dark'), cancelBtnLabel: $t('general:label.cancel'), saveBtnLabel: $t('general:label.saveAndClose') }" - :color-tooltips="colorSchemeTooltips" - :swatchers="themeColors" - :swatcher-labels="swatcherLabels" + :theme-settings="themeSettings" class="d-inline-flex mr-1" >