Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: complete status added to journey #5708

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/components/MyKiva/BadgesSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<button
class="tw-text-action hover:tw-underline tw-mt-auto"
>
{{ badge.hasStarted ? 'Continue' : 'Start this journey' }}
{{ ctaCaption(badge) }}
</button>
</div>
</div>
Expand Down Expand Up @@ -74,17 +74,27 @@ const visibleBadges = computed(() => {
.sort(indexIn(defaultBadges, 'id'));
});

const levelCaption = badge => {
return `Level ${getActiveTierData(badge).level}/${getBadgeWithVisibleTiers(badge).achievementData.tiers.length}`;
};

const getBadgeStatus = badge => {
const activeTier = getActiveTierData(badge);
if (activeTier?.level === badge?.achievementData?.tiers?.length) {
return BADGE_COMPLETED;
}
return BADGE_IN_PROGRESS;
};

const levelCaption = badge => {
if (getBadgeStatus(badge) === BADGE_COMPLETED) {
return 'Complete!';
}
return `Level ${getActiveTierData(badge).level}/${getBadgeWithVisibleTiers(badge).achievementData.tiers.length}`;
};

const ctaCaption = badge => {
if (getBadgeStatus(badge) === BADGE_COMPLETED) {
return 'See this journey';
}
return badge.hasStarted ? 'Continue' : 'Start this journey';
};
</script>

<style lang="postcss" scoped>
Expand Down
Loading