@@ -18,11 +18,14 @@ import getSortedSketches from '../selectors/projects';
18
18
import Loader from '../../App/components/loader' ;
19
19
import Overlay from '../../App/components/Overlay' ;
20
20
import AddToCollectionList from './AddToCollectionList' ;
21
+ import getConfig from '../../../utils/getConfig' ;
21
22
22
23
import ArrowUpIcon from '../../../images/sort-arrow-up.svg' ;
23
24
import ArrowDownIcon from '../../../images/sort-arrow-down.svg' ;
24
25
import DownFilledTriangleIcon from '../../../images/down-filled-triangle.svg' ;
25
26
27
+ const ROOT_URL = getConfig ( 'API_URL' ) ;
28
+
26
29
const formatDateCell = ( date , mobile = false ) =>
27
30
dates . format ( date , { showTime : ! mobile } ) ;
28
31
@@ -140,7 +143,13 @@ class SketchListRowBase extends React.Component {
140
143
} ;
141
144
142
145
handleSketchDownload = ( ) => {
143
- this . props . exportProjectAsZip ( this . props . sketch . id ) ;
146
+ const { sketch } = this . props ;
147
+ const downloadLink = document . createElement ( 'a' ) ;
148
+ downloadLink . href = `${ ROOT_URL } /projects/${ sketch . id } /zip` ;
149
+ downloadLink . download = `${ sketch . name } .zip` ;
150
+ document . body . appendChild ( downloadLink ) ;
151
+ downloadLink . click ( ) ;
152
+ document . body . removeChild ( downloadLink ) ;
144
153
} ;
145
154
146
155
handleSketchDuplicate = ( ) => {
@@ -332,7 +341,6 @@ SketchListRowBase.propTypes = {
332
341
deleteProject : PropTypes . func . isRequired ,
333
342
showShareModal : PropTypes . func . isRequired ,
334
343
cloneProject : PropTypes . func . isRequired ,
335
- exportProjectAsZip : PropTypes . func . isRequired ,
336
344
changeProjectName : PropTypes . func . isRequired ,
337
345
onAddToCollection : PropTypes . func . isRequired ,
338
346
mobile : PropTypes . bool ,
0 commit comments