Auctions index card

This commit is contained in:
2026-09-09 17:29:12 +03:00
parent 1879ec67f1
commit ff81b5b9bb
2 changed files with 29 additions and 9 deletions
+22 -8
View File
@@ -25,19 +25,33 @@ onMounted(async () => {
await loadAuctions() await loadAuctions()
}) })
function formatPrice(price) {
const fmt = new Intl.NumberFormat("en-US", {style: "currency", currency: "USD"}) // TODO: maybe load currency from backend or env
return fmt.format(price)
}
</script> </script>
<template> <template>
<div class="placeholder" v-if="isPending"></div> <template v-if="isPending">
<ul v-else-if="!isPending && data != null && data.length > 0"> <div class="spinner-border me-1" role="status"></div>
<li v-for="auction in data" :key="auction.id"> <span>Loading…</span>
<span>{{ auction.name }}</span> </template>
<span v-if="auction.current_bid">{{ auction.current_bid }}</span> <div v-else-if="!isPending && data != null && data.length > 0" class="auctions-section" role="list">
</li> <div v-for="auction in data" :key="auction.id" class="card" role="listitem">
</ul> <div class="card-body">
<h2 class="h5">{{ auction.name }}</h2>
<p class="text-end">{{ formatPrice(auction.current_bid || auction.starting_price) }}</p>
</div>
</div>
</div>
<p v-else>No auctions available</p> <p v-else>No auctions available</p>
</template> </template>
<style scoped> <style scoped>
.auctions-section {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(20em, 1fr));
gap: 1em;
}
</style> </style>
+6
View File
@@ -1 +1,7 @@
@import "bootstrap/scss/bootstrap"; @import "bootstrap/scss/bootstrap";
/* Minor adjustments */
.card-body > p:last-child {
margin-bottom: 0;
}