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: add link back to team challenge page #5121

Merged
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
34 changes: 34 additions & 0 deletions .storybook/stories/NotifyMe.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import NotifyMe from '@/components/Thanks/NotifyMe';

export default {
title: 'Components/Notify Me',
component: NotifyMe,
};

const story = (args = {}) => {
const template = (_args, { argTypes }) => ({
props: Object.keys(argTypes),
components: { NotifyMe },
template: '<notify-me :goal="goal" email="[email protected]" :teamPublicId="teamPublicId" />',
})
template.args = args;
return template;
};

const future = new Date();
future.setDate(future.getDate() + 2);

const goal = {
endDate: future.toISOString(),
targets: {
totalCount: 2,
values: [
{ status: 'COMPLETE' },
{ status: 'IN_PROGRESS' },
]
}
}

export const Default = story({ goal });

export const Team = story({ goal, teamPublicId: 'aplus' });
19 changes: 15 additions & 4 deletions src/components/Thanks/NotifyMe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
</p>
</div>
<div class="tw-mt-2 tw-mb-6">
<h3>Challenge <span class="tw-text-eco-green-3">{{ percentageFunded }}% complete</span></h3>
<h3>
Challenge
<a :href="teamChallengePath" class="tw-text-eco-green-3">
{{ percentageFunded }}% complete
</a>
</h3>
</div>
<div class="tw-flex tw-flex-col tw-items-center">
<h2 class="tw-text-center tw-mb-2">
Expand Down Expand Up @@ -68,7 +73,6 @@ import KvMaterialIcon from '~/@kiva/kv-components/vue/KvMaterialIcon';

export default {
name: 'NotifyMe',
inject: ['apollo'],
mixins: [teamGoalInfo],
components: {
KvProgressCircle,
Expand All @@ -82,7 +86,11 @@ export default {
email: {
type: String,
default: '',
}
},
teamPublicId: {
type: String,
default: '',
},
},
data() {
return {
Expand All @@ -105,7 +113,10 @@ export default {
iterableListIdString() {
const isProd = window.location.hostname === 'www.kiva.org';
return isProd ? '0daedc50-6b66-44de-898d-fc7365f64da5' : '84945c52-fd49-4ae8-9ab6-4daa11eb6052';
}
},
teamChallengePath() {
return this.teamPublicId ? `/team/challenge/${this.teamPublicId}` : '/teams';
},
},
methods: {
async notify() {
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/query/thanksPage.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ query checkoutReceipt($checkoutId: Int!, $visitorId: String) {
}
team {
id
teamPublicId
name
}

}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/pages/Thanks/ThanksPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</template>
<template v-else>
<div v-if="goal" class="tw-bg-secondary">
<NotifyMe :goal="goal" :email="lender.email" />
<NotifyMe :goal="goal" :email="lender.email" :team-public-id="teamPublicId" />
</div>
<div class="row page-content" v-if="receipt && !showFocusedShareAsk">
<div class="small-12 columns thanks">
Expand Down Expand Up @@ -299,6 +299,9 @@ export default {
teamId() {
return getTeamId(this.loans);
},
teamPublicId() {
return this.loans?.[0]?.team?.teamPublicId;
},
},
created() {
// Retrieve and apply Page level data + experiment state
Expand Down
Loading