-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): Toggle devtools feature flag in app settings (#1678)
Closes #1632
- Loading branch information
Showing
4 changed files
with
65 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// @flow | ||
// app info card with version and updated | ||
import * as React from 'react' | ||
import {connect} from 'react-redux' | ||
|
||
import type {State, Dispatch} from '../../types' | ||
import {getDevToolsOn, toggleDevTools} from '../../config' | ||
import {Card} from '@opentrons/components' | ||
import {LabeledToggle, ToggleInfo} from '../toggles' | ||
|
||
type SP = { | ||
devToolsOn: boolean, | ||
} | ||
|
||
type DP = { | ||
toggleDevTools: () => mixed | ||
} | ||
type Props = SP & DP | ||
|
||
const TITLE = 'Advanced Settings' | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(AdvancedSettingsCard) | ||
|
||
function AdvancedSettingsCard (props: Props) { | ||
return ( | ||
<Card title={TITLE} column> | ||
<LabeledToggle | ||
label='Enable Developer Tools' | ||
toggledOn={props.devToolsOn} | ||
onClick={props.toggleDevTools} | ||
/> | ||
<ToggleInfo> | ||
<p>Requires restart. Turns on the app's developer tools, which provide access to the inner workings of the app and additional logging.</p> | ||
</ToggleInfo> | ||
</Card> | ||
) | ||
} | ||
|
||
function mapStateToProps (state: State): SP { | ||
return { | ||
devToolsOn: getDevToolsOn(state) | ||
} | ||
} | ||
|
||
function mapDispatchToProps (dispatch: Dispatch) { | ||
return { | ||
toggleDevTools: () => dispatch(toggleDevTools()) | ||
} | ||
} |
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