diff --git a/website/client/src/components/avatarModal/body-settings.vue b/website/client/src/components/avatarModal/body-settings.vue index b69118c890..01baf53f96 100644 --- a/website/client/src/components/avatarModal/body-settings.vue +++ b/website/client/src/components/avatarModal/body-settings.vue @@ -1,7 +1,7 @@ @@ -36,16 +30,14 @@ import appearance from '@/../../common/script/content/appearance'; import { subPageMixin } from '../../mixins/subPage'; import { userStateMixin } from '../../mixins/userState'; import { avatarEditorUtilities } from '../../mixins/avatarEditUtilities'; -import subMenu from './sub-menu'; +import customizeBanner from './customize-banner.vue'; import customizeOptions from './customize-options'; -import gem from '@/assets/svg/gem.svg'; - -const freeShirtKeys = Object.keys(appearance.shirt).filter(k => appearance.shirt[k].price === 0); -const specialShirtKeys = Object.keys(appearance.shirt).filter(k => appearance.shirt[k].price !== 0); +import subMenu from './sub-menu'; export default { components: { subMenu, + customizeBanner, customizeOptions, }, mixins: [ @@ -58,10 +50,6 @@ export default { ], data () { return { - specialShirtKeys, - icons: Object.freeze({ - gem, - }), items: [ { id: 'size', @@ -78,25 +66,19 @@ export default { sizes () { return ['slim', 'broad'].map(s => this.mapKeysToFreeOption(s, 'size')); }, - freeShirts () { - return freeShirtKeys.map(s => this.mapKeysToFreeOption(s, 'shirt')); - }, - specialShirts () { - let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line - const keys = this.specialShirtKeys; - const options = keys.map(key => this.mapKeysToOption(key, 'shirt')); - return options; + userShirts () { + const freeShirts = Object.keys(appearance.shirt) + .filter(k => appearance.shirt[k].price === 0) + .map(s => this.mapKeysToFreeOption(s, 'shirt')); + const ownedShirts = Object.keys(this.user.purchased.shirt) + .filter(k => this.user.purchased.shirt[k]) + .map(s => this.mapKeysToFreeOption(s, 'shirt')); + + return [...freeShirts, ...ownedShirts]; }, }, mounted () { this.changeSubPage('size'); }, - methods: { - - }, }; - - diff --git a/website/client/src/components/avatarModal/customize-banner.vue b/website/client/src/components/avatarModal/customize-banner.vue new file mode 100644 index 0000000000..2d98adab39 --- /dev/null +++ b/website/client/src/components/avatarModal/customize-banner.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/website/client/src/components/avatarModal/customize-options.vue b/website/client/src/components/avatarModal/customize-options.vue index 338ef86264..a69d31570f 100644 --- a/website/client/src/components/avatarModal/customize-options.vue +++ b/website/client/src/components/avatarModal/customize-options.vue @@ -1,7 +1,6 @@ @@ -73,7 +40,7 @@ export default { mixins: [ avatarEditorUtilities, ], - props: ['items', 'currentValue', 'fullSet'], + props: ['items', 'currentValue'], data () { return { icons: Object.freeze({ diff --git a/website/client/src/components/avatarModal/extra-settings.vue b/website/client/src/components/avatarModal/extra-settings.vue index b1d4f3b613..a73c53a754 100644 --- a/website/client/src/components/avatarModal/extra-settings.vue +++ b/website/client/src/components/avatarModal/extra-settings.vue @@ -1,7 +1,8 @@ @@ -61,17 +76,18 @@ import appearance from '@/../../common/script/content/appearance'; import { subPageMixin } from '../../mixins/subPage'; import { userStateMixin } from '../../mixins/userState'; import { avatarEditorUtilities } from '../../mixins/avatarEditUtilities'; -import subMenu from './sub-menu'; +import customizeBanner from './customize-banner'; import customizeOptions from './customize-options'; -import gem from '@/assets/svg/gem.svg'; +import subMenu from './sub-menu'; const freeShirtKeys = Object.keys(appearance.shirt).filter(k => appearance.shirt[k].price === 0); const specialShirtKeys = Object.keys(appearance.shirt).filter(k => appearance.shirt[k].price !== 0); export default { components: { - subMenu, + customizeBanner, customizeOptions, + subMenu, }, mixins: [ subPageMixin, @@ -89,9 +105,6 @@ export default { }, chairKeys: ['none', 'black', 'blue', 'green', 'pink', 'red', 'yellow', 'handleless_black', 'handleless_blue', 'handleless_green', 'handleless_pink', 'handleless_red', 'handleless_yellow'], specialShirtKeys, - icons: Object.freeze({ - gem, - }), items: [ { id: 'size', @@ -178,7 +191,7 @@ export default { return freeShirtKeys.map(s => this.mapKeysToFreeOption(s, 'shirt')); }, specialShirts () { - let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line + let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line const keys = this.specialShirtKeys; const options = keys.map(key => this.mapKeysToOption(key, 'shirt')); return options; @@ -228,6 +241,16 @@ export default { }); return options; }, + showEmptySection () { + switch (this.activeSubPage) { + case 'ears': + return this.editing && this.animalItems('headAccessory').length === 1; + case 'tails': + return this.editing && this.animalItems('back').length === 1; + default: + return false; + } + }, }, mounted () { this.changeSubPage(this.extraSubMenuItems[0].id); @@ -236,7 +259,7 @@ export default { animalItems (category) { // @TODO: For some resonse when I use $set on the // user purchases object, this is not recomputed. Hack for now - let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line + let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line const keys = this.animalItemKeys[category]; const noneOption = this.createGearItem(0, category, 'base', category); @@ -248,36 +271,22 @@ export default { for (const key of keys) { const newKey = `${category}_special_${key}`; const userPurchased = this.user.items.gear.owned[newKey]; - - const option = {}; - option.key = key; - option.active = this.user.preferences.costume - ? this.user.items.gear.costume[category] === newKey - : this.user.items.gear.equipped[category] === newKey; - option.class = `headAccessory_special_${option.key} ${category}`; - if (category === 'back') { - option.class = `icon_back_special_${option.key} back`; - } - option.gemLocked = userPurchased === undefined; - option.goldLocked = userPurchased === false; - if (option.goldLocked) { - option.gold = 20; - } - if (option.gemLocked) { - option.gem = 2; - } - option.locked = option.gemLocked || option.goldLocked; - option.click = () => { - if (option.gemLocked) { - return this.unlock(`items.gear.owned.${newKey}`); - } if (option.goldLocked) { - return this.buy(newKey); + if (userPurchased) { + const option = {}; + option.key = key; + option.active = this.user.preferences.costume + ? this.user.items.gear.costume[category] === newKey + : this.user.items.gear.equipped[category] === newKey; + option.class = `headAccessory_special_${option.key} ${category}`; + if (category === 'back') { + option.class = `icon_back_special_${option.key} back`; } - const type = this.user.preferences.costume ? 'costume' : 'equipped'; - return this.equip(newKey, type); - }; - - options.push(option); + option.click = () => { + const type = this.user.preferences.costume ? 'costume' : 'equipped'; + return this.equip(newKey, type); + }; + options.push(option); + } } return options; @@ -287,17 +296,6 @@ export default { return keys.join(','); }, - animalItemsOwned (category) { - // @TODO: For some resonse when I use $set on the user purchases object, - // this is not recomputed. Hack for now - let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line - - let own = true; - this.animalItemKeys[category].forEach(key => { - if (this.user.items.gear.owned[`${category}_special_${key}`] === undefined) own = false; - }); - return own; - }, createGearItem (key, gearType, subGearType, additionalClass) { const newKey = `${gearType}_${subGearType ? `${subGearType}_` : ''}${key}`; const option = {}; @@ -339,7 +337,3 @@ export default { }, }; - - diff --git a/website/client/src/components/avatarModal/hair-settings.vue b/website/client/src/components/avatarModal/hair-settings.vue index 11623fe072..157bd3b893 100644 --- a/website/client/src/components/avatarModal/hair-settings.vue +++ b/website/client/src/components/avatarModal/hair-settings.vue @@ -1,7 +1,8 @@ - - diff --git a/website/client/src/components/avatarModal/skin-settings.vue b/website/client/src/components/avatarModal/skin-settings.vue index 45fb5ee206..10f429de35 100644 --- a/website/client/src/components/avatarModal/skin-settings.vue +++ b/website/client/src/components/avatarModal/skin-settings.vue @@ -1,7 +1,7 @@