Merge branch 'develop' into release

This commit is contained in:
Sabe Jones
2020-08-07 15:22:43 -05:00
79 changed files with 1046 additions and 497 deletions
@@ -74,6 +74,7 @@ export default {
setupAmazon () {
if (this.isAmazonSetup) return;
this.isAmazonSetup = true;
this.amazonLogout();
this.showButton();
},
showButton () {
@@ -2,8 +2,9 @@
<b-modal
id="amazon-payment"
title="Amazon"
:hide-footer="true"
size="md"
:hide-footer="true"
@hide="reset()"
>
<h2 class="text-center">
Continue with Amazon
@@ -58,10 +59,12 @@ import pick from 'lodash/pick';
import * as Analytics from '@/libs/analytics';
import { mapState } from '@/libs/store';
import { CONSTANTS, setLocalSetting } from '@/libs/userlocalManager';
import paymentsMixin from '@/mixins/payments';
const habiticaUrl = `${window.location.protocol}//${window.location.host}`;
export default {
mixins: [paymentsMixin],
data () {
return {
amazonPayments: {
@@ -201,6 +204,7 @@ export default {
}
setLocalSetting(CONSTANTS.savedAppStateValues.SAVED_APP_STATE, JSON.stringify(appState));
if (url) {
window.location.assign(url);
} else {
@@ -245,8 +249,6 @@ export default {
paymentType: 'Amazon',
});
this.$root.$emit('bv::hide::modal', 'amazon-payment');
const newGroup = response.data.data;
if (newGroup && newGroup._id) {
// Handle new user signup
@@ -275,6 +277,7 @@ export default {
this.storePaymentStatusAndReload();
} catch (e) {
this.$set(this, 'amazonButtonEnabled', true);
this.$root.$emit('bv::hide::modal', 'amazon-payment');
// @TODO: do we need this? this.amazonPaymentsreset();
}
}
+18 -20
View File
@@ -223,14 +223,14 @@
<div
v-if="task.type === 'todo' && task.date"
class="d-flex align-items-center"
:class="{'due-overdue': isDueOverdue}"
:class="{'due-overdue': checkIfOverdue() }"
>
<div
v-b-tooltip.hover.bottom="$t('dueDate')"
class="svg-icon calendar"
v-html="icons.calendar"
></div>
<span>{{ dueIn }}</span>
<span>{{ formatDueDate() }}</span>
</div>
<div class="icons-right d-flex justify-content-end">
<div
@@ -934,24 +934,6 @@ export default {
if (this.task.type === 'habit' && (this.task.up || this.task.down)) return true;
return false;
},
timeTillDue () {
// this.task && is necessary to make sure the computed property updates correctly
const endOfToday = moment().endOf('day');
const endOfDueDate = moment(this.task && this.task.date).endOf('day');
return moment.duration(endOfDueDate.diff(endOfToday));
},
isDueOverdue () {
return this.timeTillDue.asDays() <= 0;
},
dueIn () {
const dueIn = this.timeTillDue.asDays() === 0
? this.$t('today')
: this.timeTillDue.humanize(true);
// this.task && is necessary to make sure the computed property updates correctly
return this.task && this.task.date && this.$t('dueIn', { dueIn });
},
hasTags () {
return this.task.tags && this.task.tags.length > 0;
},
@@ -1001,6 +983,22 @@ export default {
item.completed = !item.completed; // @TODO this should go into the action?
this.scoreChecklistItem({ taskId: this.task._id, itemId: item.id });
},
calculateTimeTillDue () {
const endOfToday = moment().endOf('day');
const endOfDueDate = moment(this.task.date).endOf('day');
return moment.duration(endOfDueDate.diff(endOfToday));
},
checkIfOverdue () {
return this.calculateTimeTillDue().asDays() <= 0;
},
formatDueDate () {
const dueIn = this.calculateTimeTillDue().asDays() === 0
? this.$t('today')
: this.calculateTimeTillDue().humanize(true);
return this.task.date && this.$t('dueIn', { dueIn });
},
edit (e, task) {
if (this.isRunningYesterdailies || !this.showEdit) return;