Skip to content

Commit

Permalink
Add pending statistics suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
bperel committed May 3, 2020
1 parent 14d2af0 commit 3f77252
Showing 1 changed file with 38 additions and 3 deletions.
41 changes: 38 additions & 3 deletions src/views/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@
<b-card title="Top contributors">
<b-table striped hover :items="contributors"></b-table>
</b-card>
<b-card class="pending-suggestions" title="Undecided suggestions">
<div id="counters">
<div
class="counter"
:key="pendingSuggestionForLanguage.language"
v-for="pendingSuggestionForLanguage in pendingSuggestions"
>
<b-badge
>Wikipedia {{ pendingSuggestionForLanguage.language }}</b-badge
>
<h2 class="timer count-title count-number">
{{ pendingSuggestionForLanguage.count }}
</h2>
</div>
</div>
</b-card>
</b-card-group>
</div>
</template>
Expand All @@ -47,6 +63,7 @@ export default {
...mapState(["LANGUAGETOOL_ENDPOINT_ROOT"]),
},
data: () => ({
pendingSuggestions: [],
contributors: [],
areaChart: {
xAxis: {
Expand Down Expand Up @@ -87,6 +104,9 @@ export default {
axios
.get(`${this.LANGUAGETOOL_ENDPOINT_ROOT}/stats`)
.then(({ data }) => {
vm.contributors = data.contributors;
vm.pendingSuggestions = data.pendingSuggestions;
let currentDate = new Date(data.decisions[0].date);
while (currentDate <= new Date().addDay()) {
vm.areaChart.xAxis.data.push(currentDate.toShortISOString());
Expand All @@ -103,17 +123,32 @@ export default {
});
currentDate = currentDate.addDay();
}
vm.contributors = data.contributors;
})
.catch(() => {
vm.error = "Something wrong occurred while fetching the statistics";
});
},
};
</script>
<style scoped>
<style scoped lang="scss">
.echarts {
display: inline-block;
}
#counters {
background-color: #f5f5f5;
.counter {
display: inline-block;
padding: 20px;
border-radius: 5px;
.count-title {
font-size: 40px;
font-weight: normal;
margin-top: 10px;
margin-bottom: 0;
text-align: center;
}
}
}
</style>

0 comments on commit 3f77252

Please sign in to comment.