-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1513 from tomivm/feature/improve-phrase
Feature/improve phrase
- Loading branch information
Showing
19 changed files
with
262 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import { | |
FINISH_FIRST_VISIT, | ||
UPDATE_CONNECTIVITY, | ||
UPDATE_DISPLAY_SETTINGS, | ||
UPDATE_NAVIGATION_SETTINGS, | ||
UPDATE_NAVIGATION_SETTINGS | ||
} from '../App.constants'; | ||
import appReducer from '../App.reducer'; | ||
|
||
|
@@ -24,9 +24,9 @@ describe('reducer', () => { | |
communicatorTour: { | ||
isCommBoardsEnabled: true, | ||
isPublicBoardsEnabled: true, | ||
isAllMyBoardsEnabled: true, | ||
isAllMyBoardsEnabled: true | ||
}, | ||
isAnalyticsTourEnabled: true, | ||
isAnalyticsTourEnabled: true | ||
}, | ||
displaySettings: { | ||
uiSize: DISPLAY_SIZE_STANDARD, | ||
|
@@ -35,7 +35,7 @@ describe('reducer', () => { | |
hideOutputActive: false, | ||
increaseOutputButtons: false, | ||
labelPosition: 'Below', | ||
darkThemeActive: false, | ||
darkThemeActive: false | ||
}, | ||
navigationSettings: { | ||
active: false, | ||
|
@@ -47,11 +47,12 @@ describe('reducer', () => { | |
quickUnlockActive: false, | ||
removeOutputActive: false, | ||
vocalizeFolders: false, | ||
improvePhraseActive: false | ||
}, | ||
symbolsSettings: { | ||
arasaacActive: false, | ||
arasaacActive: false | ||
}, | ||
userData: {}, | ||
userData: {} | ||
}; | ||
uData = { name: 'martin bedouret', email: '[email protected]' }; | ||
mockApp = { | ||
|
@@ -62,7 +63,7 @@ describe('reducer', () => { | |
labelPosition: 'Below', | ||
fontFamily: DEFAULT_FONT_FAMILY, | ||
fontSize: 'Standard', | ||
darkThemeActive: false, | ||
darkThemeActive: false | ||
}, | ||
isConnected: true, | ||
isFirstVisit: false, | ||
|
@@ -76,8 +77,9 @@ describe('reducer', () => { | |
quickUnlockActive: false, | ||
removeOutputActive: false, | ||
vocalizeFolders: false, | ||
improvePhraseActive: false | ||
}, | ||
userData: uData, | ||
userData: uData | ||
}; | ||
}); | ||
it('should return the initial state', () => { | ||
|
@@ -86,57 +88,57 @@ describe('reducer', () => { | |
it('should handle login ', () => { | ||
const login = { | ||
type: LOGIN_SUCCESS, | ||
payload: uData, | ||
payload: uData | ||
}; | ||
expect(appReducer(initialState, login)).toEqual({ | ||
...initialState, | ||
userData: uData, | ||
isFirstVisit: false, | ||
isFirstVisit: false | ||
}); | ||
}); | ||
it('should handle logout', () => { | ||
const logout = { | ||
type: LOGOUT, | ||
type: LOGOUT | ||
}; | ||
expect(appReducer(initialState, logout)).toEqual(initialState); | ||
}); | ||
it('should handle updateDisplaySettings', () => { | ||
const updateDisplaySettings = { | ||
type: UPDATE_DISPLAY_SETTINGS, | ||
payload: mockApp.displaySettings, | ||
payload: mockApp.displaySettings | ||
}; | ||
expect(appReducer(initialState, updateDisplaySettings)).toEqual({ | ||
...initialState, | ||
displaySettings: mockApp.displaySettings, | ||
displaySettings: mockApp.displaySettings | ||
}); | ||
}); | ||
it('should handle updateNavigationSettings', () => { | ||
const updateNavigationSettings = { | ||
type: UPDATE_NAVIGATION_SETTINGS, | ||
payload: mockApp.navigationSettings, | ||
payload: mockApp.navigationSettings | ||
}; | ||
expect(appReducer(initialState, updateNavigationSettings)).toEqual({ | ||
...initialState, | ||
navigationSettings: mockApp.navigationSettings, | ||
navigationSettings: mockApp.navigationSettings | ||
}); | ||
}); | ||
it('should handle finishFirstVisit ', () => { | ||
const finishFirstVisit = { | ||
type: FINISH_FIRST_VISIT, | ||
type: FINISH_FIRST_VISIT | ||
}; | ||
expect(appReducer(initialState, finishFirstVisit)).toEqual({ | ||
...initialState, | ||
isFirstVisit: false, | ||
isFirstVisit: false | ||
}); | ||
}); | ||
it('should handle updateConnectivity', () => { | ||
const updateConnectivity = { | ||
type: UPDATE_CONNECTIVITY, | ||
payload: false, | ||
payload: false | ||
}; | ||
expect(appReducer(initialState, updateConnectivity)).toEqual({ | ||
...initialState, | ||
isConnected: false, | ||
isConnected: false | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/components/Board/ImprovePhraseOutput/ImprovePhraseOutput.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import styles from './ImprovePhraseOutput.module.css'; | ||
|
||
import { Typography } from '@material-ui/core'; | ||
import { PlayArrow } from '@material-ui/icons'; | ||
|
||
const propTypes = { | ||
improvedPhrase: PropTypes.string, | ||
speak: PropTypes.func | ||
}; | ||
|
||
function ImprovePhraseOutput({ improvedPhrase, speak }) { | ||
const handlePlay = async () => { | ||
if (!improvedPhrase || improvedPhrase.length === 0) return; | ||
speak(improvedPhrase); | ||
}; | ||
const enabledControllsClassname = improvedPhrase | ||
? `${styles.text_and_controls} ${styles.enabled}` | ||
: styles.text_and_controls; | ||
|
||
return ( | ||
<div | ||
tabIndex="0" | ||
className={enabledControllsClassname} | ||
onClick={handlePlay} | ||
> | ||
<Typography className={styles.text} variant="h5"> | ||
{improvedPhrase} | ||
</Typography> | ||
{improvedPhrase && ( | ||
<PlayArrow className={styles.playArrow} fontSize="large" /> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
ImprovePhraseOutput.propTypes = propTypes; | ||
|
||
export default ImprovePhraseOutput; |
Oops, something went wrong.