Skip to content

Commit

Permalink
Merge pull request abcotter#39 from abcotter/shareResults
Browse files Browse the repository at this point in the history
add download option fo single top funder graph and for demo state of main funder
  • Loading branch information
abcotter authored Mar 17, 2022
2 parents 0ff73df + 9a09566 commit 37e2364
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
Binary file added frontend/src/assets/DemoToDownload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 21 additions & 3 deletions frontend/src/components/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@

<div v-if="!loading">
<h2>Share Your Results</h2>
<ion-icon name="logo-instagram" style="font-size: 35px"></ion-icon>
<ion-icon name="logo-facebook" style="font-size: 35px"></ion-icon>
<ion-icon name="download-outline" style="font-size: 35px"></ion-icon>
<ion-icon
name="logo-instagram"
style="font-size: 35px; fill: grey"
></ion-icon>
<ion-icon
name="logo-facebook"
style="font-size: 35px; fill: grey"
></ion-icon>
<ion-icon
name="download-outline"
style="font-size: 35px"
@click="download()"
></ion-icon>
</div>
</div>
</template>
Expand All @@ -53,6 +63,7 @@ import HipTips from "./TipsCarousel/HipTips.vue";
import axios from "axios";
import DoubleBounce from "./loader.vue";
import SampleData from "../../../endpointLambdas/reportAnalytics/SampleOutput.json";
import img from "../assets/DemoToDownload.png";
export default {
async mounted() {
Expand Down Expand Up @@ -105,6 +116,13 @@ export default {
behavior: "smooth",
});
},
download() {
console.log(img);
var a = document.createElement("a");
a.href = img;
a.download = "MainFunder.png";
a.click();
},
},
};
</script>
Expand Down
26 changes: 26 additions & 0 deletions frontend/src/components/MainFunderCards/LeftMainFunderStat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
style="max-width: 30vw; max-height: 30vw"
id="VideoSponsoredbyFunder"
></canvas>
<a id="toSave" v-show="false"></a>
<ion-icon
name="download-outline"
style="
font-size: 35px;
position: absolute;
left: 45vw;
top: 80vh;
cursor: pointer;
"
@click="downloadMainFunder()"
></ion-icon>
</div>
<div class="arrow-left">
<img
Expand Down Expand Up @@ -56,13 +68,21 @@ export default {
},
options: {
responsive: true,
animation: {
onComplete: function (animation) {
var a = document.getElementById("toSave");
a.setAttribute("download", "timeSponsoredByMainFunder.png");
a.setAttribute("href", this.toBase64Image());
},
},
},
};
},
data() {
return {
chartData: null,
href: null,
};
},
computed: {},
Expand All @@ -72,6 +92,12 @@ export default {
new Chart(ctx, this.chartData);
},
},
methods: {
downloadMainFunder() {
var a = document.getElementById("toSave");
a.click();
},
},
};
</script>

Expand Down

0 comments on commit 37e2364

Please sign in to comment.