mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
product with links
This commit is contained in:
@@ -1,36 +1,48 @@
|
|||||||
import { Button } from "@components/ui/button";
|
import { Button } from "@components/ui/button";
|
||||||
import { getPSA, getLowerBuildKits, getAKBarreledReceivers } from "@queries/PSA";
|
import { getPSA, getLowerBuildKits, getARCompleteLowers } from "@queries/PSA";
|
||||||
import { psa } from '@db/schema/Psa';
|
import { psa } from "@db/schema/Psa";
|
||||||
import styles from '../styles.module.css';
|
import styles from "../styles.module.css";
|
||||||
|
import PageHero from "@components/PageHero";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
export default async function LowerReceiverPage() {
|
export default async function LowerReceiverPage() {
|
||||||
const psa = await getLowerBuildKits();
|
const psa = await getARCompleteLowers();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto py-5">
|
<div>
|
||||||
<table className={"table-auto border-separate border-spacing-4 border border-slate-500 text-gray-900"}>
|
<PageHero title="Lowers" />
|
||||||
<thead>
|
<div className="container mx-auto py-5">
|
||||||
<tr className={styles.tr}>
|
<table
|
||||||
<th>Component</th>
|
className={
|
||||||
<th>Manufacturer</th>
|
"table-auto border-separate border-spacing-4 border border-slate-500 text-gray-900"
|
||||||
<th>Model #</th>
|
}
|
||||||
<th>Price</th>
|
>
|
||||||
</tr>
|
<thead>
|
||||||
</thead>
|
<tr className={styles.tr}>
|
||||||
<tbody>
|
<th>Component</th>
|
||||||
{psa.map((psa) => (
|
<th>Manufacturer</th>
|
||||||
<tr key={psa.upc}>
|
<th>Model #</th>
|
||||||
<td>{psa.category}</td>
|
<th>Price</th>
|
||||||
<td>{psa.brandName}</td>
|
|
||||||
<td>{psa.modelnumber}</td>
|
|
||||||
<td className="flex items-center gap-2">
|
|
||||||
${Number(psa.salePrice).toFixed(2)}
|
|
||||||
<Button variant="default">Buy</Button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
{psa.map((psa) => (
|
||||||
|
<tr key={psa.upc}>
|
||||||
|
<td>{psa.category}</td>
|
||||||
|
<td>{psa.brandName}</td>
|
||||||
|
<td>{psa.modelnumber}</td>
|
||||||
|
<td className="flex items-center gap-2">
|
||||||
|
${Number(psa.salePrice).toFixed(2)}
|
||||||
|
{/* I dont think this is exactly correct but works for now? */}
|
||||||
|
<Link href={psa.buyLink} passHref={true}>
|
||||||
|
<Button variant="default">Buy</Button>
|
||||||
|
</Link>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -24,19 +24,20 @@ export async function getLowerBuildKits(page = 1) {
|
|||||||
.offset(offset);
|
.offset(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getAKBarreledReceivers(page = 1) {
|
// DISABLING FOR NOW. NO NEED FOR AK. FOCUS ON AR15
|
||||||
const limit = 20;
|
// export async function getAKBarreledReceivers(page = 1) {
|
||||||
const offset = (page - 1) * limit;
|
// const limit = 20;
|
||||||
|
// const offset = (page - 1) * limit;
|
||||||
|
|
||||||
return await db.select()
|
// return await db.select()
|
||||||
.from(psa)
|
// .from(psa)
|
||||||
.limit(limit)
|
// .limit(limit)
|
||||||
.where(eq(psa.fineline, "AK Barreled Receivers"))
|
// .where(eq(psa.fineline, "AK Barreled Receivers"))
|
||||||
.offset(offset);
|
// .offset(offset);
|
||||||
}
|
// }
|
||||||
|
|
||||||
export async function getARCompleteLowers(page = 1) {
|
export async function getARCompleteLowers(page = 1) {
|
||||||
const limit = 20;
|
const limit = 40;
|
||||||
const offset = (page - 1) * limit;
|
const offset = (page - 1) * limit;
|
||||||
|
|
||||||
return await db.select()
|
return await db.select()
|
||||||
|
|||||||
Reference in New Issue
Block a user