Merge branch 'prod'

pull/5227/head
Cagatay Civici 2024-02-06 09:18:52 +03:00
commit 36c0cdd6a7
5 changed files with 1 additions and 29 deletions

View File

@ -34,13 +34,6 @@ export default {
}); });
}, },
mounted() { mounted() {
const preferredColorScheme = localStorage.getItem(this.$appState.colorSchemeKey);
const prefersDarkColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
if ((preferredColorScheme === null && prefersDarkColorScheme) || preferredColorScheme === 'dark') {
this.applyTheme({ theme: 'aura-dark-green', dark: true });
}
EventBus.on('theme-change', this.themeChangeListener); EventBus.on('theme-change', this.themeChangeListener);
}, },
beforeUnmount() { beforeUnmount() {

View File

@ -39,13 +39,6 @@ export default {
}); });
}, },
mounted() { mounted() {
const preferredColorScheme = localStorage.getItem(this.$appState.colorSchemeKey);
const prefersDarkColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
if ((preferredColorScheme === null && prefersDarkColorScheme) || preferredColorScheme === 'dark') {
this.applyTheme({ theme: 'aura-dark-green', dark: true });
}
EventBus.on('theme-change', this.themeChangeListener); EventBus.on('theme-change', this.themeChangeListener);
}, },
beforeUnmount() { beforeUnmount() {

View File

@ -104,12 +104,9 @@ export default {
if (this.$appState.darkTheme) { if (this.$appState.darkTheme) {
newTheme = currentTheme.replace('dark', 'light'); newTheme = currentTheme.replace('dark', 'light');
localStorage.setItem(this.$appState.colorSchemeKey, 'light');
} else { } else {
if (currentTheme.includes('light')) newTheme = currentTheme.replace('light', 'dark'); if (currentTheme.includes('light')) newTheme = currentTheme.replace('light', 'dark');
else newTheme = 'aura-dark-green'; //fallback else newTheme = 'aura-dark-green'; //fallback
localStorage.setItem(this.$appState.colorSchemeKey, 'dark');
} }
EventBus.emit('theme-change', { theme: newTheme, dark: !this.$appState.darkTheme }); EventBus.emit('theme-change', { theme: newTheme, dark: !this.$appState.darkTheme });

View File

@ -52,22 +52,12 @@ export default {
expire.setTime(today.getTime() + 3600000 * 24 * 7); expire.setTime(today.getTime() + 3600000 * 24 * 7);
document.cookie = 'primeaffiliateid=' + afId + ';expires=' + expire.toUTCString() + ';path=/; domain:primefaces.org'; document.cookie = 'primeaffiliateid=' + afId + ';expires=' + expire.toUTCString() + ';path=/; domain:primefaces.org';
} }
const preferredColorScheme = localStorage.getItem(this.$appState.colorSchemeKey);
const prefersDarkColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
if ((preferredColorScheme === null && prefersDarkColorScheme) || preferredColorScheme === 'dark') {
this.replaceTableTheme('aura-dark-green');
} else {
this.replaceTableTheme('aura-light-green');
}
}, },
methods: { methods: {
onDarkModeToggle() { onDarkModeToggle() {
const newTheme = this.$appState.darkTheme ? 'aura-light-green' : 'aura-dark-green'; const newTheme = this.$appState.darkTheme ? 'aura-light-green' : 'aura-dark-green';
const newTableTheme = this.$appState.darkTheme ? this.tableTheme.replace('dark', 'light') : this.tableTheme.replace('light', 'dark'); const newTableTheme = this.$appState.darkTheme ? this.tableTheme.replace('dark', 'light') : this.tableTheme.replace('light', 'dark');
localStorage.setItem(this.$appState.colorSchemeKey, this.$appState.darkTheme ? 'light' : 'dark');
EventBus.emit('theme-change', { theme: newTheme, dark: !this.$appState.darkTheme }); EventBus.emit('theme-change', { theme: newTheme, dark: !this.$appState.darkTheme });
this.replaceTableTheme(newTableTheme); this.replaceTableTheme(newTableTheme);
}, },

View File

@ -8,8 +8,7 @@ const $appState = {
newsActive: false, newsActive: false,
announcement: null, announcement: null,
ripple: false, ripple: false,
storageKey: 'primevue', storageKey: 'primevue'
colorSchemeKey: 'primevue-color-scheme'
}); });
} }
}; };