From 411c7a8d9cdc01d54d669a4f333825d2bdb5ef3d Mon Sep 17 00:00:00 2001 From: morethanwords Date: Tue, 13 Apr 2021 22:48:46 +0400 Subject: [PATCH] Chatlist menu footer --- src/components/sidebarLeft/index.ts | 25 ++++++++++++++++++- .../sidebarRight/tabs/sharedMedia.ts | 3 ++- src/config/app.ts | 2 +- src/lang.ts | 2 ++ src/lib/appManagers/appImManager.ts | 4 +++ src/scss/partials/_button.scss | 20 +++++++++++++++ 6 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/components/sidebarLeft/index.ts b/src/components/sidebarLeft/index.ts index 7bc84f7a..6ebfc6a2 100644 --- a/src/components/sidebarLeft/index.ts +++ b/src/components/sidebarLeft/index.ts @@ -36,6 +36,7 @@ import findUpClassName from "../../helpers/dom/findUpClassName"; import findUpTag from "../../helpers/dom/findUpTag"; import PeerTitle from "../peerTitle"; import { replaceContent } from "../../helpers/dom"; +import App from "../../config/app"; export const LEFT_COLUMN_ACTIVE_CLASSNAME = 'is-left-column-shown'; @@ -135,12 +136,34 @@ export class AppSidebarLeft extends SidebarSlider { }) }, { icon: 'help', - text: 'SettingsHelp', + text: 'TelegramFeatures', onClick: () => { appImManager.openUsername('TelegramTips'); } + }, { + icon: 'help', + text: 'ReportBug', + onClick: () => { + const a = document.createElement('a'); + a.target = '_blank'; + a.href = 'https://bugs.telegram.org/?tag_ids=40&sort=time'; + document.body.append(a); + a.click(); + setTimeout(() => { + a.remove(); + }, 0); + } }]); + const btnMenuFooter = document.createElement('div'); + btnMenuFooter.classList.add('btn-menu-footer'); + const t = document.createElement('span'); + t.classList.add('btn-menu-footer-text'); + t.innerHTML = 'Telegram WebK alpha ' + App.version; + btnMenuFooter.append(t); + btnMenu.classList.add('has-footer'); + btnMenu.append(btnMenuFooter); + btnMenu.classList.add('bottom-right'); this.toolsBtn.append(btnMenu); diff --git a/src/components/sidebarRight/tabs/sharedMedia.ts b/src/components/sidebarRight/tabs/sharedMedia.ts index 9d201667..36599a3a 100644 --- a/src/components/sidebarRight/tabs/sharedMedia.ts +++ b/src/components/sidebarRight/tabs/sharedMedia.ts @@ -224,7 +224,8 @@ class PeerProfileAvatars { const x = e.pageX; const clickX = x - rect.left; - if(clickX > (rect.width * SWITCH_ZONE) && clickX < (rect.width - rect.width * SWITCH_ZONE)) { + if((!this.listLoader.previous.length && !this.listLoader.next.length) + || (clickX > (rect.width * SWITCH_ZONE) && clickX < (rect.width - rect.width * SWITCH_ZONE))) { const peerId = this.peerId; const targets: {element: HTMLElement, item: string | Message.messageService}[] = []; diff --git a/src/config/app.ts b/src/config/app.ts index 78ac664e..aaf6c731 100644 --- a/src/config/app.ts +++ b/src/config/app.ts @@ -13,7 +13,7 @@ const App = { id: 1025907, hash: '452b0359b988148995f22ff0f4229750', version: '0.4.0', - langPackVersion: '0.1.2', + langPackVersion: '0.1.3', langPack: 'macos', langPackCode: 'en', domains: [] as string[], diff --git a/src/lang.ts b/src/lang.ts index 5466e524..b2e77538 100644 --- a/src/lang.ts +++ b/src/lang.ts @@ -90,6 +90,7 @@ const lang = { "MediaViewer.Context.Download": "Download", "Profile": "Profile", "Saved": "Saved", + "ReportBug": "Report Bug", // * android "ActionCreateChannel": "Channel created", @@ -390,6 +391,7 @@ const lang = { "other_value": "%1$d stickers" }, "HidAccount": "The account was hidden by the user", + "TelegramFeatures": "Telegram Features", // * macos "AccountSettings.Filters": "Chat Folders", diff --git a/src/lib/appManagers/appImManager.ts b/src/lib/appManagers/appImManager.ts index abce6cd6..c917d050 100644 --- a/src/lib/appManagers/appImManager.ts +++ b/src/lib/appManagers/appImManager.ts @@ -261,6 +261,10 @@ export class AppImManager { } public getChatSavedPosition(chat: Chat): ChatSavedPosition { + if(!(['chat', 'discussion'] as ChatType[]).includes(chat.type) || !chat.peerId) { + return; + } + const key = chat.peerId + (chat.threadId ? '_' + chat.threadId : ''); return sessionStorage.getFromCache('chatPositions')[key]; } diff --git a/src/scss/partials/_button.scss b/src/scss/partials/_button.scss index db3c56ae..d2650ea4 100644 --- a/src/scss/partials/_button.scss +++ b/src/scss/partials/_button.scss @@ -227,6 +227,26 @@ width: auto !important; max-width: none !important; } + + &.has-footer { + padding-bottom: 0; + } + + &-footer { + height: 2.5rem; + background: var(--background-color-true); + display: flex; + align-items: center; + justify-content: center; + border-bottom-left-radius: inherit; + border-bottom-right-radius: inherit; + font-size: .875rem; + cursor: default; + + &-text { + margin-top: -.125rem; + } + } } .btn-primary {