snappymail/dev/Stores/User/App.js

25 lines
735 B
JavaScript
Raw Normal View History

import { keyScope, leftPanelDisabled, SettingsGet, elementById } from 'Common/Globals';
2022-02-17 16:36:29 +08:00
import { addObservablesTo } from 'External/ko';
import { ThemeStore } from 'Stores/Theme';
2023-02-22 22:06:59 +08:00
import { arePopupsVisible } from 'Knoin/Knoin';
export const AppUserStore = {
allowContacts: () => !!SettingsGet('contactsAllowed')
};
addObservablesTo(AppUserStore, {
2022-03-06 05:25:32 +08:00
focusedState: 'none',
threadsAllowed: false
});
AppUserStore.focusedState.subscribe(value => {
2022-02-26 00:02:08 +08:00
['FolderList','MessageList','MessageView'].forEach(name => {
if (name === value) {
2023-02-22 22:06:59 +08:00
arePopupsVisible() || keyScope(value);
2022-03-06 05:25:32 +08:00
ThemeStore.isMobile() && leftPanelDisabled('FolderList' !== value);
2022-02-26 00:02:08 +08:00
}
2023-02-23 00:43:54 +08:00
elementById('V-Mail'+name).classList.toggle('focused', name === value);
});
});