Skip to content
This repository was archived by the owner on Feb 10, 2022. It is now read-only.

Commit 7950924

Browse files
committed
[CALLS-700]Call history design implementation
1. intentation size change. 2. voice call bug fix in the call log
1 parent 4905a7d commit 7950924

File tree

4 files changed

+139
-139
lines changed

4 files changed

+139
-139
lines changed

lib/components/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import BaseElement from "./BaseElement";
2-
import { jss, sheet, classes } from "../css/styles.js";
2+
import { jss, sheet } from "../css/styles.js";
33

44
export default class App extends BaseElement {
55
constructor({ id, className, pages, styles, args }) {

lib/components/Header.js

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -5,92 +5,92 @@ import Menu from "../components/Menu";
55
import { sheet, classes } from "../css/styles";
66

77
export default class Header extends BaseElement {
8-
constructor({ id, className, parent, element, args } = {}) {
9-
super({ id, className, parent, element, args });
10-
this.element = element;
11-
this.parent = parent;
8+
constructor({ id, className, parent, element, args } = {}) {
9+
super({ id, className, parent, element, args });
10+
this.element = element;
11+
this.parent = parent;
1212

13-
this.settingItems = [
14-
{
15-
'label': 'Device settings',
16-
'callback': () => { this.sendToParent('show_settings') }
17-
},
18-
{
19-
'label': 'Sign out',
20-
'callback': () => {
21-
SendBirdCall.deauthenticate();
22-
this.sendToParent('deauthenticate');
23-
}
24-
}
25-
];
13+
this.settingItems = [
14+
{
15+
'label': 'Device settings',
16+
'callback': () => { this.sendToParent('show_settings') }
17+
},
18+
{
19+
'label': 'Sign out',
20+
'callback': () => {
21+
SendBirdCall.deauthenticate();
22+
this.sendToParent('deauthenticate');
23+
}
24+
}
25+
];
2626

27-
this.args = args;
28-
this.parent = parent;
29-
}
27+
this.args = args;
28+
this.parent = parent;
29+
}
3030

31-
build() {
32-
const userDiv = createDiv({
33-
id: 'header_user_div',
34-
className: `${classes['userDiv']} ${classes['center']}`
35-
});
31+
build() {
32+
const userDiv = createDiv({
33+
id: 'header_user_div',
34+
className: `${classes['userDiv']} ${classes['center']}`
35+
});
3636

37-
let profileImg;
38-
if (this.args.user && this.args.user.profileUrl) {
39-
sheet.update({ profileUrl: this.args.user.profileUrl });
40-
profileImg = createDiv({ id: 'header_profile_img', className: classes['profileSmall'] });
41-
} else {
42-
profileImg = createDiv({ id: 'header_avatar', className: `${classes['avatar']}` });
43-
}
37+
let profileImg;
38+
if (this.args.user && this.args.user.profileUrl) {
39+
sheet.update({ profileUrl: this.args.user.profileUrl });
40+
profileImg = createDiv({ id: 'header_profile_img', className: classes['profileSmall'] });
41+
} else {
42+
profileImg = createDiv({ id: 'header_avatar', className: `${classes['avatar']}` });
43+
}
4444

45-
const headerInfo = createDiv({ id: 'header_info', className: `${classes['headerInfo']}` });
46-
const userId = createDiv({
47-
id: 'header_user_id',
48-
className: `${classes['headerUserId']} ${classes['fontNormal']} ${classes['fontHeavy']}`,
49-
innerText: this.args.user.userId || ''
50-
});
51-
const nickname = createDiv({
52-
id: 'header_nickname',
53-
className: `${classes['headerNickname']} ${classes['fontSmall']}`,
54-
innerText: this.args.user.nickname || 'no nickname'
55-
});
56-
headerInfo.appendChild(userId);
57-
headerInfo.appendChild(nickname);
45+
const headerInfo = createDiv({ id: 'header_info', className: `${classes['headerInfo']}` });
46+
const userId = createDiv({
47+
id: 'header_user_id',
48+
className: `${classes['headerUserId']} ${classes['fontNormal']} ${classes['fontHeavy']}`,
49+
innerText: this.args.user.userId || ''
50+
});
51+
const nickname = createDiv({
52+
id: 'header_nickname',
53+
className: `${classes['headerNickname']} ${classes['fontSmall']}`,
54+
innerText: this.args.user.nickname || 'no nickname'
55+
});
56+
headerInfo.appendChild(userId);
57+
headerInfo.appendChild(nickname);
5858

59-
userDiv.appendChild(profileImg);
60-
userDiv.appendChild(headerInfo);
59+
userDiv.appendChild(profileImg);
60+
userDiv.appendChild(headerInfo);
6161

62-
const headerButtons = createDiv({
63-
id: 'header_buttons',
64-
className: `${classes['headerButtons']} ${classes['row']} ${classes['center']}`
65-
});
66-
const settingsButton = new Menu({
67-
id: 'settings_button',
68-
element: createDiv({ className: `${classes['settingsButton']}` }),
69-
items: this.settingItems
70-
});
62+
const headerButtons = createDiv({
63+
id: 'header_buttons',
64+
className: `${classes['headerButtons']} ${classes['row']} ${classes['center']}`
65+
});
66+
const settingsButton = new Menu({
67+
id: 'settings_button',
68+
element: createDiv({ className: `${classes['settingsButton']}` }),
69+
items: this.settingItems
70+
});
7171

72-
const closeButton = createDiv({
73-
id: 'close_button',
74-
className: `${classes['closeButton']}`
75-
});
76-
closeButton.onclick = () => {
77-
this.parent.sendToParent('widgetclose');
78-
};
79-
settingsButton.appendToHTML(headerButtons);
80-
headerButtons.appendChild(closeButton);
72+
const closeButton = createDiv({
73+
id: 'close_button',
74+
className: `${classes['closeButton']}`
75+
});
76+
closeButton.onclick = () => {
77+
this.parent.sendToParent('widgetclose');
78+
};
79+
settingsButton.appendToHTML(headerButtons);
80+
headerButtons.appendChild(closeButton);
8181

82-
const divider = createDiv({
83-
id: 'header_divider',
84-
className: classes['headerDivider']
85-
});
82+
const divider = createDiv({
83+
id: 'header_divider',
84+
className: classes['headerDivider']
85+
});
8686

87-
this.element.appendChild(userDiv);
88-
this.element.appendChild(divider);
89-
this.element.appendChild(headerButtons);
87+
this.element.appendChild(userDiv);
88+
this.element.appendChild(divider);
89+
this.element.appendChild(headerButtons);
9090

91-
if( !this.args.isWidget ){
92-
const headerLogo = createDiv({ id: 'header_logo', className: `${classes['headerLogo']}`});
93-
this.element.appendChild(headerLogo);
94-
}
91+
if( !this.args.isWidget ){
92+
const headerLogo = createDiv({ id: 'header_logo', className: `${classes['headerLogo']}`});
93+
this.element.appendChild(headerLogo);
9594
}
95+
}
9696
}

lib/views/CallLogItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class CallLogItem {
140140
eventhandler(event, {peerId: this.destPeerID, isVideoCall: true, callOption: null});
141141
};
142142
this.btnCallVoice.onclick = (event) => {
143-
eventhandler(event, {peerId: this.destPeerID, isVideoCall: true, callOption: null});
143+
eventhandler(event, {peerId: this.destPeerID, isVideoCall: false, callOption: null});
144144
};
145145
}
146146
}

lib/views/CallLogView.js

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,74 @@ import { createList, createDiv } from "../utils/domUtil";
55
import { CallLogItem } from "./CallLogItem";
66

77
export default class CallLogView extends BaseElement{
8-
constructor({ args }) {
9-
super({
10-
id: 'calllog_view',
11-
className: `${classes['container']} ${classes['center']} ${classes['viewDial']}`,
12-
args
13-
});
8+
constructor({ args }) {
9+
super({
10+
id: 'calllog_view',
11+
className: `${classes['container']} ${classes['center']} ${classes['viewDial']}`,
12+
args
13+
});
1414

15-
this.callLogQuery = null;
16-
this.callLogQueryData = [];
17-
this.args = args;
18-
}
15+
this.callLogQuery = null;
16+
this.callLogQueryData = [];
17+
this.args = args;
18+
}
1919

20-
build() {
21-
const callLogList = createList({ id: 'call_log_list', className: `${classes['callLogListContainer']}` });
22-
this.callLogQuery = SendBirdCall.createDirectCallLogListQuery({ limit: 30 });
20+
build() {
21+
const callLogList = createList({ id: 'call_log_list', className: `${classes['callLogListContainer']}` });
22+
this.callLogQuery = SendBirdCall.createDirectCallLogListQuery({ limit: 30 });
23+
this.getCallLogs(callLogList);
24+
callLogList.onscroll = (e) => {
25+
let scrollposition = e.target.scrollHeight - e.target.clientHeight;
26+
if( scrollposition === e.target.scrollTop ) {
2327
this.getCallLogs(callLogList);
24-
callLogList.onscroll = (e) => {
25-
let scrollposition = e.target.scrollHeight - e.target.clientHeight;
26-
if( scrollposition === e.target.scrollTop ) {
27-
this.getCallLogs(callLogList);
28-
}
29-
};
28+
}
29+
};
3030

31-
if( this.args.isWidget ) {
32-
callLogList.classList.add(classes['widgetCallLog']);
33-
this.element.appendChild(callLogList);
34-
}
35-
else{
36-
const callLogDescription = createDiv({ id: 'call_log_desc', className: `${classes['callLogListDesc']}` });
37-
const callLogDescLogo = createDiv({ className: `${classes['callLogDescLogo']}` });
38-
const callLogDescTitle = createDiv({ innerText: 'Sendbird Calls Quickstart', className: `${classes['callLogDescTitle']} ${classes['font24']} ${classes['fontDemi']}` });
39-
const callLogDescLabel = createDiv({ innerText: 'This is the Sendbird Calls Quickstart page. Lorem ipsum', className: `${classes['callLogDescLabel']} ${classes['fontNormal']} ${classes['fontHeavy']}` });
40-
callLogDescription.appendChild(callLogDescLogo);
41-
callLogDescription.appendChild(callLogDescTitle);
42-
callLogDescription.appendChild(callLogDescLabel);
31+
if( this.args.isWidget ) {
32+
callLogList.classList.add(classes['widgetCallLog']);
33+
this.element.appendChild(callLogList);
34+
}
35+
else{
36+
const callLogDescription = createDiv({ id: 'call_log_desc', className: `${classes['callLogListDesc']}` });
37+
const callLogDescLogo = createDiv({ className: `${classes['callLogDescLogo']}` });
38+
const callLogDescTitle = createDiv({ innerText: 'Sendbird Calls Quickstart', className: `${classes['callLogDescTitle']} ${classes['font24']} ${classes['fontDemi']}` });
39+
const callLogDescLabel = createDiv({ innerText: 'This is the Sendbird Calls Quickstart page. Lorem ipsum', className: `${classes['callLogDescLabel']} ${classes['fontNormal']} ${classes['fontHeavy']}` });
40+
callLogDescription.appendChild(callLogDescLogo);
41+
callLogDescription.appendChild(callLogDescTitle);
42+
callLogDescription.appendChild(callLogDescLabel);
4343

44-
this.element.appendChild(callLogList);
45-
this.element.appendChild(callLogDescription);
46-
}
44+
this.element.appendChild(callLogList);
45+
this.element.appendChild(callLogDescription);
4746
}
47+
}
48+
49+
getCallLogs(element){
50+
if( this.callLogQuery.hasNext && !this.callLogQuery.isLoading ) {
51+
this.callLogQuery.next((directCallLog) => {
52+
if( directCallLog ){
53+
if( directCallLog.length > 0 ) {
54+
for( let i = 0; i < directCallLog.length; i++ ){
55+
let callItem = null;
56+
if( i === 0 ){
57+
callItem = new CallLogItem({ callLogInfo: directCallLog[i], className: `${classes['callLogItemWrap']}` });
58+
}
59+
else {
60+
callItem = new CallLogItem({ callLogInfo: directCallLog[i], className: `${classes['callLogItemWrap']} ${classes['callLogItemWarpBorder']}` });
61+
}
62+
callItem.onclick = (event, args) => {
63+
this.sendToParent('dial', args);
64+
};
4865

49-
getCallLogs(element){
50-
if( this.callLogQuery.hasNext && !this.callLogQuery.isLoading ) {
51-
this.callLogQuery.next((directCallLog) => {
52-
if( directCallLog ){
53-
if( directCallLog.length > 0 ) {
54-
for( let i = 0; i < directCallLog.length; i++ ){
55-
let callItem = null;
56-
if( i === 0 ){
57-
callItem = new CallLogItem({ callLogInfo: directCallLog[i], className: `${classes['callLogItemWrap']}` });
58-
}
59-
else {
60-
callItem = new CallLogItem({ callLogInfo: directCallLog[i], className: `${classes['callLogItemWrap']} ${classes['callLogItemWarpBorder']}` });
61-
}
62-
callItem.onclick = (event, args) => {
63-
this.sendToParent('dial', args);
64-
};
65-
66-
element.appendChild(callItem.element);
67-
}
68-
}
69-
else{
70-
// empty call log
71-
const emptyCallLog = new CallLogItem({ className: `${classes['callLogEmptyWrap']}` });
72-
element.appendChild(emptyCallLog.element);
73-
}
74-
}
75-
});
66+
element.appendChild(callItem.element);
67+
}
68+
}
69+
else{
70+
// empty call log
71+
const emptyCallLog = new CallLogItem({ className: `${classes['callLogEmptyWrap']}` });
72+
element.appendChild(emptyCallLog.element);
73+
}
7674
}
75+
});
7776
}
77+
}
7878
}

0 commit comments

Comments
 (0)