fix: partly navigation

This commit is contained in:
Vlad Stan 2023-07-06 15:21:04 +03:00
parent 676ab5cc1b
commit b8cdf27a44
2 changed files with 14 additions and 10 deletions

View file

@ -53,8 +53,8 @@ const market = async () => {
merchants: [], merchants: [],
shoppingCarts: [], shoppingCarts: [],
showMarketConfig: false, activePage: 'market',
showShoppingCartList: false,
searchNostr: false, searchNostr: false,
drawer: true, drawer: true,
pubkeys: new Set(), pubkeys: new Set(),
@ -460,11 +460,12 @@ const market = async () => {
} else { } else {
this.activeStall = null this.activeStall = null
this.activeProduct = null this.activeProduct = null
this.showMarketConfig = false
this.showShoppingCartList = false
url.searchParams.delete('merchant_pubkey') url.searchParams.delete('merchant_pubkey')
url.searchParams.delete('stall_id') url.searchParams.delete('stall_id')
url.searchParams.delete('product_id') url.searchParams.delete('product_id')
this.setActivePage('market')
} }
window.history.pushState({}, '', url) window.history.pushState({}, '', url)
@ -541,6 +542,9 @@ const market = async () => {
this.initNostr() this.initNostr()
}, },
setActivePage(page = 'market'){
this.activePage = page
},
addMerchant(publicKey) { addMerchant(publicKey) {
console.log('### addMerchat', publicKey) console.log('### addMerchat', publicKey)

View file

@ -172,10 +172,9 @@
<q-toolbar class="col-lg-4 col-md-5 col-sm-6"> <q-toolbar class="col-lg-4 col-md-5 col-sm-6">
<div class="float-right"> <div class="float-right">
<q-btn color="gray" icon="travel_explore" flat size="lg" <q-btn color="gray" icon="travel_explore" flat size="lg"
@click="searchNostr = !searchNostr"><q-tooltip>Search @click="setActivePage('search-nostr')"><q-tooltip>Search
for products on Nostr</q-tooltip></q-btn> for products on Nostr</q-tooltip></q-btn>
<q-btn color="gray" icon="settings" flat size="lg" <q-btn color="gray" icon="settings" flat size="lg" @click="setActivePage('market-config')"><q-tooltip>
@click="showMarketConfig = !showMarketConfig"><q-tooltip>
Settings</q-tooltip></q-btn> Settings</q-tooltip></q-btn>
<q-btn v-if="account" color="gray" icon="perm_identity" flat size="lg"><q-tooltip>User <q-btn v-if="account" color="gray" icon="perm_identity" flat size="lg"><q-tooltip>User
Login</q-tooltip></q-btn> Login</q-tooltip></q-btn>
@ -183,7 +182,7 @@
size="lg"><q-tooltip>User size="lg"><q-tooltip>User
Config</q-tooltip></q-btn> Config</q-tooltip></q-btn>
<q-btn color="gray" icon="shopping_cart" flat size="lg" <q-btn color="gray" icon="shopping_cart" flat size="lg"
@click="showShoppingCartList = !showShoppingCartList"><q-tooltip>Shopping @click="setActivePage('shopping-cart-list')"><q-tooltip>Shopping
Cart</q-tooltip></q-btn> Cart</q-tooltip></q-btn>
</div> </div>
</q-toolbar> </q-toolbar>
@ -203,9 +202,10 @@
<q-separator class="q-mt-md q-mb-md"></q-separator> <q-separator class="q-mt-md q-mb-md"></q-separator>
<market-config v-if="showMarketConfig" :merchants="merchants" @add-merchant="addMerchant" <market-config v-if="activePage === 'market-config'" :merchants="merchants" @add-merchant="addMerchant"
@remove-merchant="removeMerchant"></market-config> @remove-merchant="removeMerchant"></market-config>
<shopping-cart-list v-else-if="showShoppingCartList" :carts="shoppingCarts" :products="products"></shopping-cart-list> <shopping-cart-list v-else-if="activePage === 'shopping-cart-list'" :carts="shoppingCarts"
:products="products"></shopping-cart-list>
<customer-stall v-else-if="!isLoading && activeStall" :stall="stalls.find(stall => stall.id == activeStall)" <customer-stall v-else-if="!isLoading && activeStall" :stall="stalls.find(stall => stall.id == activeStall)"
:products="filterProducts" :stall-products="products.filter(p => p.stall_id == activeStall)" :products="filterProducts" :stall-products="products.filter(p => p.stall_id == activeStall)"
:product-detail="activeProduct" :relays="relays" :account="account" :pool="pool" :styles="config?.opts ?? {}" :product-detail="activeProduct" :relays="relays" :account="account" :pool="pool" :styles="config?.opts ?? {}"