diff --git a/src/modules/market/stores/market.ts b/src/modules/market/stores/market.ts index a5a2cee..20c89f5 100644 --- a/src/modules/market/stores/market.ts +++ b/src/modules/market/stores/market.ts @@ -803,6 +803,10 @@ export const useMarketStore = defineStore('market', () => { filterData.value.categories.push(category) } } + + const clearCategoryFilters = () => { + filterData.value.categories = [] + } const updateSortOptions = (field: string, order: 'asc' | 'desc' = 'asc') => { sortOptions.value = { field, order } @@ -881,6 +885,7 @@ export const useMarketStore = defineStore('market', () => { updateFilterData, clearFilters, toggleCategoryFilter, + clearCategoryFilters, updateSortOptions, formatPrice, addToStallCart, diff --git a/src/modules/market/views/MarketPage.vue b/src/modules/market/views/MarketPage.vue index 564642b..ffe9dd7 100644 --- a/src/modules/market/views/MarketPage.vue +++ b/src/modules/market/views/MarketPage.vue @@ -52,19 +52,84 @@ - +
-
- +

Browse by Category

+ +
+ +
+
- {{ category.category }} - ({{ category.count }}) - + +
+ {{ category.category }} +
+ {{ category.count }} +
+
+
+ + +
+ +
+
+
+ + +
+
+
+ + + Active Filters: + +
+ + {{ category }} + +
+
+
+ {{ productsToDisplay.length }} products found +
+
@@ -107,7 +172,7 @@ import { config } from '@/lib/config' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar' -import { ShoppingCart } from 'lucide-vue-next' +import { ShoppingCart, X, Check, Filter } from 'lucide-vue-next' import MarketFuzzySearch from '../components/MarketFuzzySearch.vue' import ProductCard from '../components/ProductCard.vue' import type { Product } from '../types/market' @@ -232,6 +297,20 @@ const handleCategoryFilter = (category: string) => { marketStore.toggleCategoryFilter(category) } +// Computed properties for enhanced category filtering +const selectedCategoriesCount = computed(() => { + return marketStore.filterData.categories.length +}) + +const selectedCategories = computed(() => { + return marketStore.filterData.categories +}) + +// Clear all category filters +const clearAllCategoryFilters = () => { + marketStore.clearCategoryFilters() +} + onMounted(() => { // Only load market if it hasn't been preloaded if (needsToLoadMarket.value) {