Don't show "no guilds" texts while loading (#10665)

* Don't show "no guilds" texts while loading

Unified styling of "no guilds" message with my challenges page
Fixes #10662

* Don't show "no challenges" texts while loading

Add loading indicator (similar to find challenges & my guilds pages)

* Change gray color

* Set challenge icon color
This commit is contained in:
Carl Vuorinen
2018-10-08 23:18:11 +03:00
committed by Matteo Pagliazzi
parent bdfc23717e
commit 218d47d64a
2 changed files with 28 additions and 35 deletions

View File

@@ -7,6 +7,7 @@
.row.header-row .row.header-row
.col-md-8.text-left .col-md-8.text-left
h1(v-once) {{$t('myChallenges')}} h1(v-once) {{$t('myChallenges')}}
h2(v-if='loading && challenges.length === 0') {{ $t('loading') }}
.col-md-4 .col-md-4
// @TODO: implement sorting span.dropdown-label {{ $t('sortBy') }} // @TODO: implement sorting span.dropdown-label {{ $t('sortBy') }}
b-dropdown(:text="$t('sort')", right=true) b-dropdown(:text="$t('sort')", right=true)
@@ -16,7 +17,7 @@
span(v-once) {{$t('createChallenge')}} span(v-once) {{$t('createChallenge')}}
.row .row
.no-challenges.text-center.col-md-6.offset-3(v-if='filteredChallenges.length === 0') .no-challenges.text-center.col-md-6.offset-3(v-if='!loading && challenges.length === 0')
.svg-icon(v-html="icons.challengeIcon") .svg-icon(v-html="icons.challengeIcon")
h2(v-once) {{$t('noChallengeTitle')}} h2(v-once) {{$t('noChallengeTitle')}}
p(v-once) {{$t('challengeDescription1')}} p(v-once) {{$t('challengeDescription1')}}
@@ -48,14 +49,15 @@
} }
.no-challenges { .no-challenges {
color: $gray-300; color: $gray-200;
margin-top: 10em; margin-top: 10em;
h2 { h2 {
color: $gray-300; color: $gray-200;
} }
.svg-icon { .svg-icon {
color: #C3C0C7;
width: 88.7px; width: 88.7px;
margin: 1em auto; margin: 1em auto;
} }
@@ -84,6 +86,7 @@ export default {
challengeIcon, challengeIcon,
positiveIcon, positiveIcon,
}), }),
loading: false,
challenges: [], challenges: [],
sort: 'none', sort: 'none',
sortOptions: [ sortOptions: [
@@ -113,7 +116,7 @@ export default {
}; };
}, },
mounted () { mounted () {
this.loadchallanges(); this.loadChallenges();
}, },
computed: { computed: {
filteredChallenges () { filteredChallenges () {
@@ -138,10 +141,12 @@ export default {
this.$store.state.challengeOptions.workingChallenge = {}; this.$store.state.challengeOptions.workingChallenge = {};
this.$root.$emit('bv::show::modal', 'challenge-modal'); this.$root.$emit('bv::show::modal', 'challenge-modal');
}, },
async loadchallanges () { async loadChallenges () {
this.loading = true;
this.challenges = await this.$store.dispatch('challenges:getUserChallenges', { this.challenges = await this.$store.dispatch('challenges:getUserChallenges', {
member: true, member: true,
}); });
this.loading = false;
}, },
challengeCreated (challenge) { challengeCreated (challenge) {
this.challenges.push(challenge); this.challenges.push(challenge);

View File

@@ -2,18 +2,11 @@
.row .row
sidebar(v-on:search="updateSearch", v-on:filter="updateFilters") sidebar(v-on:search="updateSearch", v-on:filter="updateFilters")
.no-guilds.standard-page(v-if='filteredGuilds.length === 0') .standard-page
.no-guilds-wrapper
.svg-icon(v-html='icons.greyBadge')
h2 {{$t('noGuildsTitle')}}
p {{$t('noGuildsParagraph1')}}
p {{$t('noGuildsParagraph2')}}
span(v-if='loading') {{ $t('loading') }}
.standard-page(v-if='filteredGuilds.length > 0')
.row .row
.col-md-8 .col-md-8.text-left
h1.page-header.float-left(v-once) {{ $t('myGuilds') }} h1.page-header(v-once) {{ $t('myGuilds') }}
h2(v-if='loading && guilds.length === 0') {{ $t('loading') }}
.col-4 .col-4
button.btn.btn-secondary.create-group-button.float-right(@click='createGroup()') button.btn.btn-secondary.create-group-button.float-right(@click='createGroup()')
.svg-icon.positive-icon(v-html="icons.positiveIcon") .svg-icon.positive-icon(v-html="icons.positiveIcon")
@@ -22,6 +15,14 @@
span.dropdown-label {{ $t('sortBy') }} span.dropdown-label {{ $t('sortBy') }}
b-dropdown(:text="$t('sort')", right=true) b-dropdown(:text="$t('sort')", right=true)
b-dropdown-item(v-for='sortOption in sortOptions', :key="sortOption.value", @click='sort(sortOption.value)') {{sortOption.text}} b-dropdown-item(v-for='sortOption in sortOptions', :key="sortOption.value", @click='sort(sortOption.value)') {{sortOption.text}}
.row
.no-guilds.text-center.col-md-6.offset-md-3(v-if='!loading && guilds.length === 0')
.svg-icon(v-html='icons.greyBadge')
h2(v-once) {{$t('noGuildsTitle')}}
p(v-once) {{$t('noGuildsParagraph1')}}
p(v-once) {{$t('noGuildsParagraph2')}}
.row .row
.col-md-12 .col-md-12
public-guild-item(v-for="guild in filteredGuilds", :key='guild._id', :guild="guild", :display-gem-bank='true') public-guild-item(v-for="guild in filteredGuilds", :key='guild._id', :guild="guild", :display-gem-bank='true')
@@ -41,29 +42,16 @@
} }
.no-guilds { .no-guilds {
text-align: center;
color: $gray-200; color: $gray-200;
margin-top: 15em; margin-top: 10em;
p { h2 {
font-size: 14px; color: $gray-200;
line-height: 1.43;
} }
.no-guilds-wrapper { .svg-icon {
width: 400px; width: 88.7px;
margin: 0 auto; margin: 1em auto;
.svg-icon {
width: 60px;
margin: 0 auto;
}
}
}
@media only screen and (max-width: 768px) {
.no-guilds-wrapper {
width: 100% !important;
} }
} }
</style> </style>