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

Transfer by Dialpad #6217

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6d07d5d
Add ability to transfer by dial pad
dbkr Jun 10, 2021
a85420b
Re-arrange buttons as per transfer dialog design
dbkr Jun 11, 2021
2cc6bce
Much theming & visual of transfer window dial pad
dbkr Jun 18, 2021
a91c859
Merge remote-tracking branch 'origin/develop' into dbkr/transfer_by_d…
dbkr Jun 18, 2021
df35844
Somehow lost react braces
dbkr Jun 18, 2021
84e9ed6
Add tab icons
dbkr Jun 18, 2021
b97a166
Put delete button back, fix layout
dbkr Jun 18, 2021
7327058
Remove duplicated height setting
dbkr Jun 18, 2021
ed4313f
Fix other Dialpad usage
dbkr Jun 18, 2021
e67a803
missed return
dbkr Jun 21, 2021
ab95fcb
use currentTarget over target
dbkr Jun 21, 2021
f4ee7bb
Inherit width & height
dbkr Jun 21, 2021
65eb9c9
Make dispatcher actions camel case like the others
dbkr Jun 21, 2021
d012e9c
Use unit-less 0
dbkr Jun 21, 2021
284aec8
Design feedback
dbkr Jun 21, 2021
c829cb9
Use flexbox to layout buttons
dbkr Jun 22, 2021
fc7a306
Remove top margin on input to move dial pad up
dbkr Jun 22, 2021
a636e5e
shift the dial pad up a bit more
dbkr Jun 22, 2021
c93e973
Disable input once a selection is made
dbkr Jun 22, 2021
f8e5fb5
Merge remote-tracking branch 'origin/develop' into dbkr/transfer_by_d…
dbkr Jun 23, 2021
10a900b
Change drop shadow to 1px border
dbkr Jun 23, 2021
fb4806b
Merge remote-tracking branch 'origin/develop' into dbkr/transfer_by_d…
dbkr Jun 23, 2021
0d8dd74
Reduce bottom padding
dbkr Jun 23, 2021
9e3b861
Merge remote-tracking branch 'origin/develop' into dbkr/transfer_by_d…
dbkr Jun 24, 2021
91bc871
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
anoadragon453 Jul 1, 2021
b3afaad
lint fixes
anoadragon453 Jul 1, 2021
12e360b
Not all semicolons are created necessary
anoadragon453 Jul 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 87 additions & 23 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,100 @@ 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;
margin-bottom: 8px;
}

.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: inherit;
height: inherit;
}
}

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

.mx_TabbedView_tabLabel {
Expand All @@ -46,43 +128,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;
background-color: $icon-button-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
87 changes: 82 additions & 5 deletions res/css/views/dialogs/_InviteDialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_InviteDialog_transferWrapper .mx_Dialog {
padding-bottom: 16px;
}

.mx_InviteDialog_addressBar {
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -286,24 +290,48 @@ limitations under the License.
}
}

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

.mx_InviteDialog_userSections {
height: calc(100% - 115px); // mx_InviteDialog's height minus some for the upper and lower elements
}
}

.mx_InviteDialog_content {
height: calc(100% - 36px); // full height minus the size of the header
overflow: hidden;
}

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

.mx_InviteDialog_content {
overflow: hidden;
height: 100%;
flex-direction: column;

.mx_TabbedView {
height: calc(100% - 60px);
}
overflow: visible;
}

.mx_InviteDialog_addressBar {
margin-top: 8px;
}

input[type="checkbox"] {
margin-right: 8px;
}
}

.mx_InviteDialog_userSections {
margin-top: 4px;
overflow-y: auto;
padding: 0 45px 4px 0;
height: calc(100% - 115px); // mx_InviteDialog's height minus some for the upper and lower elements
}

.mx_InviteDialog_hasFooter .mx_InviteDialog_userSections {
Expand All @@ -318,6 +346,55 @@ limitations under the License.
padding: 0;
}

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

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

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

.mx_InviteDialog_transferConsultConnect {
padding-top: 16px;
/* This wants a drop shadow the full width of the dialog, so relative-position it
* and make it wider, then compensate with padding
*/
position: relative;
width: 496px;
left: -24px;
padding-left: 24px;
padding-right: 24px;
border-top: 1px solid $message-body-panel-bg-color;

display: flex;
flex-direction: row;
align-items: center;
}

.mx_InviteDialog_transferConsultConnect_pushRight {
margin-left: auto;
}

.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');
}

.mx_InviteDialog_multiInviterError {
> h4 {
font-size: $font-15px;
Expand Down
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
3 changes: 3 additions & 0 deletions res/img/voip/tab-dialpad.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions res/img/voip/tab-userdirectory.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 49 additions & 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 Expand Up @@ -871,6 +871,12 @@ export default class CallHandler extends EventEmitter {
case Action.DialNumber:
this.dialNumber(payload.number);
break;
case Action.TransferCallToMatrixID:
this.startTransferToMatrixID(payload.call, payload.destination, payload.consultFirst);
break;
case Action.TransferCallToPhoneNumber:
this.startTransferToPhoneNumber(payload.call, payload.destination, payload.consultFirst);
break;
}
};

Expand Down Expand Up @@ -905,6 +911,48 @@ export default class CallHandler extends EventEmitter {
});
}

private async startTransferToPhoneNumber(call: MatrixCall, destination: string, consultFirst: boolean) {
const results = await this.pstnLookup(destination);
if (!results || results.length === 0 || !results[0].userid) {
Modal.createTrackedDialog('', '', ErrorDialog, {
title: _t("Unable to transfer call"),
description: _t("There was an error looking up the phone number"),
});
return;
}

await this.startTransferToMatrixID(call, results[0].userid, consultFirst);
}

private async startTransferToMatrixID(call: MatrixCall, destination: string, consultFirst: boolean) {
if (consultFirst) {
const dmRoomId = await ensureDMExists(MatrixClientPeg.get(), destination);

dis.dispatch({
action: 'place_call',
type: call.type,
room_id: dmRoomId,
transferee: call,
});
dis.dispatch({
action: 'view_room',
room_id: dmRoomId,
should_peek: false,
joining: false,
});
} else {
try {
await call.transfer(destination);
} catch (e) {
console.log("Failed to transfer call", e);
Modal.createTrackedDialog('Failed to transfer call', '', ErrorDialog, {
title: _t('Transfer Failed'),
description: _t('Failed to transfer call'),
});
}
}
}

setActiveCallRoomId(activeCallRoomId: string) {
logger.info("Setting call in room " + activeCallRoomId + " active");

Expand Down
Loading