From 84bd15aca805d76b91b8925e34a94b4edad5b5c9 Mon Sep 17 00:00:00 2001 From: Rodri Sanchez Date: Mon, 4 Dec 2023 14:26:46 -0300 Subject: [PATCH 1/5] Hide scroll on live tiles --- src/components/Board/Symbol/Symbol.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/Board/Symbol/Symbol.css b/src/components/Board/Symbol/Symbol.css index 1d98e7442..259281d43 100644 --- a/src/components/Board/Symbol/Symbol.css +++ b/src/components/Board/Symbol/Symbol.css @@ -24,6 +24,10 @@ padding: 0.2em 0.9em 0.2em 0.9em; } +.liveInput .MuiInputBase-input::-webkit-scrollbar { + display: none; +} + .Symbol textarea { align-self: flex-start; font-weight: 700; From 07ab0faff4e1dee0e207a0c7ad186e3605c50465 Mon Sep 17 00:00:00 2001 From: Rodri Sanchez Date: Mon, 4 Dec 2023 14:37:59 -0300 Subject: [PATCH 2/5] Repeat last spoken sentence with redo --- src/components/Board/Output/Output.container.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/Board/Output/Output.container.js b/src/components/Board/Output/Output.container.js index 059a9bfca..bbf6d3b33 100644 --- a/src/components/Board/Output/Output.container.js +++ b/src/components/Board/Output/Output.container.js @@ -219,6 +219,15 @@ export class OutputContainer extends Component { this.spliceOutput(index); }; + handleRepeatLastSpokenSentence() { + const { output } = this.props; + const lastSpokenSymbol = output.findLast( + (element, index) => element.label && index !== output.length - 1 + ); + const text = lastSpokenSymbol ? lastSpokenSymbol.label : ''; + this.speakOutput(text); + } + handleOutputClick = event => { const targetEl = event.target; const targetElLow = targetEl.tagName.toLowerCase(); @@ -228,6 +237,11 @@ export class OutputContainer extends Component { }; handleOutputKeyDown = event => { + if (event.ctrlKey && event.nativeEvent.shiftKey && keycode('Z')) { + this.handleRepeatLastSpokenSentence(); + return; + } + if (event.keyCode === keycode('enter')) { const targetEl = event.target; if (targetEl.tagName.toLowerCase() === 'div') { From b150092000fa817e9cd5ab94492a1c8253dc3393 Mon Sep 17 00:00:00 2001 From: Rodri Sanchez Date: Mon, 4 Dec 2023 14:55:51 -0300 Subject: [PATCH 3/5] Add Ctrl + Y key combination --- src/components/Board/Output/Output.container.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Board/Output/Output.container.js b/src/components/Board/Output/Output.container.js index bbf6d3b33..c88d37334 100644 --- a/src/components/Board/Output/Output.container.js +++ b/src/components/Board/Output/Output.container.js @@ -237,7 +237,11 @@ export class OutputContainer extends Component { }; handleOutputKeyDown = event => { - if (event.ctrlKey && event.nativeEvent.shiftKey && keycode('Z')) { + console.log(event); + if ( + (event.ctrlKey && event.nativeEvent.shiftKey && keycode('Z')) || + (event.ctrlKey && keycode('Y')) + ) { this.handleRepeatLastSpokenSentence(); return; } From a321790fefaee003118a31934112f6528c0605c9 Mon Sep 17 00:00:00 2001 From: Rodri Sanchez Date: Mon, 4 Dec 2023 15:26:05 -0300 Subject: [PATCH 4/5] Add keydown eventListener to call repeat function --- .../Board/Output/Output.container.js | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/components/Board/Output/Output.container.js b/src/components/Board/Output/Output.container.js index c88d37334..0155fbfaf 100644 --- a/src/components/Board/Output/Output.container.js +++ b/src/components/Board/Output/Output.container.js @@ -64,6 +64,16 @@ export class OutputContainer extends Component { translatedOutput: [] }; + componentDidMount() { + document.addEventListener('keydown', this.handleRepeatLastSpokenSentence); + } + componentWillUnmount() { + document.removeEventListener( + 'keydown', + this.handleRepeatLastSpokenSentence + ); + } + outputReducer(accumulator, currentValue) { const actionValue = currentValue.action && @@ -219,14 +229,19 @@ export class OutputContainer extends Component { this.spliceOutput(index); }; - handleRepeatLastSpokenSentence() { - const { output } = this.props; - const lastSpokenSymbol = output.findLast( - (element, index) => element.label && index !== output.length - 1 - ); - const text = lastSpokenSymbol ? lastSpokenSymbol.label : ''; - this.speakOutput(text); - } + handleRepeatLastSpokenSentence = event => { + if ( + (event.ctrlKey && event.shiftKey && event.keyCode === 90) || + (event.ctrlKey && event.keyCode === 89) + ) { + const { output } = this.props; + const lastSpokenSymbol = output.findLast( + (element, index) => element.label && index !== output.length - 1 + ); + const text = lastSpokenSymbol ? lastSpokenSymbol.label : ''; + this.speakOutput(text); + } + }; handleOutputClick = event => { const targetEl = event.target; @@ -237,15 +252,6 @@ export class OutputContainer extends Component { }; handleOutputKeyDown = event => { - console.log(event); - if ( - (event.ctrlKey && event.nativeEvent.shiftKey && keycode('Z')) || - (event.ctrlKey && keycode('Y')) - ) { - this.handleRepeatLastSpokenSentence(); - return; - } - if (event.keyCode === keycode('enter')) { const targetEl = event.target; if (targetEl.tagName.toLowerCase() === 'div') { From 53f2d2e726f33b45477bd4e08675d54397eeedba Mon Sep 17 00:00:00 2001 From: Rodri Sanchez Date: Mon, 4 Dec 2023 15:30:00 -0300 Subject: [PATCH 5/5] Define Z_KEY_CODE and Y_KEY_CODE constants --- src/components/Board/Output/Output.container.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Board/Output/Output.container.js b/src/components/Board/Output/Output.container.js index 0155fbfaf..ea3b4827c 100644 --- a/src/components/Board/Output/Output.container.js +++ b/src/components/Board/Output/Output.container.js @@ -230,9 +230,11 @@ export class OutputContainer extends Component { }; handleRepeatLastSpokenSentence = event => { + const Z_KEY_CODE = 90; + const Y_KEY_CODE = 89; if ( - (event.ctrlKey && event.shiftKey && event.keyCode === 90) || - (event.ctrlKey && event.keyCode === 89) + (event.ctrlKey && event.shiftKey && event.keyCode === Z_KEY_CODE) || + (event.ctrlKey && event.keyCode === Y_KEY_CODE) ) { const { output } = this.props; const lastSpokenSymbol = output.findLast(