Style fixes (#9108)

* fixed some columns on smaller screens

* changed mystic hourglass check

* Checked for bad data

* Groupped pets and mounts

* Added show more

* Fixed lint

* Fixed lint
This commit is contained in:
Keith Holliday
2017-09-30 08:34:25 -05:00
committed by GitHub
parent 77d75c4669
commit 9cf2ccf7c4
12 changed files with 140 additions and 87 deletions

View File

@@ -4,12 +4,12 @@
modify-inventory(v-if="isUserLoaded") modify-inventory(v-if="isUserLoaded")
footer.container-fluid footer.container-fluid
.row .row
.col-2 .col-12.col-md-2
h3 h3
a(href='https://itunes.apple.com/us/app/habitica/id994882113?ls=1&mt=8', target='_blank') {{ $t('mobileIOS') }} a(href='https://itunes.apple.com/us/app/habitica/id994882113?ls=1&mt=8', target='_blank') {{ $t('mobileIOS') }}
h3 h3
a(href='https://play.google.com/store/apps/details?id=com.habitrpg.android.habitica', target='_blank') {{ $t('mobileAndroid') }} a(href='https://play.google.com/store/apps/details?id=com.habitrpg.android.habitica', target='_blank') {{ $t('mobileAndroid') }}
.col-2 .col-12.col-md-2
h3 Company h3 Company
ul ul
li li
@@ -28,7 +28,7 @@
a(href='/static/press-kit') {{ $t('presskit') }} a(href='/static/press-kit') {{ $t('presskit') }}
li li
a(href='/static/contact') {{ $t('contactUs') }} a(href='/static/contact') {{ $t('contactUs') }}
.col-2 .col-12.col-md-2
h3 Community h3 Community
ul ul
li li
@@ -47,7 +47,7 @@
a(href='https://www.facebook.com/Habitica', target='_blank') {{ $t('communityFacebook') }} a(href='https://www.facebook.com/Habitica', target='_blank') {{ $t('communityFacebook') }}
li li
a(href='https://www.reddit.com/r/habitrpg/', target='_blank') {{ $t('communityReddit') }} a(href='https://www.reddit.com/r/habitrpg/', target='_blank') {{ $t('communityReddit') }}
.col-6 .col-12.col-md-6
.row .row
.col-6 .col-6
h3 Developers h3 Developers

View File

@@ -52,7 +52,7 @@ div
a.dropdown-item(href="https://trello.com/c/odmhIqyW/440-read-first-table-of-contents", target='_blank') {{ $t('requestAF') }} a.dropdown-item(href="https://trello.com/c/odmhIqyW/440-read-first-table-of-contents", target='_blank') {{ $t('requestAF') }}
a.dropdown-item(href="http://habitica.wikia.com/wiki/Contributing_to_Habitica", target='_blank') {{ $t('contributing') }} a.dropdown-item(href="http://habitica.wikia.com/wiki/Contributing_to_Habitica", target='_blank') {{ $t('contributing') }}
a.dropdown-item(href="http://habitica.wikia.com/wiki/Habitica_Wiki", target='_blank') {{ $t('wiki') }} a.dropdown-item(href="http://habitica.wikia.com/wiki/Habitica_Wiki", target='_blank') {{ $t('wiki') }}
.item-with-icon(v-if="userHourglasses != 0") .item-with-icon(v-if="userHourglasses > 0")
.svg-icon(v-html="icons.hourglasses") .svg-icon(v-html="icons.hourglasses")
span {{ userHourglasses }} span {{ userHourglasses }}
.item-with-icon .item-with-icon

View File

@@ -51,7 +51,7 @@
) )
.row .row
task-column.col-6( task-column.col-12.col-sm-6(
v-for="column in columns", v-for="column in columns",
:type="column", :type="column",
:key="column", :key="column",

View File

@@ -16,7 +16,7 @@
.svg-icon.positive-icon(v-html="icons.positiveIcon") .svg-icon.positive-icon(v-html="icons.positiveIcon")
span(v-once) {{$t('createChallenge')}} span(v-once) {{$t('createChallenge')}}
.row .row
.col-6(v-for='challenge in filteredChallenges', v-if='!memberOf(challenge)') .col-12.col-md-6(v-for='challenge in filteredChallenges', v-if='!memberOf(challenge)')
challenge-item(:challenge='challenge') challenge-item(:challenge='challenge')
</template> </template>

View File

@@ -23,7 +23,7 @@
p(v-once) {{$t('challengeDescription2')}} p(v-once) {{$t('challengeDescription2')}}
.row .row
.col-6(v-for='challenge in filteredChallenges') .col-12.col-md-6(v-for='challenge in filteredChallenges')
challenge-item(:challenge='challenge') challenge-item(:challenge='challenge')
</template> </template>

View File

@@ -1,5 +1,5 @@
<template lang="pug"> <template lang="pug">
.col-2.standard-sidebar .col-2.standard-sidebar.hidden-xs-down
.form-group .form-group
input.form-control.search(type="text", :placeholder="$t('search')", v-model='searchTerm') input.form-control.search(type="text", :placeholder="$t('search')", v-model='searchTerm')

View File

@@ -72,7 +72,7 @@
v-on:taskEdited='taskEdited', v-on:taskEdited='taskEdited',
) )
.row .row
task-column.col-3( task-column.col-12.col-sm-6.col-3(
v-for="column in columns", v-for="column in columns",
:type="column", :type="column",
:key="column", :key="column",

View File

@@ -4,7 +4,7 @@
invite-modal(:group='this.group') invite-modal(:group='this.group')
start-quest-modal(:group='this.group') start-quest-modal(:group='this.group')
quest-details-modal(:group='this.group') quest-details-modal(:group='this.group')
.col-8.standard-page .col-12.col-sm-8.standard-page
.row .row
.col-6.title-details .col-6.title-details
h1 {{group.name}} h1 {{group.name}}
@@ -46,7 +46,7 @@
.col-12.hr .col-12.hr
chat-message(:chat.sync='group.chat', :group-id='group._id', group-name='group.name') chat-message(:chat.sync='group.chat', :group-id='group._id', group-name='group.name')
.col-4.sidebar .col-12.col-sm-4.sidebar
.row(:class='{"guild-background": !isParty}') .row(:class='{"guild-background": !isParty}')
.col-6 .col-6
.col-6 .col-6

View File

@@ -1,5 +1,5 @@
<template lang="pug"> <template lang="pug">
.standard-sidebar .standard-sidebar.hidden-xs-down
.form-group .form-group
input.form-control.search(type="text", :placeholder="$t('search')", v-model='searchTerm') input.form-control.search(type="text", :placeholder="$t('search')", v-model='searchTerm')

View File

@@ -1,6 +1,6 @@
<template lang="pug"> <template lang="pug">
.row .row
.clearfix.col-8.standard-page .col-12.col-sm-8.clearfix.standard-page
.row .row
.col-6.title-details .col-6.title-details
h1(v-once) {{ $t('welcomeToTavern') }} h1(v-once) {{ $t('welcomeToTavern') }}
@@ -29,7 +29,7 @@
.hr.col-12 .hr.col-12
chat-message(:chat.sync='group.chat', :group-id='group._id', group-name='group.name') chat-message(:chat.sync='group.chat', :group-id='group._id', group-name='group.name')
.col-md-4.sidebar .col-12.col-sm-4.sidebar
.section .section
.grassy-meadow-backdrop .grassy-meadow-backdrop
.daniel_front .daniel_front

View File

@@ -1,6 +1,7 @@
<template lang="pug"> <template lang="pug">
// @TODO: breakdown to componentes and use some SOLID
.row.stable(v-mousePosition="30", @mouseMoved="mouseMoved($event)") .row.stable(v-mousePosition="30", @mouseMoved="mouseMoved($event)")
.standard-sidebar .standard-sidebar.col-3.hidden-xs-down
div div
#npmMattStable.npc_matt #npmMattStable.npc_matt
b-popover( b-popover(
@@ -53,7 +54,7 @@
@change="updateHideMissing" @change="updateHideMissing"
) )
.standard-page .standard-page.col-12.col-sm-9
.clearfix .clearfix
h1.float-left.mb-0.page-header(v-once) {{ $t('stable') }} h1.float-left.mb-0.page-header(v-once) {{ $t('stable') }}
@@ -73,55 +74,49 @@
span.badge.badge-pill.badge-default {{countOwnedAnimals(petGroups[0], 'pet')}} span.badge.badge-pill.badge-default {{countOwnedAnimals(petGroups[0], 'pet')}}
div( div(
v-for="petGroup in petGroups", v-for="(petGroup, index) in petGroups",
v-if="viewOptions[petGroup.key].selected", v-if="viewOptions[petGroup.key].selected",
:key="petGroup.key" :key="petGroup.key"
) )
h4(v-if="viewOptions[petGroup.key].animalCount != 0") {{ petGroup.label }} h4(v-if="viewOptions[petGroup.key].animalCount !== 0") {{ petGroup.label }}
itemRows( .pet-row.d-flex(
:items="pets(petGroup, hideMissing, selectedSortBy, searchTextThrottled)", v-for="(group, key, index) in pets(petGroup, hideMissing, selectedSortBy, searchTextThrottled)",
:itemWidth=94, v-if='index === 0 || showMore === petGroup.key')
:itemMargin=24, .pet-group(
:type="petGroup.key", v-for='item in group'
) v-drag.drop.food="item.key",
template(slot="item", scope="context") @itemDragOver="onDragOver($event, item)",
div( @itemDropped="onDrop($event, item)",
v-drag.drop.food="context.item.key", @itemDragLeave="onDragLeave()",
@itemDragOver="onDragOver($event, context.item)", :class="{'last': item.isLastInRow}"
@itemDropped="onDrop($event, context.item)", )
@itemDragLeave="onDragLeave()", petItem(
:class="{'last': context.item.isLastInRow}" :item="item",
:itemContentClass="getPetItemClass(item)",
:popoverPosition="'top'",
:progress="item.progress",
:emptyItem="!item.isOwned()",
:showPopover="currentDraggingFood == null",
:highlightBorder="highlightPet == item.key",
@click="petClicked(item)"
) )
petItem( span(slot="popoverContent")
:item="context.item", div.hatchablePopover(v-if="item.isHatchable()")
:itemContentClass="getPetItemClass(context.item)", h4.popover-content-title {{ item.name }}
:popoverPosition="'top'", div.popover-content-text(v-html="$t('haveHatchablePet', { potion: item.potionName, egg: item.eggName })")
:progress="context.item.progress", div.potionEggGroup
:emptyItem="!context.item.isOwned()", div.potionEggBackground
:showPopover="currentDraggingFood == null", div(:class="'Pet_HatchingPotion_'+item.potionKey")
:highlightBorder="highlightPet == context.item.key", div.potionEggBackground
@click="petClicked(context.item)" div(:class="'Pet_Egg_'+item.eggKey")
) div(v-else)
span(slot="popoverContent") h4.popover-content-title {{ item.name }}
div.hatchablePopover(v-if="context.item.isHatchable()") template(slot="itemBadge", scope="context")
h4.popover-content-title {{ context.item.name }} starBadge(:selected="item.key === currentPet", :show="item.isOwned()", @click="selectPet(item)")
div.popover-content-text(v-html="$t('haveHatchablePet', { potion: context.item.potionName, egg: context.item.eggName })")
div.potionEggGroup
div.potionEggBackground
div(:class="'Pet_HatchingPotion_'+context.item.potionKey")
div.potionEggBackground
div(:class="'Pet_Egg_'+context.item.eggKey")
div(v-else) .btn.btn-flat.btn-show-more(@click="setShowMore(petGroup.key)", v-if='petGroup.key !== "specialPets"')
h4.popover-content-title {{ context.item.name }} | {{ showMore === petGroup.key ? $t('showLess') : $t('showMore') }}
template(slot="itemBadge", scope="context")
starBadge(
:selected="context.item.key === currentPet",
:show="context.item.isOwned()",
@click="selectPet(context.item)",
)
h2 h2
| {{ $t('mounts') }} | {{ $t('mounts') }}
@@ -135,31 +130,30 @@
) )
h4(v-if="viewOptions[mountGroup.key].animalCount != 0") {{ mountGroup.label }} h4(v-if="viewOptions[mountGroup.key].animalCount != 0") {{ mountGroup.label }}
itemRows( .pet-row.d-flex(v-for="(group, key, index) in mounts(mountGroup, hideMissing, selectedSortBy, searchTextThrottled)"
:items="mounts(mountGroup, hideMissing, selectedSortBy, searchTextThrottled)", v-if='index === 0 || showMore === mountGroup.key')
:itemWidth=94, .pet-group(v-for='item in group')
:itemMargin=24,
:type="mountGroup.key",
)
template(slot="item", scope="context")
mountItem( mountItem(
:item="context.item", :item="item",
:itemContentClass="context.item.isOwned() ? ('Mount_Icon_' + context.item.key) : 'PixelPaw GreyedOut'", :itemContentClass="item.isOwned() ? ('Mount_Icon_' + item.key) : 'PixelPaw GreyedOut'",
:key="context.item.key", :key="item.key",
:popoverPosition="'top'", :popoverPosition="'top'",
:emptyItem="!context.item.isOwned()", :emptyItem="!item.isOwned()",
:showPopover="true", :showPopover="true",
@click="selectMount(context.item)" @click="selectMount(item)"
) )
span(slot="popoverContent") span(slot="popoverContent")
h4.popover-content-title {{ context.item.name }} h4.popover-content-title {{ item.name }}
template(slot="itemBadge", scope="context") template(slot="itemBadge", scope="context")
starBadge( starBadge(
:selected="context.item.key === currentMount", :selected="item.key === currentMount",
:show="context.item.isOwned()", :show="item.isOwned()",
@click="selectMount(context.item)", @click="selectMount(item)",
) )
.btn.btn-flat.btn-show-more(@click="setShowMore(mountGroup.key)", v-if='mountGroup.key !== "specialMounts"')
| {{ showMore === mountGroup.key ? $t('showLess') : $t('showMore') }}
drawer( drawer(
:title="$t('quickInventory')", :title="$t('quickInventory')",
:errorMessage="(!hasDrawerTabItems(selectedDrawerTab)) ? ((selectedDrawerTab === 0) ? $t('noFoodAvailable') : $t('noSaddlesAvailable')) : null" :errorMessage="(!hasDrawerTabItems(selectedDrawerTab)) ? ((selectedDrawerTab === 0) ? $t('noFoodAvailable') : $t('noSaddlesAvailable')) : null"
@@ -219,7 +213,6 @@
:visible="hatchablePet != null", :visible="hatchablePet != null",
@change="resetHatchablePet($event)" @change="resetHatchablePet($event)"
) )
div.content(v-if="hatchablePet") div.content(v-if="hatchablePet")
div.potionEggGroup div.potionEggGroup
div.potionEggBackground div.potionEggBackground
@@ -253,11 +246,9 @@
div.food-icon(:class="'Pet_Food_'+currentDraggingFood.key") div.food-icon(:class="'Pet_Food_'+currentDraggingFood.key")
div.popover div.popover
div.popover-content {{ $t('clickOnPetToFeed', {foodName: currentDraggingFood.text() }) }} div.popover-content {{ $t('clickOnPetToFeed', {foodName: currentDraggingFood.text() }) }}
</template> </template>
<style lang="scss"> <style lang="scss">
@import '~client/assets/scss/colors.scss'; @import '~client/assets/scss/colors.scss';
@import '~client/assets/scss/modal.scss'; @import '~client/assets/scss/modal.scss';
@@ -283,6 +274,20 @@
top: -16px !important; top: -16px !important;
} }
.group {
height: 130px;
overflow: hidden;
}
.pet-row {
max-width: 100%;
flex-wrap: wrap;
.item {
margin-right: .5em;
}
}
.hatchablePopover { .hatchablePopover {
width: 180px width: 180px
} }
@@ -500,6 +505,7 @@
import _filter from 'lodash/filter'; import _filter from 'lodash/filter';
import _flatMap from 'lodash/flatMap'; import _flatMap from 'lodash/flatMap';
import _throttle from 'lodash/throttle'; import _throttle from 'lodash/throttle';
import groupBy from 'lodash/groupBy';
import Item from '../item'; import Item from '../item';
import ItemRows from 'client/components/ui/itemRows'; import ItemRows from 'client/components/ui/itemRows';
@@ -585,6 +591,7 @@
currentDraggingFood: null, currentDraggingFood: null,
selectedDrawerTab: 0, selectedDrawerTab: 0,
showMore: '',
}; };
}, },
watch: { watch: {
@@ -712,7 +719,13 @@
}, },
}, },
methods: { methods: {
setShowMore (key) {
if (this.showMore === key) {
this.showMore = '';
return;
}
this.showMore = key;
},
getAnimalList (animalGroup, type) { getAnimalList (animalGroup, type) {
let key = animalGroup.key; let key = animalGroup.key;
@@ -833,11 +846,39 @@
}, },
pets (animalGroup, hideMissing, sortBy, searchText) { pets (animalGroup, hideMissing, sortBy, searchText) {
return this.listAnimals(animalGroup, 'pet', hideMissing, sortBy, searchText); let pets = this.listAnimals(animalGroup, 'pet', hideMissing, sortBy, searchText);
// Don't group special
if (animalGroup.key === 'specialPets') {
return {none: pets};
}
let groupKey = 'eggKey';
if (sortBy === 'sortByColor') {
groupKey = 'potionKey';
} else if (sortBy === 'AZ') {
groupKey = '';
}
return groupBy(pets, groupKey);
}, },
mounts (animalGroup, hideMissing, sortBy, searchText) { mounts (animalGroup, hideMissing, sortBy, searchText) {
return this.listAnimals(animalGroup, 'mount', hideMissing, sortBy, searchText); let mounts = this.listAnimals(animalGroup, 'mount', hideMissing, sortBy, searchText);
// Don't group special
if (animalGroup.key === 'specialMounts') {
return {none: mounts};
}
let groupKey = 'eggKey';
if (sortBy === 'sortByColor') {
groupKey = 'potionKey';
} else if (sortBy === 'AZ') {
groupKey = '';
}
return groupBy(mounts, groupKey);
}, },
getPetItemClass (pet) { getPetItemClass (pet) {

View File

@@ -37,11 +37,11 @@ div.item-with-icon.item-notifications.dropdown
@click='go("/user/profile")') @click='go("/user/profile")')
span.glyphicon.glyphicon-plus-sign span.glyphicon.glyphicon-plus-sign
span {{ $t('haveUnallocated', {points: user.stats.points}) }} span {{ $t('haveUnallocated', {points: user.stats.points}) }}
a.dropdown-item(v-for='(message, key) in user.newMessages', v-if='message.value') a.dropdown-item(v-for='message in userNewMessages')
span(@click='navigateToGroup(key)') span(@click='navigateToGroup(message.key)')
span.glyphicon.glyphicon-comment span.glyphicon.glyphicon-comment
span {{message.name}} span {{message.name}}
span.clear-button(@click='clearMessages(key)', :popover="$t('clear')", span.clear-button(@click='clearMessages(message.key)', :popover="$t('clear')",
popover-placement='right', popover-trigger='mouseenter', popover-append-to-body='true') Clear popover-placement='right', popover-trigger='mouseenter', popover-append-to-body='true') Clear
a.dropdown-item(v-for='(notification, index) in user.groupNotifications', @click='viewGroupApprovalNotification(notification, index, true)') a.dropdown-item(v-for='(notification, index) in user.groupNotifications', @click='viewGroupApprovalNotification(notification, index, true)')
span(:class="groupApprovalNotificationIcon(notification)") span(:class="groupApprovalNotificationIcon(notification)")
@@ -156,6 +156,18 @@ export default {
return {name: ''}; return {name: ''};
// return this.user.party; // return this.user.party;
}, },
userNewMessages () {
// @TODO: For some reason data becomes corrupted. We should fix this on the server
let userNewMessages = [];
for (let key in this.user.newMessages) {
let message = this.user.newMessages[key];
if (message && message.name && message.value) {
message.key = key;
userNewMessages.push(message);
}
}
return userNewMessages;
},
}, },
methods: { methods: {
// @TODO: I hate this function, we can do better with a hashmap // @TODO: I hate this function, we can do better with a hashmap
@@ -244,8 +256,8 @@ export default {
count += this.user.stats.points > 0 ? 1 : 0; count += this.user.stats.points > 0 ? 1 : 0;
} }
if (this.user.newMessages) { if (this.userNewMessages) {
count += Object.keys(this.user.newMessages).length; count += Object.keys(this.userNewMessages).length;
} }
return count; return count;