Skip to content

Commit

Permalink
fix: badges loading indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bedon committed Nov 25, 2024
1 parent cbced40 commit e2414fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
10 changes: 3 additions & 7 deletions src/pages/Portfolio/LendingStats/BadgesSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ export default {
type: Array,
default: () => []
},
/* total number of possible badges */
totalPossibleBadges: {
type: Number,
default: 0
isLoading: {
type: Boolean,
default: false
},
},
components: {
Expand All @@ -52,9 +51,6 @@ export default {
badgesObtained() {
return this.completedAchievements.length ?? 0;
},
isLoading() {
return this.totalPossibleBadges === 0;
},
},
};
</script>
8 changes: 3 additions & 5 deletions src/pages/Portfolio/LendingStats/LendingStatsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</p>
<hr class="tw-border-tertiary tw-my-4">
<badges-section
:total-possible-badges="totalPossibleBadges"
:is-loading="badgesLoading"
:completed-achievements="completedAchievements"
/>
<hr class="tw-border-tertiary tw-my-4">
Expand Down Expand Up @@ -178,10 +178,8 @@ export default {
return completedBadgesArr;
},
totalPossibleBadges() {
return this.badgesData.reduce((acc, badge) => {
return acc + (badge?.contentfulData?.length ?? 0);
}, 0);
badgesLoading() {
return !this.badgesData.length;
}
},
methods: {
Expand Down

0 comments on commit e2414fb

Please sign in to comment.