diff --git a/src/components/MyKiva/NextYearGoalCard.vue b/src/components/MyKiva/NextYearGoalCard.vue index 8e33676f982..ce57776b230 100644 --- a/src/components/MyKiva/NextYearGoalCard.vue +++ b/src/components/MyKiva/NextYearGoalCard.vue @@ -119,11 +119,7 @@ const $kvTrackEvent = inject('$kvTrackEvent'); const router = useRouter(); const goalData = inject('goalData'); -const { - ID_BASIC_NEEDS, - ID_CLIMATE_ACTION, - ID_SUPPORT_ALL -} = useBadgeData(); +const { ID_SUPPORT_ALL } = useBadgeData(); const { getCtaHref, getGoalDisplayName, @@ -176,14 +172,11 @@ const categoryName = computed(() => { }); const goalDescription = computed(() => { - switch (props.userGoal?.category) { - case ID_BASIC_NEEDS: - case ID_CLIMATE_ACTION: - case ID_SUPPORT_ALL: - return `${goalLoans.value} ${categoryName.value}`; - default: - return `${goalLoans.value} loans to ${categoryName.value}`; + const name = categoryName.value; + if (props.userGoal?.category === ID_SUPPORT_ALL || name.endsWith('loans')) { + return `${goalLoans.value} ${name}`; } + return `${goalLoans.value} loans to ${name}`; }); const ctaHref = computed(() => { diff --git a/src/components/Thanks/SingleVersion/GoalCompleted.vue b/src/components/Thanks/SingleVersion/GoalCompleted.vue index a3c9d0d47a8..01d71a8fb4c 100644 --- a/src/components/Thanks/SingleVersion/GoalCompleted.vue +++ b/src/components/Thanks/SingleVersion/GoalCompleted.vue @@ -47,18 +47,17 @@ import { import HighFive from '#src/assets/images/thanks-page/hi-five.svg'; import BadgeContainer from '#src/components/MyKiva/BadgeContainer'; import BgRays from '#src/components/Thanks/BgRays'; +import useGoalData from '#src/composables/useGoalData'; const $kvTrackEvent = inject('$kvTrackEvent'); +const { getGoalDisplayName } = useGoalData({}); + const props = defineProps({ currentGoal: { type: Object, default: null, }, - getGoalDisplayName: { - type: Function, - required: true, - }, loading: { type: Boolean, default: false, @@ -67,7 +66,8 @@ const props = defineProps({ const goalDisplayName = computed(() => { const category = props.currentGoal?.category || ''; - return category ? props.getGoalDisplayName(props.currentGoal?.target, category) : 'loans'; + if (!category) return 'loans'; + return getGoalDisplayName(props.currentGoal?.target, category); }); const handleContinue = () => { diff --git a/src/components/Thanks/SingleVersion/GoalInProgress.vue b/src/components/Thanks/SingleVersion/GoalInProgress.vue index e4a359fb1d3..cc964c01702 100644 --- a/src/components/Thanks/SingleVersion/GoalInProgress.vue +++ b/src/components/Thanks/SingleVersion/GoalInProgress.vue @@ -32,9 +32,12 @@ import { import { mdiArrowRight } from '@mdi/js'; import HandsPlant from '#src/assets/images/thanks-page/hands-plant-v2.png'; import { ID_SUPPORT_ALL } from '#src/composables/useBadgeData'; +import useGoalData from '#src/composables/useGoalData'; const $kvTrackEvent = inject('$kvTrackEvent'); +const { getGoalDisplayName } = useGoalData({}); + const props = defineProps({ loading: { type: Boolean, @@ -52,10 +55,6 @@ const props = defineProps({ type: Object, default: null, }, - getGoalDisplayName: { - type: Function, - required: true, - }, targetLoansAmount: { type: Number, default: 0, @@ -66,7 +65,7 @@ const loanImageUrl = computed(() => props.loan?.image?.url ?? ''); const goalDisplayName = computed(() => { const category = props.currentGoal?.category || ''; - return category ? props.getGoalDisplayName(props.targetLoansAmount, category) : ''; + return category ? getGoalDisplayName(props.targetLoansAmount, category) : ''; }); const moduleTitle = computed(() => { @@ -76,11 +75,15 @@ const moduleTitle = computed(() => { } if (props.targetLoansAmount > 0) { - if (props.currentGoal?.category === ID_SUPPORT_ALL) { - title += `You’re making progress towards your goal of making ${props.targetLoansAmount} loans this year`; + const category = props.currentGoal?.category; + const count = props.targetLoansAmount; + const name = goalDisplayName.value; + if (category === ID_SUPPORT_ALL) { + title += `You're making progress towards your goal of making ${count} loans this year.`; + } else if (name.endsWith('loans')) { + title += `You're making progress towards your goal of making ${count} ${name} this year.`; } else { - // eslint-disable-next-line max-len - title += `You’re making progress towards your goal of making ${props.targetLoansAmount} loans to ${goalDisplayName.value} this year.`; + title += `You're making progress towards your goal of making ${count} loans to ${name} this year.`; } return title; } diff --git a/src/components/Thanks/ThanksPageSingleVersion.vue b/src/components/Thanks/ThanksPageSingleVersion.vue index e4a8ba2ed6e..dc0f89ed030 100644 --- a/src/components/Thanks/ThanksPageSingleVersion.vue +++ b/src/components/Thanks/ThanksPageSingleVersion.vue @@ -22,7 +22,6 @@ @@ -61,7 +60,6 @@ :is-opted-in="isOptedIn" :loan="loanForComment" :current-goal="userGoal" - :get-goal-display-name="getGoalDisplayName" :target-loans-amount="goalTargetLoansAmount" class="tw-mb-2.5" /> @@ -214,7 +212,6 @@ const currGoalProgress = ref(0); const { checkCompletedGoal, - getGoalDisplayName, getPostCheckoutProgressByLoans, loadGoalData, loading: goalDataLoading,