Oct 1 fixes (#9121)

* Added default tags to task

* Added seasonal gear check and show spooky

* Disabled spooky sparkles

* Fixed challenge remove tasks modal

* Hid checklist

* Added group gems modal

* Purchase with amazon

* Added check for user health
This commit is contained in:
Keith Holliday
2017-10-01 19:17:02 -05:00
committed by GitHub
parent 9f11820a02
commit f01e552637
14 changed files with 135 additions and 47 deletions

View File

@@ -10,7 +10,7 @@
h1(v-markdown='challenge.name') h1(v-markdown='challenge.name')
div div
strong(v-once) {{$t('createdBy')}}: strong(v-once) {{$t('createdBy')}}:
span {{challenge.leader.profile.name}} span(v-if='challenge.leader && challenge.leader.profile') {{challenge.leader.profile.name}}
// @TODO: make challenge.author a variable inside the createdBy string (helps with RTL languages) // @TODO: make challenge.author a variable inside the createdBy string (helps with RTL languages)
// @TODO: Implement in V2 strong.margin-left(v-once) // @TODO: Implement in V2 strong.margin-left(v-once)
.svg-icon.calendar-icon(v-html="icons.calendarIcon") .svg-icon.calendar-icon(v-html="icons.calendarIcon")

View File

@@ -4,6 +4,7 @@
invite-modal(:group='this.group') invite-modal(:group='this.group')
start-quest-modal(:group='this.group') start-quest-modal(:group='this.group')
quest-details-modal(:group='this.group') quest-details-modal(:group='this.group')
group-gems-modal
.col-12.col-sm-8.standard-page .col-12.col-sm-8.standard-page
.row .row
.col-6.title-details .col-6.title-details
@@ -20,7 +21,7 @@
span.number {{ group.memberCount | abbrNum }} span.number {{ group.memberCount | abbrNum }}
div(v-once) {{ $t('memberList') }} div(v-once) {{ $t('memberList') }}
.col-4(v-if='!isParty') .col-4(v-if='!isParty')
.item-with-icon .item-with-icon(@click='showGroupGems()')
.svg-icon.gem(v-html="icons.gem") .svg-icon.gem(v-html="icons.gem")
span.number {{group.balance * 4}} span.number {{group.balance * 4}}
div(v-once) {{ $t('guildBank') }} div(v-once) {{ $t('guildBank') }}
@@ -47,7 +48,6 @@
.row .row
.col-12.hr .col-12.hr
chat-message(:chat.sync='group.chat', :group-id='group._id', group-name='group.name') chat-message(:chat.sync='group.chat', :group-id='group._id', group-name='group.name')
.col-12.col-sm-4.sidebar .col-12.col-sm-4.sidebar
.row(:class='{"guild-background": !isParty}') .row(:class='{"guild-background": !isParty}')
.col-6 .col-6
@@ -453,6 +453,7 @@ import inviteModal from './inviteModal';
import chatMessage from '../chat/chatMessages'; import chatMessage from '../chat/chatMessages';
import autocomplete from '../chat/autoComplete'; import autocomplete from '../chat/autoComplete';
import groupChallenges from '../challenges/groupChallenges'; import groupChallenges from '../challenges/groupChallenges';
import groupGemsModal from 'client/components/groups/groupGemsModal';
import markdownDirective from 'client/directives/markdown'; import markdownDirective from 'client/directives/markdown';
import bCollapse from 'bootstrap-vue/lib/components/collapse'; import bCollapse from 'bootstrap-vue/lib/components/collapse';
@@ -490,6 +491,7 @@ export default {
groupChallenges, groupChallenges,
autocomplete, autocomplete,
questDetailsModal, questDetailsModal,
groupGemsModal,
}, },
directives: { directives: {
bToggle, bToggle,
@@ -857,6 +859,9 @@ export default {
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/reject'}); let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/reject'});
this.group.quest = quest; this.group.quest = quest;
}, },
showGroupGems () {
this.$root.$emit('show::modal', 'group-gems-modal');
},
}, },
}; };
</script> </script>

View File

