Skip to content

Commit f8887d2

Browse files
committed
merged from master
2 parents 45783b1 + d3a80b7 commit f8887d2

22 files changed

+129
-145
lines changed

Diff for: README.md

+8-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/reactrewind/react-rewind/pulls) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
88
![Release Beta](https://img.shields.io/badge/release-beta-blue.svg)<br/><br/>
9-
Designed to help engineers fix bugs faster by recording and replaying through different states of their applications. Debug your app more easily by “rewinding” your session instead of having to reproduce the issue until you find the problem. <br/>
9+
Designed to help engineers fix bugs faster by recording and replaying through different states of their applications. Debug your app more easily by “rewinding” your session instead of having to wait to reproduce the issue once you find the problem. <br/>
1010

1111

1212

@@ -25,21 +25,18 @@
2525
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
2626

2727
### Prerequisites
28-
Your application must be using the hook `useReducer` for actions to be recorded.
28+
You must use an unminified version of React. Also, your application must be using the hook `useReducer` for actions to be recorded.
2929

3030
### Installing
3131
React Rewind will soon be available as a Chrome extension through the Google Chrome Web Store.
3232

3333
To install locally, setup instructions are as follows:
3434

35-
1. `git clone https://github.com/reactrewind/react-rewind.git`
36-
2. `cd react-rewind`
37-
3. `npm run install_dep`
38-
4. `npm run build`
39-
5. Visit the URL `chrome://extensions/`
40-
6. Click Load Unpacked button and select the folder `react-rewind/src/browser/chrome`
41-
7. On your application page, open the Chrome Developer tools and select `React Rewind` from the tool bar
42-
8. Click Record and begin interacting with your application
35+
1. `git clone --single-branch --branch beta-release https://github.com/reactrewind/react-rewind.git`
36+
2. Visit the URL `chrome://extensions/`
37+
3. Click Load Unpacked button and select the folder `react-rewind/chrome`
38+
4. On your application page, open the Chrome Developer (Ctrl + Shift + J / Mac: Cmd + Option + I) tools and select `React Rewind` from the tool bar
39+
5. Click Record and begin interacting with your application
4340

4441

4542
As you interact with your application, actions will populate the events panel. Click on these actions to view more details about them, such as the action object that was dispatched, the effects or state difference, and the whole state of the application after the dispatch. The time slider panel allows you to rewind, fast forward, and play through all recorded actions.
@@ -62,7 +59,7 @@ Please fork this repo. We welcome pull requests. For suggestions or to report b
6259

6360
## Versioning
6461

65-
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
62+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/reactrewind/react-rewind/tags).
6663

6764
## Authors
6865

Diff for: src/app/components/DetailCards/Actions/ActionsDisplay.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import ReactJson from 'react-json-view';
33

4-
//styled components
4+
// styled components
55
import { DetailsWrapper } from '../../../styles/Details.jsx';
66

