Keyboard navigation

pull/1102/head
Vincent 6 years ago
parent 3030b028eb
commit 56ae7055cb

@ -256,6 +256,13 @@ $composition-container-height: 60px;
} }
} }
&--visualisation {
margin-top: -900px;
z-index: 1000;
height: 400px;
width: 100%;
}
&--delete { &--delete {
display: flex; display: flex;
justify-content: center; justify-content: center;

@ -56,7 +56,7 @@ export class SessionConversation extends React.Component<any, State> {
this.renderTimerNotification = this.renderTimerNotification.bind(this); this.renderTimerNotification = this.renderTimerNotification.bind(this);
this.renderFriendRequest = this.renderFriendRequest.bind(this); this.renderFriendRequest = this.renderFriendRequest.bind(this);
this.onKeyUp = this.onKeyUp.bind(this); this.onKeyDown = this.onKeyDown.bind(this);
this.onStartedRecording = this.onStartedRecording.bind(this); this.onStartedRecording = this.onStartedRecording.bind(this);
this.onStoppedRecording = this.onStoppedRecording.bind(this); this.onStoppedRecording = this.onStoppedRecording.bind(this);
this.selectMessage = this.selectMessage.bind(this); this.selectMessage = this.selectMessage.bind(this);
@ -111,7 +111,7 @@ export class SessionConversation extends React.Component<any, State> {
<div <div
className={classNames('conversation-item', selectionMode && 'selection-mode')} className={classNames('conversation-item', selectionMode && 'selection-mode')}
tabIndex={0} tabIndex={0}
onKeyUp={this.onKeyUp} onKeyDown={this.onKeyDown}
> >
<div className="conversation-header"> <div className="conversation-header">
{this.renderHeader()} {this.renderHeader()}
@ -614,26 +614,61 @@ export class SessionConversation extends React.Component<any, State> {
private onStartedRecording() { private onStartedRecording() {
this.setState({ this.setState({
isRecording: true, isRecording: true,
selectedMessages: [],
}) })
} }
private onStoppedRecording() { private onStoppedRecording() {
this.setState({ this.setState({
isRecording: false, isRecording: false,
}) });
console.log(`[vince] Stopped recording entirely`);
} }
private onKeyUp(event: any) { private onKeyDown(event: any) {
const selectionMode = !!this.state.selectedMessages.length; const selectionMode = !!this.state.selectedMessages.length;
const messageContainer = document.getElementsByClassName('messages-container')[0];
const pageHeight = messageContainer.clientHeight;
const arrowScrollPx = 50;
const pageScrollPx = 0.80 * pageHeight;
console.log(`[vince][key] event: `, event); console.log(`[vince][key] event: `, event);
console.log(`[vince][key] key: `, event.key); console.log(`[vince][key] key: `, event.key);
console.log(`[vince][key] key: `, event.keyCode); console.log(`[vince][key] key: `, event.keyCode);
if (event.key === 'Escape') { if (event.key === 'Escape') {
if (selectionMode){
this.resetSelection();
}
} }
switch(event.key){
case 'Escape':
if (selectionMode){
this.resetSelection();
}
break;
// Scrolling
case 'ArrowUp':
messageContainer.scrollBy(0, -arrowScrollPx);
break;
case 'ArrowDown':
messageContainer.scrollBy(0, arrowScrollPx);
break;
case 'PageUp':
messageContainer.scrollBy(0, -pageScrollPx);
break;
case 'PageDown':
messageContainer.scrollBy(0, pageScrollPx);
break;
default:
break;
}
} }
} }

@ -81,14 +81,14 @@ export class SessionRecording extends React.Component<Props, State> {
)} )}
</div> </div>
{/* <ReactMic <ReactMic
record={this.state.isRecording} record={this.state.isRecording}
visualSetting={'frequencyBars'}
className='session-recording--visualisation' className='session-recording--visualisation'
onStop={() => null} onStop={() => null}
onData= {(data: any) => console.log(`[vince][mic] Data:`, data)} onData= {(data: any) => console.log(`[vince][mic] Data:`, data)}
strokeColor={'#00F480'} strokeColor={'#00F480'}
/> */} backgroundColor={'blue'}
/>
<div className="send-message-button"> <div className="send-message-button">
@ -149,7 +149,8 @@ export class SessionRecording extends React.Component<Props, State> {
} }
private onDeleteVoiceMessage() { private onDeleteVoiceMessage() {
console.log(`[vince][mic] Deleting voice message`) this.onStopRecording();
this.props.onStoppedRecording();
} }
private onSendVoiceMessage() { private onSendVoiceMessage() {

Loading…
Cancel
Save