Skip to content

Commit 082a843

Browse files
committed
changed error message and styling
1 parent 0c6b69d commit 082a843

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

src/app/containers/MainContainer.jsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
import { useStoreContext } from '../store';
1212

1313
function MainContainer() {
14-
const [npmExists, setnpm] = useState(false);
1514
const [store, dispatch] = useStoreContext();
1615
const { tabs, currentTab, port: currentPort } = store;
1716

@@ -39,7 +38,6 @@ function MainContainer() {
3938
}
4039
case 'initialConnectSnapshots': {
4140
dispatch(initialConnect(payload));
42-
setnpm(true);
4341
break;
4442
}
4543
default:
@@ -54,7 +52,19 @@ function MainContainer() {
5452
dispatch(setPort(port));
5553
});
5654

57-
if (!npmExists) return <div style={{ color: 'black' }}>Please install our npm package in your app</div>;
55+
if (!tabs[currentTab]) {
56+
return (
57+
<div className="error-container">
58+
<a
59+
href="https://www.npmjs.com/package/react-time-travel"
60+
target="_blank"
61+
rel="noopener noreferrer"
62+
>
63+
No React application found. Please install our npm package in your app.
64+
</a>
65+
</div>
66+
);
67+
}
5868
const { viewIndex, sliderIndex, snapshots } = tabs[currentTab];
5969

6070
// if viewIndex is -1, then use the sliderIndex instead

src/app/styles/styles.scss

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,30 @@ body {
1818
overflow: hidden;
1919
}
2020

21+
.error-container {
22+
height: 100%;
23+
margin: 0 auto;
24+
background-color: $brand-color;
25+
overflow: hidden;
26+
27+
display: grid;
28+
justify-content: center;
29+
a {
30+
color: white;
31+
margin-top: 5%;
32+
height: 3%;
33+
}
34+
}
35+
2136
.body-container {
2237
height: 94%;
2338
display: grid;
2439
grid-template-columns: 1fr 2fr;
2540
grid-template-rows: 8fr 1fr;
2641
grid-template-areas:
27-
"actions states"
28-
"travel travel"
29-
"buttons buttons";
42+
'actions states'
43+
'travel travel'
44+
'buttons buttons';
3045
}
3146

3247
/* if extension width is less than 500px, stack the body containers */
@@ -35,10 +50,10 @@ body {
3550
grid-template-rows: 3fr 5fr 1fr;
3651
grid-template-columns: auto;
3752
grid-template-areas:
38-
"actions"
39-
"states"
40-
"travel"
41-
"buttons";
53+
'actions'
54+
'states'
55+
'travel'
56+
'buttons';
4257
}
4358
}
4459
.travel-container {

0 commit comments

Comments
 (0)