- mail_settings_controller for setting smtp settings - added view ror rjecting dataset for editor - added new model AppConfig for stroing appwide config values - better validate_chesum.ts command with process chunking - added vue3 apps 'BasicSettings' like email, profile settings - started with 2 multilingual capabilities - npm updates
This commit is contained in:
parent
010bead723
commit
b06ccae603
67 changed files with 7820 additions and 1463 deletions
41
resources/js/Stores/locale.ts
Normal file
41
resources/js/Stores/locale.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
// src/stores/locale.ts
|
||||
import { defineStore } from 'pinia';
|
||||
import dayjs from '@/utils/dayjs';
|
||||
import { getBrowserLocale } from '@/utils/tethyscloud-l10n';
|
||||
|
||||
export const LocaleStore = defineStore('locale', {
|
||||
|
||||
state: () => ({
|
||||
locale: 'en',
|
||||
}),
|
||||
|
||||
actions: {
|
||||
setLocale(locale: string) {
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
localStorage.setItem('app-locale', locale);
|
||||
}
|
||||
this.locale = locale;
|
||||
dayjs.locale(locale); // Update dayjs locale
|
||||
},
|
||||
|
||||
initializeLocale() {
|
||||
let locale = 'en';
|
||||
|
||||
// Check if localStorage is available and has a saved locale
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
const savedLocale = localStorage.getItem('app-locale');
|
||||
if (savedLocale) {
|
||||
locale = savedLocale;
|
||||
} else {
|
||||
// Get locale from the browser if not saved in localStorage
|
||||
locale = getBrowserLocale({ languageCodeOnly: true });
|
||||
}
|
||||
} else {
|
||||
// Fallback to the browser locale if localStorage is not available
|
||||
locale = getBrowserLocale({ languageCodeOnly: true });
|
||||
}
|
||||
|
||||
this.setLocale(locale);
|
||||
},
|
||||
},
|
||||
});
|
|
@ -28,7 +28,7 @@ export enum State {
|
|||
STATE_ENABLED = 2,
|
||||
}
|
||||
|
||||
export const saveState = async (data) => {
|
||||
export const saveState = async (data: any) => {
|
||||
const url = '/api/twofactor_totp/settings/enable';
|
||||
|
||||
const resp = await axios.post(url, data);
|
||||
|
@ -122,7 +122,7 @@ export const MainService = defineStore('main', {
|
|||
this.dataset = null;
|
||||
},
|
||||
|
||||
fetch(sampleDataKey: any) {
|
||||
fetch(sampleDataKey: string) {
|
||||
// sampleDataKey= clients or history
|
||||
axios
|
||||
.get(`/data-sources/${sampleDataKey}.json`)
|
||||
|
@ -136,7 +136,7 @@ export const MainService = defineStore('main', {
|
|||
});
|
||||
},
|
||||
|
||||
fetchApi(sampleDataKey) {
|
||||
fetchApi(sampleDataKey: string) {
|
||||
// sampleDataKey= authors or datasets
|
||||
axios
|
||||
.get(`/api/${sampleDataKey}`)
|
||||
|
@ -150,7 +150,7 @@ export const MainService = defineStore('main', {
|
|||
});
|
||||
},
|
||||
|
||||
setState(state) {
|
||||
setState(state: any) {
|
||||
this.totpState = state;
|
||||
},
|
||||
|
||||
|
|
|
@ -61,5 +61,17 @@ export const StyleService = defineStore('style', {
|
|||
document.documentElement.classList[this.darkMode ? 'add' : 'remove']('dark-scrollbars-compat');
|
||||
}
|
||||
},
|
||||
|
||||
// Toggle dark mode
|
||||
setLocale(payload?: boolean) {
|
||||
this.darkMode = payload !== undefined ? payload : !this.darkMode;
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
localStorage.setItem(darkModeKey, this.darkMode ? '1' : '0');
|
||||
}
|
||||
if (typeof document !== 'undefined') {
|
||||
document.body.classList[this.darkMode ? 'add' : 'remove']('dark-scrollbars');
|
||||
document.documentElement.classList[this.darkMode ? 'add' : 'remove']('dark-scrollbars-compat');
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue