@@ -2,13 +2,17 @@ import Box from "@material-ui/core/Box"
2
2
import { makeStyles } from "@material-ui/core/styles"
3
3
import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline"
4
4
import React , { useEffect , useReducer } from "react"
5
+ import { Link } from "react-router-dom"
5
6
import { mapStackTrace } from "sourcemapped-stacktrace"
6
7
import { Margins } from "../Margins/Margins"
7
8
import { Section } from "../Section/Section"
9
+ import { Typography } from "../Typography/Typography"
8
10
import { reducer , RuntimeErrorReport , stackTraceAvailable , stackTraceUnavailable } from "./RuntimeErrorReport"
9
11
10
12
const Language = {
11
13
title : "Coder encountered an error" ,
14
+ body : "Please copy the crash log using the button below and" ,
15
+ link : "send it to us." ,
12
16
}
13
17
14
18
interface RuntimeErrorStateProps {
@@ -20,7 +24,6 @@ interface RuntimeErrorStateProps {
20
24
*/
21
25
const ErrorStateTitle = ( ) => {
22
26
const styles = useStyles ( )
23
-
24
27
return (
25
28
< Box className = { styles . title } display = "flex" alignItems = "center" >
26
29
< ErrorOutlineIcon />
@@ -29,6 +32,28 @@ const ErrorStateTitle = () => {
29
32
)
30
33
}
31
34
35
+ /**
36
+ * A description for our error boundary UI
37
+ */
38
+ const ErrorStateDescription = ( ) => {
39
+ const styles = useStyles ( )
40
+ return (
41
+ < Typography variant = "body2" color = "textSecondary" >
42
+ { Language . body }
43
+ < Link
44
+ to = "#"
45
+ onClick = { ( e ) => {
46
+ window . location . href = "mailto:support@coder.com"
47
+ e . preventDefault ( )
48
+ } }
49
+ className = { styles . link }
50
+ >
51
+ { Language . link }
52
+ </ Link >
53
+ </ Typography >
54
+ )
55
+ }
56
+
32
57
/**
33
58
* An error UI that is displayed when our error boundary (ErrorBoundary.tsx) is triggered
34
59
*/
@@ -47,7 +72,7 @@ export const RuntimeErrorState: React.FC<RuntimeErrorStateProps> = ({ error }) =
47
72
return (
48
73
< Box display = "flex" flexDirection = "column" >
49
74
< Margins >
50
- < Section className = { styles . reportContainer } title = { < ErrorStateTitle /> } >
75
+ < Section className = { styles . reportContainer } title = { < ErrorStateTitle /> } description = { < ErrorStateDescription /> } >
51
76
< RuntimeErrorReport error = { reportState . error } mappedStack = { reportState . mappedStack } />
52
77
</ Section >
53
78
</ Margins >
@@ -65,7 +90,10 @@ const useStyles = makeStyles((theme) => ({
65
90
color : theme . palette . error . main ,
66
91
} ,
67
92
} ,
68
-
93
+ link : {
94
+ textDecoration : "none" ,
95
+ color : theme . palette . primary . main ,
96
+ } ,
69
97
reportContainer : {
70
98
display : "flex" ,
71
99
justifyContent : "center" ,
0 commit comments