├── .eslintignore ├── .babelrc ├── src ├── reducers.js ├── SliderButton.js └── SliderMonitor.js ├── .gitignore ├── .npmignore ├── examples └── todomvc │ ├── constants │ ├── TodoFilters.js │ └── ActionTypes.js │ ├── README.md │ ├── .babelrc │ ├── reducers │ ├── index.js │ └── todos.js │ ├── containers │ ├── Root.js │ ├── Root.prod.js │ ├── Root.dev.js │ ├── DevTools.js │ └── TodoApp.js │ ├── dist │ └── index.html │ ├── store │ ├── configureStore.prod.js │ ├── configureStore.js │ └── configureStore.dev.js │ ├── webpack.config.prod.js │ ├── index.js │ ├── components │ ├── Header.js │ ├── TodoTextInput.js │ ├── TodoItem.js │ ├── Footer.js │ └── MainSection.js │ ├── actions │ └── TodoActions.js │ ├── package.json │ └── webpack.config.js ├── .eslintrc ├── LICENSE.md ├── CODE_OF_CONDUCT.md ├── package.json ├── README.md └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | lib 2 | **/node_modules 3 | examples/**/dist 4 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-0", "react"] 3 | } 4 | -------------------------------------------------------------------------------- /src/reducers.js: -------------------------------------------------------------------------------- 1 | export default function reducer() { 2 | return {}; 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | .DS_Store 4 | lib 5 | coverage 6 | bundle.js 7 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.log 3 | src 4 | test 5 | examples 6 | coverage 7 | yarn.lock 8 | -------------------------------------------------------------------------------- /examples/todomvc/constants/TodoFilters.js: -------------------------------------------------------------------------------- 1 | export const SHOW_ALL = 'show_all'; 2 | export const SHOW_MARKED = 'show_marked'; 3 | export const SHOW_UNMARKED = 'show_unmarked'; 4 | -------------------------------------------------------------------------------- /examples/todomvc/README.md: -------------------------------------------------------------------------------- 1 | # Redux DevTools TodoMVC example 2 | 3 | ## Getting Started 4 | 5 | 1. Install dependencies: `npm i` 6 | 2. Start the development server: `npm start` 7 | -------------------------------------------------------------------------------- /examples/todomvc/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["es2015", { "modules": false }], 4 | "stage-0", 5 | "react" 6 | ], 7 | "plugins": [ 8 | "react-hot-loader/babel" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /examples/todomvc/reducers/index.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from 'redux'; 2 | import todos from './todos'; 3 | 4 | const rootReducer = combineReducers({ 5 | todos 6 | }); 7 | 8 | export default rootReducer; 9 | -------------------------------------------------------------------------------- /examples/todomvc/containers/Root.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable global-require */ 2 | if (process.env.NODE_ENV === 'production') { 3 | module.exports = require('./Root.prod'); 4 | } else { 5 | module.exports = require('./Root.dev'); 6 | } 7 | -------------------------------------------------------------------------------- /examples/todomvc/dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Redux TodoMVC 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/todomvc/store/configureStore.prod.js: -------------------------------------------------------------------------------- 1 | import { createStore } from 'redux'; 2 | import rootReducer from '../reducers'; 3 | 4 | export default function configureStore(initialState) { 5 | return createStore(rootReducer, initialState); 6 | } 7 | -------------------------------------------------------------------------------- /examples/todomvc/store/configureStore.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable global-require */ 2 | if (process.env.NODE_ENV === 'production') { 3 | module.exports = require('./configureStore.prod'); 4 | } else { 5 | module.exports = require('./configureStore.dev'); 6 | } 7 | -------------------------------------------------------------------------------- /examples/todomvc/constants/ActionTypes.js: -------------------------------------------------------------------------------- 1 | export const ADD_TODO = 'ADD_TODO'; 2 | export const DELETE_TODO = 'DELETE_TODO'; 3 | export const EDIT_TODO = 'EDIT_TODO'; 4 | export const MARK_TODO = 'MARK_TODO'; 5 | export const MARK_ALL = 'MARK_ALL'; 6 | export const CLEAR_MARKED = 'CLEAR_MARKED'; 7 | -------------------------------------------------------------------------------- /examples/todomvc/webpack.config.prod.js: -------------------------------------------------------------------------------- 1 | // NOTE: This config is used for deploy to gh-pages 2 | const webpack = require('webpack'); 3 | const devConfig = require('./webpack.config'); 4 | 5 | devConfig.entry = './index'; 6 | devConfig.plugins = [ 7 | new webpack.NoEmitOnErrorsPlugin() 8 | ]; 9 | 10 | module.exports = devConfig; 11 | -------------------------------------------------------------------------------- /examples/todomvc/containers/Root.prod.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { Provider } from 'react-redux'; 4 | import TodoApp from './TodoApp'; 5 | 6 | const Root = ({ store }) => ( 7 | 8 |
9 | 10 |
11 |
12 | ); 13 | 14 | Root.propTypes = { 15 | store: PropTypes.object.isRequired 16 | }; 17 | 18 | export default Root; 19 | -------------------------------------------------------------------------------- /examples/todomvc/containers/Root.dev.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { Provider } from 'react-redux'; 4 | import TodoApp from './TodoApp'; 5 | import DevTools from './DevTools'; 6 | 7 | const Root = ({ store }) => ( 8 | 9 |
10 | 11 | 12 |
13 |
14 | ); 15 | 16 | Root.propTypes = { 17 | store: PropTypes.object.isRequired 18 | }; 19 | 20 | export default Root; 21 | -------------------------------------------------------------------------------- /examples/todomvc/containers/DevTools.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { createDevTools } from 'redux-devtools'; 3 | import DockMonitor from 'redux-devtools-dock-monitor'; 4 | import SliderMonitor from 'redux-slider-monitor'; // eslint-disable-line 5 | 6 | export default createDevTools( 7 | 13 | 14 | 15 | ); 16 | -------------------------------------------------------------------------------- /examples/todomvc/index.js: -------------------------------------------------------------------------------- 1 | import 'todomvc-app-css/index.css'; 2 | import React from 'react'; 3 | import ReactDOM from 'react-dom'; 4 | import { AppContainer } from 'react-hot-loader'; 5 | import configureStore from './store/configureStore'; 6 | import Root from './containers/Root'; 7 | 8 | const store = configureStore(); 9 | 10 | const rootEl = document.getElementById('root'); 11 | const render = () => { 12 | ReactDOM.render( 13 | 14 | 15 | , 16 | rootEl 17 | ); 18 | }; 19 | 20 | render(Root); 21 | if (module.hot) { 22 | module.hot.accept('./containers/Root', render); 23 | } 24 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint-config-airbnb", 3 | "env": { 4 | "browser": true, 5 | "mocha": true, 6 | "node": true 7 | }, 8 | "parser": "babel-eslint", 9 | "rules": { 10 | "comma-dangle": [2, "never"], 11 | "jsx-quotes": [2, "prefer-single"], 12 | "react/jsx-uses-react": 2, 13 | "react/jsx-uses-vars": 2, 14 | "react/react-in-jsx-scope": 2, 15 | "react/sort-comp": 0, 16 | "react/forbid-prop-types": 0, 17 | "import/no-extraneous-dependencies": 0, 18 | "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], 19 | 'jsx-a11y/no-static-element-interactions': 0 20 | }, 21 | "plugins": [ 22 | "react" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /examples/todomvc/store/configureStore.dev.js: -------------------------------------------------------------------------------- 1 | import { createStore, compose } from 'redux'; 2 | import { persistState } from 'redux-devtools'; 3 | import rootReducer from '../reducers'; 4 | import DevTools from '../containers/DevTools'; 5 | 6 | const finalCreateStore = compose( 7 | DevTools.instrument(), 8 | persistState( 9 | window.location.href.match( 10 | /[?&]debug_session=([^&]+)\b/ 11 | ) 12 | ) 13 | )(createStore); 14 | 15 | export default function configureStore(initialState) { 16 | const store = finalCreateStore(rootReducer, initialState); 17 | 18 | if (module.hot) { 19 | module.hot.accept('../reducers', () => store.replaceReducer(rootReducer)); 20 | } 21 | 22 | return store; 23 | } 24 | -------------------------------------------------------------------------------- /examples/todomvc/components/Header.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import TodoTextInput from './TodoTextInput'; 4 | 5 | export default class Header extends Component { 6 | static propTypes = { 7 | addTodo: PropTypes.func.isRequired 8 | }; 9 | 10 | handleSave = (text) => { 11 | if (text.length !== 0) { 12 | this.props.addTodo(text); 13 | } 14 | } 15 | 16 | render() { 17 | return ( 18 |
19 |

