small changes

This commit is contained in:
2025-01-14 17:03:18 -05:00
parent 0eb54c6024
commit 69ff5e1433
2 changed files with 124 additions and 71 deletions

View File

@@ -1,101 +1,154 @@
import { ChevronDownIcon } from "@heroicons/react/20/solid"; import { PlusIcon } from "@heroicons/react/24/outline";
import { getPSA, getLowerBuildKits, getGrips } from "@queries/PSA"; import Link from 'next/link';
import { psa } from "@schemas/schema";
import partTypes from "src/data/parts_cats.json";
export default async function BuilderPage() { import { Fragment } from "react";
const psa = await getGrips();
const partsData = [
{
group: "Lower Parts",
parts: [
{
name: "Lower Receiver",
link: "/lowers",
source: "Palmetto State Armory",
price: "199.99",
ship_price: "8.99",
},
{
name: "Lower Parts Kit",
source: "-",
price: "-",
ship_price: "-",
},
{
name: "Lower Parts Kit",
source: "-",
price: "-",
ship_price: "-",
},
{
name: "Lower Parts Kit",
source: "-",
price: "-",
ship_price: "-",
},
{
name: "Lower Parts Kit",
source: "-",
price: "-",
ship_price: "-",
},
],
},
{
group: "Upper Parts",
parts: [
{ name: "Upper Reciever", source: "-", price: "-", ship_price: "-" },
{ name: "Barrel", source: "-", price: "-", ship_price: "-" },
{ name: "BCG", source: "-", price: "-", ship_price: "-" },
{ name: "Muzzle Device", source: "-", price: "-", ship_price: "-" },
{
name: "Charging Handle",
source: "-",
price: "-",
ship_price: "-",
},
],
},
];
export default function BuilderPage() {
return ( return (
<div className="p-4 sm:p-6 lg:p-8"> <div className="p-4 sm:px-6 lg:px-8">
<div className="sm:flex sm:items-center"> <div className="sm:flex sm:items-center">
<div className="sm:flex-auto"> <div className="sm:flex-auto">
<h1 className="text-base font-semibold text-gray-900">Users</h1> <h1 className="text-base font-semibold text-gray-900">
<p className="mt-2 text-sm text-gray-700"> Choose your Components
A list of all the Grips We Could Find{" "} </h1>
</p>
</div> </div>
</div> </div>
<div className="mt-8 flow-root"> <div className="mt-8 flow-root">
<div className="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8"> <div className="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div className="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8"> <div className="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8">
<table className="min-w-full divide-y divide-gray-300"> <table className="min-w-full">
<thead> <thead className="bg-white">
{/* Need to Fix Headers to align with other product tables */}
<tr> <tr>
<th <th
scope="col" scope="col"
className="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 " className="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-3"
> >
<a href="#" className="group inline-flex"> Components
Component
<span className="invisible ml-2 flex-none rounded text-gray-400 group-hover:visible group-focus:visible">
<ChevronDownIcon
aria-hidden="true"
className="size-5"
/>
</span>
</a>
</th> </th>
<th <th
scope="col" scope="col"
className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900" className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
> >
<a href="#" className="group inline-flex"> Source
Manufacturer
<span className="ml-2 flex-none rounded bg-gray-100 text-gray-900 group-hover:bg-gray-200">
<ChevronDownIcon
aria-hidden="true"
className="size-5"
/>
</span>
</a>
</th> </th>
<th <th
scope="col" scope="col"
className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900" className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
> >
<a href="#" className="group inline-flex">
Price Price
<span className="invisible ml-2 flex-none rounded text-gray-400 group-hover:visible group-focus:visible">
<ChevronDownIcon
aria-hidden="true"
className="invisible ml-2 size-5 flex-none rounded text-gray-400 group-hover:visible group-focus:visible"
/>
</span>
</a>
</th> </th>
<th <th
scope="col" scope="col"
className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900" className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
> >
<a href="#" className="group inline-flex"> Shipping
</th>
<th
scope="col"
className="px-8 py-3.5 text-right text-sm font-semibold text-gray-900"
>
Purchase Purchase
<span className="invisible ml-2 flex-none rounded text-gray-400 group-hover:visible group-focus:visible">
<ChevronDownIcon
aria-hidden="true"
className="invisible ml-2 size-5 flex-none rounded text-gray-400 group-hover:visible group-focus:visible"
/>
</span>
</a>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody className=" divide-y divide-gray-200 bg-white"> <tbody className="bg-white">
{psa.map((psa) => ( {/* Need to fix this to pull in parts that a user chooses during build process */}
<tr key={psa.upc}> {partsData.map((group, groupIndex) => (
<td className="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 "> <Fragment key={groupIndex}>
{psa.productName} <tr className="border-t border-gray-200">
<th
scope="colgroup"
colSpan={5}
className="bg-gray-100 py-2 pl-4 pr-3 text-left text-sm uppercase font-semibold text-gray-900 sm:pl-3"
>
{group.group}
</th>
</tr>
{group.parts.map((part, partIndex) => (
<tr key={partIndex}>
<td className="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-3">
<Link href={part.link}>{part.name}</Link>
</td> </td>
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500"> <td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
{psa.brandName} {part.source}
</td> </td>
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500"> <td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
{psa.retailPrice} {part.price}
</td> </td>
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500"> <td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
{psa.salePrice} {part.ship_price}
</td>
<td className="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-3">
<button
type="button"
className="inline-flex items-center gap-x-1.5 rounded-md bg-lime-800 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-lime-900 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-lime-900"
>
<PlusIcon
aria-hidden="true"
className="-ml-0.5 size-5"
/>
Purchase
</button>
</td> </td>
</tr> </tr>
))} ))}
</Fragment>
))}
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@@ -53,11 +53,11 @@ export default {
'5': 'hsl(var(--chart-5))' '5': 'hsl(var(--chart-5))'
} }
}, },
borderRadius: { // borderRadius: {
lg: 'var(--radius)', // lg: 'var(--radius)',
md: 'calc(var(--radius) - 2px)', // md: 'calc(var(--radius) - 2px)',
sm: 'calc(var(--radius) - 4px)' // sm: 'calc(var(--radius) - 4px)'
} // }
} }
}, },
plugins: [require("tailwindcss-animate")], plugins: [require("tailwindcss-animate")],