Skip to content

Commit c098c1b

Browse files
committed
commit to update the image on error container
1 parent c7e4ecd commit c098c1b

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

src/app/containers/ErrorContainer.tsx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,49 +25,56 @@ function ErrorContainer(): JSX.Element {
2525
dispatch(launchContentScript(tabs[currentTab]));
2626
}
2727

28-
const status = { // We create a status object that we may use later if tabs[currentTab] exists
28+
const status = {
29+
// We create a status object that we may use later if tabs[currentTab] exists
2930
contentScriptLaunched: false,
3031
reactDevToolsInstalled: false,
3132
targetPageisaReactApp: false,
3233
};
3334

34-
35-
if (tabs[currentTab]) { // If we do have a tabs[currentTab] object, we replace the status obj we declared above with the properties of the tabs[currentTab].status
35+
if (tabs[currentTab]) {
36+
// If we do have a tabs[currentTab] object, we replace the status obj we declared above with the properties of the tabs[currentTab].status
3637
Object.assign(status, tabs[currentTab].status);
3738
}
3839

3940
// hook that sets timer while waiting for a snapshot from the background script, resets if the tab changes/reloads
4041
useEffect(() => {
41-
// We declare a function
42-
function setLoadingArray(i: number, value: boolean) { // 'setLoadingArray' checks an element in our 'loadingArray' local state and compares it with passed in boolean argument. If they don't match, we update our local state replacing the selected element with the boolean argument
43-
if (loadingArray[i] !== value) { // this conditional helps us avoid unecessary state changes if the element and the value are already the same
42+
// We declare a function
43+
function setLoadingArray(i: number, value: boolean) {
44+
// 'setLoadingArray' checks an element in our 'loadingArray' local state and compares it with passed in boolean argument. If they don't match, we update our local state replacing the selected element with the boolean argument
45+
if (loadingArray[i] !== value) {
46+
// this conditional helps us avoid unecessary state changes if the element and the value are already the same
4447
const loadingArrayClone = [...loadingArray];
4548
loadingArrayClone[i] = value;
4649
setLoading(loadingArrayClone);
4750
}
4851
}
4952

50-
if (titleTracker.current !== currentTitle) { // if the current tab changes/reloads, we reset loadingArray to it's default [true, true, true]
53+
if (titleTracker.current !== currentTitle) {
54+
// if the current tab changes/reloads, we reset loadingArray to it's default [true, true, true]
5155
titleTracker.current = currentTitle;
5256
setLoadingArray(0, true);
5357
setLoadingArray(1, true);
5458
setLoadingArray(2, true);
5559

56-
if (timeout.current) { // if there is a current timeout set, we clear it
60+
if (timeout.current) {
61+
// if there is a current timeout set, we clear it
5762
clearTimeout(timeout.current);
5863
timeout.current = null;
5964
}
6065
}
6166

62-
if (!status.contentScriptLaunched) { // if content script hasnt been launched/found, set a timer or immediately update 'loadingArray' state
67+
if (!status.contentScriptLaunched) {
68+
// if content script hasnt been launched/found, set a timer or immediately update 'loadingArray' state
6369

64-
if (loadingArray[0] === true) { // if loadingArray[0] is true, then that means our timeout.current is still null so we now set it to a setTimeout function that will flip loadingArray[0] to false after 3 seconds
70+
if (loadingArray[0] === true) {
71+
// if loadingArray[0] is true, then that means our timeout.current is still null so we now set it to a setTimeout function that will flip loadingArray[0] to false after 3 seconds
6572
timeout.current = setTimeout(() => {
6673
setLoadingArray(0, false);
6774
}, 3000); // increased from 1500
6875
}
6976
} else {
70-
setLoadingArray(0, false) // if status.contentScriptLaunched is true, that means timeout.current !== null. This means that useEffect was triggered previously.
77+
setLoadingArray(0, false); // if status.contentScriptLaunched is true, that means timeout.current !== null. This means that useEffect was triggered previously.
7178
}
7279

7380
// The next two if statements are written in a way to allow the checking of 'content script hook', 'reactDevTools check', and 'target page is a react app' to be run in chronological order.
@@ -86,7 +93,7 @@ function ErrorContainer(): JSX.Element {
8693

8794
return (
8895
<div className='error-container'>
89-
<img src='../assets/logo-no-version.png' alt='Reactime Logo' height='50px' />
96+
<img src='../assets/logos/whiteBlackSquareLogo.png' alt='Reactime Logo' height='50px' />
9097

9198
<h2>Launching Reactime on tab: {currentTitle}</h2>
9299

0 commit comments

Comments
 (0)