From 052bf22b2e5dc0874cbe3c86d3a833842931ddae Mon Sep 17 00:00:00 2001 From: Deepansh Mathur Date: Fri, 26 Apr 2024 01:23:35 +0530 Subject: [PATCH] setting for language picker popup --- src/App.vue | 76 ++++++++++++++++---- src/assets/locales/en.js | 5 ++ src/assets/locales/hi.js | 6 ++ src/pages/Embeds/Plio.vue | 16 +++++ src/services/Config/GlobalDefaultSettings.js | 16 +++++ src/services/Config/User.js | 7 +- src/store/modules/generic.js | 16 +++++ 7 files changed, 123 insertions(+), 19 deletions(-) diff --git a/src/App.vue b/src/App.vue index 8462d2aa6..f68a54805 100644 --- a/src/App.vue +++ b/src/App.vue @@ -173,7 +173,13 @@
this.createSession()) .then(() => this.logData()); diff --git a/src/services/Config/GlobalDefaultSettings.js b/src/services/Config/GlobalDefaultSettings.js index c65493166..6a31ee0a8 100644 --- a/src/services/Config/GlobalDefaultSettings.js +++ b/src/services/Config/GlobalDefaultSettings.js @@ -16,6 +16,11 @@ export let settingsMetadata = { description: "settings.menu.description.skipEnabled", type: "checkbox", }, + firstTimeLanguagePickerPopup: { + title: "settings.menu.title.firstTimeLanguagePickerPopup", + description: "settings.menu.description.firstTimeLanguagePickerPopup", + type: "checkbox", + }, }; /** @@ -51,6 +56,17 @@ let globalDefaultSetings = new Map( }) ), }, + ui: { + scope: ["org-admin", "super-admin"], + children: new Map( + Object.entries({ + firstTimeLanguagePickerPopup: { + scope: ["org-admin", "super-admin"], + value: true, + }, + }) + ), + }, }) ), }, diff --git a/src/services/Config/User.js b/src/services/Config/User.js index 1845230a5..6cffb0a24 100644 --- a/src/services/Config/User.js +++ b/src/services/Config/User.js @@ -15,17 +15,14 @@ export default { setLocaleFromUserConfig() { // set the system locale from the user config let redirectId = setInterval(() => { - let activeWorkspace = store.state.auth.activeWorkspace; let userConfig = store.state.auth.config; - if (activeWorkspace === "tap") { - i18n.global.locale = process.env.VUE_APP_I18N_LOCALE; - } else if (userConfig != null) { + if (userConfig != null) { userConfig = JSON.parse(userConfig); i18n.global.locale = userConfig["locale"] || process.env.VUE_APP_I18N_LOCALE; clearInterval(redirectId); } - }, 10); + }, 50); }, updateLocale() { diff --git a/src/store/modules/generic.js b/src/store/modules/generic.js index 6368aa53e..3ecab62bf 100644 --- a/src/store/modules/generic.js +++ b/src/store/modules/generic.js @@ -1,4 +1,5 @@ const state = { + isFirstTimeLanguagePickerShownBySetting: true, isSharePlioDialogShown: false, isEmbedPlioDialogShown: false, // whether to show the dialog with info on embedding plio plioLinkToShare: null, @@ -22,6 +23,9 @@ const getters = { isTabScreen: (state) => { return state.windowInnerWidth < 640; }, + isFirstTimeLanguagePickerShownBySetting: (state) => { + return state.isFirstTimeLanguagePickerShownBySetting; + }, }; const actions = { showSharePlioDialog({ commit, dispatch }, plioLink) { @@ -59,6 +63,12 @@ const actions = { hideSpinner({ commit }) { commit("hideSpinner"); }, + setFirstTimeLanguagePickerShownBySetting({ commit }) { + commit("setFirstTimeLanguagePickerShownBySetting"); + }, + unsetFirstTimeLanguagePickerShownBySetting({ commit }) { + commit("unsetFirstTimeLanguagePickerShownBySetting"); + }, }; const mutations = { @@ -92,6 +102,12 @@ const mutations = { hideSpinner(state) { state.isSpinnerShown = false; }, + setFirstTimeLanguagePickerShownBySetting(state) { + state.isFirstTimeLanguagePickerShownBySetting = true; + }, + unsetFirstTimeLanguagePickerShownBySetting(state) { + state.isFirstTimeLanguagePickerShownBySetting = false; + }, }; export default {