mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-04 04:59:40 +00:00
commit 35fae86bf8498a21419a32f7cdfca7f521b85494
Author: Sabe Jones <sabrecat@gmail.com>
Date: Thu Apr 30 11:36:24 2020 -0500
fix(items): bouncy numbers
commit 3d32d8962060fc2561687bca5a4037c47e12ca04
Author: Sabe Jones <sabrecat@gmail.com>
Date: Thu Apr 30 09:36:52 2020 -0500
fix(badges): standardize box-shadow
commit 5f89f1a8db00ab7d1ea29b99c90c47c358ee9268
Author: Sabe Jones <sabrecat@gmail.com>
Date: Wed Apr 29 15:51:56 2020 -0500
fix(badges): standardize hover, box-shadow; fix equipment pills
commit 4eda06072a82f7a41de2fde6c9e1023e0e519b3c
Author: Sabe Jones <sabrecat@gmail.com>
Date: Tue Apr 28 13:24:04 2020 -0500
fix(badges): pill vs round
commit 7181af5cb8d552e82eb4f12bf98a31723669f16b
Author: Sabe Jones <sabrecat@gmail.com>
Date: Mon Apr 27 15:54:30 2020 -0500
fix(items): SVG nonsense
commit 95cfe28db0ec0a452ae6437b3a89c07b055a4092
Author: Sabe Jones <sabrecat@gmail.com>
Date: Fri Apr 24 12:35:00 2020 -0500
fix(items): don't apply "empty" to equipment
commit 5932b9e9fafc2afa914a36a91fcf4d03132f18a4
Author: Sabe Jones <sabrecat@gmail.com>
Date: Fri Apr 24 11:50:46 2020 -0500
refactor(pins): move pin badge to component and implement across site
commit 0533f6f79a8c51b506c2c1870bad529fccff9ae7
Author: Sabe Jones <sabrecat@gmail.com>
Date: Fri Apr 24 11:50:23 2020 -0500
fix(mounts): misaligned tigers
commit a74e64afa3e0ff7a032da3406f7787b4782cc7bf
Author: Sabe Jones <sabrecat@gmail.com>
Date: Fri Apr 24 06:17:53 2020 -0500
fix(svg): remove mask attributes
commit ae0f874fb6b708b4420d8b3ac18aa3b92dc2554c
Author: Sabe Jones <sabrecat@gmail.com>
Date: Thu Apr 23 18:11:13 2020 -0500
refactor(icons): standard freeze structure
commit 03c836313f91f761a1ae46d89b39625bd562d239
Author: Sabe Jones <sabrecat@gmail.com>
Date: Thu Apr 23 16:31:33 2020 -0500
WIP(styles): pin badge story
commit 661cf2a885a77fbc9edd8e84802354c282e86476
Merge: 34ec0b6c6a c4343379a1
Author: Sabe Jones <sabrecat@gmail.com>
Date: Thu Apr 23 14:48:22 2020 -0500
Merge branch 'develop' into sabrecat/quests-touchup
commit 34ec0b6c6ae3991665699aafc80d49d550a1661b
Author: Sabe Jones <sabrecat@gmail.com>
Date: Mon Apr 20 16:12:11 2020 -0500
fix(items): style bodges
commit 3bbe1e98e14e94d4e3de8bdcc192478fe5d7cd0d
Merge: 095674ac0f 13123c0bae
Author: Sabe Jones <sabrecat@gmail.com>
Date: Mon Apr 20 15:51:31 2020 -0500
Merge branch 'develop' into sabrecat/quests-touchup
commit 095674ac0fd462a8558d9de5469b7216be579411
Author: Sabe Jones <sabrecat@gmail.com>
Date: Tue Apr 7 12:27:03 2020 -0500
fix(markets): styling
commit 8ffb8080a7b07ab0e5e19215bc8a3ce0b77cd54e
Merge: 5d4b20cd4f 9ac7840940
Author: Sabe Jones <sabrecat@gmail.com>
Date: Tue Apr 7 09:49:16 2020 -0500
Merge branch 'develop' into sabrecat/quests-touchup
commit 5d4b20cd4f58c514ff788d5f64eb6398792c9583
Author: Sabe Jones <sabrecat@gmail.com>
Date: Thu Mar 26 15:01:05 2020 -0500
WIP(shops): item updates start
341 lines
7.1 KiB
Vue
341 lines
7.1 KiB
Vue
<template>
|
|
<div>
|
|
<div
|
|
:id="itemId"
|
|
class="item-wrapper"
|
|
@click="click()"
|
|
>
|
|
<div
|
|
class="item"
|
|
:class="getItemClasses()"
|
|
>
|
|
<slot
|
|
name="itemBadge"
|
|
:item="item"
|
|
:emptyItem="emptyItem"
|
|
></slot>
|
|
<span
|
|
v-if="item.event && item.owned == null && showEventBadge"
|
|
class="badge badge-round badge-item badge-clock"
|
|
>
|
|
<span
|
|
class="svg-icon inline clock"
|
|
v-html="icons.clock"
|
|
></span>
|
|
</span>
|
|
<span
|
|
v-if="item.locked"
|
|
class="svg-icon inline lock"
|
|
v-html="icons.lock"
|
|
></span>
|
|
<span
|
|
v-if="item.isSuggested"
|
|
class="suggestedDot"
|
|
></span>
|
|
<div class="image">
|
|
<div
|
|
v-once
|
|
:class="item.class"
|
|
></div>
|
|
<slot
|
|
name="itemImage"
|
|
:item="item"
|
|
></slot>
|
|
</div>
|
|
<div
|
|
class="price d-flex align-items-center justify-content-center"
|
|
:class="currencyClass"
|
|
>
|
|
<span
|
|
v-once
|
|
:class="{ 'w-0': currencyClass === 'unlock'}"
|
|
class="svg-icon inline icon-16 mr-1"
|
|
v-html="icons[currencyClass]"
|
|
></span>
|
|
<span
|
|
v-once
|
|
class="price-label"
|
|
:class="currencyClass"
|
|
>{{ getPrice() }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<b-popover
|
|
v-if="showPopover"
|
|
:target="itemId"
|
|
triggers="hover"
|
|
:placement="popoverPosition"
|
|
>
|
|
<slot
|
|
name="popoverContent"
|
|
:item="item"
|
|
>
|
|
<equipmentAttributesPopover
|
|
v-if="item.purchaseType === 'gear'"
|
|
:item="item"
|
|
/>
|
|
<div
|
|
v-else-if="item.purchaseType === 'quests'"
|
|
class="questPopover"
|
|
>
|
|
<h4 class="popover-content-title">
|
|
{{ item.text }}
|
|
</h4>
|
|
<questInfo :quest="item" />
|
|
</div>
|
|
<div v-else>
|
|
<h4
|
|
v-once
|
|
class="popover-content-title"
|
|
>
|
|
{{ item.text }}
|
|
</h4>
|
|
<div
|
|
v-if="showNotes && item.key !== 'armoire'"
|
|
v-once
|
|
class="popover-content-text"
|
|
>
|
|
{{ item.notes }}
|
|
</div>
|
|
<div
|
|
v-if="showNotes && item.key === 'armoire'"
|
|
class="popover-content-text"
|
|
>
|
|
{{ item.notes }}
|
|
</div>
|
|
</div>
|
|
<div
|
|
v-if="item.event"
|
|
:class="item.purchaseType === 'gear' ? 'mt-4' : 'mt-2'"
|
|
>
|
|
{{ limitedString }}
|
|
</div>
|
|
</slot>
|
|
</b-popover>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="scss" scoped>
|
|
@import '~@/assets/scss/colors.scss';
|
|
|
|
.item-wrapper {
|
|
z-index: 10;
|
|
}
|
|
|
|
.item {
|
|
height: 7.5rem;
|
|
width: 94px;
|
|
border-radius: 4px;
|
|
background-color: $white;
|
|
box-shadow: 0 1px 3px 0 rgba($black, 0.12), 0 1px 2px 0 rgba($black, 0.24);
|
|
cursor: pointer;
|
|
|
|
&.locked .price {
|
|
opacity: 0.5;
|
|
}
|
|
}
|
|
|
|
.image {
|
|
margin: 12px 13px;
|
|
}
|
|
|
|
.price {
|
|
height: 1.75rem;
|
|
width: 94px;
|
|
margin-left: -1px;
|
|
margin-right: -1px;
|
|
border-radius: 0px 0px 4px 4px;
|
|
|
|
&.gems {
|
|
background-color: rgba($green-100, 0.15);
|
|
}
|
|
|
|
&.gold {
|
|
background-color: rgba($yellow-100, 0.15);
|
|
}
|
|
|
|
&.hourglasses {
|
|
background-color: rgba($blue-50, 0.15);
|
|
}
|
|
|
|
&.unlock {
|
|
background-color: rgba($gray-400, 0.15);
|
|
}
|
|
}
|
|
|
|
.price-label {
|
|
font-family: Roboto;
|
|
font-size: 12px;
|
|
font-weight: bold;
|
|
line-height: 1.33;
|
|
|
|
&.gems {
|
|
color: $green-1;
|
|
}
|
|
|
|
&.gold {
|
|
color: $yellow-1;
|
|
}
|
|
|
|
&.unlock {
|
|
color: $gray-100;
|
|
}
|
|
|
|
&.hourglasses {
|
|
color: $blue-1;
|
|
}
|
|
}
|
|
|
|
span.svg-icon.inline.lock {
|
|
height: 12px;
|
|
width: 10px;
|
|
position: absolute;
|
|
right: 8px;
|
|
top: 8px;
|
|
margin-top: 0;
|
|
color: $gray-200;
|
|
}
|
|
|
|
span.badge.badge-round.badge-item.badge-clock {
|
|
height: 24px;
|
|
width: 24px;
|
|
background-color: $purple-300;
|
|
position: absolute;
|
|
left: -8px;
|
|
top: -12px;
|
|
margin-top: 0;
|
|
padding: 4px;
|
|
}
|
|
|
|
span.svg-icon.inline.clock {
|
|
height: 16px;
|
|
width: 16px;
|
|
}
|
|
|
|
.suggestedDot {
|
|
width: 6px;
|
|
height: 6px;
|
|
background-color: $purple-400;
|
|
border-radius: 4px;
|
|
|
|
position: absolute;
|
|
right: 8px;
|
|
top: 8px;
|
|
margin-top: 0;
|
|
}
|
|
|
|
.icon-48 {
|
|
width: 48px;
|
|
height: 48px;
|
|
}
|
|
|
|
.w-0 {
|
|
width: 0rem;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
import uuid from 'uuid';
|
|
|
|
import moment from 'moment';
|
|
import svgGem from '@/assets/svg/gem.svg';
|
|
import svgGold from '@/assets/svg/gold.svg';
|
|
import svgHourglasses from '@/assets/svg/hourglass.svg';
|
|
import svgLock from '@/assets/svg/lock.svg';
|
|
import svgClock from '@/assets/svg/clock.svg';
|
|
|
|
import EquipmentAttributesPopover from '@/components/inventory/equipment/attributesPopover';
|
|
|
|
import QuestInfo from './quests/questInfo.vue';
|
|
|
|
import seasonalShopConfig from '@/../../common/script/libs/shops-seasonal.config';
|
|
|
|
export default {
|
|
components: {
|
|
EquipmentAttributesPopover,
|
|
QuestInfo,
|
|
},
|
|
props: {
|
|
item: {
|
|
type: Object,
|
|
},
|
|
price: {
|
|
type: Number,
|
|
default: -1,
|
|
},
|
|
emptyItem: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
highlightBorder: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
popoverPosition: {
|
|
type: String,
|
|
default: 'bottom',
|
|
},
|
|
showPopover: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
showEventBadge: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
owned: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
},
|
|
data () {
|
|
return Object.freeze({
|
|
itemId: uuid.v4(),
|
|
icons: {
|
|
gems: svgGem,
|
|
gold: svgGold,
|
|
lock: svgLock,
|
|
hourglasses: svgHourglasses,
|
|
clock: svgClock,
|
|
},
|
|
});
|
|
},
|
|
computed: {
|
|
showNotes () {
|
|
if (['armoire', 'potion'].indexOf(this.item.path) > -1) return true;
|
|
return false;
|
|
},
|
|
currencyClass () {
|
|
if (this.item.unlockCondition && this.item.unlockCondition.condition === 'party invite' && !this.owned) return 'unlock';
|
|
if (this.item.currency && this.icons[this.item.currency]) {
|
|
return this.item.currency;
|
|
}
|
|
return 'gold';
|
|
},
|
|
limitedString () {
|
|
return this.item.owned === false ? ''
|
|
: this.$t('limitedOffer', { date: moment(seasonalShopConfig.dateRange.end).format('LL') });
|
|
},
|
|
},
|
|
methods: {
|
|
click () {
|
|
this.$emit('click', {});
|
|
},
|
|
getPrice () {
|
|
if (this.item.unlockCondition && this.item.unlockCondition.condition === 'party invite' && !this.owned) return this.item.unlockCondition.text();
|
|
if (this.price === -1) {
|
|
return this.item.value;
|
|
}
|
|
return this.price;
|
|
},
|
|
getItemClasses () {
|
|
return {
|
|
'item-empty': this.emptyItem,
|
|
'highlight-border': this.highlightBorder,
|
|
suggested: this.item.isSuggested,
|
|
locked: this.item.locked,
|
|
};
|
|
},
|
|
},
|
|
};
|
|
</script>
|