Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 5 additions & 12 deletions src/components/MyKiva/NextYearGoalCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(() => {
Expand Down
10 changes: 5 additions & 5 deletions src/components/Thanks/SingleVersion/GoalCompleted.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = () => {
Expand Down
21 changes: 12 additions & 9 deletions src/components/Thanks/SingleVersion/GoalInProgress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -52,10 +55,6 @@ const props = defineProps({
type: Object,
default: null,
},
getGoalDisplayName: {
type: Function,
required: true,
},
targetLoansAmount: {
type: Number,
default: 0,
Expand All @@ -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(() => {
Expand All @@ -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;
}
Expand Down
3 changes: 0 additions & 3 deletions src/components/Thanks/ThanksPageSingleVersion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<GoalCompleted
v-if="showGoalCompletedModule"
:current-goal="userGoal"
:get-goal-display-name="getGoalDisplayName"
:loading="goalDataLoading"
class="tw-mb-2.5"
/>
Expand Down Expand Up @@ -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"
/>
Expand Down Expand Up @@ -214,7 +212,6 @@ const currGoalProgress = ref(0);

const {
checkCompletedGoal,
getGoalDisplayName,
getPostCheckoutProgressByLoans,
loadGoalData,
loading: goalDataLoading,
Expand Down
Loading