Files
habitica/website/client/components/inventory/stable.vue
Matteo Pagliazzi 0af1203832 Client Redesign: Inventory pages, secondary menu, misc css and design items (#8631)
* add colors palette

* add secondary menu component and style it

* add box shadow to secondary menu

* misc css, fixes for secondary menu

* client: add equipment page with grouping, css: add some styles

* add typography

* more equipment

* stable: fix linting

* equipment: add styles (lots of general styles too)

* remove duplicate google fonts loading

* add dropdowns

* design: white search input background, remove gray from items

* start adding drawer and selected indicator

* wip equipment

* fix equipment

* equipment: correctly bind new properties on items.gear.equipped

* equipment: fix vue binding. version 2

* equipment: fix vue binding. version 3

* back to first fix for equip op, fix for sourcemaps, send http request when an item is equipped, load bootstrap-vue components where needed

* checkboxes and radio buttons

* correctly renders selected items in first postion during the first render

* add search

* general changes, constants part of app state, add popovers

* add toggle switch, rename css

* correct offset

* upgrade deps

* upgrade deps

* drawer and lot of other work

* update equipping mechanism

* finish equipment

* fix compilation and upgrade deps

* use v-show in place of v-if to fix ui issues

* v-show -> v-if

* fix linting in test/client

* fix es6 compilation in test/client

* fix babel compilation for tests

* fix groupsUtilities mixin tests

* client: buttons

* client: buttons: fix colors

* client: finish buttons and dropdowns

* upgrade bootstrap-vue, finish buttons and dropdowns

* fix tasks page layout

* misc fixes for buttons

* add textareas

* fix app menu

* add inputs

* fixes for toggleSwitch

* typography

* checkboxes and radio buttons

* add checkbox icon

* fix equip.js

* extract strings to newClient.json

* add Popover above 'Use Costume' / 'Auto Equip' slider - disable item select if costume-mode and 'useCostume' isn't active

* show "you have disabled your costume" error above the drawer items

* check errorMessage for null

* hide star if costume not enabled

* fix errorMessage (!errorMessage seems not to work for string)

* show minimize / expand icon - always centered by css

* drawer test

* drawer: fix centering on large screens

* fix show more button

* add margin when two dropdowns are next to each other

* adjust the page padding based on the drawer, misc fixes

* drawer fixes
2017-05-16 21:09:55 +02:00

132 lines
4.0 KiB
Vue

<template lang="pug">
.row
.col-2.standard-sidebar
.form-group
input.form-control(type="text", :placeholder="$t('search')")
.form
h3(v-once) {{ $t('filter') }}
.form-group
.form-check
label.form-check-label(v-once)
input.form-check-input(type="checkbox")
strong {{ $t('pets') }}
.form-check.nested-field
label.form-check-label(v-once)
input.form-check-input(type="checkbox")
span {{ $t('hatchingPotions') }}
.form-check.nested-field
label.form-check-label(v-once)
input.form-check-input(type="checkbox")
span {{ $t('quest') }}
.form-check.nested-field
label.form-check-label(v-once)
input.form-check-input(type="checkbox")
span {{ $t('special') }}
.form-group
.form-check
label.form-check-label(v-once)
input.form-check-input(type="checkbox")
strong {{ $t('mounts') }}
.form-check.nested-field
label.form-check-label(v-once)
input.form-check-input(type="checkbox")
span {{ $t('hatchingPotions') }}
.form-check.nested-field
label.form-check-label(v-once)
input.form-check-input(type="checkbox")
span {{ $t('quest') }}
.form-check.nested-field
label.form-check-label(v-once)
input.form-check-input(type="checkbox")
span {{ $t('special') }}
.col-10.standard-page
h4 Pets
.inventory-item-container(v-for="pet in dropPets")
.PixelPaw
.btn.btn-secondary.d-block(@click="open.dropPets = !open.dropPets") {{ open.dropPets ? 'Close' : 'Open' }}
h2 Magic Potions Pets
.inventory-item-container(v-for="pet in magicPets")
.PixelPaw
.btn.btn-secondary.d-block(@click="open.magicPets = !open.magicPets") {{ open.magicPets ? 'Close' : 'Open' }}
h2 Quest Pets
.inventory-item-container(v-for="pet in questPets")
.PixelPaw
.btn.btn-secondary.d-block(@click="open.questPets = !open.questPets") {{ open.questPets ? 'Close' : 'Open' }}
h2 Rare Pets
.inventory-item-container(v-for="pet in rarePets")
.PixelPaw
.btn.btn-secondary.d-block(@click="open.rarePets = !open.rarePets") {{ open.rarePets ? 'Close' : 'Open' }}
h2 Mounts
h2 Quest Mounts
h2 Rare Mounts
</template>
<style lang="scss">
.inventory-item-container {
padding: 20px;
border: 1px solid;
display: inline-block;
}
</style>
<script>
import { mapState } from 'client/libs/store';
import each from 'lodash/each';
// TODO Normalize special pets and mounts
// import Store from 'client/store';
// import deepFreeze from 'client/libs/deepFreeze';
// const specialMounts =
export default {
data () {
return {
open: {
dropPets: false,
magicPets: false,
questPets: false,
rarePets: false,
},
};
},
computed: {
...mapState(['content']),
dropPets () {
return this.listAnimals('pet', this.content.dropEggs, this.content.dropHatchingPotions, this.open.dropPets);
},
magicPets () {
return this.listAnimals('pet', this.content.dropEggs, this.content.premiumHatchingPotions, this.open.magicPets);
},
questPets () {
return this.listAnimals('pet', this.content.questEggs, this.content.dropHatchingPotions, this.open.questPets);
},
rarePets () {
return this.listAnimals('pet', this.content.dropEggs, this.content.dropHatchingPotions, this.open.rarePets);
},
},
methods: {
listAnimals (type, eggSource, potionSource, isOpen = false) {
let animals = [];
let iteration = 0;
each(eggSource, (egg) => {
if (iteration === 1 && !isOpen) return false;
iteration++;
each(potionSource, (potion) => {
let animalKey = `${egg.key}-${potion.key}`;
animals.push(this.content[`${type}Info`][animalKey].text());
});
});
return animals;
},
},
};
</script>