@@ -12,6 +12,7 @@ interface BuildPageProps {
12
12
path : string ;
13
13
siteId ?: string ;
14
14
ref ?: string ;
15
+ tab ?: string ;
15
16
}
16
17
17
18
interface BuildPageState {
@@ -20,6 +21,7 @@ interface BuildPageState {
20
21
loading : boolean ;
21
22
ref : string ;
22
23
manifest : any ;
24
+ tab ?: string ;
23
25
}
24
26
25
27
export class BuildPage extends Page < BuildPageProps , BuildPageState > {
@@ -31,7 +33,9 @@ export class BuildPage extends Page<BuildPageProps, BuildPageState> {
31
33
loading : false ,
32
34
ref : props . matches . ref ,
33
35
manifest : null ,
36
+ tab : props . matches . tab ,
34
37
} ;
38
+ console . log ( this ) ;
35
39
}
36
40
37
41
async componentDidMount ( ) {
@@ -51,6 +55,10 @@ export class BuildPage extends Page<BuildPageProps, BuildPageState> {
51
55
}
52
56
}
53
57
58
+ async componentWillReceiveProps ( props : BuildPageProps ) {
59
+ this . setState ( { tab : props . tab } ) ;
60
+ }
61
+
54
62
filterPaths ( paths : Record < string , string > ) {
55
63
return Object . keys ( paths )
56
64
. sort ( )
@@ -80,7 +88,6 @@ export class BuildPage extends Page<BuildPageProps, BuildPageState> {
80
88
renderPathsTable ( ) {
81
89
return (
82
90
< div class = "BuildPage__content__table" >
83
- < div class = "BuildPage__content__table__title" > Files</ div >
84
91
< table >
85
92
< thead >
86
93
< tr >
@@ -112,7 +119,6 @@ export class BuildPage extends Page<BuildPageProps, BuildPageState> {
112
119
renderRedirectsTable ( ) {
113
120
return (
114
121
< div class = "BuildPage__content__table" >
115
- < div class = "BuildPage__content__table__title" > Redirects</ div >
116
122
{ this . state . manifest &&
117
123
this . state . manifest . redirects &&
118
124
this . state . manifest . redirects . length ? (
@@ -165,7 +171,7 @@ export class BuildPage extends Page<BuildPageProps, BuildPageState> {
165
171
</ div >
166
172
< div class = "BuildPage__content__gitData__secondary" >
167
173
< span class = "BuildPage__content__gitData__secondary__shortSha" >
168
- { this . state . manifest . ref . slice ( 0 , 7 ) }
174
+ < code > { this . state . manifest . ref . slice ( 0 , 7 ) } </ code >
169
175
</ span >
170
176
on
171
177
< span class = "BuildPage__content__gitData__secondary__modified" >
@@ -180,6 +186,46 @@ export class BuildPage extends Page<BuildPageProps, BuildPageState> {
180
186
) ;
181
187
}
182
188
189
+ renderTabSet ( ) {
190
+ return (
191
+ < div class = "BuildPage__tabset" >
192
+ < div class = "BuildPage__tabset__bar" >
193
+ < Link
194
+ className = { `BuildPage__tabset__bar__tab ${
195
+ this . state . tab === undefined
196
+ ? 'BuildPage__tabset__bar__tab--active'
197
+ : ''
198
+ } `}
199
+ href = { this . state . currentPath }
200
+ >
201
+ < span class = "material-icons-outlined" > insert_drive_file</ span >
202
+ Files (
203
+ { this . state . manifest
204
+ ? Object . keys ( this . state . manifest . paths ) . length
205
+ : '0' }
206
+ )
207
+ </ Link >
208
+ < Link
209
+ className = { `BuildPage__tabset__bar__tab ${
210
+ this . state . tab === 'redirects'
211
+ ? 'BuildPage__tabset__bar__tab--active'
212
+ : ''
213
+ } `}
214
+ href = { `${ this . state . currentPath } ?tab=redirects` }
215
+ >
216
+ < span class = "material-icons-outlined" > double_arrow</ span >
217
+ Redirects (
218
+ { this . state . manifest ? this . state . manifest . redirects . length : '0' } )
219
+ </ Link >
220
+ </ div >
221
+ < div >
222
+ { this . state . tab === undefined ? this . renderPathsTable ( ) : '' }
223
+ { this . state . tab === 'redirects' ? this . renderRedirectsTable ( ) : '' }
224
+ </ div >
225
+ </ div >
226
+ ) ;
227
+ }
228
+
183
229
render ( ) {
184
230
return (
185
231
< div class = "BuildPage" >
@@ -199,8 +245,7 @@ export class BuildPage extends Page<BuildPageProps, BuildPageState> {
199
245
</ div >
200
246
< div class = "BuildPage__content" >
201
247
{ this . state . loading ? '' : this . renderGitData ( ) }
202
- { this . state . loading ? this . renderLoading ( ) : this . renderPathsTable ( ) }
203
- { this . state . loading ? '' : this . renderRedirectsTable ( ) }
248
+ { this . state . loading ? this . renderLoading ( ) : this . renderTabSet ( ) }
204
249
</ div >
205
250
</ div >
206
251
) ;
0 commit comments