mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
* Added initial bailey api
* wip
* implement new panel header
* Fixed lint
* add ability to mark notification as seen
* add notification count, remove top badge from user and add ability to mark multiple notifications as seen
* add support dismissall and mark all as read
* do not dismiss actionable notif
* mark as seen when menu is opened instead of closed
* implement ordering, list of actionable notifications
* add groups messages and fix badges count
* add notifications for received cards
* send card received notification to target not sender
* rename notificaion field
* fix integration tests
* mark cards notifications as read and update tests
* add mystery items notifications
* add unallocated stats points notifications
* fix linting
* simplify code
* refactoring and fixes
* fix dropdown opening
* start splitting notifications into their own component
* add notifications for inbox messages
* fix unit tests
* fix default buttons styles
* add initial bailey support
* add title and tests to new stuff notification
* add notification if a group task needs more work
* add tests and fixes for marking a task as needing more work
* make sure user._v is updated
* remove console.log
* notification: hover status and margins
* start styling notifications, add separate files and basic functionalities
* fix tests
* start adding mystery items notification
* wip card notification
* fix cards text
* initial implementation inbox messages
* initial implementation group messages
* disable inbox notifications until mobile is ready
* wip group chat messages
* finish mystery and card notifications
* add bailey notification and fix a lot of stuff
* start adding guilds and parties invitations
* misc invitation fixes
* fix lint issues
* remove old code and add key to notifications
* fix tests
* remove unused code
* add link for public guilds invite
* starts to implement needs work notification design and feature
* fixes to needs work, add group task approved notification
* finish needs work feature
* lots of fixes
* implement quest notification
* bailey fixes and static page
* routing fixes
* fixes # this.$store.dispatch(guilds:join, {groupId: group.id, type: party});
* read notifications on click
* chat notifications
* fix tests for chat notifications
* fix chat notification test
* fix tests
* fix tests (again)
* try awaiting
* remove only
* more sleep
* add bailey tests
* fix icons alignment
* fix issue with multiple points notifications
* remove merge code
* fix rejecting guild invitation
* make remove area bigger
* fix error with notifications and add migration
* fix migration
* fix typos
* add cleanup migration too
* notifications empty state, new counter color, fix marking messages as seen in guilds
* fixes
* add image and install correct packages
* fix mongoose version
* update bailey
* typo
* make sure chat is marked as read after other requests
147 lines
4.9 KiB
Vue
147 lines
4.9 KiB
Vue
<template lang="pug">
|
|
b-modal#send-gems(:title="title", :hide-footer="true", size='lg')
|
|
.modal-body(v-if='userReceivingGems')
|
|
.panel.panel-default(
|
|
:class="gift.type === 'gems' ? 'panel-primary' : 'transparent'",
|
|
@click='gift.type = "gems"'
|
|
)
|
|
h3.panel-heading.clearfix
|
|
.float-right
|
|
span(v-if='gift.gems.fromBalance') {{ $t('sendGiftGemsBalance', {number: userLoggedIn.balance * 4}) }}
|
|
span(v-if='!gift.gems.fromBalance') {{ $t('sendGiftCost', {cost: gift.gems.amount / 4}) }}
|
|
| {{ $t('gemsPopoverTitle') }}
|
|
.panel-body
|
|
.row
|
|
.col-md-6
|
|
.form-group
|
|
input.form-control(type='number', placeholder='Number of Gems',
|
|
min='0', :max='gift.gems.fromBalance ? userLoggedIn.balance * 4 : 9999',
|
|
v-model='gift.gems.amount')
|
|
.col-md-6
|
|
.btn-group
|
|
button.btn.btn-secondary(:class="{active: gift.gems.fromBalance}", @click="gift.gems.fromBalance = true") {{ $t('sendGiftFromBalance') }}
|
|
button.btn.btn-secondary(:class="{active: !gift.gems.fromBalance}", @click="gift.gems.fromBalance = false") {{ $t('sendGiftPurchase') }}
|
|
.row
|
|
.col-md-12
|
|
p.small(v-html="$t('gemGiftsAreOptional', assistanceEmailObject)")
|
|
|
|
.panel.panel-default(
|
|
:class="gift.type=='subscription' ? 'panel-primary' : 'transparent'",
|
|
@click='gift.type = "subscription"'
|
|
)
|
|
h3.panel-heading {{ $t('subscription') }}
|
|
.panel-body
|
|
.form-group
|
|
.radio(v-for='block in subscriptionBlocks', v-if="block.target !== 'group' && block.canSubscribe === true")
|
|
label
|
|
input(type="radio", name="subRadio", :value="block.key", v-model='gift.subscription.key')
|
|
| {{ $t('sendGiftSubscription', {price: block.price, months: block.months}) }}
|
|
|
|
textarea.form-control(rows='3', v-model='gift.message', :placeholder="$t('sendGiftMessagePlaceholder')")
|
|
//include ../formatting-help
|
|
|
|
.modal-footer
|
|
button.btn.btn-primary(v-if='fromBal', @click='sendGift()') {{ $t("send") }}
|
|
template(v-else)
|
|
button.btn.btn-primary(@click='showStripe({gift, uuid: userReceivingGems._id})') {{ $t('card') }}
|
|
button.btn.btn-warning(@click='openPaypalGift({gift: gift, giftedTo: userReceivingGems._id})') PayPal
|
|
button.btn.btn-success(@click="amazonPaymentsInit({type: 'single', gift, giftedTo: userReceivingGems._id})") Amazon Payments
|
|
button.btn.btn-secondary(@click='close()') {{$t('cancel')}}
|
|
</template>
|
|
|
|
<style lang="scss">
|
|
.panel {
|
|
margin-bottom: 4px;
|
|
|
|
&.transparent {
|
|
.panel-body {
|
|
opacity: 0.7;
|
|
}
|
|
}
|
|
|
|
.panel-heading {
|
|
margin-top: 8px;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.panel-body {
|
|
padding: 8px;
|
|
border-radius: 2px;
|
|
border: 1px solid #C3C0C7;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
import toArray from 'lodash/toArray';
|
|
import omitBy from 'lodash/omitBy';
|
|
import orderBy from 'lodash/orderBy';
|
|
import { mapState } from 'client/libs/store';
|
|
import planGemLimits from '../../../common/script/libs/planGemLimits';
|
|
import paymentsMixin from 'client/mixins/payments';
|
|
import notificationsMixin from 'client/mixins/notifications';
|
|
|
|
// @TODO: EMAILS.TECH_ASSISTANCE_EMAIL, load from config
|
|
const TECH_ASSISTANCE_EMAIL = 'admin@habitica.com';
|
|
|
|
export default {
|
|
props: ['userReceivingGems'],
|
|
mixins: [paymentsMixin, notificationsMixin],
|
|
data () {
|
|
return {
|
|
planGemLimits,
|
|
gift: {
|
|
type: 'gems',
|
|
gems: {
|
|
amount: 0,
|
|
fromBalance: true,
|
|
},
|
|
subscription: {key: ''},
|
|
message: '',
|
|
},
|
|
amazonPayments: {},
|
|
assistanceEmailObject: {
|
|
hrefTechAssistanceEmail: `<a href="mailto:${TECH_ASSISTANCE_EMAIL}">${TECH_ASSISTANCE_EMAIL}</a>`,
|
|
},
|
|
};
|
|
},
|
|
computed: {
|
|
...mapState({
|
|
userLoggedIn: 'user.data',
|
|
originalSubscriptionBlocks: 'content.subscriptionBlocks',
|
|
}),
|
|
subscriptionBlocks () {
|
|
let subscriptionBlocks = toArray(this.originalSubscriptionBlocks);
|
|
subscriptionBlocks = omitBy(subscriptionBlocks, (block) => {
|
|
return block.discount === true;
|
|
});
|
|
subscriptionBlocks = orderBy(subscriptionBlocks, ['months']);
|
|
|
|
return subscriptionBlocks;
|
|
},
|
|
fromBal () {
|
|
return this.gift.type === 'gems' && this.gift.gems.fromBalance;
|
|
},
|
|
title () {
|
|
if (!this.userReceivingGems) return '';
|
|
return this.$t('sendGiftHeading', {name: this.userReceivingGems.profile.name});
|
|
},
|
|
},
|
|
methods: {
|
|
// @TODO move to payments mixin or action (problem is that we need notifications)
|
|
async sendGift () {
|
|
await this.$store.dispatch('members:transferGems', {
|
|
message: this.gift.message,
|
|
toUserId: this.userReceivingGems._id,
|
|
gemAmount: this.gift.gems.amount,
|
|
});
|
|
this.text(this.$t('sentGems'));
|
|
this.close();
|
|
},
|
|
close () {
|
|
this.$root.$emit('bv::hide::modal', 'send-gems');
|
|
},
|
|
},
|
|
};
|
|
</script>
|