-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(redux-devtools-inspector-monitor): add option to sort state t…
…ree alphabetically and/or disable collections
- Loading branch information
Kent Kwee
committed
Jan 8, 2023
1 parent
248aa98
commit dad8f9b
Showing
15 changed files
with
150 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'remotedev-redux-devtools-extension': minor | ||
'@redux-devtools/inspector-monitor': minor | ||
--- | ||
|
||
Option to sort State Tree keys alphabetically | ||
Option to disable collapsing of object keys |
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
52 changes: 52 additions & 0 deletions
52
packages/redux-devtools-app/src/components/Settings/StateTree.tsx
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,52 @@ | ||
import React, { Component } from 'react'; | ||
import { connect, ResolveThunks } from 'react-redux'; | ||
import { Container, Form } from '@redux-devtools/ui'; | ||
import { changeStateTreeSettings } from '../../actions'; | ||
import { StoreState } from '../../reducers'; | ||
|
||
type StateProps = ReturnType<typeof mapStateToProps>; | ||
type DispatchProps = ResolveThunks<typeof actionCreators>; | ||
type Props = StateProps & DispatchProps; | ||
|
||
export class StateTree extends Component<Props> { | ||
render() { | ||
const stateTree = this.props.theme; | ||
const formData = { | ||
sortAlphabetically: stateTree.sortAlphabetically, | ||
disableCollection: stateTree.disableCollection, | ||
}; | ||
|
||
return ( | ||
<Container> | ||
<Form | ||
schema={{ | ||
type: 'object', | ||
properties: { | ||
sortAlphabetically: { | ||
title: 'Sort Alphabetically', | ||
type: 'boolean', | ||
}, | ||
disableCollection: { | ||
title: 'Disable collapsing of nodes', | ||
type: 'boolean', | ||
}, | ||
}, | ||
}} | ||
formData={formData} | ||
noSubmit | ||
onChange={this.props.changeStateTreeSettings} | ||
/> | ||
</Container> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = (state: StoreState) => ({ | ||
theme: state.stateTreeSettings, | ||
}); | ||
|
||
const actionCreators = { | ||
changeStateTreeSettings, | ||
}; | ||
|
||
export default connect(mapStateToProps, actionCreators)(StateTree); |
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
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
23 changes: 23 additions & 0 deletions
23
packages/redux-devtools-app/src/reducers/stateTreeSettings.ts
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,23 @@ | ||
import { CHANGE_STATE_TREE_SETTINGS } from '../constants/actionTypes'; | ||
import { StoreAction } from '../actions'; | ||
|
||
export interface StateTreeSettings { | ||
readonly sortAlphabetically: boolean; | ||
readonly disableCollection: boolean; | ||
} | ||
|
||
export function stateTreeSettings( | ||
state: StateTreeSettings = { | ||
sortAlphabetically: false, | ||
disableCollection: false, | ||
}, | ||
action: StoreAction | ||
) { | ||
if (action.type === CHANGE_STATE_TREE_SETTINGS) { | ||
return { | ||
sortAlphabetically: action.sortAlphabetically, | ||
disableCollection: action.disableCollection, | ||
}; | ||
} | ||
return state; | ||
} |
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