Skip to content

Commit 8c08d60

Browse files
Changed some words to improve clarity. Finished ErrorMsg.tsx
1 parent 6d55367 commit 8c08d60

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/app/components/ErrorMsg.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
/* eslint-disable react/prop-types */
22
import React from 'react';
33

4+
/*
5+
This file determines what text will be displayed to the user if any one of the following fail to load:
6+
7+
1. if the content script has been launched on the current tab
8+
2. if React Dev Tools has been installed
9+
3. if target tab contains a compatible React app
10+
11+
*/
12+
413
// parses loadingArray and status and returns the correct message
514
function parseError(loadingArray: [], status: Record<string, unknown>): string {
615
let stillLoading = true;
@@ -9,14 +18,16 @@ function parseError(loadingArray: [], status: Record<string, unknown>): string {
918
});
1019
// As long as everything is still loading dont diplay an error message
1120
if (stillLoading) return 'default';
12-
// Return first status that fails
21+
22+
// If we're done loading everything, return the first status that fails
1323
if (!status.contentScriptLaunched) return 'Content Script Error';
1424
if (!status.reactDevToolsInstalled) return 'RDT Error';
1525
if (!status.targetPageisaReactApp) return 'Not React App';
1626
return 'default';
1727
}
1828

1929
function ErrorMsg({ loadingArray, status, launchContent }): JSX.Element {
30+
// we use the evaluated result (string) of parseError and match it to the case so that an appropriate error message will be displayed to the user
2031
switch (parseError(loadingArray, status)) {
2132
case 'Content Script Error':
2233
return (

src/app/components/Loader.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ import { ClipLoader } from 'react-spinners';
55
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
66
import { faCheck, faExclamationCircle } from '@fortawesome/free-solid-svg-icons';
77

8-
// Displays the result of the check when loading is done
8+
/*
9+
This file is what decides what icon (loading, checkmark, exclamation point) is displayed next to the checks in the ErrorContainer loading screen:
10+
11+
1. if the content script has been launched on the current tab
12+
2. if React Dev Tools has been installed
13+
3. if target tab contains a compatible React app
14+
*/
15+
916
const handleResult = (result: boolean): JSX.Element =>
1017
result ? (
1118
// if result boolean is true, we display a checkmark icon

src/app/containers/ErrorContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ErrorMsg from '../components/ErrorMsg';
66
import { useStoreContext } from '../store';
77

88
/*
9-
This is the loading popup that a user may get when first initalizing the application. This page checks:
9+
This is the loading screen that a user may get when first initalizing the application. This page checks:
1010
1111
1. if the content script has been launched on the current tab
1212
2. if React Dev Tools has been installed

0 commit comments

Comments
 (0)