mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
* wip: createIntro / onboard ui rework * extract more methods - working body settings component * move justin above the dialog * extract submenu + fix styles * white background on items, working example of "none" item, item border radius * extract options as component * move more subMenu's to the component * add chair margins * move tasks to common/content * add menu indicator * extract more parts of onboarding-intro * refactor / fully converted hair-settings * extract extra-settings * fix sprite positions / lint * extract task-strings to be translatable * style fixes - hide submenu's if not editing * style / margin fixes * more style fixes * show hair styles at onboarding - use arrowleft/right as svg instead of image fix next color * finish button style - full set background/purchase button * fix footer - prev/next hover * Add Default Tasks + `byHabitica` property * customize-options click item on the full zone * purple tasks * footer animation => none * fix onboarding task habit up/down * onboarding circle color/position * task styles * fix onboarding position * show seasonal options * add hover to (locked-) options * added the correct behavior of shop-items to onboarding options * hide hover on active options
115 lines
3.0 KiB
Vue
115 lines
3.0 KiB
Vue
<template lang="pug">
|
|
#skin.section.customize-section
|
|
sub-menu.text-center(:items="skinSubMenuItems", :activeSubPage="activeSubPage", @changeSubPage="changeSubPage($event)")
|
|
customize-options(
|
|
:items="freeSkins",
|
|
:currentValue="user.preferences.skin"
|
|
)
|
|
|
|
div(v-if='editing && set.key !== "undefined"', v-for='set in seasonalSkins')
|
|
customize-options(
|
|
:items='set.options',
|
|
:currentValue="user.preferences.skin",
|
|
:fullSet='!hideSet(set) && !userOwnsSet("skin", set.keys)',
|
|
@unlock='unlock(`skin.${set.keys.join(",skin.")}`)'
|
|
)
|
|
</template>
|
|
|
|
<script>
|
|
import appearance from 'common/script/content/appearance';
|
|
import {subPageMixin} from '../../mixins/subPage';
|
|
import {userStateMixin} from '../../mixins/userState';
|
|
import {avatarEditorUtilies} from '../../mixins/avatarEditUtilities';
|
|
import appearanceSets from 'common/script/content/appearance/sets';
|
|
import subMenu from './sub-menu';
|
|
import customizeOptions from './customize-options';
|
|
import gem from 'assets/svg/gem.svg';
|
|
|
|
import groupBy from 'lodash/groupBy';
|
|
|
|
const skinsBySet = groupBy(appearance.skin, 'set.key');
|
|
|
|
const freeSkinKeys = skinsBySet[undefined].map(s => s.key);
|
|
|
|
// const specialSkinKeys = Object.keys(appearance.shirt).filter(k => appearance.shirt[k].price !== 0);
|
|
|
|
|
|
export default {
|
|
props: [
|
|
'editing',
|
|
],
|
|
components: {
|
|
subMenu,
|
|
customizeOptions,
|
|
},
|
|
mixins: [
|
|
subPageMixin,
|
|
userStateMixin,
|
|
avatarEditorUtilies,
|
|
],
|
|
data () {
|
|
return {
|
|
freeSkinKeys,
|
|
icons: Object.freeze({
|
|
gem,
|
|
}),
|
|
skinSubMenuItems: [
|
|
{
|
|
id: 'color',
|
|
label: this.$t('color'),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
computed: {
|
|
freeSkins () {
|
|
return freeSkinKeys.map(s => this.mapKeysToFreeOption(s, 'skin'));
|
|
},
|
|
seasonalSkins () {
|
|
// @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 seasonalSkins = [];
|
|
for (let setKey in skinsBySet) {
|
|
let set = skinsBySet[setKey];
|
|
|
|
let keys = set.map(item => {
|
|
return item.key;
|
|
});
|
|
|
|
let options = keys.map(optionKey => {
|
|
const option = this.mapKeysToOption(optionKey, 'skin', '', setKey);
|
|
|
|
return option;
|
|
});
|
|
|
|
let text = this.$t(setKey);
|
|
if (appearanceSets[setKey] && appearanceSets[setKey].text) {
|
|
text = appearanceSets[setKey].text();
|
|
}
|
|
|
|
let compiledSet = {
|
|
key: setKey,
|
|
options,
|
|
keys,
|
|
text,
|
|
};
|
|
seasonalSkins.push(compiledSet);
|
|
}
|
|
|
|
return seasonalSkins;
|
|
},
|
|
},
|
|
mounted () {
|
|
this.changeSubPage('color');
|
|
},
|
|
methods: {
|
|
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|