Skip to content

Commit

Permalink
Merge pull request #2313 from adityagarg06/fix/export_Project_As_Zip
Browse files Browse the repository at this point in the history
fix/exportProjectAsZip
  • Loading branch information
lindapaiste authored Jul 30, 2023
2 parents 09bd960 + 2d4ba62 commit 4a4f4d2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions client/modules/IDE/components/SketchList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ import getSortedSketches from '../selectors/projects';
import Loader from '../../App/components/loader';
import Overlay from '../../App/components/Overlay';
import AddToCollectionList from './AddToCollectionList';
import getConfig from '../../../utils/getConfig';

import ArrowUpIcon from '../../../images/sort-arrow-up.svg';
import ArrowDownIcon from '../../../images/sort-arrow-down.svg';
import DownFilledTriangleIcon from '../../../images/down-filled-triangle.svg';

const ROOT_URL = getConfig('API_URL');

const formatDateCell = (date, mobile = false) =>
dates.format(date, { showTime: !mobile });

Expand Down Expand Up @@ -140,7 +143,13 @@ class SketchListRowBase extends React.Component {
};

handleSketchDownload = () => {
this.props.exportProjectAsZip(this.props.sketch.id);
const { sketch } = this.props;
const downloadLink = document.createElement('a');
downloadLink.href = `${ROOT_URL}/projects/${sketch.id}/zip`;
downloadLink.download = `${sketch.name}.zip`;
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
};

handleSketchDuplicate = () => {
Expand Down Expand Up @@ -332,7 +341,6 @@ SketchListRowBase.propTypes = {
deleteProject: PropTypes.func.isRequired,
showShareModal: PropTypes.func.isRequired,
cloneProject: PropTypes.func.isRequired,
exportProjectAsZip: PropTypes.func.isRequired,
changeProjectName: PropTypes.func.isRequired,
onAddToCollection: PropTypes.func.isRequired,
mobile: PropTypes.bool,
Expand Down

0 comments on commit 4a4f4d2

Please sign in to comment.