2021-11-08 00:06:08 +08:00
|
|
|
import { keyScope, leftPanelDisabled, SettingsGet, elementById } from 'Common/Globals';
|
2022-02-17 16:36:29 +08:00
|
|
|
import { addObservablesTo } from 'External/ko';
|
2021-02-17 03:12:23 +08:00
|
|
|
import { ThemeStore } from 'Stores/Theme';
|
2023-02-22 22:06:59 +08:00
|
|
|
import { arePopupsVisible } from 'Knoin/Knoin';
|
2020-09-04 18:05:17 +08:00
|
|
|
|
2021-03-11 05:41:35 +08:00
|
|
|
export const AppUserStore = {
|
2023-02-21 18:52:50 +08:00
|
|
|
allowContacts: () => !!SettingsGet('contactsAllowed')
|
2021-03-11 05:41:35 +08:00
|
|
|
};
|
|
|
|
|
2021-03-16 17:59:47 +08:00
|
|
|
addObservablesTo(AppUserStore, {
|
2022-03-06 05:25:32 +08:00
|
|
|
focusedState: 'none',
|
2021-03-11 05:41:35 +08:00
|
|
|
|
2022-09-08 19:28:24 +08:00
|
|
|
threadsAllowed: false
|
2021-03-11 05:41:35 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
2021-11-06 19:27:37 +08:00
|
|
|
});
|
2021-03-11 05:41:35 +08:00
|
|
|
});
|