@@ -0,0 +1,32 @@
<template lang="pug">
b-modal#group-gems-modal(:title="$t('groupGems')", size='md', :hide-footer="true")
.modal-body
.row
.col-6.offset-3
h3 {{ $t('groupGemsDesc') }}
.modal-footer
.col-12.text-center
button.btn.btn-primary(@click='close()') {{$t('close')}}
</template>
<style scoped>
.modal-body {
margin-top: 1em;
margin-bottom: 1em;
}
</style>
<script>
import bModal from 'bootstrap-vue/lib/components/modal';
export default {
components: {
bModal,
},
methods: {
close () {
this.$root.$emit('hide::modal', 'group-gems-modal');
},
},
};
</script>

View File

@@ -303,6 +303,11 @@ export default {
this.$root.$emit('show::modal', 'avatar-modal'); this.$root.$emit('show::modal', 'avatar-modal');
} }
if (this.user.stats.hp <= 0) {
this.playSound('Death');
this.$root.$emit('show::modal', 'death');
}
if (this.questCompleted) { if (this.questCompleted) {
this.$root.$emit('show::modal', 'quest-completed'); this.$root.$emit('show::modal', 'quest-completed');
} }

View File

@@ -1,15 +1,22 @@
<template lang="pug"> <template lang="pug">
b-modal#amazon-payment(title="Amazon", :hide-footer="true", size='lg') b-modal#amazon-payment(title="Amazon", :hide-footer="true", size='md')
h2.text-center Continue with Amazon
#AmazonPayButton #AmazonPayButton
#AmazonPayWallet(v-if="amazonPayments.loggedIn", style="width: 400px; height: 228px;") #AmazonPayWallet(v-if="amazonPayments.loggedIn", style="width: 400px; height: 228px;")
#AmazonPayRecurring(v-if="amazonPayments.loggedIn && amazonPayments.type === 'subscription'", #AmazonPayRecurring(v-if="amazonPayments.loggedIn && amazonPayments.type === 'subscription'",
style="width: 400px; height: 140px;") style="width: 400px; height: 140px;")
.modal-footer .modal-footer
.btn.btn-primary(:disabled="amazonPaymentsCanCheckout() || !amazonButtonEnabled", .text-center
@click="amazonCheckOut()") {{ $t('checkout') }} .btn.btn-primary(v-if="amazonPaymentsCanCheckout",
@click="amazonCheckOut()") {{ $t('checkout') }}
</template> </template>
<style scoped> <style scoped>
#AmazonPayButton {
margin: 0 auto;
width: 150px;
}
#AmazonPayRecurring { #AmazonPayRecurring {
height: 200px; height: 200px;
width: 500px; width: 500px;
@@ -41,6 +48,17 @@ export default {
computed: { computed: {
...mapState({user: 'user.data'}), ...mapState({user: 'user.data'}),
...mapState(['isAmazonReady']), ...mapState(['isAmazonReady']),
amazonPaymentsCanCheckout () {
if (this.amazonPayments.type === 'single') {
return this.amazonPaymentspaymentSelected === true;
} else if (this.amazonPayments.type === 'subscription') {
return this.amazonPaymentspaymentSelected === true &&
// Mah.. one is a boolean the other a string...
this.amazonPaymentsrecurringConsent === 'true';
} else {
return false;
}
},
}, },
mounted () { mounted () {
if (this.isAmazonReady) return this.setupAmazon(); if (this.isAmazonReady) return this.setupAmazon();
@@ -79,11 +97,16 @@ export default {
billingAgreementId: this.amazonPaymentsbillingAgreementId, billingAgreementId: this.amazonPaymentsbillingAgreementId,
}); });
// @TODO: Success if (response.status === 200) {
this.amazonPayments.loggedIn = true; this.amazonPayments.loggedIn = true;
this.amazonPaymentsorderReferenceId = response.data.orderReferenceId; this.amazonPayments.orderReferenceId = response.data.data.orderReferenceId;
this.amazonPaymentsinitWidgets();
// @TODO: error // @TODO: Clarify the deifference of these functions by renaming
this.amazonPaymentsinitWidgets();
this.amazonInitWidgets();
return;
}
alert(response.message); alert(response.message);
} }
}, },
@@ -106,17 +129,6 @@ export default {
onError: this.amazonOnError, onError: this.amazonOnError,
}); });
}, },
amazonPaymentsCanCheckout () {
if (this.amazonPayments.type === 'single') {
return this.amazonPaymentspaymentSelected === true;
} else if (this.amazonPayments.type === 'subscription') {
return this.amazonPaymentspaymentSelected === true &&
// Mah.. one is a boolean the other a string...
this.amazonPaymentsrecurringConsent === 'true';
} else {
return false;
}
},
amazonInitWidgets () { amazonInitWidgets () {
let walletParams = { let walletParams = {
sellerId: AMAZON_PAYMENTS.SELLER_ID, // @TODO: Import sellerId: AMAZON_PAYMENTS.SELLER_ID, // @TODO: Import
@@ -131,6 +143,7 @@ export default {
onError: this.amazonOnError, onError: this.amazonOnError,
}; };
// @TODO: Check if this is duplicated below
if (this.amazonPayments.type === 'subscription') { if (this.amazonPayments.type === 'subscription') {
walletParams.agreementType = 'BillingAgreement'; walletParams.agreementType = 'BillingAgreement';
@@ -158,7 +171,7 @@ export default {
}).bind('AmazonPayRecurring'); }).bind('AmazonPayRecurring');
}; };
} else { } else {
walletParams.amazonOrderReferenceId = this.amazonPaymentsorderReferenceId; walletParams.amazonOrderReferenceId = this.amazonPayments.orderReferenceId;
} }
new this.OffAmazonPayments.Widgets.Wallet(walletParams).bind('AmazonPayWallet'); new this.OffAmazonPayments.Widgets.Wallet(walletParams).bind('AmazonPayWallet');
@@ -166,18 +179,22 @@ export default {
async amazonCheckOut () { async amazonCheckOut () {
this.amazonButtonEnabled = false; this.amazonButtonEnabled = false;
// @TODO: Create factory functions
// @TODO: A gift should not read the same as buying gems for yourself.
if (this.amazonPayments.type === 'single') { if (this.amazonPayments.type === 'single') {
let url = '/amazon/checkout'; let url = '/amazon/checkout';
let response = await axios.post(url, { let response = await axios.post(url, {
orderReferenceId: this.amazonPaymentsorderReferenceId, orderReferenceId: this.amazonPayments.orderReferenceId,
gift: this.amazonPaymentsgift, gift: this.amazonPaymentsgift,
}); });
// Success if (response.status < 400) {
this.amazonPaymentsreset(); this.reset();
window.location.reload(true); // @TODO: What are we syncing?
window.location.reload(true);
return;
}
// Failure
alert(response.message); alert(response.message);
this.amazonPaymentsreset(); this.amazonPaymentsreset();
} else if (this.amazonPayments.type === 'subscription') { } else if (this.amazonPayments.type === 'subscription') {
@@ -212,7 +229,7 @@ export default {
} }
window.location.reload(true); window.location.reload(true);
this.amazonPaymentsreset(); this.reset();
} }
}, },
amazonPaymentsinitWidgets () { amazonPaymentsinitWidgets () {
@@ -263,16 +280,15 @@ export default {
}, },
amazonOnError (error) { amazonOnError (error) {
alert(error.getErrorMessage()); alert(error.getErrorMessage());
// @TODO: this.amazonPaymentsreset(); this.reset();
}, },
reset () { reset () {
this.amazonPaymentsmodal.close(); // @TODO: this.$root.$emit('hide::modal', 'guild-form');
this.amazonPaymentsmodal = null; this.amazonPaymentsmodal = null;
this.amazonPayments.type = null; this.amazonPayments.type = null;
this.amazonPayments.loggedIn = false; this.amazonPayments.loggedIn = false;
this.amazonPaymentsgift = null; this.amazonPaymentsgift = null;
this.amazonPaymentsbillingAgreementId = null; this.amazonPaymentsbillingAgreementId = null;
this.amazonPaymentsorderReferenceId = null; this.amazonPayments.orderReferenceId = null;
this.amazonPaymentspaymentSelected = false; this.amazonPaymentspaymentSelected = false;
this.amazonPaymentsrecurringConsent = false; this.amazonPaymentsrecurringConsent = false;
this.amazonPaymentssubscription = null; this.amazonPaymentssubscription = null;

View File

@@ -39,14 +39,14 @@
.gem-text {{ $t('gems') }} .gem-text {{ $t('gems') }}
.divider .divider
button.btn.btn-primary(@click='gemAmount = 4') {{gemAmount === 4 ? $t('selected') : '$1.00'}} button.btn.btn-primary(@click='gemAmount = 4') {{gemAmount === 4 ? $t('selected') : '$1.00'}}
.card.text-center.col-3(:class="{active: gemAmount === 21 }") .card.text-center.col-3(:class="{active: gemAmount === 20 }")
.card-img-top .card-img-top
.mx-auto(v-html='icons.twentyOneGems', style='"height: 55px; width: 47.5px; margin-top: 1.85em;"') .mx-auto(v-html='icons.twentyOneGems', style='"height: 55px; width: 47.5px; margin-top: 1.85em;"')
.card-body .card-body
.gem-count 20 .gem-count 20
.gem-text {{ $t('gems') }} .gem-text {{ $t('gems') }}
.divider .divider
button.btn.btn-primary(@click='gemAmount === 21 ? gemAmount = 0 : gemAmount = 21') {{gemAmount === 21 ? $t('selected') : '$5.00'}} button.btn.btn-primary(@click='gemAmount === 20 ? gemAmount = 0 : gemAmount = 20') {{gemAmount === 20 ? $t('selected') : '$5.00'}}
//.card.text-center(:class="{active: gemAmount === 42}") //.card.text-center(:class="{active: gemAmount === 42}")
.card-img-top .card-img-top
.mx-auto(v-html='icons.fortyTwoGems', style='"height: 49.5px; width: 51px; margin-top: 1.9em;"') .mx-auto(v-html='icons.fortyTwoGems', style='"height: 49.5px; width: 51px; margin-top: 1.9em;"')

View File

@@ -36,7 +36,7 @@
span.text(v-once, v-html="seasonal.notes") span.text(v-once, v-html="seasonal.notes")
span.rectangle span.rectangle
div.content(v-else-if="seasonal.featured.items.length !== 0") div.content(v-else-if="seasonal.featured.items.length !== 0")
div.featured-label.with-border div.featured-label.with-border(v-if='!featuredGearBought')
span.rectangle span.rectangle
span.text(v-once) {{ $t('featuredset', { name: seasonal.featured.text }) }} span.text(v-once) {{ $t('featuredset', { name: seasonal.featured.text }) }}
span.rectangle span.rectangle
@@ -349,6 +349,7 @@
selectedSortItemsBy: 'AZ', selectedSortItemsBy: 'AZ',
hidePinned: false, hidePinned: false,
featuredGearBought: false,
}; };
}, },
computed: { computed: {
@@ -363,7 +364,22 @@
}, },
seasonal () { seasonal () {
return shops.getSeasonalShop(this.user); let seasonal = shops.getSeasonalShop(this.user);
let itemsNotOwned = seasonal.featured.items.filter(item => {
return !this.user.items.gear.owned[item.key];
});
seasonal.featured.items = itemsNotOwned;
// If we are out of gear, show the spells
// @TODO: Open this up when they are available.
// @TODO: add dates to check instead?
// if (seasonal.featured.items.length === 0) {
// this.featuredGearBought = true;
// seasonal.featured.items = seasonal.featured.items.concat(seasonal.categories[0].items);
// }
return seasonal;
}, },
seasonalCategories () { seasonalCategories () {
return this.seasonal.categories; return this.seasonal.categories;

View File

@@ -1,5 +1,5 @@
<template lang='pug'> <template lang='pug'>
b-modal#broken-task-modal(title="Broken Challenge", size='sm', :hide-footer="true", v-if='brokenChallengeTask.challenge') b-modal#broken-task-modal(title="Broken Challenge", size='sm', :hide-footer="true", v-if='brokenChallengeTask && brokenChallengeTask.challenge')
.modal-body .modal-body
div(v-if='brokenChallengeTask.challenge.broken === "TASK_DELETED" || brokenChallengeTask.challenge.broken === "CHALLENGE_TASK_NOT_FOUND"') div(v-if='brokenChallengeTask.challenge.broken === "TASK_DELETED" || brokenChallengeTask.challenge.broken === "CHALLENGE_TASK_NOT_FOUND"')
h2 {{ $t('brokenTask') }} h2 {{ $t('brokenTask') }}
@@ -38,10 +38,14 @@ import notifications from 'client/mixins/notifications';
export default { export default {
mixins: [notifications], mixins: [notifications],
props: ['brokenChallengeTask'],
components: { components: {
bModal, bModal,
}, },
computed: {
brokenChallengeTask () {
return this.$store.state.brokenChallengeTask;
},
},
methods: { methods: {
...mapActions({ ...mapActions({
destroyTask: 'tasks:destroy', destroyTask: 'tasks:destroy',
@@ -70,6 +74,7 @@ export default {
this.destroyTask(this.brokenChallengeTask); this.destroyTask(this.brokenChallengeTask);
}, },
close () { close () {
this.$store.state.brokenChallengeTask = {};
this.$root.$emit('hide::modal', 'broken-task-modal'); this.$root.$emit('hide::modal', 'broken-task-modal');
}, },
}, },

View File

@@ -1,6 +1,5 @@
<template lang="pug"> <template lang="pug">
.task-wrapper .task-wrapper
broken-task-modal(:brokenChallengeTask='brokenChallengeTask')
.task(@click='castEnd($event, task)') .task(@click='castEnd($event, task)')
approval-header(:task='task', v-if='this.task.group.id', :group='group') approval-header(:task='task', v-if='this.task.group.id', :group='group')
.d-flex(:class="{'task-not-scoreable': isUser !== true}") .d-flex(:class="{'task-not-scoreable': isUser !== true}")
@@ -17,7 +16,7 @@
.task-clickable-area(@click="edit($event, task)") .task-clickable-area(@click="edit($event, task)")
h3.task-title(:class="{ 'has-notes': task.notes }", v-markdown="task.text") h3.task-title(:class="{ 'has-notes': task.notes }", v-markdown="task.text")
.task-notes.small-text(v-markdown="task.notes") .task-notes.small-text(v-markdown="task.notes")
.checklist(v-if="task.checklist && task.checklist.length > 0") .checklist(v-if="canViewchecklist")
label.custom-control.custom-checkbox.checklist-item( label.custom-control.custom-checkbox.checklist-item(
v-for="item in task.checklist", :class="{'checklist-item-done': item.completed}", v-for="item in task.checklist", :class="{'checklist-item-done': item.completed}",
) )
@@ -311,7 +310,6 @@ import checkIcon from 'assets/svg/check.svg';
import bPopover from 'bootstrap-vue/lib/components/popover'; import bPopover from 'bootstrap-vue/lib/components/popover';
import markdownDirective from 'client/directives/markdown'; import markdownDirective from 'client/directives/markdown';
import notifications from 'client/mixins/notifications'; import notifications from 'client/mixins/notifications';
import brokenTaskModal from './brokenTaskModal';
import approvalHeader from './approvalHeader'; import approvalHeader from './approvalHeader';
import approvalFooter from './approvalFooter'; import approvalFooter from './approvalFooter';
@@ -321,7 +319,6 @@ export default {
bPopover, bPopover,
approvalFooter, approvalFooter,
approvalHeader, approvalHeader,
brokenTaskModal,
}, },
directives: { directives: {
markdown: markdownDirective, markdown: markdownDirective,
@@ -339,7 +336,6 @@ export default {
tags: tagsIcon, tags: tagsIcon,
check: checkIcon, check: checkIcon,
}), }),
brokenChallengeTask: {},
}; };
}, },
computed: { computed: {
@@ -348,6 +344,11 @@ export default {
getTagsFor: 'tasks:getTagsFor', getTagsFor: 'tasks:getTagsFor',
getTaskClasses: 'tasks:getTaskClasses', getTaskClasses: 'tasks:getTaskClasses',
}), }),
canViewchecklist () {
let hasChecklist = this.task.checklist && this.task.checklist.length > 0;
let userIsTaskUser = this.task.userId ? this.task.userId === this.user._id : true;
return hasChecklist && userIsTaskUser;
},
leftControl () { leftControl () {
const task = this.task; const task = this.task;
if (task.type === 'reward') return false; if (task.type === 'reward') return false;
@@ -505,7 +506,7 @@ export default {
} }
}, },
handleBrokenTask (task) { handleBrokenTask (task) {
this.brokenChallengeTask = task; this.$store.state.brokenChallengeTask = task;
this.$root.$emit('show::modal', 'broken-task-modal'); this.$root.$emit('show::modal', 'broken-task-modal');
}, },
}, },

