diff --git a/README.md b/README.md index 1265082..9859315 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ Name | Type | Description `theme` | Object or string | Contains either [base16](https://github.com/chriskempson/base16) theme name or object, that can be `base16` colors map or object containing classnames or styles. `invertTheme` | Boolean | Inverts theme color luminance, making light theme out of dark theme and vice versa. `supportImmutable` | Boolean | Better `Immutable` rendering in `Diff` (can affect performance if state has huge objects/arrays). `false` by default. +`hideMainButtons` | Boolean | Will not show top buttons: `commit`, `reset`... `false` by default. +`hideActionButtons` | Boolean | Will not show action buttons: `jump`, `skip`. `false` by default. `tabs` | Array or function | Overrides list of tabs (see below) `diffObjectHash` | Function | Optional callback for better array handling in diffs (see [jsondiffpatch docs](https://github.com/benjamine/jsondiffpatch/blob/master/docs/arrays.md)) `diffPropertyFilter` | Function | Optional callback for ignoring particular props in diff (see [jsondiffpatch docs](https://github.com/benjamine/jsondiffpatch#options)) diff --git a/src/ActionList.jsx b/src/ActionList.jsx index 5e796ab..2d13358 100644 --- a/src/ActionList.jsx +++ b/src/ActionList.jsx @@ -60,7 +60,7 @@ export default class ActionList extends PureComponent { render() { const { styling, actions, actionIds, isWideLayout, onToggleAction, skippedActionIds, selectedActionId, startActionId, onSelect, onSearch, searchValue, currentActionId, - onCommit, onSweep, onJumpToState } = this.props; + hideMainButtons, hideActionButtons, onCommit, onSweep, onJumpToState } = this.props; const lowerSearchValue = searchValue && searchValue.toLowerCase(); const filteredActionIds = searchValue ? actionIds.filter( id => actions[id].action.type.toLowerCase().indexOf(lowerSearchValue) !== -1 @@ -77,6 +77,7 @@ export default class ActionList extends PureComponent { onSearch={onSearch} onCommit={onCommit} onSweep={onSweep} + hideMainButtons={hideMainButtons} hasSkippedActions={skippedActionIds.length > 0} hasStagedActions={actionIds.length > 1} />
@@ -96,6 +97,7 @@ export default class ActionList extends PureComponent { onToggleClick={() => onToggleAction(actionId)} onJumpClick={() => onJumpToState(actionId)} onCommitClick={() => onCommit(actionId)} + hideActionButtons={hideActionButtons} isSkipped={skippedActionIds.indexOf(actionId) !== -1} /> )}
diff --git a/src/ActionListHeader.jsx b/src/ActionListHeader.jsx index 3260840..834b5e5 100644 --- a/src/ActionListHeader.jsx +++ b/src/ActionListHeader.jsx @@ -19,13 +19,16 @@ const getActiveButtons = (hasSkippedActions): Array<'Sweep' | 'Commit'> => [ ].filter(Boolean); const ActionListHeader = - ({ styling, onSearch, hasSkippedActions, hasStagedActions, onCommit, onSweep }: Props) => + ({ + styling, onSearch, hasSkippedActions, hasStagedActions, onCommit, onSweep, hideMainButtons + }: Props) =>
onSearch(e.target.value)} placeholder='filter...' /> + {!hideMainButtons &&
@@ -46,6 +49,7 @@ const ActionListHeader =
+ }
; export default ActionListHeader; diff --git a/src/ActionListRow.jsx b/src/ActionListRow.jsx index 0be4b9c..101af45 100644 --- a/src/ActionListRow.jsx +++ b/src/ActionListRow.jsx @@ -37,7 +37,7 @@ export default class ActionListRow extends PureComponent { render() { const { styling, isSelected, action, isInitAction, onSelect, - timestamps, isSkipped, isInFuture } = this.props; + timestamps, isSkipped, isInFuture, hideActionButtons } = this.props; const { hover } = this.state; const timeDelta = timestamps.current - timestamps.previous; const showButtons = hover && !isInitAction || isSkipped; @@ -53,9 +53,9 @@ export default class ActionListRow extends PureComponent { return (
{ > {actionType}
-
- + {hideActionButtons ? +
{timeDelta === 0 ? '+00:00:00' : dateformat(timeDelta, timestamps.previous ? '+MM:ss.L' : 'h:MM:ss.L')}
- -
- {[BUTTON_JUMP, BUTTON_SKIP].map(btn => (!isInitAction || btn !== BUTTON_SKIP) && -
- {btn} -
- )} -
-
-
+ : +
+ +
+ {timeDelta === 0 ? '+00:00:00' : + dateformat(timeDelta, timestamps.previous ? '+MM:ss.L' : 'h:MM:ss.L')} +
+
+ +
+ {[BUTTON_JUMP, BUTTON_SKIP].map(btn => (!isInitAction || btn !== BUTTON_SKIP) && +
+ {btn} +
+ )} +
+
+
+ } ); } diff --git a/src/DevtoolsInspector.js b/src/DevtoolsInspector.js index e305af0..359082c 100644 --- a/src/DevtoolsInspector.js +++ b/src/DevtoolsInspector.js @@ -17,7 +17,9 @@ import type { ObjectHash, PropertyFilter, Delta } from 'jsondiffpatch'; type DefaultProps = { supportImmutable: boolean, theme: Theme, - invertTheme: boolean + invertTheme: boolean, + hideMainButtons: boolean, + hideActionButtons: boolean }; type AppState = Object; @@ -127,7 +129,9 @@ export default class DevtoolsInspector extends PureComponent state, supportImmutable: false, theme: 'inspector', - invertTheme: true + invertTheme: true, + hideMainButtons: false, + hideActionButtons: false }; componentDidMount() { @@ -173,7 +177,8 @@ export default class DevtoolsInspector extends PureComponent