Beginning of rework of Product view

This commit is contained in:
Lucas Verney 2017-09-22 14:33:24 -04:00
parent 975907916d
commit 072126edac
4 changed files with 49 additions and 17 deletions

View File

@ -7,6 +7,7 @@ export default {
OpenDatabaseLicense: 'Open Database License', OpenDatabaseLicense: 'Open Database License',
}, },
misc: { misc: {
loading: 'Loading…',
or: 'or', or: 'or',
there: 'there', there: 'there',
}, },

View File

@ -14,6 +14,7 @@ export const mutations = {
[types.STORE_PRODUCT](state, { product }) { [types.STORE_PRODUCT](state, { product }) {
state.product = product; state.product = product;
state.isLoading = false; state.isLoading = false;
state.ui.title = product.product_name; // Set UI title
}, },
[types.IS_LOADING](state) { [types.IS_LOADING](state) {
state.isLoading = true; state.isLoading = true;

14
src/views/Loading.vue Normal file
View File

@ -0,0 +1,14 @@
<template>
<v-container fluid class="product-panel">
<v-layout row>
<v-flex xs12 class="text-xs-center">
<p>{{ $t('misc.loading') }}</p>
</v-flex>
</v-layout>
</v-container>
</template>
<script>
export default {
};
</script>

View File

@ -1,11 +1,15 @@
<template> <template>
<v-container fluid class="product-panel"> <div>
<v-flex class="text-xs-center"> <Loading v-if="isLoading"/>
<template v-if="isLoading"> <v-container fluid v-else>
<p>Loading</p> <v-layout row align-baseline>
</template> <v-flex xs3 class="text-xs-center">
<template v-else> <v-avatar size="100%">
<p><img :src="this.product.image_front_small_url"></p> <img :src="this.product.image_front_small_url" :alt="product.product_name">
</v-avatar>
</v-flex>
</v-layout>
<v-layout row>
<v-tabs centered> <v-tabs centered>
<v-tabs-items> <v-tabs-items>
<v-tabs-content id="tab-overview"> <v-tabs-content id="tab-overview">
@ -34,10 +38,9 @@
</v-tabs-content> </v-tabs-content>
</v-tabs-items> </v-tabs-items>
</v-tabs> </v-tabs>
</template> </v-layout>
</v-flex> </v-container>
<!-- TODO: Should be pushed to left --> <v-bottom-nav v-if="!isLoading" absolute :value="true" class="transparent">
<v-bottom-nav absolute :value="true" class="transparent">
<v-btn flat class="teal--text" value="recent"> <v-btn flat class="teal--text" value="recent">
<span>Overview</span> <span>Overview</span>
<v-icon>view_list</v-icon> <v-icon>view_list</v-icon>
@ -51,14 +54,19 @@
<v-icon>info_outline</v-icon> <v-icon>info_outline</v-icon>
</v-btn> </v-btn>
</v-bottom-nav> </v-bottom-nav>
</v-container> </div>
</template> </template>
<script> <script>
import Loading from '@/views/Loading';
export default { export default {
components: {
Loading,
},
created() { created() {
this.$store.dispatch('setTitle', { title: 'Loading' }); this.$store.dispatch('setTitle', { title: '' });
this.$store.dispatch('setBackgroundColor', { backgroundColor: '#00d400' }); this.$store.dispatch('setBackgroundColor', { backgroundColor: '#9CCC65' });
this.fetchData(); this.fetchData();
}, },
watch: { watch: {
@ -67,9 +75,7 @@ export default {
}, },
computed: { computed: {
product() { product() {
const product = this.$store.state.product; return this.$store.state.product;
this.$store.dispatch('setTitle', { title: product.product_name });
return product;
}, },
isLoading() { isLoading() {
return this.$store.state.isLoading; return this.$store.state.isLoading;
@ -82,3 +88,13 @@ export default {
}, },
}; };
</script> </script>
<style scoped>
.product-icon {
background-color: white;
border-radius: 100%;
}
.product-icon >>> img {
vertical-align: middle;
}
</style>