Browse Source

Folder tabs changes

master
Eduard Kuzmenko 4 years ago
parent
commit
57f4be00f0
  1. 14
      src/components/buttonCorner.ts
  2. 3
      src/components/chat/input.ts
  3. 4
      src/components/editPeer.ts
  4. 2
      src/components/sidebarLeft/index.ts
  5. 4
      src/components/sidebarLeft/tabs/addMembers.ts
  6. 4
      src/components/sidebarLeft/tabs/blockedUsers.ts
  7. 3
      src/components/sidebarLeft/tabs/newChannel.ts
  8. 3
      src/components/sidebarLeft/tabs/newGroup.ts
  9. 3
      src/components/sidebarRight/tabs/groupType.ts
  10. 3
      src/components/sidebarRight/tabs/sharedMedia.ts
  11. 3
      src/lang.ts
  12. 2
      src/lib/appManagers/appDialogsManager.ts
  13. 2
      src/scss/partials/_button.scss
  14. 31
      src/scss/partials/_leftSidebar.scss
  15. 19
      src/scss/partials/_rightSidebar.scss
  16. 27
      src/scss/partials/_slider.scss

14
src/components/buttonCorner.ts

@ -0,0 +1,14 @@
/*
* https://github.com/morethanwords/tweb
* Copyright (C) 2019-2021 Eduard Kuzmenko
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import Button from "./button";
const ButtonCorner = (options: Partial<{className: string, icon: string, noRipple: true, onlyMobile: true, asDiv: boolean}> = {}) => {
const button = Button('btn-circle btn-corner z-depth-1' + (options.className ? ' ' + options.className : ''), options);
return button;
};
export default ButtonCorner;

3
src/components/chat/input.ts

@ -47,6 +47,7 @@ import { isMobile } from '../../helpers/userAgent';
import { i18n } from '../../lib/langPack'; import { i18n } from '../../lib/langPack';
import { generateTail } from './bubbles'; import { generateTail } from './bubbles';
import findUpClassName from '../../helpers/dom/findUpClassName'; import findUpClassName from '../../helpers/dom/findUpClassName';
import ButtonCorner from '../buttonCorner';
const RECORD_MIN_TIME = 500; const RECORD_MIN_TIME = 500;
const POSTING_MEDIA_NOT_ALLOWED = 'Posting media content isn\'t allowed in this group.'; const POSTING_MEDIA_NOT_ALLOWED = 'Posting media content isn\'t allowed in this group.';
@ -156,7 +157,7 @@ export default class ChatInput {
this.inputContainer.append(this.rowsWrapper, fakeRowsWrapper, fakeSelectionWrapper); this.inputContainer.append(this.rowsWrapper, fakeRowsWrapper, fakeSelectionWrapper);
this.chatInput.append(this.inputContainer); this.chatInput.append(this.inputContainer);
this.goDownBtn = Button('bubbles-go-down btn-corner btn-circle z-depth-1 hide', {icon: 'arrow_down'}); this.goDownBtn = ButtonCorner({icon: 'arrow_down', className: 'bubbles-go-down hide'});
this.inputContainer.append(this.goDownBtn); this.inputContainer.append(this.goDownBtn);
attachClickEvent(this.goDownBtn, (e) => { attachClickEvent(this.goDownBtn, (e) => {

4
src/components/editPeer.ts

@ -9,8 +9,8 @@ import AvatarEdit from "./avatarEdit";
import AvatarElement from "./avatar"; import AvatarElement from "./avatar";
import InputField from "./inputField"; import InputField from "./inputField";
import ListenerSetter from "../helpers/listenerSetter"; import ListenerSetter from "../helpers/listenerSetter";
import Button from "./button";
import { safeAssign } from "../helpers/object"; import { safeAssign } from "../helpers/object";
import ButtonCorner from "./buttonCorner";
export default class EditPeer { export default class EditPeer {
public nextBtn: HTMLButtonElement; public nextBtn: HTMLButtonElement;
@ -32,7 +32,7 @@ export default class EditPeer {
}) { }) {
safeAssign(this, options); safeAssign(this, options);
this.nextBtn = Button('btn-circle btn-corner tgico-check'); this.nextBtn = ButtonCorner({icon: 'check'});
this.avatarElem = document.createElement('avatar-element') as AvatarElement; this.avatarElem = document.createElement('avatar-element') as AvatarElement;
this.avatarElem.classList.add('avatar-placeholder', 'avatar-120'); this.avatarElem.classList.add('avatar-placeholder', 'avatar-120');

2
src/components/sidebarLeft/index.ts

@ -208,7 +208,7 @@ export class AppSidebarLeft extends SidebarSlider {
text: 'NewPrivateChat', text: 'NewPrivateChat',
onClick: onContactsClick onClick: onContactsClick
}]); }]);
this.newBtnMenu.className = 'btn-circle rp btn-corner btn-menu-toggle animated-button-icon'; this.newBtnMenu.className = 'btn-circle rp btn-corner z-depth-1 btn-menu-toggle animated-button-icon';
this.newBtnMenu.insertAdjacentHTML('afterbegin', ` this.newBtnMenu.insertAdjacentHTML('afterbegin', `
<span class="tgico tgico-newchat_filled"></span> <span class="tgico tgico-newchat_filled"></span>
<span class="tgico tgico-close"></span> <span class="tgico tgico-close"></span>

4
src/components/sidebarLeft/tabs/addMembers.ts

@ -7,8 +7,8 @@
import { SliderSuperTab } from "../../slider"; import { SliderSuperTab } from "../../slider";
import AppSelectPeers from "../../appSelectPeers"; import AppSelectPeers from "../../appSelectPeers";
import { putPreloader } from "../../misc"; import { putPreloader } from "../../misc";
import Button from "../../button";
import { LangPackKey, _i18n } from "../../../lib/langPack"; import { LangPackKey, _i18n } from "../../../lib/langPack";
import ButtonCorner from "../../buttonCorner";
export default class AppAddMembersTab extends SliderSuperTab { export default class AppAddMembersTab extends SliderSuperTab {
private nextBtn: HTMLButtonElement; private nextBtn: HTMLButtonElement;
@ -18,7 +18,7 @@ export default class AppAddMembersTab extends SliderSuperTab {
private skippable: boolean; private skippable: boolean;
protected init() { protected init() {
this.nextBtn = Button('btn-corner btn-circle', {icon: 'arrow_next'}); this.nextBtn = ButtonCorner({icon: 'arrow_next'});
this.content.append(this.nextBtn); this.content.append(this.nextBtn);
this.nextBtn.addEventListener('click', () => { this.nextBtn.addEventListener('click', () => {

4
src/components/sidebarLeft/tabs/blockedUsers.ts

@ -11,10 +11,10 @@ import { attachClickEvent } from "../../../helpers/dom";
import ButtonMenu from "../../buttonMenu"; import ButtonMenu from "../../buttonMenu";
import appDialogsManager from "../../../lib/appManagers/appDialogsManager"; import appDialogsManager from "../../../lib/appManagers/appDialogsManager";
import appUsersManager from "../../../lib/appManagers/appUsersManager"; import appUsersManager from "../../../lib/appManagers/appUsersManager";
import Button from "../../button";
import PopupPickUser from "../../popups/pickUser"; import PopupPickUser from "../../popups/pickUser";
import rootScope from "../../../lib/rootScope"; import rootScope from "../../../lib/rootScope";
import findUpTag from "../../../helpers/dom/findUpTag"; import findUpTag from "../../../helpers/dom/findUpTag";
import ButtonCorner from "../../buttonCorner";
export default class AppBlockedUsersTab extends SliderSuperTab { export default class AppBlockedUsersTab extends SliderSuperTab {
public peerIds: number[]; public peerIds: number[];
@ -32,7 +32,7 @@ export default class AppBlockedUsersTab extends SliderSuperTab {
this.scrollable.append(section.container); this.scrollable.append(section.container);
} }
const btnAdd = Button('btn-circle btn-corner tgico-add is-visible'); const btnAdd = ButtonCorner({icon: 'add', className: 'is-visible'});
this.content.append(btnAdd); this.content.append(btnAdd);
attachClickEvent(btnAdd, (e) => { attachClickEvent(btnAdd, (e) => {

3
src/components/sidebarLeft/tabs/newChannel.ts

@ -13,6 +13,7 @@ import { SliderSuperTab } from "../../slider";
import AvatarEdit from "../../avatarEdit"; import AvatarEdit from "../../avatarEdit";
import AppAddMembersTab from "./addMembers"; import AppAddMembersTab from "./addMembers";
import { _i18n } from "../../../lib/langPack"; import { _i18n } from "../../../lib/langPack";
import ButtonCorner from "../../buttonCorner";
export default class AppNewChannelTab extends SliderSuperTab { export default class AppNewChannelTab extends SliderSuperTab {
private uploadAvatar: () => Promise<InputFile> = null; private uploadAvatar: () => Promise<InputFile> = null;
@ -58,7 +59,7 @@ export default class AppNewChannelTab extends SliderSuperTab {
caption.classList.add('caption'); caption.classList.add('caption');
_i18n(caption, 'Channel.DescriptionHolderDescrpiton'); _i18n(caption, 'Channel.DescriptionHolderDescrpiton');
this.nextBtn = Button('btn-corner btn-circle', {icon: 'arrow_next'}); this.nextBtn = ButtonCorner({icon: 'arrow_next'});
this.nextBtn.addEventListener('click', () => { this.nextBtn.addEventListener('click', () => {
const title = this.channelNameInputField.value; const title = this.channelNameInputField.value;

3
src/components/sidebarLeft/tabs/newGroup.ts

@ -15,6 +15,7 @@ import InputField from "../../inputField";
import { SliderSuperTab } from "../../slider"; import { SliderSuperTab } from "../../slider";
import AvatarEdit from "../../avatarEdit"; import AvatarEdit from "../../avatarEdit";
import { i18n } from "../../../lib/langPack"; import { i18n } from "../../../lib/langPack";
import ButtonCorner from "../../buttonCorner";
export default class AppNewGroupTab extends SliderSuperTab { export default class AppNewGroupTab extends SliderSuperTab {
private searchGroup = new SearchGroup(' ', 'contacts', true, 'new-group-members disable-hover', false); private searchGroup = new SearchGroup(' ', 'contacts', true, 'new-group-members disable-hover', false);
@ -47,7 +48,7 @@ export default class AppNewGroupTab extends SliderSuperTab {
this.nextBtn.classList.toggle('is-visible', !!value.length && !this.groupNameInputField.input.classList.contains('error')); this.nextBtn.classList.toggle('is-visible', !!value.length && !this.groupNameInputField.input.classList.contains('error'));
}); });
this.nextBtn = Button('btn-corner btn-circle', {icon: 'arrow_next'}); this.nextBtn = ButtonCorner({icon: 'arrow_next'});
this.nextBtn.addEventListener('click', () => { this.nextBtn.addEventListener('click', () => {
const title = this.groupNameInputField.value; const title = this.groupNameInputField.value;

3
src/components/sidebarRight/tabs/groupType.ts

@ -20,6 +20,7 @@ import { UsernameInputField } from "../../usernameInputField";
import { SliderSuperTabEventable } from "../../sliderTab"; import { SliderSuperTabEventable } from "../../sliderTab";
import I18n from "../../../lib/langPack"; import I18n from "../../../lib/langPack";
import PopupPeer from "../../popups/peer"; import PopupPeer from "../../popups/peer";
import ButtonCorner from "../../buttonCorner";
export default class AppGroupTypeTab extends SliderSuperTabEventable { export default class AppGroupTypeTab extends SliderSuperTabEventable {
public peerId: number; public peerId: number;
@ -134,7 +135,7 @@ export default class AppGroupTypeTab extends SliderSuperTabEventable {
inputWrapper.append(linkInputField.container) inputWrapper.append(linkInputField.container)
publicSection.content.append(inputWrapper); publicSection.content.append(inputWrapper);
const applyBtn = Button('btn-circle btn-corner tgico-check is-visible'); const applyBtn = ButtonCorner({icon: 'check', className: 'is-visible'});
this.content.append(applyBtn); this.content.append(applyBtn);
attachClickEvent(applyBtn, () => { attachClickEvent(applyBtn, () => {

3
src/components/sidebarRight/tabs/sharedMedia.ts

@ -46,6 +46,7 @@ import Scrollable from "../../scrollable";
import { isTouchSupported } from "../../../helpers/touchSupport"; import { isTouchSupported } from "../../../helpers/touchSupport";
import { isFirefox } from "../../../helpers/userAgent"; import { isFirefox } from "../../../helpers/userAgent";
import appDownloadManager from "../../../lib/appManagers/appDownloadManager"; import appDownloadManager from "../../../lib/appManagers/appDownloadManager";
import ButtonCorner from "../../buttonCorner";
let setText = (text: string, row: Row) => { let setText = (text: string, row: Row) => {
//fastRaf(() => { //fastRaf(() => {
@ -912,7 +913,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
this.profile.element.append(this.searchSuper.container); this.profile.element.append(this.searchSuper.container);
const btnAddMembers = Button('btn-corner btn-circle', {icon: 'addmember_filled'}); const btnAddMembers = ButtonCorner({icon: 'addmember_filled'});
this.content.append(btnAddMembers); this.content.append(btnAddMembers);
btnAddMembers.addEventListener('click', () => { btnAddMembers.addEventListener('click', () => {

3
src/lang.ts

@ -490,7 +490,8 @@ const lang = {
"ChatList.Filter.List.Title": "Chat Folders", "ChatList.Filter.List.Title": "Chat Folders",
"ChatList.Filter.Include.AddChat": "Add Chats", "ChatList.Filter.Include.AddChat": "Add Chats",
"ChatList.Filter.Exclude.AddChat": "Add Chats", "ChatList.Filter.Exclude.AddChat": "Add Chats",
"ChatList.Filter.All": "All", //"ChatList.Filter.All": "All",
"ChatList.Filter.AllChats": "All Chats",
"ChatList.Filter.Contacts": "Contacts", "ChatList.Filter.Contacts": "Contacts",
"ChatList.Filter.NonContacts": "Non-Contacts", "ChatList.Filter.NonContacts": "Non-Contacts",
"ChatList.Filter.Groups": "Groups", "ChatList.Filter.Groups": "Groups",

2
src/lib/appManagers/appDialogsManager.ts

@ -281,7 +281,7 @@ export class AppDialogsManager {
this.addFilter({ this.addFilter({
id: this.filterId, id: this.filterId,
title: '', title: '',
titleEl: i18n('ChatList.Filter.All'), titleEl: i18n('ChatList.Filter.AllChats'),
orderIndex: 0 orderIndex: 0
}); });

2
src/scss/partials/_button.scss

@ -305,7 +305,7 @@
height: 40px; height: 40px;
align-items: center; align-items: center;
margin: 15px auto 1rem; margin: 15px auto 1rem;
border-radius: 30px; border-radius: 20px;
padding: 0 24px 0 12px; padding: 0 24px 0 12px;
display: flex; display: flex;

31
src/scss/partials/_leftSidebar.scss

@ -73,41 +73,43 @@
} }
} }
.item-main {
--menu-size: 3rem;
}
.menu-horizontal-scrollable { .menu-horizontal-scrollable {
--scrollable-size: var(--menu-size);
z-index: 1; z-index: 1;
background-color: var(--surface-color); background-color: var(--surface-color);
position: relative; position: relative;
box-shadow: 0px 1px 5px -1px rgba(0, 0, 0, .16);
top: unset; top: unset;
height: 43px;
@include respond-to(handhelds) {
box-shadow: 0px 1px 5px -1px rgba(0, 0, 0, .16);
}
.scrollable { .scrollable {
position: relative; position: relative;
} }
.menu-horizontal-div { .menu-horizontal-div {
height: 43px;
position: relative !important; position: relative !important;
justify-content: flex-start; justify-content: flex-start;
z-index: 0; z-index: 0;
&-item { &-item {
height: 43px;
padding: 0 1rem;
display: flex;
justify-content: center;
align-items: center;
flex: 0 0 auto; flex: 0 0 auto;
min-width: 3rem; min-width: 3rem;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
> span { > span {
overflow: visible; overflow: visible;
i { i {
bottom: calc(-.6875rem); bottom: calc(-.6875rem - 2px);
padding-right: 1rem !important; /* padding-right: 1rem !important;
margin-left: -.5rem !important; margin-left: -.5rem !important; */
} }
} }
} }
@ -123,8 +125,8 @@
} }
&:not(.hide) + .scrollable { &:not(.hide) + .scrollable {
top: 43px; top: var(--menu-size);
height: calc(100% - 43px); height: calc(100% - var(--menu-size));
#folders-container { #folders-container {
margin-top: .5rem; margin-top: .5rem;
@ -634,6 +636,7 @@
right: 1rem; right: 1rem;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
border-radius: 15px;
body.animation-level-0 & { body.animation-level-0 & {
transition: none; transition: none;

19
src/scss/partials/_rightSidebar.scss

@ -166,24 +166,6 @@
} }
} */ } */
} }
.search-super {
.menu-horizontal-div-item {
height: 3.5rem;
padding-top: 0;
padding-bottom: 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 1rem;
line-height: var(--line-height);
border-radius: 0;
}
.menu-horizontal-div i {
bottom: calc(-.625rem - 7px);
}
}
} }
.search-super { .search-super {
@ -239,7 +221,6 @@
top: 0px; top: 0px;
z-index: 2; z-index: 2;
background-color: var(--surface-color); background-color: var(--surface-color);
height: 3.5rem;
&:before { &:before {
position: absolute; position: absolute;

27
src/scss/partials/_slider.scss

@ -5,6 +5,9 @@
*/ */
.menu-horizontal-scrollable { .menu-horizontal-scrollable {
--scrollable-size: 3.5rem;
height: var(--scrollable-size);
&:after { &:after {
content: " "; content: " ";
position: absolute; position: absolute;
@ -22,34 +25,34 @@
} }
.menu-horizontal-div { .menu-horizontal-div {
--size: var(--scrollable-size, 3.5rem);
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
flex-direction: row;
position: relative; position: relative;
z-index: 2; z-index: 2;
flex-direction: row; user-select: none;
color: var(--secondary-text-color); color: var(--secondary-text-color);
border-bottom: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);
position: relative;
&-item { &-item {
display: inline-block; height: var(--size);
padding: .75rem 1rem; padding: 0 1rem;
cursor: pointer; cursor: pointer;
text-align: center; text-align: center;
flex: 1 1 auto; flex: 1 1 auto;
//flex: 0 0 auto; font-size: 1rem;
//overflow: hidden;
user-select: none;
// font-size: 1rem;
font-size: 14px;
font-weight: 500; font-weight: 500;
position: relative; position: relative;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
transition: none !important; transition: none !important;
display: flex;
align-items: center;
justify-content: center;
line-height: var(--line-height);
border-radius: 0;
@include hover-background-effect(); @include hover-background-effect();
@ -81,7 +84,7 @@
i { i {
position: absolute; position: absolute;
bottom: calc(-.625rem - 3px); bottom: calc(-.625rem - 7px);
left: 0; left: 0;
opacity: 0; opacity: 0;
background-color: var(--primary-color); background-color: var(--primary-color);

Loading…
Cancel
Save