Skip to content

Commit bf5bb9d

Browse files
Fixed Component Map expanded functionality (#273)
* adding the ability to close a component * fixed component map expansion UI issue * updated data diagram
1 parent 6f312aa commit bf5bb9d

File tree

13 files changed

+261
-158
lines changed

13 files changed

+261
-158
lines changed

assets/DataFlowDiagram.PNG

177 KB
Loading
File renamed without changes.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"@types/chrome": "^0.0.119",
9090
"@types/d3-scale-chromatic": "^2.0.0",
9191
"@types/jest": "^26.0.4",
92+
"@types/lodash.isequal": "^4.5.5",
9293
"@types/node": "^12.19.6",
9394
"@typescript-eslint/eslint-plugin": "^3.6.1",
9495
"@typescript-eslint/parser": "^3.6.1",
@@ -162,6 +163,7 @@
162163
"jest-runner": "^26.1.0",
163164
"jscharting": "^3.0.2",
164165
"jsondiffpatch": "^0.3.11",
166+
"lodash": "^4.17.21",
165167
"prop-types": "^15.7.2",
166168
"rc-slider": "^8.7.1",
167169
"rc-tooltip": "^3.7.3",
@@ -176,6 +178,7 @@
176178
"react-spinners": "^0.11.0",
177179
"react-split": "^2.0.14",
178180
"recoil": "0.0.10",
181+
"util": "^0.12.4",
179182
"web-vitals": "^1.1.0"
180183
}
181184
}

src/README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Our mission at Reactime is to maintain and iterate constantly, but never at the
88

99
## File Structure
1010

11-
In the *src* folder, there are three directories we care about: *app*, *backend*, and *extension*.
11+
In the *src* folder, there are three directories we care about: *app*, *backend*, and *extension*.
1212
```
1313
src/
1414
├── app/ # Frontend code
@@ -19,18 +19,18 @@ src/
1919
│   ├── containers/ # More React components
2020
│   ├── reducers/ # Redux mechanism for updating state
2121
│   ├── styles/ #
22-
│   ├── index.tsx # Starting point for root App component
22+
│   ├── index.tsx # Starting point for root App component
2323
│   ├── module.d.ts #
2424
│   └── store.tsx #
2525
2626
├── backend/ # "Backend" code (injected into target app)
2727
│   │ # Focus especially on linkFiber, timeJump, tree, and helpers
2828
│   ├── __tests__/ #
2929
│   ├── types/ # Typescript interfaces
30-
│   ├── helpers.js #
31-
│   ├── index.ts # Starting point for backend functionality
32-
│   ├── index.d.ts #
33-
│   ├── linkFiber.ts #
30+
│   ├── helpers.js #
31+
│   ├── index.ts # Starting point for backend functionality
32+
│   ├── index.d.ts #
33+
│   ├── linkFiber.ts #
3434
│   ├── masterState.js # Component action record interface
3535
│   ├── module.d.ts #
3636
│   ├── package.json #
@@ -46,7 +46,7 @@ src/
4646
└──
4747
```
4848

49-
1. The *app* folder is responsible for the Single Page Application that you see when you open the chrome dev tools under the Reactime tab.
49+
1. The *app* folder is responsible for the Single Page Application that you see when you open the chrome dev tools under the Reactime tab.
5050

5151
![FRONTEND DATA FLOW](../assets/frontend.png)
5252

@@ -55,7 +55,7 @@ src/
5555

5656
![BACKEND DATA FLOW](../assets/backend.png)
5757

