Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Much theming & visual of transfer window dial pad
Browse files Browse the repository at this point in the history
  • Loading branch information
dbkr committed Jun 18, 2021
1 parent a85420b commit 2cc6bce
Show file tree
Hide file tree
Showing 7 changed files with 244 additions and 77 deletions.
107 changes: 85 additions & 22 deletions res/css/structures/_TabbedView.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2017 Travis Ralston
Copyright 2019 New Vector Ltd
Copyright 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -20,19 +21,99 @@ limitations under the License.
padding: 0 0 0 16px;
display: flex;
flex-direction: column;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin-top: 8px;
}

.mx_TabbedView_tabsOnLeft {
flex-direction: column;
position: absolute;

.mx_TabbedView_tabLabels {
width: 170px;
max-width: 170px;
position: fixed;
}

.mx_TabbedView_tabPanel {
margin-left: 240px; // 170px sidebar + 70px padding
flex-direction: column;
}

.mx_TabbedView_tabLabel_active {
background-color: $tab-label-active-bg-color;
color: $tab-label-active-fg-color;
}

.mx_TabbedView_tabLabel_active .mx_TabbedView_maskedIcon::before {
background-color: $tab-label-active-icon-bg-color;
}

.mx_TabbedView_maskedIcon {
width: 16px;
height: 16px;
margin-left: 8px;
margin-right: 16px;
}

.mx_TabbedView_maskedIcon::before {
mask-size: 16px;
width: 16px;
height: 16px;
}
}

.mx_TabbedView_tabsOnTop {
flex-direction: column;

.mx_TabbedView_tabLabels {
display: flex;
}

.mx_TabbedView_tabLabel {
padding-left: 0px;
padding-right: 52px;

.mx_TabbedView_tabLabel_text {
font-size: 15px;
color: $tertiary-fg-color;
}
}

.mx_TabbedView_tabPanel {
flex-direction: row;
}

.mx_TabbedView_tabLabel_active {
color: $accent-color;
.mx_TabbedView_tabLabel_text {
color: $accent-color;
}
}

.mx_TabbedView_tabLabel_active .mx_TabbedView_maskedIcon::before {
background-color: $accent-color;
}

.mx_TabbedView_maskedIcon {
width: 22px;
height: 22px;
margin-left: 0px;
margin-right: 8px;
}

.mx_TabbedView_maskedIcon::before {
mask-size: 22px;
width: 22px;
height: 22px;
}
}

.mx_TabbedView_tabLabels {
width: 170px;
max-width: 170px;
color: $tab-label-fg-color;
position: fixed;
}

.mx_TabbedView_tabLabel {
Expand All @@ -46,43 +127,25 @@ limitations under the License.
position: relative;
}

.mx_TabbedView_tabLabel_active {
background-color: $tab-label-active-bg-color;
color: $tab-label-active-fg-color;
}

.mx_TabbedView_maskedIcon {
margin-left: 8px;
margin-right: 16px;
width: 16px;
height: 16px;
display: inline-block;
}

.mx_TabbedView_maskedIcon::before {
display: inline-block;
background-color: $tab-label-icon-bg-color;
mask-repeat: no-repeat;
mask-size: 16px;
width: 16px;
height: 16px;
mask-position: center;
content: '';
}

.mx_TabbedView_tabLabel_active .mx_TabbedView_maskedIcon::before {
background-color: $tab-label-active-icon-bg-color;
}

.mx_TabbedView_tabLabel_text {
vertical-align: middle;
}

.mx_TabbedView_tabPanel {
margin-left: 240px; // 170px sidebar + 70px padding
flex-grow: 1;
display: flex;
flex-direction: column;
min-height: 0; // firefox
}

Expand Down
54 changes: 52 additions & 2 deletions res/css/views/dialogs/_InviteDialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,37 @@ limitations under the License.
}
}

