From e8b60a9b12e6de4bbfa25bb70aef2b47cd3995a0 Mon Sep 17 00:00:00 2001 From: MRVDH Date: Fri, 19 Feb 2021 20:14:44 +0100 Subject: [PATCH 1/2] Added history to front page url --- .../components/others/CategoryAndProducts.vue | 19 ++++----- .../others/CategoryAndProductsSkeleton.vue | 38 ++++++++++++++++++ client/src/components/routes/StoreFront.vue | 40 ++++++------------- client/src/router/index.js | 6 ++- 4 files changed, 63 insertions(+), 40 deletions(-) create mode 100644 client/src/components/others/CategoryAndProductsSkeleton.vue diff --git a/client/src/components/others/CategoryAndProducts.vue b/client/src/components/others/CategoryAndProducts.vue index ebb7b91..0440024 100644 --- a/client/src/components/others/CategoryAndProducts.vue +++ b/client/src/components/others/CategoryAndProducts.vue @@ -36,16 +36,11 @@ - - - - - + + @@ -53,11 +48,13 @@ import ApiService from '@/services/ApiService'; import CustomProductCard from '@/components/others/ProductCard'; +import CustomCategoryAndProductsSkeleton from '@/components/others/CategoryAndProductsSkeleton'; export default { name: 'CategoryAndProducts', components: { - CustomProductCard + CustomProductCard, + CustomCategoryAndProductsSkeleton }, props: { category: Object, diff --git a/client/src/components/others/CategoryAndProductsSkeleton.vue b/client/src/components/others/CategoryAndProductsSkeleton.vue new file mode 100644 index 0000000..62ed8e5 --- /dev/null +++ b/client/src/components/others/CategoryAndProductsSkeleton.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/client/src/components/routes/StoreFront.vue b/client/src/components/routes/StoreFront.vue index 8d4f0c3..ad57878 100644 --- a/client/src/components/routes/StoreFront.vue +++ b/client/src/components/routes/StoreFront.vue @@ -26,25 +26,10 @@ -
- - - - - - - - - - -
+
{ - this.lists = res.data.filter(x => !x.hidden && x.sellable_item_count > 0); - - this.topMenuItems = this.lists.filter(x => !x.is_included_in_category_tree); - this.selectedTopMenuItem = this.topMenuItems[0]; - this.productCategories = this.lists.filter(x => x.is_included_in_category_tree); + this.topMenuItems = res.data.filter(x => !x.is_included_in_category_tree && !x.hidden && x.sellable_item_count > 0); + this.selectedTopMenuItem = this.topMenuItems.find(x => x.id === this.$route.params.listId) || this.topMenuItems[0]; if (!this.loggedIn) { this.topMenuItems.unshift({ @@ -112,6 +94,8 @@ export default { }); }, selectTopMenuItem (item) { + this.$router.push({ name: 'StoreFront', params: { listId: item.id } }); + if (!this.loggedIn && item.id === "purchases") { return; } diff --git a/client/src/router/index.js b/client/src/router/index.js index b624bd8..a801789 100644 --- a/client/src/router/index.js +++ b/client/src/router/index.js @@ -5,7 +5,11 @@ Vue.use(VueRouter); const routes = [ { - path: '/', + path: '/', + redirect: '/store-front' + }, + { + path: '/store-front/:listId?', name: 'StoreFront', component: () => import(/* webpackChunkName: "store-front" */ '../components/routes/StoreFront.vue') }, From 86905ba46c45c49d01d27130fe532bf66260fe1b Mon Sep 17 00:00:00 2001 From: MRVDH Date: Fri, 19 Feb 2021 20:56:11 +0100 Subject: [PATCH 2/2] Search history implemented --- .../components/others/CategoryAndProducts.vue | 8 +++-- client/src/components/routes/Search.vue | 30 ++++++++++++++++++- client/src/components/routes/StoreFront.vue | 4 ++- client/src/router/index.js | 10 +++++++ 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/client/src/components/others/CategoryAndProducts.vue b/client/src/components/others/CategoryAndProducts.vue index 0440024..7eab38c 100644 --- a/client/src/components/others/CategoryAndProducts.vue +++ b/client/src/components/others/CategoryAndProducts.vue @@ -1,6 +1,6 @@