todos

20 | 25 |
26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /examples/todomvc/actions/TodoActions.js: -------------------------------------------------------------------------------- 1 | import * as types from '../constants/ActionTypes'; 2 | 3 | export function addTodo(text) { 4 | return { 5 | type: types.ADD_TODO, 6 | text 7 | }; 8 | } 9 | 10 | export function deleteTodo(id) { 11 | return { 12 | type: types.DELETE_TODO, 13 | id 14 | }; 15 | } 16 | 17 | export function editTodo(id, text) { 18 | return { 19 | type: types.EDIT_TODO, 20 | id, 21 | text 22 | }; 23 | } 24 | 25 | export function markTodo(id) { 26 | return { 27 | type: types.MARK_TODO, 28 | id 29 | }; 30 | } 31 | 32 | export function markAll() { 33 | return { 34 | type: types.MARK_ALL 35 | }; 36 | } 37 | 38 | export function clearMarked() { 39 | return { 40 | type: types.CLEAR_MARKED 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /examples/todomvc/containers/TodoApp.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { connect } from 'react-redux'; 4 | import { bindActionCreators } from 'redux'; 5 | import Header from '../components/Header'; 6 | import MainSection from '../components/MainSection'; 7 | import * as TodoActions from '../actions/TodoActions'; 8 | 9 | const TodoApp = ({ todos, actions }) => ( 10 |
11 |
12 | 13 |
14 | ); 15 | 16 | TodoApp.propTypes = { 17 | todos: PropTypes.array.isRequired, 18 | actions: PropTypes.object.isRequired 19 | }; 20 | 21 | function mapState(state) { 22 | return { 23 | todos: state.todos 24 | }; 25 | } 26 | 27 | function mapDispatch(dispatch) { 28 | return { 29 | actions: bindActionCreators(TodoActions, dispatch) 30 | }; 31 | } 32 | 33 | export default connect(mapState, mapDispatch)(TodoApp); 34 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Cale Newman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/todomvc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todomvc", 3 | "version": "0.0.0", 4 | "description": "TodoMVC example for redux", 5 | "main": "server.js", 6 | "scripts": { 7 | "start": "webpack-dev-server", 8 | "build": "webpack --config webpack.config.prod.js", 9 | "deploy": "gh-pages -d dist" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/calesce/redux-slider-monitor.git" 14 | }, 15 | "license": "MIT", 16 | "dependencies": { 17 | "classnames": "^2.1.2" 18 | }, 19 | "devDependencies": { 20 | "babel-cli": "^6.24.1", 21 | "babel-core": "^6.24.1", 22 | "babel-loader": "^6.4.1", 23 | "babel-preset-es2015": "^6.24.1", 24 | "babel-preset-react": "^6.24.1", 25 | "babel-preset-stage-0": "^6.24.1", 26 | "gh-pages": "^0.12.0", 27 | "node-libs-browser": "^0.5.2", 28 | "raw-loader": "^0.5.1", 29 | "react-hot-loader": "^3.0.0-beta.6", 30 | "redux-devtools-dock-monitor": "^1.0.1", 31 | "redux-devtools-log-monitor": "^1.0.1", 32 | "style-loader": "^0.16.1", 33 | "todomvc-app-css": "^2.0.1", 34 | "webpack": "^2.2.1", 35 | "webpack-dev-server": "^2.4.1" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/todomvc/reducers/todos.js: -------------------------------------------------------------------------------- 1 | import { ADD_TODO, DELETE_TODO, EDIT_TODO, MARK_TODO, MARK_ALL, CLEAR_MARKED } from '../constants/ActionTypes'; 2 | 3 | const initialState = [{ 4 | text: 'Use Redux', 5 | marked: false, 6 | id: 0 7 | }]; 8 | 9 | export default function todos(state = initialState, action) { 10 | switch (action.type) { 11 | case ADD_TODO: 12 | return [{ 13 | id: (state.length === 0) ? 0 : state[0].id + 1, 14 | marked: false, 15 | text: action.text 16 | }, ...state]; 17 | 18 | case DELETE_TODO: 19 | return state.filter(todo => 20 | todo.id !== action.id 21 | ); 22 | 23 | case EDIT_TODO: 24 | return state.map(todo => ( 25 | todo.id === action.id ? 26 | { ...todo, text: action.text } : 27 | todo 28 | )); 29 | 30 | case MARK_TODO: 31 | return state.map(todo => ( 32 | todo.id === action.id ? 33 | { ...todo, marked: !todo.marked } : 34 | todo 35 | )); 36 | 37 | case MARK_ALL: { 38 | const areAllMarked = state.every(todo => todo.marked); 39 | return state.map(todo => ({ 40 | ...todo, 41 | marked: !areAllMarked 42 | })); 43 | } 44 | case CLEAR_MARKED: 45 | return state.filter(todo => todo.marked === false); 46 | 47 | default: 48 | return state; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 4 | 5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion. 6 | 7 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 8 | 9 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. 10 | 11 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. 12 | 13 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/) 14 | 15 | -------------------------------------------------------------------------------- /examples/todomvc/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const webpack = require('webpack'); 3 | 4 | module.exports = { 5 | devtool: 'eval-cheap-module-source-map', 6 | devServer: { 7 | contentBase: path.join(__dirname, 'dist'), 8 | host: 'localhost', 9 | port: process.env.PORT || 3000, 10 | historyApiFallback: true, 11 | hot: true 12 | }, 13 | entry: [ 14 | 'react-hot-loader/patch', 15 | 'webpack-dev-server/client?http://localhost:3000', 16 | 'webpack/hot/only-dev-server', 17 | './index' 18 | ], 19 | output: { 20 | path: path.join(__dirname, 'dist'), 21 | filename: 'bundle.js' 22 | }, 23 | plugins: [ 24 | new webpack.HotModuleReplacementPlugin(), 25 | new webpack.NoEmitOnErrorsPlugin() 26 | ], 27 | resolve: { 28 | alias: { 29 | 'redux-slider-monitor': path.join(__dirname, '..', '..', 'src/SliderMonitor'), 30 | react: path.join(__dirname, '../../node_modules', 'react'), 31 | 'react-dom': path.join(__dirname, '../../node_modules', 'react-dom'), 32 | 'redux-devtools': path.join(__dirname, '../../node_modules', 'redux-devtools') 33 | }, 34 | extensions: ['.js'] 35 | }, 36 | module: { 37 | rules: [{ 38 | test: /\.js$/, 39 | use: ['babel-loader'], 40 | exclude: /node_modules/, 41 | include: [ 42 | __dirname, 43 | path.join(__dirname, '..', '..', 'src') 44 | ] 45 | }, { 46 | test: /\.css?$/, 47 | use: ['style-loader', 'raw-loader'], 48 | include: __dirname 49 | }] 50 | } 51 | }; 52 | -------------------------------------------------------------------------------- /examples/todomvc/components/TodoTextInput.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import classnames from 'classnames'; 4 | 5 | export default class TodoTextInput extends Component { 6 | static propTypes = { 7 | onSave: PropTypes.func.isRequired, 8 | text: PropTypes.string, 9 | placeholder: PropTypes.string, 10 | editing: PropTypes.bool, 11 | newTodo: PropTypes.bool 12 | }; 13 | 14 | static defaultProps = { 15 | text: '', 16 | placeholder: '', 17 | editing: false, 18 | newTodo: false 19 | }; 20 | 21 | constructor(props, context) { 22 | super(props, context); 23 | this.state = { 24 | text: this.props.text || '' 25 | }; 26 | } 27 | 28 | handleSubmit = (e) => { 29 | const text = e.target.value.trim(); 30 | if (e.which === 13) { 31 | this.props.onSave(text); 32 | if (this.props.newTodo) { 33 | this.setState({ text: '' }); 34 | } 35 | } 36 | } 37 | 38 | handleChange = (e) => { 39 | this.setState({ text: e.target.value }); 40 | } 41 | 42 | handleBlur = (e) => { 43 | if (!this.props.newTodo) { 44 | this.props.onSave(e.target.value); 45 | } 46 | } 47 | 48 | render() { 49 | return ( 50 | 60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "redux-slider-monitor", 3 | "version": "2.0.0-2", 4 | "description": "A custom monitor for replaying Redux actions that works similarly to a video player", 5 | "main": "lib/SliderMonitor.js", 6 | "scripts": { 7 | "clean": "rimraf lib", 8 | "build": "babel src --out-dir lib", 9 | "lint": "eslint src examples", 10 | "prepublish": "npm run lint && npm run clean && npm run build" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/calesce/redux-slider-monitor.git" 15 | }, 16 | "author": "Cale Newman (http://github.com/calesce)", 17 | "license": "MIT", 18 | "bugs": { 19 | "url": "https://github.com/calesce/redux-slider-monitor/issues" 20 | }, 21 | "homepage": "https://github.com/calesce/redux-slider-monitor", 22 | "devDependencies": { 23 | "babel-cli": "^6.24.1", 24 | "babel-core": "^6.24.1", 25 | "babel-eslint": "^7.2.2", 26 | "babel-loader": "^6.4.1", 27 | "babel-preset-es2015": "^6.24.1", 28 | "babel-preset-react": "^6.24.1", 29 | "babel-preset-stage-0": "^6.24.1", 30 | "eslint": "^3.19.0", 31 | "eslint-config-airbnb": "^14.1.0", 32 | "eslint-plugin-import": "^2.2.0", 33 | "eslint-plugin-jsx-a11y": "^4.0.0", 34 | "eslint-plugin-react": "^6.10.3", 35 | "react": "^16.7.0", 36 | "react-dom": "^16.7.0", 37 | "react-redux": "^5.0.4", 38 | "redux": "^3.0.0", 39 | "redux-devtools": "^3.0.0", 40 | "rimraf": "^2.3.4" 41 | }, 42 | "peerDependencies": { 43 | "react": "^0.14.0 || ^15.0.0 || ^16.0.0-0", 44 | "react-dom": "^0.14.0 || ^15.0.0 || ^16.0.0-0", 45 | "redux-devtools": "^3.0.0" 46 | }, 47 | "dependencies": { 48 | "devui": "^1.0.0-3", 49 | "prop-types": "^15.5.8", 50 | "redux-devtools-themes": "^1.0.0" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /examples/todomvc/components/TodoItem.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import classnames from 'classnames'; 4 | import TodoTextInput from './TodoTextInput'; 5 | 6 | export default class TodoItem extends Component { 7 | static propTypes = { 8 | todo: PropTypes.object.isRequired, 9 | editTodo: PropTypes.func.isRequired, 10 | deleteTodo: PropTypes.func.isRequired, 11 | markTodo: PropTypes.func.isRequired 12 | }; 13 | 14 | constructor(props, context) { 15 | super(props, context); 16 | this.state = { 17 | editing: false 18 | }; 19 | } 20 | 21 | handleDoubleClick = () => { 22 | this.setState({ editing: true }); 23 | } 24 | 25 | handleSave = (id, text) => { 26 | if (text.length === 0) { 27 | this.props.deleteTodo(id); 28 | } else { 29 | this.props.editTodo(id, text); 30 | } 31 | this.setState({ editing: false }); 32 | } 33 | 34 | render() { 35 | const { todo, markTodo, deleteTodo } = this.props; 36 | 37 | let element; 38 | if (this.state.editing) { 39 | element = ( 40 | this.handleSave(todo.id, text)} 44 | /> 45 | ); 46 | } else { 47 | element = ( 48 |
49 | markTodo(todo.id)} 54 | /> 55 | 58 |
63 | ); 64 | } 65 | 66 | return ( 67 |
  • 73 | {element} 74 |
  • 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /examples/todomvc/components/Footer.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import classnames from 'classnames'; 4 | import { SHOW_ALL, SHOW_MARKED, SHOW_UNMARKED } from '../constants/TodoFilters'; 5 | 6 | const FILTER_TITLES = { 7 | [SHOW_ALL]: 'All', 8 | [SHOW_UNMARKED]: 'Active', 9 | [SHOW_MARKED]: 'Completed' 10 | }; 11 | 12 | export default class Footer extends Component { 13 | static propTypes = { 14 | markedCount: PropTypes.number.isRequired, 15 | unmarkedCount: PropTypes.number.isRequired, 16 | filter: PropTypes.string.isRequired, 17 | onClearMarked: PropTypes.func.isRequired, 18 | onShow: PropTypes.func.isRequired 19 | } 20 | 21 | render() { 22 | return ( 23 |
    24 | {this.renderTodoCount()} 25 |
      26 | {[SHOW_ALL, SHOW_UNMARKED, SHOW_MARKED].map(filter => 27 |
    • 28 | {this.renderFilterLink(filter)} 29 |
    • 30 | )} 31 |
    32 | {this.renderClearButton()} 33 |
    34 | ); 35 | } 36 | 37 | renderTodoCount() { 38 | const { unmarkedCount } = this.props; 39 | const itemWord = unmarkedCount === 1 ? 'item' : 'items'; 40 | 41 | return ( 42 | 43 | {unmarkedCount || 'No'} {itemWord} left 44 | 45 | ); 46 | } 47 | 48 | renderFilterLink(filter) { 49 | const title = FILTER_TITLES[filter]; 50 | const { filter: selectedFilter, onShow } = this.props; 51 | 52 | return ( 53 | onShow(filter)} 57 | > 58 | {title} 59 | 60 | ); 61 | } 62 | 63 | renderClearButton() { 64 | const { markedCount, onClearMarked } = this.props; 65 | if (markedCount > 0) { 66 | return ( 67 | 73 | ); 74 | } 75 | return null; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Redux Slider Monitor 2 | 3 | [![npm version](https://img.shields.io/npm/v/redux-slider-monitor.svg?style=flat-square)](https://www.npmjs.com/package/redux-slider-monitor) 4 | 5 | > This package was merged into [`redux-devtools` monorepo](https://github.com/reduxjs/redux-devtools). Please refer to that repository for the latest updates, issues and pull requests. 6 | 7 | A custom monitor for use with [Redux DevTools](https://github.com/gaearon/redux-devtools). 8 | 9 | It uses a slider based on [react-slider](https://github.com/mpowaga/react-slider) to slide between different recorded actions. It also features play/pause/step-through, which is inspired by some very cool [Elm](http://elm-lang.org/) [examples](http://elm-lang.org/blog/time-travel-made-easy). 10 | 11 | [Try out the demo!](https://calesce.github.io/redux-slider-monitor/?debug_session=123) 12 | 13 | 14 | 15 | ### Installation 16 | 17 | ```npm install redux-slider-monitor``` 18 | 19 | ### Recommended Usage 20 | 21 | Use with [`DockMonitor`](https://github.com/gaearon/redux-devtools-dock-monitor) 22 | ```javascript 23 | 27 | 28 | 29 | ``` 30 | 31 | Dispatch some Redux actions. Use the slider to navigate between the state changes. 32 | 33 | Click the play/pause buttons to watch the state changes over time, or step backward or forward in state time with the left/right arrow buttons. Change replay speeds with the ```1x``` button, and "Live" will replay actions with the same time intervals in which they originally were dispatched. 34 | 35 | ## Keyboard shortcuts 36 | 37 | Pass the ```keyboardEnabled``` prop to use these shortcuts 38 | 39 | ```ctrl+j```: play/pause 40 | 41 | ```ctrl+[```: step backward 42 | 43 | ```ctrl+]```: step forward 44 | 45 | 46 | ### Running Examples 47 | 48 | You can do this: 49 | 50 | ``` 51 | git clone https://github.com/calesce/redux-slider-monitor.git 52 | cd redux-slider-monitor 53 | npm install 54 | 55 | cd examples/todomvc 56 | npm install 57 | npm start 58 | open http://localhost:3000 59 | ``` 60 | 61 | ### License 62 | 63 | MIT 64 | -------------------------------------------------------------------------------- /src/SliderButton.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PureComponent } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import Button from 'devui/lib/Button'; 4 | 5 | export default class SliderButton extends (PureComponent || Component) { 6 | static propTypes = { 7 | theme: PropTypes.object, 8 | type: PropTypes.string, 9 | disabled: PropTypes.bool, 10 | onClick: PropTypes.func 11 | } 12 | 13 | iconStyle() { 14 | return { 15 | cursor: 'hand', 16 | fill: this.props.theme.base06, 17 | width: '1.8rem', 18 | height: '1.8rem' 19 | }; 20 | } 21 | 22 | renderPlayButton() { 23 | return ( 24 | 38 | ); 39 | } 40 | 41 | renderPauseButton = () => ( 42 | 56 | ) 57 | 58 | renderStepButton = (direction) => { 59 | const isLeft = direction === 'left'; 60 | const d = isLeft ? 61 | 'M15.41 16.09l-4.58-4.59 4.58-4.59-1.41-1.41-6 6 6 6z' : 62 | 'M8.59 16.34l4.58-4.59-4.58-4.59 1.41-1.41 6 6-6 6z'; 63 | 64 | return ( 65 | 79 | ); 80 | } 81 | 82 | render() { 83 | switch (this.props.type) { 84 | case 'play': 85 | return this.renderPlayButton(); 86 | case 'pause': 87 | return this.renderPauseButton(); 88 | case 'stepLeft': 89 | return this.renderStepButton('left'); 90 | case 'stepRight': 91 | return this.renderStepButton('right'); 92 | default: 93 | return null; 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /examples/todomvc/components/MainSection.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import TodoItem from './TodoItem'; 4 | import Footer from './Footer'; 5 | import { SHOW_ALL, SHOW_MARKED, SHOW_UNMARKED } from '../constants/TodoFilters'; 6 | 7 | const TODO_FILTERS = { 8 | [SHOW_ALL]: () => true, 9 | [SHOW_UNMARKED]: todo => !todo.marked, 10 | [SHOW_MARKED]: todo => todo.marked 11 | }; 12 | 13 | export default class MainSection extends Component { 14 | static propTypes = { 15 | todos: PropTypes.array.isRequired, 16 | actions: PropTypes.object.isRequired 17 | }; 18 | 19 | constructor(props, context) { 20 | super(props, context); 21 | this.handleClearMarked = this.handleClearMarked.bind(this); 22 | this.handleShow = this.handleShow.bind(this); 23 | this.state = { filter: SHOW_ALL }; 24 | } 25 | 26 | handleClearMarked() { 27 | const atLeastOneMarked = this.props.todos.some(todo => todo.marked); 28 | if (atLeastOneMarked) { 29 | this.props.actions.clearMarked(); 30 | } 31 | } 32 | 33 | handleShow(filter) { 34 | this.setState({ filter }); 35 | } 36 | 37 | render() { 38 | const { todos, actions } = this.props; 39 | const { filter } = this.state; 40 | 41 | const filteredTodos = todos.filter(TODO_FILTERS[filter]); 42 | const markedCount = todos.reduce((count, todo) => 43 | (todo.marked ? count + 1 : count), 44 | 0 45 | ); 46 | 47 | return ( 48 |
    49 | {this.renderToggleAll(markedCount)} 50 |
      51 | {filteredTodos.map(todo => 52 | 53 | )} 54 |
    55 | {this.renderFooter(markedCount)} 56 |
    57 | ); 58 | } 59 | 60 | renderToggleAll(markedCount) { 61 | const { todos, actions } = this.props; 62 | if (todos.length > 0) { 63 | return ( 64 | 70 | ); 71 | } 72 | return null; 73 | } 74 | 75 | renderFooter(markedCount) { 76 | const { todos } = this.props; 77 | const { filter } = this.state; 78 | const unmarkedCount = todos.length - markedCount; 79 | 80 | if (todos.length) { 81 | return ( 82 |