View File

@@ -1,5 +1,6 @@
<template lang="pug"> <template lang="pug">
.row.user-tasks-page .row.user-tasks-page
broken-task-modal
task-modal( task-modal(
:task="editingTask || creatingTask", :task="editingTask || creatingTask",
:purpose="creatingTask !== null ? 'create' : 'edit'", :purpose="creatingTask !== null ? 'create' : 'edit'",
@@ -289,6 +290,7 @@ import throttle from 'lodash/throttle';
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep';
import { mapState, mapActions } from 'client/libs/store'; import { mapState, mapActions } from 'client/libs/store';
import taskDefaults from 'common/script/libs/taskDefaults'; import taskDefaults from 'common/script/libs/taskDefaults';
import brokenTaskModal from './brokenTaskModal';
import Item from 'client/components/inventory/item.vue'; import Item from 'client/components/inventory/item.vue';
@@ -300,6 +302,7 @@ export default {
bDropdownItem, bDropdownItem,
Item, Item,
spells, spells,
brokenTaskModal,
}, },
directives: { directives: {
markdown, markdown,
@@ -412,6 +415,8 @@ export default {
}, },
createTask (type) { createTask (type) {
this.creatingTask = taskDefaults({type, text: ''}); this.creatingTask = taskDefaults({type, text: ''});
this.creatingTask.tags = this.selectedTags;
// Necessary otherwise the first time the modal is not rendered // Necessary otherwise the first time the modal is not rendered
Vue.nextTick(() => { Vue.nextTick(() => {
this.$root.$emit('show::modal', 'task-modal'); this.$root.$emit('show::modal', 'task-modal');

View File

@@ -29,4 +29,4 @@ export function setup () {
stripeScript.async = true; stripeScript.async = true;
stripeScript.src = '//checkout.stripe.com/v2/checkout.js'; stripeScript.src = '//checkout.stripe.com/v2/checkout.js';
firstScript.parentNode.insertBefore(stripeScript, firstScript); firstScript.parentNode.insertBefore(stripeScript, firstScript);
} }

View File

@@ -133,6 +133,7 @@ export default function () {
notificationStore: [], notificationStore: [],
modalStack: [], modalStack: [],
userIdToMessage: '', userIdToMessage: '',
brokenChallengeTask: {},
}, },
}); });

View File

@@ -391,5 +391,7 @@
"reverseChat": "Reverse Chat", "reverseChat": "Reverse Chat",
"invites": "Invites", "invites": "Invites",
"details": "Details", "details": "Details",
"participantDesc": "Once all members have either accepted or declined, the Quest begins. Only those that clicked 'accept' will be able to participate in the Quest and receive the drops." "participantDesc": "Once all members have either accepted or declined, the Quest begins. Only those that clicked 'accept' will be able to participate in the Quest and receive the drops.",
"groupGems": "Group Gems",
"groupGemsDesc": "Guild Gems can be spent to make Challenges! In the future, you will be able to add more Guild Gems."
} }

View File

@@ -22,7 +22,7 @@ module.exports = {
}, },
availableSpells: [ availableSpells: [
// 'spookySparkles', 'spookySparkles',
], ],
availableQuests: [ availableQuests: [