feat: add shopping-cart list

This commit is contained in:
Vlad Stan 2023-07-06 15:13:58 +03:00
parent 6152f6b0de
commit 676ab5cc1b
4 changed files with 29 additions and 1 deletions

View file

@ -0,0 +1,3 @@
<div>
xxxx
</div>

View file

@ -0,0 +1,18 @@
async function shoppingCartList(path) {
const template = await loadTemplateAsync(path)
Vue.component('shopping-cart-list', {
name: 'shopping-cart-list',
template,
props: ['carts', 'products'],
data: function () {
return {}
},
computed: {},
methods: {
},
created() { }
})
}

View file

@ -30,6 +30,7 @@ const market = async () => {
customerStall('static/components/customer-stall/customer-stall.html'),
productDetail('static/components/product-detail/product-detail.html'),
shoppingCart('static/components/shopping-cart/shopping-cart.html'),
shoppingCartList('static/components/shopping-cart-list/shopping-cart-list.html'),
chatDialog('static/components/chat-dialog/chat-dialog.html'),
marketConfig('static/components/market-config/market-config.html')
])
@ -50,8 +51,10 @@ const market = async () => {
},
merchants: [],
shoppingCarts: [],
showMarketConfig: false,
showShoppingCartList: false,
searchNostr: false,
drawer: true,
pubkeys: new Set(),
@ -457,6 +460,8 @@ const market = async () => {
} else {
this.activeStall = null
this.activeProduct = null
this.showMarketConfig = false
this.showShoppingCartList = false
url.searchParams.delete('merchant_pubkey')
url.searchParams.delete('stall_id')
url.searchParams.delete('product_id')

View file

@ -183,7 +183,7 @@
size="lg"><q-tooltip>User
Config</q-tooltip></q-btn>
<q-btn color="gray" icon="shopping_cart" flat size="lg"
@click="searchNostr = !searchNostr"><q-tooltip>Shopping
@click="showShoppingCartList = !showShoppingCartList"><q-tooltip>Shopping
Cart</q-tooltip></q-btn>
</div>
</q-toolbar>
@ -205,6 +205,7 @@
<market-config v-if="showMarketConfig" :merchants="merchants" @add-merchant="addMerchant"
@remove-merchant="removeMerchant"></market-config>
<shopping-cart-list v-else-if="showShoppingCartList" :carts="shoppingCarts" :products="products"></shopping-cart-list>
<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)"
:product-detail="activeProduct" :relays="relays" :account="account" :pool="pool" :styles="config?.opts ?? {}"
@ -300,6 +301,7 @@
<script src="{{ url_for('nostrmarket_static', path='components/customer-stall/customer-stall.js') }}"></script>
<script src="{{ url_for('nostrmarket_static', path='components/product-detail/product-detail.js') }}"></script>
<script src="{{ url_for('nostrmarket_static', path='components/shopping-cart/shopping-cart.js') }}"></script>
<script src="{{ url_for('nostrmarket_static', path='components/shopping-cart-list/shopping-cart-list.js') }}"></script>
<script src="{{ url_for('nostrmarket_static', path='components/chat-dialog/chat-dialog.js') }}"></script>
<script src="{{ url_for('nostrmarket_static', path='components/market-config/market-config.js') }}"></script>
<script src="{{ url_for('nostrmarket_static', path='js/market.js') }}"></script>