Browse Source

Temp

master
morethanwords 4 years ago
parent
commit
284848beec
  1. 6
      src/components/sidebarLeft/index.ts
  2. 27
      src/components/sidebarLeft/tabs/chatFolders.ts
  3. 8
      src/components/sidebarLeft/tabs/contacts.ts
  4. 2
      src/index.hbs

6
src/components/sidebarLeft/index.ts

@ -91,8 +91,10 @@ export class AppSidebarLeft extends SidebarSlider { @@ -91,8 +91,10 @@ export class AppSidebarLeft extends SidebarSlider {
new AppArchivedTab(this).open();
});
attachClickEvent(this.buttons.contacts, (e) => {
new AppContactsTab(this).open();
[this.newButtons.privateChat, this.buttons.contacts].forEach(btn => {
attachClickEvent(btn, (e) => {
new AppContactsTab(this).open();
});
});
attachClickEvent(this.buttons.settings, (e) => {

27
src/components/sidebarLeft/tabs/chatFolders.ts

@ -19,7 +19,7 @@ import { SettingSection } from ".."; @@ -19,7 +19,7 @@ import { SettingSection } from "..";
export default class AppChatFoldersTab extends SliderSuperTab {
private createFolderBtn: HTMLElement;
private foldersContainer: HTMLElement;
private foldersSection: SettingSection;
private suggestedSection: SettingSection;
private stickerContainer: HTMLElement;
private animation: RLottiePlayer;
@ -117,20 +117,17 @@ export default class AppChatFoldersTab extends SliderSuperTab { @@ -117,20 +117,17 @@ export default class AppChatFoldersTab extends SliderSuperTab {
icon: 'add'
});
const sec1 = new SettingSection({
this.foldersSection = new SettingSection({
name: 'Folders'
});
this.foldersSection.container.style.display = 'none';
this.foldersContainer = sec1.content;
const sec2 = new SettingSection({
this.suggestedSection = new SettingSection({
name: 'Recommended folders'
});
this.suggestedSection = sec2;
this.suggestedSection.container.style.display = 'none';
this.scrollable.append(this.stickerContainer, caption, this.createFolderBtn, sec1.container, sec2.container);
this.scrollable.append(this.stickerContainer, caption, this.createFolderBtn, this.foldersSection.container, this.suggestedSection.container);
attachClickEvent(this.createFolderBtn, () => {
if(Object.keys(this.filtersRendered).length >= 10) {
@ -150,10 +147,16 @@ export default class AppChatFoldersTab extends SliderSuperTab { @@ -150,10 +147,16 @@ export default class AppChatFoldersTab extends SliderSuperTab {
this.animation = player;
});
const onFiltersContainerUpdate = () => {
this.foldersSection.container.style.display = Object.keys(this.filtersRendered).length ? '' : 'none';
};
appMessagesManager.filtersStorage.getDialogFilters().then(filters => {
for(const filter of filters) {
this.renderFolder(filter, this.foldersContainer);
this.renderFolder(filter, this.foldersSection.content);
}
onFiltersContainerUpdate();
});
this.listenerSetter.add(rootScope, 'filter_update', (e) => {
@ -161,9 +164,11 @@ export default class AppChatFoldersTab extends SliderSuperTab { @@ -161,9 +164,11 @@ export default class AppChatFoldersTab extends SliderSuperTab {
if(this.filtersRendered.hasOwnProperty(filter.id)) {
this.renderFolder(filter, null, this.filtersRendered[filter.id]);
} else {
this.renderFolder(filter, this.foldersContainer);
this.renderFolder(filter, this.foldersSection.content);
}
onFiltersContainerUpdate();
this.getSuggestedFilters();
});
@ -180,6 +185,8 @@ export default class AppChatFoldersTab extends SliderSuperTab { @@ -180,6 +185,8 @@ export default class AppChatFoldersTab extends SliderSuperTab {
this.filtersRendered[filter.id].remove();
delete this.filtersRendered[filter.id]
}
onFiltersContainerUpdate();
});
this.listenerSetter.add(rootScope, 'filter_order', (e: BroadcastEvents['filter_order']) => {

8
src/components/sidebarLeft/tabs/contacts.ts

@ -4,6 +4,7 @@ import appUsersManager from "../../../lib/appManagers/appUsersManager"; @@ -4,6 +4,7 @@ import appUsersManager from "../../../lib/appManagers/appUsersManager";
import appPhotosManager from "../../../lib/appManagers/appPhotosManager";
import rootScope from "../../../lib/rootScope";
import InputSearch from "../../inputSearch";
import { canFocus } from "../../../helpers/dom";
// TODO: поиск по людям глобальный, если не нашло в контактах никого
@ -45,6 +46,11 @@ export default class AppContactsTab extends SliderSuperTab { @@ -45,6 +46,11 @@ export default class AppContactsTab extends SliderSuperTab {
(Array.from(this.list.children) as HTMLElement[]).slice(pageCount).forEach(el => el.remove()); */
}
onOpenAfterTimeout() {
if(!canFocus(true)) return;
this.inputSearch.input.focus();
}
public openContacts(query?: string) {
if(this.init) {
this.init();
@ -115,4 +121,4 @@ export default class AppContactsTab extends SliderSuperTab { @@ -115,4 +121,4 @@ export default class AppContactsTab extends SliderSuperTab {
this.openContacts();
return super.open();
}
}
}

2
src/index.hbs

@ -130,7 +130,7 @@ @@ -130,7 +130,7 @@
<div class="btn-menu top-left">
<div class="btn-menu-item menu-channel tgico-newchannel rp">New Channel</div>
<div class="btn-menu-item menu-group tgico-newgroup rp">New Group</div>
<div class="btn-menu-item menu-privateChat tgico-newprivate rp btn-disabled">New Private Chat</div>
<div class="btn-menu-item menu-privateChat tgico-newprivate rp">New Private Chat</div>
</div>
</button>
</div>

Loading…
Cancel
Save