diff --git a/src/modules/market/views/MarketDashboard.vue b/src/modules/market/views/MarketDashboard.vue index 4a823c8..f545e7a 100644 --- a/src/modules/market/views/MarketDashboard.vue +++ b/src/modules/market/views/MarketDashboard.vue @@ -73,18 +73,33 @@ import DashboardOverview from '../components/DashboardOverview.vue' import OrderHistory from '../components/OrderHistory.vue' import MerchantStore from '../components/MerchantStore.vue' import MarketSettings from '../components/MarketSettings.vue' +import { auth } from '@/composables/useAuthService' -// const auth = useAuth() const marketStore = useMarketStore() // Local state const activeTab = ref('overview') // Computed properties for tab badges -const orderCount = computed(() => Object.keys(marketStore.orders).length) -const pendingOrders = computed(() => - Object.values(marketStore.orders).filter(o => o.status === 'pending').length -) +const orderCount = computed(() => { + // Count orders where current user is the buyer + const currentUserPubkey = auth.currentUser?.value?.pubkey + if (!currentUserPubkey) return 0 + + return Object.values(marketStore.orders).filter(order => + order.buyerPubkey === currentUserPubkey + ).length +}) + +const pendingOrders = computed(() => { + // Count pending orders where current user is the seller + const currentUserPubkey = auth.currentUser?.value?.pubkey + if (!currentUserPubkey) return 0 + + return Object.values(marketStore.orders).filter(order => + order.sellerPubkey === currentUserPubkey && order.status === 'pending' + ).length +}) // const pendingPayments = computed(() => // Object.values(marketStore.orders).filter(o => o.paymentStatus === 'pending').length // )