1
1
<!DOCTYPE html>
2
2
<html lang="en">
3
-
4
- <head>
5
- <meta charset="utf-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
7
- <meta name="theme-color" content="#000000" />
8
- <!--
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
6
+ <meta name="theme-color" content="#000000" />
7
+ <!--
9
8
manifest.json provides metadata used when your web app is added to the
10
9
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
11
10
-->
12
- <link rel="manifest" href="manifest.json" />
13
- <link rel="shortcut icon" href="favicon.ico" />
14
- <!--
11
+ <link rel="manifest" href="manifest.json" />
12
+ <link rel="shortcut icon" href="favicon.ico" />
13
+ <!--
15
14
Notice the use of %PUBLIC_URL% in the tags above.
16
15
It will be replaced with the URL of the `public` folder during the build.
17
16
Only files inside the `public` folder can be referenced from the HTML.
20
19
work correctly both with client-side routing and a non-root public URL.
21
20
Learn how to configure a non-root public URL by running `npm run build`.
22
21
-->
23
- <title>CodeRoad</title>
24
- </head>
22
+ <title>CodeRoad</title>
23
+ <script>
24
+ // script must load in the header to work
25
+ window.onerror = function () {
26
+ // an error bubbled up
27
+ // cannot detect error message as it runs in a different script
28
+ const targetElement = document.getElementById('coderoad-message')
29
+
30
+ if (targetElement) {
31
+ // setup failed, display an error message
32
+ document.body.style.padding = '1rem'
33
+ document.body.style.border = '0.5rem solid #FFBABA'
25
34
26
- <body>
27
- <noscript>
28
- You need to enable JavaScript to run this app.
29
- </noscript>
30
- <div id="root"></div>
31
- <!--
35
+ const description = document.createElement('p')
36
+ description.textContent =
37
+ 'Try reloading VSCode, if the problem persists please report the error so we can get it fixed at'
38
+ description.style.marginTop = '1rem'
39
+ description.style.padding = '1rem'
40
+ const link = document.createElement('a')
41
+ link.href = 'https://github.com/coderoad/coderoad-vscode/issues'
42
+ link.textContent = 'github.com/coderoad/coderoad-vscode'
43
+ // append description & link
44
+ targetElement.textContent = 'Failed to load.'
45
+ targetElement.append(description)
46
+ description.append(document.createElement('br'))
47
+ description.append(link)
48
+ }
49
+ }
50
+ </script>
51
+ </head>
52
+
53
+ <body>
54
+ <div id="root">
55
+ <div style="position: absolute; top: 33%; left: 0; right: 0; text-align: center;">
56
+ <h1>CodeRoad</h1>
57
+ <h3 id="coderoad-message">
58
+ Loading...
59
+ </h3>
60
+ </div>
61
+ </div>
62
+ <!--
32
63
This HTML file is a template.
33
64
If you open it directly in the browser, you will see an empty page.
34
65
38
69
To begin the development, run `npm start` or `yarn start`.
39
70
To create a production bundle, use `npm run build` or `yarn build`.
40
71
-->
41
- </body>
42
-
43
- </html>
72
+ </body>
73
+ </html>
0 commit comments