Market filter works except for exclusive boxes

This commit is contained in:
metacryst
2025-11-25 12:51:32 -06:00
parent cf9edc066a
commit dc9b106439
6 changed files with 115 additions and 32 deletions

View File

@@ -29,24 +29,46 @@ class MarketGrid extends Shadow {
ZStack(() => {
// BuyModal()
for (let i = 0; i < this.listings.length; i++) {
const rating = this.listings[i].stars
let params = new URLSearchParams(window.location.search);
const hyperiaMade = params.get("hyperia-made") === "true";
const americaMade = params.get("america-made") === "true";
const newItem = params.get("new") === "true";
const usedItem = params.get("used") === "true";
let filtered = this.listings;
if (hyperiaMade) {
filtered = filtered.filter(item => item.madeIn === "Hyperia");
}
if (americaMade) {
filtered = filtered.filter(item => item.madeIn === "America");
}
if (newItem) {
filtered = filtered.filter(item => item.type === "new");
}
if (usedItem) {
filtered = filtered.filter(item => item.type === "used");
}
for (let i = 0; i < filtered.length; i++) {
const rating = filtered[i].stars
const percent = (rating / 5)
VStack(() => {
img(this.listings[i].image)
img(filtered[i].image)
.marginBottom(0.5, em)
p(this.listings[i].company)
p(filtered[i].company)
.marginBottom(0.5, em)
p(this.listings[i].title)
p(filtered[i].title)
.fontSize(1.2, em)
.fontWeight("bold")
.marginBottom(0.5, em)
HStack(() => {
p(this.listings[i].stars)
p(filtered[i].stars)
.marginRight(0.2, em)
ZStack(() => {
@@ -67,21 +89,28 @@ class MarketGrid extends Shadow {
.fontSize(1.2, em)
.lineHeight(1)
p(this.listings[i].reviews)
p(filtered[i].reviews)
.marginLeft(0.2, em)
})
.marginBottom(0.5, em)
p(this.listings[i].price)
p(filtered[i].price)
.fontSize(1.75, em)
.marginBottom(0.5, em)
button("Buy Now")
button("Coming Soon!")
.onClick((finished) => {
if(finished) {
}
})
.onHover(function (hovering) {
if(hovering) {
this.style.backgroundColor = "var(--green)"
} else {
this.style.backgroundColor = ""
}
})
})
.padding(1, em)
@@ -96,6 +125,10 @@ class MarketGrid extends Shadow {
p("No Listings!")
}
})
.onQueryChanged(() => {
console.log("query did change yup")
this.rerender()
})
.height(100, vh)
.paddingLeft(2, em)
.paddingRight(2, em)