77
export default function Actions({ action, setIsClicked }) {
@@ -10,7 +10,7 @@ export default function Actions({ action, setIsClicked }) {
1010
return (
1111
<DetailsWrapper>
1212
{<ReactJson
13-
theme={'threezerotwofour'}
13+
theme="threezerotwofour"
1414
style={{ backgroundColor: 'transparent' }}
1515
displayDataTypes={false}
1616
src={action}

Diff for: src/app/components/DetailCards/DetailsNav.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ export default function RightNav(props) {
99
<>
1010
<DetailsNavWrapper>
1111
<Buttons>
12-
<NavLink exact activeClassName='active' to='/'>
12+
<NavLink exact activeClassName="active" to="/">
1313
<Button>actions</Button>
1414
</NavLink>
15-
<NavLink activeClassName='active' to='/effects'>
15+
<NavLink activeClassName="active" to="/effects">
1616
<Button>effects</Button>
1717
</NavLink>
18-
<NavLink activeClassName='active' to='/state'>
18+
<NavLink activeClassName="active" to="/state">
1919
<Button>state</Button>
2020
</NavLink>
2121
</Buttons>

Diff for: src/app/components/DetailCards/Effects/EffectsDisplay.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import ReactJson from 'react-json-view';
33
import { DetailsWrapper } from '../../../styles/Details.jsx';
4-
// functionality
4+
55
// gets difference from previous state to new state
66
import stateDifference from '../../stateDifference.jsx';
77

Diff for: src/app/components/DetailCards/InitialDetailCard/InitialDisplay.jsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import React from 'react';
22
import ReactJson from 'react-json-view';
33

4-
//styled components
4+
// styled components
55
import { DetailsWrapper } from '../../../styles/Details.jsx';
66

77
export default function InitialDisplay({ action }) {
88
// renders action information
9-
109
return (
1110
<DetailsWrapper>
1211
{<ReactJson
13-
theme={'threezerotwofour'}
12+
theme="threezerotwofour"
1413
style={{ backgroundColor: 'transparent' }}
1514
displayDataTypes={false}
1615
src={action}

Diff for: src/app/components/DetailCards/State/StateCard.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function EffectCard(props) {
88
return (
99
<div>
1010
<ReactJson
11-
theme={'threezerotwofour'}
11+
theme="threezerotwofour"
1212
style={{ backgroundColor: 'transparent', height: '-webkit-fill-available' }}
1313
displayDataTypes={false}
1414
src={actionState}

Diff for: src/app/components/DetailCards/State/StateDisplay.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function State({ actionState, setIsClicked }) {
99
setIsClicked(true);
1010
return (
1111
<DetailsWrapper>
12-
{<StateCard actionState={actionState} />}
12+
{<StateCard actionState={actionState} />}
1313
</DetailsWrapper>
1414
);
1515
}

Diff for: src/app/components/EventCards/EventCreator.jsx

+9-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { EventCard, EventTimeDiv } from '../../styles/Events.jsx';
55
export default function EventCreator(props) {
66
// renders individual action
77
const {
8-
action, id, addAction, actionTime, selectedEvent, index, eventTimes,
8+
action, id, addAction, selectedEvent, eventTimes,
99
} = props;
1010

1111
let displayTime;
@@ -16,20 +16,23 @@ export default function EventCreator(props) {
1616
} else {
1717
timeDifference = eventTimes[id] - eventTimes[id - 1];
1818
timeDifference = new Date(timeDifference);
19-
19+
2020
let minute = timeDifference.getMinutes();
21-
minute < 10 ? minute = '0' + minute : minute;
21+
minute = minute < 10 ? '0'.concat(minute) : minute;
22+
2223
let second = timeDifference.getSeconds();
23-
second < 10 ? second = '0' + second : second;
24+
second = second < 10 ? '0'.concat(second) : second;
25+
2426
let millisecond = Math.floor(timeDifference.getMilliseconds() / 10);
25-
millisecond < 10 ? millisecond = '0' + millisecond : millisecond;
27+
millisecond = millisecond < 10 ? '0'.concat(millisecond) : millisecond;
2628

2729
displayTime = `${minute} : ${second} : ${millisecond}`;
2830
}
2931

3032
return (
3133
<EventCard id={id} onClick={addAction} selectedEvent={selectedEvent}>
32-
&#x2630;{action}
34+
&#x2630;
35+
{action}
3336
<EventTimeDiv id={id} selectedEvent={selectedEvent}>{displayTime}</EventTimeDiv>
3437
</EventCard>
3538

Diff for: src/app/components/EventCards/EventsDisplay.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import EventCreator from './EventCreator.jsx';
77
import { EventsWrapper } from '../../styles/Events.jsx';
88

99
export default function Events(props) {
10-
const {
11-
data,
10+
const {
1211
activeEventId,
1312
filteredData,
1413
eventTimes,
1514
} = props;
15+
1616
return (
1717
<EventsWrapper>
1818
{filteredData.map((e, i) => (

Diff for: src/app/components/EventCards/FilterBar.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { FilterWrapper } from '../../styles/FilterBar.jsx';
66

77
export default function FilterBar(props) {
88
const {
9-
searchChange
9+
searchChange,
10+
searchField,
1011
} = props;
1112

1213
return (
@@ -16,7 +17,7 @@ export default function FilterBar(props) {
1617
type="text"
1718
placeholder="filter actions by name..."
1819
onChange={searchChange}
19-
value={props.searchField}
20+
value={searchField}
2021
/>
2122
</FilterWrapper>
2223
</>

Diff for: src/app/components/stateDifference.jsx

+23-28
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,34 @@
1-
21
function stateDifference(old, curr) {
2+
if (typeof old !== typeof curr) return curr;
33

4-
if(typeof(old) === "string" && typeof(curr) === "string") {
5-
if(old === curr) return false;
4+
if (typeof old === typeof curr && !Array.isArray(old) && typeof old !== 'object') {
5+
if (old === curr) return undefined;
66
return curr;
77
}
8-
else if(typeof(old) === "number" && typeof(curr) === "number") {
9-
if( old === curr) return false;
10-
return curr;
11-
}
12-
else if(typeof(old) !== typeof(curr)) {
13-
return curr;
14-
}
15-
else if(Array.isArray(old) && Array.isArray(curr)) {
16-
let newArr = [];
17-
for ( let i = 0; i < curr.length; i++){
18-
if(!old.includes(curr[i])){
19-
let result = stateDifference(old[i], curr[i])
20-
if (result) {
21-
newArr.push(result)
8+
9+
if (Array.isArray(old) && Array.isArray(curr)) {
10+
const newArr = [];
11+
for (let i = 0; i < curr.length; i++) {
12+
if (!old.includes(curr[i])) {
13+
const result = stateDifference(old[i], curr[i]);
14+
if (result !== undefined) {
15+
newArr.push(result);
2216
}
2317
}
24-
}
25-
return newArr.length > 0 ? newArr : false;
18+
}
19+
20+
return newArr.length > 0 ? newArr : undefined;
2621
}
27-
else if(typeof(old) === "object" && typeof(curr) === "object") {
28-
let newObj = {}
29-
for ( let prop in curr) {
30-
let result = stateDifference(old[prop], curr[prop])
31-
if (result) {
32-
newObj[prop] = result
33-
}
22+
23+
const newObj = {};
24+
for (let prop in curr) {
25+
const result = stateDifference(old[prop], curr[prop])
26+
if (result !== undefined) {
27+
newObj[prop] = result;
3428
}
35-
return Object.keys(newObj).length === 0 ? false : newObj
3629
}
30+
31+
return Object.keys(newObj).length === 0 ? undefined : newObj;
3732
}
3833

39-
export default stateDifference;
34+
export default stateDifference;

Diff for: src/app/container/Details.jsx

+32-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import React, { Component, useState } from 'react';
2-
3-
const ReactRouter = require('react-router-dom');
4-
5-
const Router = ReactRouter.BrowserRouter;
6-
const { Route } = ReactRouter;
1+
import React, { useState } from 'react';
72

83
// details nav component import
94
import DetailsNav from '../components/DetailCards/DetailsNav.jsx';
105

116
// component imports for react router
12-
import ActionsDisplay from '../components/DetailCards/Actions/ActionsDisplay.jsx'
13-
import EffectsDisplay from '../components/DetailCards/Effects/EffectsDisplay.jsx'
14-
import StateDisplay from '../components/DetailCards/State/StateDisplay.jsx'
15-
import InitalDisplay from '../components/DetailCards/InitialDetailCard/InitialDisplay.jsx'
7+
import ActionsDisplay from '../components/DetailCards/Actions/ActionsDisplay.jsx';
8+
import EffectsDisplay from '../components/DetailCards/Effects/EffectsDisplay.jsx';
9+
import StateDisplay from '../components/DetailCards/State/StateDisplay.jsx';
10+
import InitalDisplay from '../components/DetailCards/InitialDetailCard/InitialDisplay.jsx';
11+
12+
const ReactRouter = require('react-router-dom');
13+
14+
const Router = ReactRouter.BrowserRouter;
15+
const { Route } = ReactRouter;
1616

1717
export default function Details(props) {
1818
// destructuring required info that's being passed down from App.jsx
@@ -22,7 +22,6 @@ export default function Details(props) {
2222
} = props;
2323

2424
const [isClicked, setIsClicked] = useState(false);
25-
console.log('isClicked', isClicked);
2625
return (
2726
<Router>
2827
<>
@@ -32,15 +31,34 @@ export default function Details(props) {
3231
<Route
3332
exact
3433
path='/'
35-
render={props => <ActionsDisplay {...props} action={action} setIsClicked={setIsClicked} />}
34+
render={props => (
35+
<ActionsDisplay
36+
{...props}
37+
action={action}
38+
setIsClicked={setIsClicked}
39+
/>
40+
)}
3641
/>
3742
<Route
3843
path='/effects'
39-
render={props => <EffectsDisplay {...props} prevState={prevState} setIsClicked={setIsClicked} actionState={actionState} />}
44+
render={props => (
45+
<EffectsDisplay
46+
{...props}
47+
prevState={prevState}
48+
setIsClicked={setIsClicked}
49+
actionState={actionState}
50+
/>
51+
)}
4052
/>
4153
<Route
4254
path='/state'
43-
render={props => <StateDisplay {...props} actionState={actionState} setIsClicked={setIsClicked} />}
55+
render={props => (
56+
<StateDisplay
57+
{...props}
58+
actionState={actionState}
59+
setIsClicked={setIsClicked}
60+
/>
61+
)}
4462
/>
4563
</>
4664
</Router>

Diff for: src/app/container/Events.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useContext, useState, Component} from 'react';
1+
import React, { Component } from 'react';
22

33
// components
44
import EventsNav from '../components/EventCards/EventsNav.jsx';

Diff for: src/app/container/TimeSlider.jsx

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import React from 'react';
22

33
// styled component
4-
5-
import { TimeTravelContainer, EventTimeDiv } from '../../app/styles/Events.jsx';
6-
import { SliderWrapper, Button } from '../styles/TimeSlider.jsx'
4+
import { SliderWrapper, Button } from '../styles/TimeSlider.jsx';
75

86
const TimeSlider = (props) => {
97
const {
@@ -19,14 +17,19 @@ const TimeSlider = (props) => {
1917
} = props;
2018

2119
return (
22-
<SliderWrapper>
23-
<Button onClick={setIsRecording}>{isRecording ? 'PAUSE' : 'RECORD'}</Button>
24-
<Button onClick={toTheFuture}></Button>
25-
<Button onClick={toThePast}></Button>
26-
<Button onClick={setIsPlaying}>{isPlaying ? '||' : '►'}</Button>
27-
<input type="range" min="0" max={data.length - 1} value={isPlayingIndex}
28-
onChange={handleBarChange} />
29-
</SliderWrapper>
20+
<SliderWrapper>
21+
<Button onClick={setIsRecording}>{isRecording ? 'PAUSE' : 'RECORD'}</Button>
22+
<Button onClick={toTheFuture}></Button>
23+
<Button onClick={toThePast}></Button>
24+
<Button onClick={setIsPlaying}>{isPlaying ? '||' : '►'}</Button>
25+
<input
26+
type="range"
27+
min="0"
28+
max={data.length - 1}
29+
value={isPlayingIndex}
30+
onChange={handleBarChange}
31+
/>
32+
</SliderWrapper>
3033
);
3134
};
3235

Diff for: src/app/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import ReactDOM from "react-dom";
33
import App from "./components/App.jsx";
44

55
ReactDOM.render(
6-
<App />, document.getElementById('root')
6+
<App />, document.getElementById('root'),
77
);

0 commit comments

Comments
 (0)