mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
more fises
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { ChevronDownIcon } from "@heroicons/react/20/solid";
|
||||
import { getPSA, getLowerBuildKits, getGrips } from "@queries/PSA";
|
||||
import { psa } from "@db/schema/Psa";
|
||||
import { psa } from "@schemas/schema";
|
||||
import partTypes from "src/data/parts_cats.json";
|
||||
|
||||
export default async function BuilderPage() {
|
||||
|
||||
@@ -2,6 +2,8 @@ import { getProductType } from "@queries/PSA";
|
||||
import styles from '../styles.module.css';
|
||||
import PageHero from "@src/components/PageHero";
|
||||
import SortTable from "@src/components/SortTable";
|
||||
import { Suspense } from "react";
|
||||
import Loading from "@src/app/components/Loading/loading";
|
||||
|
||||
export default async function BarrelsPage() {
|
||||
const data = await getProductType('Barrels');
|
||||
@@ -9,9 +11,13 @@ export default async function BarrelsPage() {
|
||||
return (
|
||||
<div>
|
||||
<PageHero title="Barrels" />
|
||||
|
||||
<div className="container mx-auto">
|
||||
<SortTable data={data}></SortTable>
|
||||
<Suspense fallback="Loading...">
|
||||
<SortTable data={data}></SortTable>
|
||||
</Suspense>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
6
src/app/Products/loading.tsx
Normal file
6
src/app/Products/loading.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
const Loading = async () => {
|
||||
return (
|
||||
<div className="text-center mt-14">Loading...</div>);
|
||||
}
|
||||
|
||||
export default Loading;
|
||||
6
src/app/components/Loading/loading.tsx
Normal file
6
src/app/components/Loading/loading.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
const Loading = async () => {
|
||||
return (
|
||||
<div className="text-center mt-14">Loading...</div>);
|
||||
}
|
||||
|
||||
export default Loading;
|
||||
8
src/app/components/TestProductPage/index.tsx
Normal file
8
src/app/components/TestProductPage/index.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
'use server'
|
||||
export const TestProductPage = async (props: any) => {
|
||||
return (
|
||||
<div className="fixed pin z-50 overflow-auto bg-smoke-light flex">
|
||||
{props.data.modelnumber}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
import React, { Component } from 'react';
|
||||
import constants from '@lib/constants';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import MuiLink from '@mui/material/Link';
|
||||
import styles from './styles.module.css'
|
||||
import Link from 'next/link'
|
||||
import styled from '@emotion/styled'
|
||||
import styles from './styles.module.css';
|
||||
import Link from 'next/link';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
|
||||
export default class Copyright extends Component {
|
||||
|
||||
@@ -5,7 +5,7 @@ import styles from './styles.module.css';
|
||||
import constants from '@lib/constants'
|
||||
import {SITE_CONT_TYPE} from '@lib/constants'
|
||||
|
||||
export default function Disclosure(props) {
|
||||
export default function Disclosure(props:any) {
|
||||
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,10 +3,13 @@ import { PlusCircleIcon } from "@heroicons/react/20/solid";
|
||||
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { TestProductPage } from "../../app/components/TestProductPage";
|
||||
import { Suspense } from "react";
|
||||
|
||||
export default async function SortTable(props: any) {
|
||||
return (
|
||||
<div className="pb-12">
|
||||
|
||||
<div className="mt-8 flow-root">
|
||||
<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">
|
||||
@@ -125,13 +128,18 @@ export default async function SortTable(props: any) {
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<td style={{display:'none'}}>
|
||||
<TestProductPage data={item}></TestProductPage>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import Link from "next/link";
|
||||
|
||||
export default function Newsletter() {
|
||||
return (
|
||||
<div className="bg-gray-900 py-16 sm:py-24 lg:py-32">
|
||||
@@ -28,9 +30,9 @@ export default function Newsletter() {
|
||||
</div>
|
||||
<p className="mt-4 text-sm/6 text-gray-300">
|
||||
We care about your data. Read our{' '}
|
||||
<a href="#" className="font-semibold text-white">
|
||||
<Link href="/PP" className="font-semibold text-white">
|
||||
privacy policy
|
||||
</a>
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
</form>
|
||||
|
||||
@@ -26,7 +26,7 @@ export async function getLowerBuildKits(page = 1) {
|
||||
}
|
||||
|
||||
export async function getARCompleteLowers(page = 1) {
|
||||
const limit = 40;
|
||||
const limit = 240;
|
||||
const offset = (page - 1) * limit;
|
||||
|
||||
return await db.select()
|
||||
@@ -39,7 +39,7 @@ export async function getARCompleteLowers(page = 1) {
|
||||
export async function getProductType(productType : any, page = 1) {
|
||||
const limit = 40;
|
||||
const offset = (page - 1) * limit;
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve,1000));
|
||||
return await db.select()
|
||||
.from(psa)
|
||||
.limit(limit)
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
// db/queries.ts
|
||||
"use server";
|
||||
import { eq, not , asc} from "drizzle-orm";
|
||||
import { Product } from '@schemas/Product';
|
||||
import { products } from '@schemas/schema';
|
||||
import { db } from '../../index';
|
||||
|
||||
// Fetch all products
|
||||
export async function getAllProducts() {
|
||||
return await db.select().from(Product);
|
||||
return await db.select().from(products);
|
||||
}
|
||||
|
||||
// Add a new product
|
||||
export async function addProduct() {
|
||||
return await db.insert(Product).values({ }).returning();
|
||||
return await db.insert(products).values({ }).returning();
|
||||
}
|
||||
|
||||
// Update a Product
|
||||
export async function updateProduct( ) {
|
||||
return await db.update(Product).set({ }).where(eq(Product.id, id));
|
||||
return await db.update(products).set({ }).where(eq(Product.id, id));
|
||||
}
|
||||
|
||||
// Delete a product
|
||||
export async function deleteProduct(id: number) {
|
||||
return await db.delete(Product).where(eq(Product.id, id));
|
||||
return await db.delete(products).where(eq(products.id, id));
|
||||
}
|
||||
Reference in New Issue
Block a user