2026-02-12 23:27:13 -05:00
|
|
|
---
|
|
|
|
|
import Layout from '../layouts/Main.astro';
|
2026-02-16 15:54:07 -05:00
|
|
|
import RarityIcon from "../components/RarityIcon.astro";
|
2026-02-12 23:27:13 -05:00
|
|
|
|
2026-02-13 21:28:33 -05:00
|
|
|
//import { eq } from 'drizzle-orm';
|
2026-02-12 23:27:13 -05:00
|
|
|
import { db } from '../db';
|
2026-02-13 21:28:33 -05:00
|
|
|
//import * as schema from '../db/schema.ts';
|
|
|
|
|
|
2026-02-12 23:27:13 -05:00
|
|
|
// Get some sample Pokemon data from the database
|
2026-02-16 15:54:07 -05:00
|
|
|
//const pokemon = await db.select().from(schema.cards).where(eq(schema.cards.productLineName, "pokemon")).limit(256);
|
2026-02-13 21:28:33 -05:00
|
|
|
const pokemon = await db.query.cards.findMany({
|
|
|
|
|
where: { productLineName: "pokemon" },
|
2026-02-16 18:06:22 -05:00
|
|
|
limit: 320,
|
2026-02-13 21:28:33 -05:00
|
|
|
with: {
|
|
|
|
|
prices: true,
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-02-16 15:54:07 -05:00
|
|
|
|
|
|
|
|
const order = ["Near Mint", "Lightly Played", "Moderately Played", "Heavily Played", "Damaged"];
|
2026-02-12 23:27:13 -05:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
<Layout>
|
|
|
|
|
<div class="container">
|
2026-02-16 15:54:07 -05:00
|
|
|
<h1 class="my-5">Rigid's app thing</h1>
|
2026-02-12 23:27:13 -05:00
|
|
|
<div class="row">
|
2026-02-16 18:06:22 -05:00
|
|
|
<div class="col-sm-12 col-md-3">
|
2026-02-16 15:54:07 -05:00
|
|
|
<div class="h5">Inventory management placeholder</div>
|
2026-02-12 23:27:13 -05:00
|
|
|
</div>
|
2026-02-16 18:06:22 -05:00
|
|
|
<div class="col-sm-12 col-md-9">
|
2026-02-16 15:54:07 -05:00
|
|
|
<div class="row g-4 row-cols-1 row-cols-md-2 row-cols-lg-3 row-cols-xl-4">
|
|
|
|
|
{pokemon.map((card) => (
|
|
|
|
|
<div class="col">
|
|
|
|
|
<img src={`/cards/${card.productId}.jpg`} alt={card.productName} class="w-100 img-fluid rounded-4 mb-2" />
|
2026-02-16 18:06:22 -05:00
|
|
|
<div class="col-auto h6 my-0">{card.productName}</div>
|
|
|
|
|
<div class="d-flex justify-content-between">
|
|
|
|
|
<div class="copy-small">{card.number}</div>
|
|
|
|
|
<RarityIcon rarity={card.rarityName} />
|
2026-02-16 15:54:07 -05:00
|
|
|
</div>
|
2026-02-16 18:06:22 -05:00
|
|
|
<div class="row row-cols-5 gx-1 mt-1">
|
2026-02-16 15:54:07 -05:00
|
|
|
{card.prices
|
|
|
|
|
.slice()
|
|
|
|
|
.sort((a, b) => order.indexOf(a.condition) - order.indexOf(b.condition))
|
|
|
|
|
.filter((price, index, arr) =>
|
|
|
|
|
arr.findIndex(p => p.condition === price.condition) === index
|
|
|
|
|
)
|
|
|
|
|
.map((price) => (
|
2026-02-16 18:06:22 -05:00
|
|
|
<div class="col p price-label">
|
2026-02-16 15:54:07 -05:00
|
|
|
{price.condition.split(' ').map((w) => w[0]).join('')}
|
|
|
|
|
<br />${price.marketPrice}
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2026-02-13 21:28:33 -05:00
|
|
|
</div>
|
2026-02-16 15:54:07 -05:00
|
|
|
))}
|
2026-02-12 23:27:13 -05:00
|
|
|
|
2026-02-16 15:54:07 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-02-12 23:27:13 -05:00
|
|
|
</div>
|
2026-02-16 15:54:07 -05:00
|
|
|
|
2026-02-12 23:27:13 -05:00
|
|
|
</div>
|
|
|
|
|
</Layout>
|