@@ -30,33 +30,43 @@ export default function SuccessOrErrorModal({
30
30
31
31
const mainText = isSuccess ? 'Success!' : 'Something went wrong!' ;
32
32
33
+ const revealInFinderButton = isSuccess && (
34
+ < Button
35
+ buttonType = "primary"
36
+ onClick = { ( ) => {
37
+ onRevealInFinder ( ) ;
38
+ } }
39
+ >
40
+ < span className = "openFinderText" > Reveal in file browser</ span >
41
+ </ Button >
42
+ ) ;
43
+ const goHomeWithOptionalCopyToClipboard = isSuccess ? (
44
+ < Button buttonType = "goHome" onClick = { onGoHome } >
45
+ < span className = "backToHomeText" >
46
+ Copy encrypted file path to clipboard and go home
47
+ </ span >
48
+ </ Button >
49
+ ) : (
50
+ < Button buttonType = "goHome" onClick = { onGoHome } >
51
+ < span className = "backToHomeText" > Return home</ span >
52
+ </ Button >
53
+ ) ;
54
+
33
55
return (
34
56
< div className = "successOrErrorBody" >
35
57
< Lottie options = { animationOptions } height = { 100 } width = { 200 } />
36
58
< span className = "successOrErrorHeaderText" > { mainText } </ span >
37
59
{ ! isSuccess && errorMessage && (
38
60
< p className = "errorText" >
39
- { errorMessage
40
- . split ( '`' )
41
- . map ( ( part , index ) =>
42
- index % 2 === 0 ? part : < code className = "filePath" > { part } </ code > ,
43
- ) }
61
+ { errorMessage . split ( '`' ) . map (
62
+ ( part , index ) =>
63
+ index % 2 === 0 ? part : < code className = "filePath" > { part } </ code > , // Split on backticks and render the text as code
64
+ ) }
44
65
</ p >
45
66
) }
46
67
< div className = "buttonsWrapper" >
47
- { isSuccess && (
48
- < Button
49
- buttonType = "primary"
50
- onClick = { ( ) => {
51
- onRevealInFinder ( ) ;
52
- } }
53
- >
54
- < span className = "openFinderText" > Reveal in file browser</ span >
55
- </ Button >
56
- ) }
57
- < Button buttonType = "goHome" onClick = { onGoHome } >
58
- < span className = "backToHomeText" > Return home</ span >
59
- </ Button >
68
+ { revealInFinderButton }
69
+ { goHomeWithOptionalCopyToClipboard }
60
70
</ div >
61
71
</ div >
62
72
) ;
0 commit comments