.mx_InviteDialog {
.mx_InviteDialog_other {
// Prevent the dialog from jumping around randomly when elements change.
height: 590px;
padding-left: 20px; // the design wants some padding on the left

.mx_InviteDialog_userSections {
height: 455px; // mx_InviteDialog's height minus some for the upper elements
}
}

.mx_InviteDialog_transfer {
width: 496px;
height: 466px;
display: flex;
flex-direction: column;

.mx_InviteDialog_content {
flex: 1;
display: flex;
flex-direction: column;

.mx_TabbedView {
flex: 1;
}
}
}

.mx_InviteDialog_userSections {
margin-top: 10px;
overflow-y: auto;
padding-right: 45px;
height: 455px; // mx_InviteDialog's height minus some for the upper elements
}

// Right margin for the design. We could apply this to the whole dialog, but then the scrollbar
Expand All @@ -233,3 +253,33 @@ limitations under the License.
.mx_InviteDialog_helpText .mx_AccessibleButton_kind_link {
padding: 0;
}

.mx_InviteDialog_dialPad .mx_InviteDialog_dialPadField {
border-top: 0px;
border-left: 0px;
border-right: 0px;
border-radius: 0px;

input {
font-size: 18px;
font-weight: 600;
}
}

.mx_InviteDialog_dialPad {
width: 224px;
margin-left: auto;
margin-right: auto;
}

.mx_InviteDialog_transferButton {
float: right;
}

.mx_InviteDialog_userDirectoryIcon::before {
mask-image: url('$(res)/img/voip/tab-userdirectory.svg');
}

.mx_InviteDialog_dialPadIcon::before {
mask-image: url('$(res)/img/voip/tab-dialpad.svg');
}
2 changes: 2 additions & 0 deletions res/css/views/voip/_DialPad.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ limitations under the License.
text-align: center;
vertical-align: middle;
line-height: 40px;
margin-left: auto;
margin-right: auto;
}

.mx_DialPad_deleteButton, .mx_DialPad_dialButton {
Expand Down
2 changes: 1 addition & 1 deletion src/CallHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export default class CallHandler extends EventEmitter {
}

private setCallListeners(call: MatrixCall) {
let mappedRoomId = CallHandler.sharedInstance().roomIdForCall(call);
let mappedRoomId = this.roomIdForCall(call);

call.on(CallEvent.Error, (err: CallError) => {
if (!this.matchesCallForThisRoom(call)) return;
Expand Down
21 changes: 20 additions & 1 deletion src/components/structures/TabbedView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {_t} from '../../languageHandler';
import * as sdk from "../../index";
import AutoHideScrollbar from './AutoHideScrollbar';
import {replaceableComponent} from "../../utils/replaceableComponent";
import classNames from "classnames";

/**
* Represents a tab for the TabbedView.
Expand All @@ -37,9 +38,16 @@ export class Tab {
}
}

export enum TabLocation {
LEFT = 'left',
TOP = 'top',
}

interface IProps {
tabs: Tab[];
initialTabId?: string;
tabLocation: TabLocation;
onChange: (tabId: string) => void;
}

interface IState {
Expand All @@ -62,6 +70,10 @@ export default class TabbedView extends React.Component<IProps, IState> {
};
}

static defaultProps = {
tabLocation: TabLocation.LEFT,
}

private _getActiveTabIndex() {
if (!this.state || !this.state.activeTabIndex) return 0;
return this.state.activeTabIndex;
Expand All @@ -75,6 +87,7 @@ export default class TabbedView extends React.Component<IProps, IState> {
private _setActiveTab(tab: Tab) {
const idx = this.props.tabs.indexOf(tab);
if (idx !== -1) {
if (this.props.onChange) this.props.onChange(tab.id);
this.setState({activeTabIndex: idx});
} else {
console.error("Could not find tab " + tab.label + " in tabs");
Expand Down Expand Up @@ -121,8 +134,14 @@ export default class TabbedView extends React.Component<IProps, IState> {
const labels = this.props.tabs.map(tab => this._renderTabLabel(tab));
const panel = this._renderTabPanel(this.props.tabs[this._getActiveTabIndex()]);

const tabbedViewClasses = classNames({
'mx_TabbedView': true,
'mx_TabbedView_tabsOnLeft': this.props.tabLocation == TabLocation.LEFT,
'mx_TabbedView_tabsOnTop': this.props.tabLocation == TabLocation.TOP,
});

return (
<div className="mx_TabbedView">
<div className={tabbedViewClasses}>
<div className="mx_TabbedView_tabLabels">
{labels}
</div>
Expand Down
Loading

0 comments on commit 2cc6bce

Please sign in to comment.