mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
lint main level components and js files
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-12 text-center">
|
||||
<!-- eslint-disable max-len -->
|
||||
<svg
|
||||
id="melior"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@@ -17,6 +18,7 @@
|
||||
fill="#fff"
|
||||
></path>
|
||||
</svg>
|
||||
<!-- eslint-enable max-len -->
|
||||
</div>
|
||||
<div class="col-12 text-center">
|
||||
<h2>{{ $t('tipTitle', {tipNumber: currentTipNumber}) }}</h2>
|
||||
|
||||
@@ -484,14 +484,12 @@ import facebook from '@/assets/svg/facebook.svg';
|
||||
import instagram from '@/assets/svg/instagram.svg';
|
||||
import heart from '@/assets/svg/heart.svg';
|
||||
|
||||
import modifyInventory from './modifyInventory';
|
||||
import buyGemsModal from './payments/buyGemsModal';
|
||||
|
||||
const IS_PRODUCTION = process.env.NODE_ENV === 'production'; // eslint-disable-line no-process-env
|
||||
|
||||
export default {
|
||||
components: {
|
||||
modifyInventory,
|
||||
buyGemsModal,
|
||||
},
|
||||
data () {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<template v-for="(klass, item) in visualBuffs">
|
||||
<span
|
||||
v-if="member.stats.buffs[item] && showVisualBuffs"
|
||||
:key="item"
|
||||
:class="klass"
|
||||
></span>
|
||||
</template>
|
||||
@@ -31,17 +32,25 @@
|
||||
<span :class="['chair_' + member.preferences.chair, specialMountClass]"></span>
|
||||
<span :class="[getGearClass('back'), specialMountClass]"></span>
|
||||
<span :class="[skinClass, specialMountClass]"></span>
|
||||
<!-- eslint-disable max-len-->
|
||||
<span
|
||||
:class="[member.preferences.size + '_shirt_' + member.preferences.shirt, specialMountClass]"
|
||||
></span>
|
||||
<!-- eslint-enable max-len-->
|
||||
<span :class="['head_0', specialMountClass]"></span>
|
||||
<!-- eslint-disable max-len-->
|
||||
<span :class="[member.preferences.size + '_' + getGearClass('armor'), specialMountClass]"></span>
|
||||
<!-- eslint-enable max-len-->
|
||||
<span :class="[getGearClass('back_collar'), specialMountClass]"></span>
|
||||
<template v-for="type in ['bangs', 'base', 'mustache', 'beard']">
|
||||
<!-- eslint-disable-next-line max-len-->
|
||||
<template
|
||||
v-for="type in ['bangs', 'base', 'mustache', 'beard']"
|
||||
>
|
||||
<!-- eslint-disable max-len-->
|
||||
<span
|
||||
:key="type"
|
||||
:class="['hair_' + type + '_' + member.preferences.hair[type] + '_' + member.preferences.hair.color, specialMountClass]"
|
||||
></span>
|
||||
<!-- eslint-enable max-len-->
|
||||
</template>
|
||||
<span :class="[getGearClass('body'), specialMountClass]"></span>
|
||||
<span :class="[getGearClass('eyewear'), specialMountClass]"></span>
|
||||
|
||||
@@ -170,7 +170,6 @@
|
||||
import Avatar from './avatar';
|
||||
import ClassBadge from './members/classBadge';
|
||||
import { mapState } from '@/libs/store';
|
||||
import Profile from './userMenu/profile';
|
||||
import StatsBar from './ui/statsbar';
|
||||
|
||||
import { toNextLevel } from '@/../../common/script/statHelpers';
|
||||
@@ -185,7 +184,6 @@ import manaIcon from '@/assets/svg/mana.svg';
|
||||
export default {
|
||||
components: {
|
||||
Avatar,
|
||||
Profile,
|
||||
ClassBadge,
|
||||
StatsBar,
|
||||
},
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<!-- eslint-disable -->
|
||||
<!-- TODO re-enable when used again -->
|
||||
<template>
|
||||
<b-modal
|
||||
v-if="user.profile"
|
||||
|
||||
@@ -102,7 +102,6 @@ import notifications from '@/mixins/notifications';
|
||||
import guide from '@/mixins/guide';
|
||||
|
||||
import yesterdailyModal from './yesterdailyModal';
|
||||
import welcomeModal from './achievements/welcome';
|
||||
import newStuff from './achievements/newStuff';
|
||||
import death from './achievements/death';
|
||||
import lowHealth from './achievements/lowHealth';
|
||||
@@ -188,7 +187,6 @@ export default {
|
||||
joinedGuild,
|
||||
joinedChallenge,
|
||||
invitedFriend,
|
||||
welcomeModal,
|
||||
newStuff,
|
||||
death,
|
||||
lowHealth,
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
</div>
|
||||
<div
|
||||
v-for="member in sortedMembers"
|
||||
:key="member._id"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-10">
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import round from './round';
|
||||
|
||||
function _convertToThousand (num) {
|
||||
return `${(num / Math.pow(10, 3)).toFixed(1)}k`;
|
||||
return `${(num / (10 ** 3)).toFixed(1)}k`;
|
||||
}
|
||||
|
||||
function _convertToMillion (num) {
|
||||
return `${(num / Math.pow(10, 6)).toFixed(1)}m`;
|
||||
return `${(num / (10 ** 6)).toFixed(1)}m`;
|
||||
}
|
||||
|
||||
function _convertToBillion (num) {
|
||||
return `${(num / Math.pow(10, 9)).toFixed(1)}b`;
|
||||
return `${(num / (10 ** 9)).toFixed(1)}b`;
|
||||
}
|
||||
|
||||
export default function roundBigNumber (num) {
|
||||
|
||||
@@ -26,17 +26,23 @@ const ALLOWED_HIT_TYPES = [
|
||||
function _doesNotHaveRequiredFields (properties) {
|
||||
if (!isEqual(keys(pick(properties, REQUIRED_FIELDS)), REQUIRED_FIELDS)) {
|
||||
// @TODO: Log with Winston?
|
||||
// console.log('Analytics tracking calls must include the following properties: ' + JSON.stringify(REQUIRED_FIELDS));
|
||||
// console.log('Analytics tracking calls must include
|
||||
// the following properties: ' + JSON.stringify(REQUIRED_FIELDS));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _doesNotHaveAllowedHitType (properties) {
|
||||
if (!includes(ALLOWED_HIT_TYPES, properties.hitType)) {
|
||||
// @TODO: Log with Winston?
|
||||
// console.log('Hit type of Analytics event must be one of the following: ' + JSON.stringify(ALLOWED_HIT_TYPES));
|
||||
// console.log('Hit type of Analytics event must be one
|
||||
// of the following: ' + JSON.stringify(ALLOWED_HIT_TYPES));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _gatherUserStats (properties) {
|
||||
@@ -79,19 +85,17 @@ export function setUser () {
|
||||
export function track (properties) {
|
||||
// Use nextTick to avoid blocking the UI
|
||||
Vue.nextTick(() => {
|
||||
if (_doesNotHaveRequiredFields(properties)) return false;
|
||||
if (_doesNotHaveAllowedHitType(properties)) return false;
|
||||
if (_doesNotHaveRequiredFields(properties)) return;
|
||||
if (_doesNotHaveAllowedHitType(properties)) return;
|
||||
|
||||
amplitude.getInstance().logEvent(properties.eventAction, properties);
|
||||
window.ga('send', properties);
|
||||
});
|
||||
}
|
||||
|
||||
export function updateUser (properties) {
|
||||
export function updateUser (properties = {}) {
|
||||
// Use nextTick to avoid blocking the UI
|
||||
Vue.nextTick(() => {
|
||||
properties = properties || {};
|
||||
|
||||
_gatherUserStats(properties);
|
||||
|
||||
forEach(properties, (value, key) => {
|
||||
@@ -127,7 +131,7 @@ export function load () {
|
||||
let firstScript = document.getElementsByTagName('script')[0];
|
||||
// Google Analytics
|
||||
const gaScript = document.createElement('script');
|
||||
firstScript = document.getElementsByTagName('script')[0];
|
||||
[firstScript] = document.getElementsByTagName('script');
|
||||
gaScript.async = 1;
|
||||
gaScript.src = '//www.google-analytics.com/analytics.js';
|
||||
firstScript.parentNode.insertBefore(gaScript, firstScript);
|
||||
|
||||
@@ -3,9 +3,9 @@ import moment from 'moment';
|
||||
|
||||
export function setUpAxios (AUTH_SETTINGS) { // eslint-disable-line import/prefer-default-export
|
||||
if (!AUTH_SETTINGS) {
|
||||
AUTH_SETTINGS = localStorage.getItem('habit-mobile-settings');
|
||||
AUTH_SETTINGS = localStorage.getItem('habit-mobile-settings'); // eslint-disable-line no-param-reassign, max-len
|
||||
if (!AUTH_SETTINGS) return false;
|
||||
AUTH_SETTINGS = JSON.parse(AUTH_SETTINGS);
|
||||
AUTH_SETTINGS = JSON.parse(AUTH_SETTINGS); // eslint-disable-line no-param-reassign
|
||||
}
|
||||
|
||||
const browserTimezoneOffset = moment().zone();
|
||||
|
||||
@@ -6,7 +6,7 @@ export default function deepFreeze (obj) {
|
||||
const propNamesLength = propNames.length;
|
||||
|
||||
// Freeze properties before freezing self
|
||||
for (let i = 0; i < propNamesLength; i++) {
|
||||
for (let i = 0; i < propNamesLength; i += 1) {
|
||||
const prop = obj[propNames[i]];
|
||||
|
||||
// Freeze prop if it is an object
|
||||
|
||||
@@ -6,11 +6,11 @@ const optionalPostMentionRegExStr = '(\\.\\w+)?'; // like dot-TLD
|
||||
|
||||
const finalMentionRegEx = new RegExp(`${optionalAnchorTagRegExStr}${mentionRegExStr}${optionalPostMentionRegExStr}`, 'gi');
|
||||
|
||||
export function highlightUsers (text, userName, displayName) { // eslint-disable-line import/prefer-default-export
|
||||
export function highlightUsers (text, userName, displayName) { // eslint-disable-line import/prefer-default-export, max-len
|
||||
const currentUser = [`@${userName}`, `@${displayName}`].map(escapeRegExp);
|
||||
|
||||
text = text.replace(finalMentionRegEx, (fullMatched, preMention, mentionStr, postMention) => {
|
||||
if (preMention && preMention.includes('<a') || Boolean(postMention)) {
|
||||
text = text.replace(finalMentionRegEx, (fullMatched, preMention, mentionStr, postMention) => { // eslint-disable-line no-param-reassign, max-len
|
||||
if ((preMention && preMention.includes('<a')) || Boolean(postMention)) {
|
||||
return fullMatched;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
Vue.prototype.$t = function translateString () {
|
||||
return i18n.t.apply(null, arguments);
|
||||
Vue.prototype.$t = function translateString (...args) {
|
||||
return i18n.t.apply(null, ...args);
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -9,6 +9,8 @@ function getApiKey () {
|
||||
return AUTH_SETTINGS.auth.apiToken;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export function goToModForm (user) { // eslint-disable-line import/prefer-default-export
|
||||
@@ -18,8 +20,7 @@ export function goToModForm (user) { // eslint-disable-line import/prefer-defaul
|
||||
if (!apiKey) return;
|
||||
|
||||
const tenMins = 10 * 60 * 1000;
|
||||
let dateTime;
|
||||
dateTime = new Date();
|
||||
const dateTime = new Date();
|
||||
dateTime.setTime(dateTime.getTime() + tenMins);
|
||||
const expires = `expires=${dateTime.toGMTString()}`;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export function setup () { // eslint-disable-line import/prefer-default-export
|
||||
|
||||
// Stripe
|
||||
const stripeScript = document.createElement('script');
|
||||
firstScript = document.getElementsByTagName('script')[0];
|
||||
[firstScript] = document.getElementsByTagName('script');
|
||||
stripeScript.async = true;
|
||||
stripeScript.src = '//checkout.stripe.com/v2/checkout.js';
|
||||
firstScript.parentNode.insertBefore(stripeScript, firstScript);
|
||||
|
||||
@@ -23,7 +23,9 @@ export const avatarEditorUtilies = { // eslint-disable-line import/prefer-defaul
|
||||
return moment(appearanceSets[set.key].availableUntil).isBefore(moment());
|
||||
},
|
||||
mapKeysToFreeOption (key, type, subType) {
|
||||
const userPreference = subType ? this.user.preferences[type][subType] : this.user.preferences[type];
|
||||
const userPreference = subType
|
||||
? this.user.preferences[type][subType]
|
||||
: this.user.preferences[type];
|
||||
const pathKey = subType ? `${type}.${subType}` : `${type}`;
|
||||
|
||||
const option = {};
|
||||
@@ -37,7 +39,9 @@ export const avatarEditorUtilies = { // eslint-disable-line import/prefer-defaul
|
||||
mapKeysToOption (key, type, subType, set) {
|
||||
const option = this.mapKeysToFreeOption(key, type, subType);
|
||||
|
||||
const userPurchased = subType ? this.user.purchased[type][subType] : this.user.purchased[type];
|
||||
const userPurchased = subType
|
||||
? this.user.purchased[type][subType]
|
||||
: this.user.purchased[type];
|
||||
const locked = !userPurchased || !userPurchased[key];
|
||||
let hide = false;
|
||||
|
||||
@@ -90,7 +94,11 @@ export const avatarEditorUtilies = { // eslint-disable-line import/prefer-defaul
|
||||
|
||||
setKeys.forEach(key => {
|
||||
if (subType) {
|
||||
if (!this.user.purchased[type] || !this.user.purchased[type][subType] || !this.user.purchased[type][subType][key]) owns = false;
|
||||
if (
|
||||
!this.user.purchased[type]
|
||||
|| !this.user.purchased[type][subType]
|
||||
|| !this.user.purchased[type][subType][key]
|
||||
) owns = false;
|
||||
return;
|
||||
}
|
||||
if (!this.user.purchased[type][key]) owns = false;
|
||||
@@ -106,8 +114,10 @@ export const avatarEditorUtilies = { // eslint-disable-line import/prefer-defaul
|
||||
},
|
||||
/**
|
||||
* For gem-unlockable preferences, (a) if owned, select preference (b) else, purchase
|
||||
* @param path: User.preferences <-> User.purchased maps like User.preferences.skin=abc <-> User.purchased.skin.abc.
|
||||
* Pass in this paramater as "skin.abc". Alternatively, pass as an array ["skin.abc", "skin.xyz"] to unlock sets
|
||||
* @param path: User.preferences <-> User.purchased maps like
|
||||
*User.preferences.skin=abc <-> User.purchased.skin.abc.
|
||||
* Pass in this paramater as "skin.abc". Alternatively, pass as an
|
||||
* array ["skin.abc", "skin.xyz"] to unlock sets
|
||||
*/
|
||||
async unlock (path) {
|
||||
const fullSet = path.indexOf(',') !== -1;
|
||||
@@ -132,11 +142,11 @@ export const avatarEditorUtilies = { // eslint-disable-line import/prefer-defaul
|
||||
|
||||
if (loginIncentives.indexOf(path) === -1) {
|
||||
if (fullSet) {
|
||||
if (confirm(this.$t('purchaseFor', { cost: cost * 4 })) !== true) return;
|
||||
if (window.confirm(this.$t('purchaseFor', { cost: cost * 4 })) !== true) return;
|
||||
// @TODO: implement gem modal
|
||||
// if (this.user.balance < cost) return $rootScope.openModal('buyGems');
|
||||
} else if (!get(this.user, `purchased.${path}`)) {
|
||||
if (confirm(this.$t('purchaseFor', { cost: cost * 4 })) !== true) return;
|
||||
if (window.confirm(this.$t('purchaseFor', { cost: cost * 4 })) !== true) return;
|
||||
// @TODO: implement gem modal
|
||||
// if (this.user.balance < cost) return $rootScope.openModal('buyGems');
|
||||
}
|
||||
@@ -151,7 +161,7 @@ export const avatarEditorUtilies = { // eslint-disable-line import/prefer-defaul
|
||||
});
|
||||
this.backgroundUpdate = new Date();
|
||||
} catch (e) {
|
||||
alert(e.message);
|
||||
window.alert(e.message);
|
||||
}
|
||||
},
|
||||
async buy (item) {
|
||||
@@ -169,7 +179,7 @@ export const avatarEditorUtilies = { // eslint-disable-line import/prefer-defaul
|
||||
});
|
||||
this.backgroundUpdate = new Date();
|
||||
} catch (e) {
|
||||
alert(e.message);
|
||||
window.alert(e.message);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -39,7 +39,7 @@ export default {
|
||||
};
|
||||
|
||||
const purchaseForKey = currencyToPurchaseForKey[currency];
|
||||
return confirm(this.$t(purchaseForKey, { cost }));
|
||||
return window.confirm(this.$t(purchaseForKey, { cost }));
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -5,21 +5,21 @@ export default {
|
||||
// https://stackoverflow.com/questions/2685911/is-there-a-way-to-round-numbers-into-a-reader-friendly-format-e-g-1-1k
|
||||
abbrNum: number => {
|
||||
let decPlaces = 1;
|
||||
decPlaces = Math.pow(10, decPlaces);
|
||||
decPlaces = 10 ** decPlaces;
|
||||
|
||||
const abbrev = ['k', 'm', 'b', 't'];
|
||||
for (let i = abbrev.length - 1; i >= 0; i--) {
|
||||
const size = Math.pow(10, (i + 1) * 3);
|
||||
for (let i = abbrev.length - 1; i >= 0; i -= 1) {
|
||||
const size = 10 ** ((i + 1) * 3);
|
||||
|
||||
if (size <= number) {
|
||||
number = Math.floor(number * decPlaces / size) / decPlaces;
|
||||
number = Math.floor((number * decPlaces) / size) / decPlaces; // eslint-disable-line no-param-reassign, max-len
|
||||
|
||||
if (number === 1000 && i < abbrev.length - 1) {
|
||||
number = 1;
|
||||
i++;
|
||||
number = 1; // eslint-disable-line no-param-reassign
|
||||
i += 1;
|
||||
}
|
||||
|
||||
number += abbrev[i];
|
||||
number += abbrev[i]; // eslint-disable-line no-param-reassign
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ export default {
|
||||
]],
|
||||
};
|
||||
|
||||
for (const key in this.chapters) {
|
||||
for (const key of Object.keys(this.chapters)) {
|
||||
const chapter = this.chapters[key][0][0];
|
||||
chapter.intro = `
|
||||
<div class='featured-label'>
|
||||
@@ -126,7 +126,8 @@ export default {
|
||||
},
|
||||
routeChange () {
|
||||
this.initTour();
|
||||
switch (this.$route.name) {
|
||||
|
||||
switch (this.$route.name) { // eslint-disable-line default-case
|
||||
// case 'options.profile.avatar': return goto('intro', 5);
|
||||
case 'stats': return this.goto('stats', 0);
|
||||
case 'tavern': return this.goto('tavern', 0);
|
||||
@@ -139,6 +140,8 @@ export default {
|
||||
// @TODO: same page now case 'stable': return this.goto('mounts', 0);
|
||||
case 'equipment': return this.goto('equipment', 0);
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
hoyo (user) {
|
||||
// @TODO: What is was the timeout for?
|
||||
@@ -151,13 +154,13 @@ export default {
|
||||
// @TODO: Add dispatch User.set({'flags.welcomed': true});
|
||||
}
|
||||
if (chapter === 'classes' && this.user.flags.tour.classes === -2) return;
|
||||
if (page === -1) page = 0;
|
||||
if (page === -1) page = 0; // eslint-disable-line no-param-reassign
|
||||
const curr = this.user.flags.tour[chapter];
|
||||
if (page !== curr + 1 && !force) return;
|
||||
|
||||
const opts = {}; // @TODO: chap._options;
|
||||
opts.steps = [];
|
||||
page += 1;
|
||||
page += 1; // eslint-disable-line no-param-reassign
|
||||
times(page, p => {
|
||||
opts.steps = opts.steps.concat(this.chapters[chapter][p]);
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import { CONSTANTS, setLocalSetting } from '@/libs/userlocalManager';
|
||||
|
||||
const { STRIPE_PUB_KEY } = process.env;
|
||||
|
||||
const habiticaUrl = `${location.protocol}//${location.host}`;
|
||||
const habiticaUrl = `${window.location.protocol}//${window.location.host}`;
|
||||
|
||||
export default {
|
||||
mixins: [notificationsMixin],
|
||||
@@ -33,8 +33,11 @@ export default {
|
||||
return `/paypal/subscribe?sub=${this.subscription.key}${couponString}`;
|
||||
},
|
||||
dateTerminated () {
|
||||
if (!this.user.preferences || !this.user.preferences.dateFormat) return this.user.purchased.plan.dateTerminated;
|
||||
return moment(this.user.purchased.plan.dateTerminated).format(this.user.preferences.dateFormat.toUpperCase());
|
||||
if (!this.user.preferences || !this.user.preferences.dateFormat) {
|
||||
return this.user.purchased.plan.dateTerminated;
|
||||
}
|
||||
return moment(this.user.purchased.plan.dateTerminated)
|
||||
.format(this.user.preferences.dateFormat.toUpperCase());
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
@@ -96,7 +99,7 @@ export default {
|
||||
|
||||
let amount = 500; // 500 = $5
|
||||
if (sub) amount = sub.price * 100;
|
||||
if (data.gift && data.gift.type === 'gems') amount = data.gift.gems.amount / 4 * 100;
|
||||
if (data.gift && data.gift.type === 'gems') amount = (data.gift.gems.amount / 4) * 100;
|
||||
if (data.group) amount = (sub.price + 3 * (data.group.memberCount - 1)) * 100;
|
||||
|
||||
let paymentType;
|
||||
@@ -133,7 +136,7 @@ export default {
|
||||
// @TODO handle with normal notifications?
|
||||
const responseStatus = response.status;
|
||||
if (responseStatus >= 400) {
|
||||
alert(`Error: ${response.message}`);
|
||||
window.alert(`Error: ${response.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -214,7 +217,7 @@ export default {
|
||||
// Success
|
||||
window.location.reload(true);
|
||||
// error
|
||||
alert(response.message);
|
||||
window.alert(response.message);
|
||||
},
|
||||
});
|
||||
},
|
||||
@@ -257,7 +260,7 @@ export default {
|
||||
this.amazonPayments.type = data.type;
|
||||
},
|
||||
amazonOnError (error) {
|
||||
alert(error.getErrorMessage());
|
||||
window.alert(error.getErrorMessage());
|
||||
this.reset();
|
||||
},
|
||||
reset () {
|
||||
@@ -291,7 +294,9 @@ export default {
|
||||
group = config.group;
|
||||
}
|
||||
|
||||
let paymentMethod = group ? group.purchased.plan.paymentMethod : this.user.purchased.plan.paymentMethod;
|
||||
let paymentMethod = group
|
||||
? group.purchased.plan.paymentMethod
|
||||
: this.user.purchased.plan.paymentMethod;
|
||||
paymentMethod = paymentMethod === 'Amazon Payments' ? 'amazon' : paymentMethod.toLowerCase();
|
||||
|
||||
const queryParams = {
|
||||
@@ -322,7 +327,7 @@ export default {
|
||||
|
||||
this.loading = false;
|
||||
} catch (e) {
|
||||
alert(e.response.data.message);
|
||||
window.alert(e.response.data.message);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -26,7 +26,9 @@ export default {
|
||||
|
||||
if (spell.target === 'self') {
|
||||
return this.castEnd(null, spell.target);
|
||||
} if (spell.target === 'party') {
|
||||
}
|
||||
|
||||
if (spell.target === 'party') {
|
||||
if (!this.user.party._id) {
|
||||
const party = [this.user];
|
||||
return this.castEnd(party, spell.target);
|
||||
@@ -36,8 +38,10 @@ export default {
|
||||
if (!isArray(partyMembers)) {
|
||||
partyMembers = [this.user];
|
||||
}
|
||||
this.castEnd(partyMembers, spell.target);
|
||||
} else if (spell.target === 'tasks') {
|
||||
return this.castEnd(partyMembers, spell.target);
|
||||
}
|
||||
|
||||
if (spell.target === 'tasks') {
|
||||
const userTasks = this.$store.state.tasks.data;
|
||||
// exclude rewards
|
||||
let tasks = userTasks.habits
|
||||
@@ -50,7 +54,9 @@ export default {
|
||||
return true;
|
||||
});
|
||||
return this.castEnd(tasks, spell.target);
|
||||
} else if (spell.target === 'user') {
|
||||
}
|
||||
|
||||
if (spell.target === 'user') {
|
||||
const result = await this.castEnd(member, spell.target);
|
||||
|
||||
if (member.id === this.user.id) {
|
||||
@@ -58,7 +64,8 @@ export default {
|
||||
}
|
||||
|
||||
return result;
|
||||
} else {
|
||||
}
|
||||
|
||||
// If the cast target has to be selected (and can be cancelled)
|
||||
document.addEventListener('keyup', this.handleCastCancelKeyUp);
|
||||
|
||||
@@ -67,7 +74,6 @@ export default {
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
},
|
||||
async castEnd (target, type) {
|
||||
if (!this.$store.state.spellOptions.castingSpell) return null;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
export default {
|
||||
methods: {
|
||||
userLevelStyle (user, style) {
|
||||
style = style || '';
|
||||
style = style || ''; // eslint-disable-line no-param-reassign, max-len
|
||||
const npc = user && user.backer && user.backer.npc ? user.backer.npc : '';
|
||||
const level = user && user.contributor && user.contributor.level ? user.contributor.level : '';
|
||||
style += this.userLevelStyleFromLevel(level, npc, style);
|
||||
style += this.userLevelStyleFromLevel(level, npc, style); // eslint-disable-line no-param-reassign, max-len
|
||||
return style;
|
||||
},
|
||||
userLevelStyleFromLevel (level, npc, style) {
|
||||
style = style || '';
|
||||
if (npc) style += ' npc';
|
||||
style += level ? ` tier${level}` : ' no-tier';
|
||||
style = style || ''; // eslint-disable-line no-param-reassign, max-len
|
||||
if (npc) style += ' npc'; // eslint-disable-line no-param-reassign, max-len
|
||||
style += level ? ` tier${level}` : ' no-tier'; // eslint-disable-line no-param-reassign, max-len
|
||||
|
||||
return style;
|
||||
},
|
||||
|
||||
@@ -430,7 +430,7 @@ router.beforeEach((to, from, next) => {
|
||||
router.app.$root.$emit('bv::hide::modal', 'profile');
|
||||
}
|
||||
|
||||
next();
|
||||
return next();
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -59,7 +59,7 @@ export async function join (store, payload) {
|
||||
try {
|
||||
response = await axios.post(`/api/v4/groups/${groupId}/join`);
|
||||
} catch (err) {
|
||||
alert(err.response.data.message);
|
||||
window.alert(err.response.data.message);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user