58-
3. The *extension* folder is where the `contentScript.js` and `background.js` are located.
58+
3. The *extension* folder is where the `contentScript.js` and `background.js` are located.
5959
- Like regular web apps, Chrome Extensions are event-based. The background script is where one typically monitors for browser triggers (e.g. events like closing a tab, for example). The content script is what allows us to read or write to our target web application, usually as a result of [messages passed](https://developer.chrome.com/extensions/messaging) from the background script.
6060
- These two files help us handle requests both from the web browser and from the Reactime extension itself
6161

@@ -66,7 +66,7 @@ All the diagrams of data flows are avaliable on [MIRO](https://miro.com/app/boar
6666

6767
The general flow of data is described in the following steps:
6868

69-
![GENERAL DATA FLOW](../assets/dataflow.jpg)
69+
![GENERAL DATA FLOW](../assets/DataFlowDiagram.PNG)
7070

7171
1. When the background bundle is loaded by the browser, it executes a script injection into the dom. (see section on *backend*). This script uses a technique called [throttle](https://medium.com/@bitupon.211/debounce-and-throttle-160affa5457b) to send state data from the app to the content script every specified milliseconds (in our case, this interval is 70ms).
7272
<!-- CHECK LINE 496 IN LINKFIBER.TS -->
@@ -82,21 +82,21 @@ The general flow of data is described in the following steps:
8282
Navigation between different console.log panels can be confusing when running Reactime. We created a short instruction where you can find the results for your console.log
8383

8484
### <b> /src/extension </b>
85-
Console.logs from the Extension folder you can find here:
85+
Console.logs from the Extension folder you can find here:
8686
- Chrome Extension (Developer mode)
87-
- Background page
87+
- Background page
8888

89-
![extension](../assets/extension-console.gif)
89+
![extension](../assets/extension-console.gif)
9090

9191
### <b> /src/app </b>
92-
Console.logs from the App folder you can find here:
92+
Console.logs from the App folder you can find here:
9393
- Chrome Browser
9494
- Inspect
9595

9696
![frontend](../assets/console.gif)
9797

9898
### <b> /src/backend </b>
99-
Console.logs from the App folder you can find here:
99+
Console.logs from the App folder you can find here:
100100
- Open the Reactime extension in Chrome
101101
- Click "Inspect" on Reactime
102102

@@ -105,15 +105,15 @@ Console.logs from the App folder you can find here:
105105
## Chrome Developer Resources
106106
Still unsure about what content scripts and background scripts do for Reactime, or for a chrome extensions in general?
107107
- The implementation details [can be found](./extension/background.js) [in the source files](./extension/contentScript.ts) themselves.
108-
- We also encourage you to dive into [the official Chrome Developer Docs](https://developer.chrome.com/home).
109-
108+
- We also encourage you to dive into [the official Chrome Developer Docs](https://developer.chrome.com/home).
109+
110110
Some relevant sections are reproduced below:
111111

112-
> Content scripts are files that run in the context of web pages.
112+
> Content scripts are files that run in the context of web pages.
113113
>
114114
> By using the standard Document Object Model (DOM), they are able to **read** details of the web pages the browser visits, **make changes** to them and **pass information back** to their parent extension. ([Source](https://developer.chrome.com/extensions/content_scripts))
115115
116-
- One helpful way to remember a content script's role in the Chrome ecosystem is to think: a *content* script is used to read and modify a target web page's rendered *content*.
116+
- One helpful way to remember a content script's role in the Chrome ecosystem is to think: a *content* script is used to read and modify a target web page's rendered *content*.
117117

118118
>A background page is loaded when it is needed, and unloaded when it goes idle.
119119
>
@@ -122,12 +122,12 @@ Still unsure about what content scripts and background scripts do for Reactime,
122122
>The background page was listening for an event, and the event is dispatched.
123123
>A content script or other extension sends a message.
124124
>Another view in the extension, such as a popup, calls `runtime.getBackgroundPage`.
125-
>
125+
>
126126
>Once it has been loaded, a background page will stay running as long as it is performing an action, such as calling a Chrome API or issuing a network request.
127127
>
128128
> Additionally, the background page will not unload until all visible views and all message ports are closed. Note that opening a view does not cause the event page to load, but only prevents it from closing once loaded. ([Source](https://developer.chrome.com/extensions/background_pages))
129129
130130
- You can think of background scripts serving a purpose analogous to that of a **server** in the client/server paradigm. Much like a server, our `background.js` listens constantly for messages (i.e. requests) from two main places:
131131
1. The content script
132-
2. The chrome extension "front-end" **(*NOT* the interface of the browser, this is an important distinction.)**
133-
- In other words, a background script works as a sort of middleman, directly maintaining connection with its parent extension, and acting as a proxy enabling communication between it and the content script.
132+
2. The chrome extension "front-end" **(*NOT* the interface of the browser, this is an important distinction.)**
133+
- In other words, a background script works as a sort of middleman, directly maintaining connection with its parent extension, and acting as a proxy enabling communication between it and the content script.

src/app/actions/actions.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const save = (tabsObj) => ({
77
});
88
export const deleteSeries = () => ({
99
type: types.DELETE_SERIES,
10-
})
10+
});
1111
export const toggleMode = (mode) => ({
1212
type: types.TOGGLE_MODE,
1313
payload: mode,
@@ -90,6 +90,11 @@ export const toggleSplit = () => ({
9090
type: types.TOGGLE_SPLIT,
9191
});
9292

93+
export const toggleExpanded = (node) => ({
94+
type: types.TOGGLE_EXPANDED,
95+
payload: node,
96+
});
97+
9398
export const launchContentScript = (tab) => ({
9499
type: types.LAUNCH_CONTENT,
95100
payload: tab,

0 commit comments

Comments
 (0)