@@ -3,18 +3,16 @@ const importJsx = require('import-jsx');
3
3
const PropTypes = require ( 'prop-types' ) ;
4
4
const { merge } = require ( 'lodash' ) ;
5
5
6
- const { Box, Color, Text } = require ( 'ink' ) ;
7
- const { default : Spinner } = require ( 'ink-spinner' ) ;
6
+ const { Box, Color } = require ( 'ink' ) ;
8
7
9
8
const { resolve } = require ( 'path' ) ;
10
9
11
-
12
10
const getSubDirectories = require ( './lib/dir' ) ;
13
11
const getUserLog = require ( './lib/git' ) ;
14
12
const normolize = require ( './lib/normalizer' ) ;
15
13
16
14
const Project = importJsx ( './components/project' ) ;
17
- const Errors = importJsx ( './components/errors ' ) ;
15
+ const Loading = importJsx ( './components/loading ' ) ;
18
16
19
17
class App extends React . Component {
20
18
@@ -23,7 +21,6 @@ class App extends React.Component {
23
21
24
22
this . state = {
25
23
out : { } ,
26
- errors : [ ] ,
27
24
loading : 'Searching' ,
28
25
isLading : true ,
29
26
author : null
@@ -33,9 +30,10 @@ class App extends React.Component {
33
30
handleError ( e ) {
34
31
this . setState ( {
35
32
...this . state ,
36
- isLading : false ,
37
- errors : [ e . toString ( ) ]
33
+ isLading : false
38
34
} ) ;
35
+
36
+ throw e ;
39
37
}
40
38
41
39
componentDidMount ( ) {
@@ -83,42 +81,33 @@ class App extends React.Component {
83
81
84
82
render ( ) {
85
83
86
- const { errors , isLading, out, loading } = this . state ;
84
+ const { isLading, out, loading } = this . state ;
87
85
88
- const isErrors = errors . length ;
89
86
const isContent = Object . keys ( out ) . length ;
90
87
88
+ if ( isLading ) {
89
+ return < Loading text = { loading } > </ Loading > ;
90
+ }
91
+
91
92
return (
92
93
< Box flexDirection = "column" >
93
- { isLading ? (
94
- < Box >
95
- < Color green >
96
- < Spinner type = "dots" />
97
- < Box marginLeft = { 2 } > < Text italic > { loading } </ Text > </ Box >
98
- </ Color >
99
- </ Box >
100
- ) : (
94
+
95
+ { isContent ? (
101
96
< >
102
- { isContent ? (
103
- < >
104
- { Object . keys ( out ) . map ( day => (
105
- < Box flexDirection = "column" key = { day } >
106
- { Object . keys ( out [ day ] ) . map ( project => (
107
- < Project key = { project } day = { day } name = { project } data = { out [ day ] [ project ] } > </ Project >
108
- ) ) }
109
- </ Box >
97
+ { Object . keys ( out ) . map ( day => (
98
+ < Box flexDirection = "column" key = { day } >
99
+ { Object . keys ( out [ day ] ) . map ( project => (
100
+ < Project key = { project } day = { day } name = { project } data = { out [ day ] [ project ] } > </ Project >
110
101
) ) }
111
- </ >
112
- ) : (
113
- < Box >
114
- { ! isErrors ? ( < Color blueBright > Not Found</ Color > ) : null }
115
102
</ Box >
116
- ) }
117
-
118
- { isErrors ? ( < Errors errors = { errors } > </ Errors > ) : null }
119
-
103
+ ) ) }
120
104
</ >
105
+ ) : (
106
+ < Box >
107
+ < Color blueBright > Not Found</ Color >
108
+ </ Box >
121
109
) }
110
+
122
111
</ Box >
123
112
) ;
124
113
}
0 commit comments