diff --git a/src/components/App/App.reducer.js b/src/components/App/App.reducer.js index 51558b676..694f4babc 100644 --- a/src/components/App/App.reducer.js +++ b/src/components/App/App.reducer.js @@ -50,6 +50,7 @@ const initialState = { quickUnlockActive: false, removeOutputActive: false, vocalizeFolders: false, + quietBuilderMode: false, liveMode: false, improvePhraseActive: false }, diff --git a/src/components/App/__tests__/App.reducer.test.js b/src/components/App/__tests__/App.reducer.test.js index 4106048bf..5cbe29850 100644 --- a/src/components/App/__tests__/App.reducer.test.js +++ b/src/components/App/__tests__/App.reducer.test.js @@ -47,6 +47,7 @@ describe('reducer', () => { quickUnlockActive: false, removeOutputActive: false, vocalizeFolders: false, + quietBuilderMode: false, improvePhraseActive: false }, symbolsSettings: { @@ -77,6 +78,7 @@ describe('reducer', () => { quickUnlockActive: false, removeOutputActive: false, vocalizeFolders: false, + quietBuilderMode: false, improvePhraseActive: false }, userData: uData diff --git a/src/components/Board/Board.container.js b/src/components/Board/Board.container.js index 14afd000e..8a01dcc98 100644 --- a/src/components/Board/Board.container.js +++ b/src/components/Board/Board.container.js @@ -216,6 +216,7 @@ export class BoardContainer extends Component { const { board, + boards, communicator, changeBoard, userData, @@ -230,11 +231,9 @@ export class BoardContainer extends Component { window.gtag('set', { user_id: userData.id }); //synchronize communicator and boards with API this.setState({ isGettingApiObjects: true }); - await getApiObjects(); - this.setState({ isGettingApiObjects: false }); + getApiObjects().then(() => this.setState({ isGettingApiObjects: false })); } - const boards = this.props.boards; //see board from redux state after get ApiObjets let boardExists = null; if (id && board && id === board.id) { @@ -894,7 +893,9 @@ export class BoardContainer extends Component { } } else { clickSymbol(tile.label); - say(); + if (!navigationSettings.quietBuilderMode) { + say(); + } if (isLiveMode) { const liveTile = { backgroundColor: 'rgb(255, 241, 118)', @@ -1167,8 +1168,8 @@ export class BoardContainer extends Component { ) .then(parentBoardId => { if (createParentBoard) { - /* Here the parentBoardData is not updated with the values - that updatedApiObjects store on the API. Inside the boards are already updated + /* Here the parentBoardData is not updated with the values + that updatedApiObjects store on the API. Inside the boards are already updated an the value is not replaced because the oldboard Id was replaced on the updateApiObjects inside createApiBoardSuccess */ replaceBoard( { ...parentBoardData }, @@ -1427,7 +1428,7 @@ export class BoardContainer extends Component { }; if (tile.loadBoard) { createTile(newTile, board.id); - await this.pasteBoardsRecursively(newTile, board.id); + await this.pasteBoardsRecursively(newTile, board.id, tile.loadBoard); } else { await this.handleAddTileEditorSubmit(newTile); } @@ -1441,7 +1442,7 @@ export class BoardContainer extends Component { } }; - async pasteBoardsRecursively(folderTile, parentBoardId) { + async pasteBoardsRecursively(folderTile, parentBoardId, firstPastedFolderId) { const { createBoard, userData, @@ -1464,6 +1465,14 @@ export class BoardContainer extends Component { author: '', email: '' }; + + const tilesWithFatherRemoved = newBoard.tiles?.reduce((newTiles, tile) => { + if (firstPastedFolderId !== tile.loadBoard) newTiles.push(tile); + return newTiles; + }, []); + + newBoard.tiles = tilesWithFatherRemoved; + if (!newBoard.name) { newBoard.name = newBoard.nameKey ? intl.formatMessage({ id: newBoard.nameKey }) @@ -1515,15 +1524,19 @@ export class BoardContainer extends Component { } //return condition - newBoard.tiles.forEach(async tile => { + for await (const tile of newBoard.tiles) { if (tile && tile.loadBoard && !tile.linkedBoard) { //look for this board in available boards const newBoardToCopy = boards.find(b => b.id === tile.loadBoard); if (newBoardToCopy) { - this.pasteBoardsRecursively(tile, newBoard.id); + await this.pasteBoardsRecursively( + tile, + newBoard.id, + firstPastedFolderId + ); } } - }); + } return; } diff --git a/src/components/Settings/Navigation/Navigation.component.js b/src/components/Settings/Navigation/Navigation.component.js index a184ca1c8..0d9efa6f8 100644 --- a/src/components/Settings/Navigation/Navigation.component.js +++ b/src/components/Settings/Navigation/Navigation.component.js @@ -75,6 +75,12 @@ class Navigation extends React.Component { }); }; + toggleQuietBuilderMode = () => { + this.setState({ + quietBuilderMode: !this.state.quietBuilderMode + }); + }; + toggleLiveMode = () => { this.setState({ liveMode: !this.state.liveMode @@ -277,6 +283,24 @@ class Navigation extends React.Component { + + } + secondary={ + + } + /> + + + + + diff --git a/src/components/Settings/Navigation/Navigation.messages.js b/src/components/Settings/Navigation/Navigation.messages.js index abe024ce7..ccb3869e7 100644 --- a/src/components/Settings/Navigation/Navigation.messages.js +++ b/src/components/Settings/Navigation/Navigation.messages.js @@ -47,6 +47,15 @@ export default defineMessages({ id: 'cboard.components.Settings.Navigation.vocalizeFoldersSecondary', defaultMessage: "Reads a folder's name out loud when clicked" }, + quietBuilderMode: { + id: 'cboard.components.Settings.Navigation.quietBuilderMode', + defaultMessage: 'Enable Quiet Builder mode' + }, + quietBuilderModeSecondary: { + id: 'cboard.components.Settings.Navigation.quietBuilderModeSecondary', + defaultMessage: + 'Disables vocalization of tiles when they are clicked as you build a sentence. Click output bar to hear the constructed sentence.' + }, showLiveMode: { id: 'cboard.components.Settings.Navigation.showLiveMode', defaultMessage: 'Use the Live Mode' diff --git a/src/components/Settings/Navigation/Navigation.test.js b/src/components/Settings/Navigation/Navigation.test.js index 57e3a5aad..9b2d65a2c 100644 --- a/src/components/Settings/Navigation/Navigation.test.js +++ b/src/components/Settings/Navigation/Navigation.test.js @@ -30,7 +30,8 @@ const INITIAL_NAVIGATION_SETTINGS = { navigationButtonsStyle: NAVIGATION_BUTTONS_STYLE_SIDES, quickUnlockActive: false, removeOutputActive: false, - vocalizeFolders: false + vocalizeFolders: false, + quietBuilderMode: false }; let navigationSettings = INITIAL_NAVIGATION_SETTINGS; diff --git a/src/translations/src/cboard.json b/src/translations/src/cboard.json index 415bfd719..3cba6b95c 100644 --- a/src/translations/src/cboard.json +++ b/src/translations/src/cboard.json @@ -430,6 +430,8 @@ "cboard.components.Settings.Navigation.outputRemoveSecondary": "Shows a \"x\" buttton on each symbol in order to remove it", "cboard.components.Settings.Navigation.vocalizeFolders": "Enable folder vocalization", "cboard.components.Settings.Navigation.vocalizeFoldersSecondary": "Reads folders name out loud when clicked", + "cboard.components.Settings.Navigation.quietBuilderMode": "Enable Quiet Builder mode", + "cboard.components.Settings.Navigation.quietBuilderModeSecondary": "Disables vocalization of tiles when they are clicked as you build a sentence. Click output bar to hear the constructed sentence.", "cboard.components.Settings.Navigation.showLiveMode": "Use the Live Mode", "cboard.components.Settings.Navigation.showLiveModeSecondary": "Live mode allows you to write text directly into the output bar and quickly play the sound. It is intended for users that can write.", "cboard.components.Settings.Navigation.activeImprovePhrase": "Use the Improve Phrase",