@@ -18,11 +18,14 @@ import getSortedSketches from '../selectors/projects';
1818import Loader from '../../App/components/loader' ;
1919import Overlay from '../../App/components/Overlay' ;
2020import AddToCollectionList from './AddToCollectionList' ;
21+ import getConfig from '../../../utils/getConfig' ;
2122
2223import ArrowUpIcon from '../../../images/sort-arrow-up.svg' ;
2324import ArrowDownIcon from '../../../images/sort-arrow-down.svg' ;
2425import DownFilledTriangleIcon from '../../../images/down-filled-triangle.svg' ;
2526
27+ const ROOT_URL = getConfig ( 'API_URL' ) ;
28+
2629const formatDateCell = ( date , mobile = false ) =>
2730 dates . format ( date , { showTime : ! mobile } ) ;
2831
@@ -140,7 +143,13 @@ class SketchListRowBase extends React.Component {
140143 } ;
141144
142145 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 ) ;
144153 } ;
145154
146155 handleSketchDuplicate = ( ) => {
@@ -332,7 +341,6 @@ SketchListRowBase.propTypes = {
332341 deleteProject : PropTypes . func . isRequired ,
333342 showShareModal : PropTypes . func . isRequired ,
334343 cloneProject : PropTypes . func . isRequired ,
335- exportProjectAsZip : PropTypes . func . isRequired ,
336344 changeProjectName : PropTypes . func . isRequired ,
337345 onAddToCollection : PropTypes . func . isRequired ,
338346 mobile : PropTypes . bool ,
0 commit comments