File tree 1 file changed +10
-3
lines changed
src/components/molecules/ChartShare
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,8 @@ export default class ChartShare extends React.Component<Props, State> {
79
79
link : '' ,
80
80
value : 2 // TODO: why not a boolean
81
81
} ;
82
+ private noDownloadSupport = [ 'survey_p20' , 'subnational_p20' ] ;
83
+
82
84
constructor ( props : Props ) {
83
85
super ( props ) ;
84
86
@@ -174,11 +176,16 @@ export default class ChartShare extends React.Component<Props, State> {
174
176
}
175
177
176
178
private renderDownloadButton ( ) {
177
- if ( this . props . download ) {
179
+ const { download, stateToShare } = this . props ;
180
+ if ( download ) {
178
181
let url = '' ;
179
- if ( this . props . stateToShare && this . props . stateToShare . indicator ) {
180
- const indicator = this . props . stateToShare . indicator . split ( '.' ) [ 1 ] . replace ( / - / g, '_' ) ;
182
+ if ( stateToShare && stateToShare . indicator && this . noDownloadSupport . indexOf ( stateToShare . indicator ) === - 1 ) {
183
+ const indicator = stateToShare . indicator . indexOf ( '.' ) > - 1
184
+ ? stateToShare . indicator . split ( '.' ) [ 1 ] . replace ( / - / g, '_' )
185
+ : stateToShare . indicator ;
181
186
url = `${ getWarehouseAPILink } /single_table?indicator=${ indicator } &format=csv` ;
187
+ } else {
188
+ return null ;
182
189
}
183
190
184
191
return (
You can’t perform that action at this time.
0 commit comments