more work

This commit is contained in:
2025-01-31 16:14:00 -05:00
parent 88d7d6c7b1
commit 583162acbe
15 changed files with 2445 additions and 108 deletions

2470
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -51,7 +51,7 @@
"next": "15.1.0", "next": "15.1.0",
"next-themes": "^0.4.3", "next-themes": "^0.4.3",
"nodemailer": "^6.10.0", "nodemailer": "^6.10.0",
"observable": "link:@trpc/server/observable", "observable": "@trpc/server/observable",
"oslo": "^1.2.1", "oslo": "^1.2.1",
"path": "^0.12.7", "path": "^0.12.7",
"perf_hooks": "^0.0.1", "perf_hooks": "^0.0.1",
@@ -61,7 +61,7 @@
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-icons": "^5.3.0", "react-icons": "^5.3.0",
"sha2": "link:@oslojs/crypto/sha2", "sha2": "@oslojs/crypto/sha2",
"sonner": "^1.7.2", "sonner": "^1.7.2",
"stripe": "^17.6.0", "stripe": "^17.6.0",
"superjson": "^2.2.2", "superjson": "^2.2.2",
@@ -84,7 +84,7 @@
"csv-parse": "^5.6.0", "csv-parse": "^5.6.0",
"csv-parser": "^3.0.0", "csv-parser": "^3.0.0",
"drizzle-kit": "^0.28.1", "drizzle-kit": "^0.28.1",
"drizzle-orm": "^0.38.2", "drizzle-orm": "^0.38.4",
"eslint": "^8", "eslint": "^8",
"eslint-config-next": "15.0.3", "eslint-config-next": "15.0.3",
"fs": "0.0.1-security", "fs": "0.0.1-security",

2
pnpm-lock.yaml generated
View File

@@ -229,7 +229,7 @@ importers:
specifier: ^0.28.1 specifier: ^0.28.1
version: 0.28.1 version: 0.28.1
drizzle-orm: drizzle-orm:
specifier: ^0.38.2 specifier: ^0.38.4
version: 0.38.4(@types/pg@8.11.11)(@types/react@18.3.18)(bun-types@1.2.0)(knex@0.8.6)(pg@8.13.1)(postgres@3.4.5)(react@18.2.0) version: 0.38.4(@types/pg@8.11.11)(@types/react@18.3.18)(bun-types@1.2.0)(knex@0.8.6)(pg@8.13.1)(postgres@3.4.5)(react@18.2.0)
eslint: eslint:
specifier: ^8 specifier: ^8

View File

@@ -1,8 +1,7 @@
import { users } from "@schemas/schema";
import { getAllUsersOrdrByLastname } from "@actions/userActions"; import { getAllUsersOrdrByLastname } from "@actions/userActions";
import AccountsTable from "@components/AccountsTable"; // Adjust the import path as necessary import AccountsTable from "@components/AccountsTable"; // Adjust the import path as necessary
import React, { Suspense } from 'react'; import React, { Suspense } from 'react';
import { ColumnHeadings } from "@src/lib/bb_utils"; import { ColumnHeadings } from "@src/lib/utils";
import PageHero from "@components/PageHero"; import PageHero from "@components/PageHero";

View File

@@ -1,10 +1,10 @@
import { getData } from "@actions/userActions"; import { getData } from "@actions/userActions";
import styles from '../styles.module.css'; //import styles from '../styles.module.css';
import PageHero from "@components/PageHero"; import PageHero from "@components/PageHero";
import UsersTable from "@src/components/admin/UsersTable"; import UsersTable from "@src/components/admin/UsersTable";
import { Suspense } from "react"; import { Suspense } from "react";
import Loading from "@src/components/Loading/loading"; import Loading from "@src/components/Loading/loading";
import { ColumnHeadings } from "@src/lib/bb_utils"; import { ColumnHeadings } from "@src/lib/utils";
export default async function UsersPage() { export default async function UsersPage() {
const data = await getData(); const data = await getData();
@@ -16,7 +16,7 @@ export default async function UsersPage() {
<PageHero title="Users" /> <PageHero title="Users" />
<div className="container mx-auto"> <div className="container mx-auto">
<Suspense fallback="Loading..."> <Suspense fallback={<Loading/>}>
<UsersTable data={data} newColumnHeadings={columnHeadings}></UsersTable> <UsersTable data={data} newColumnHeadings={columnHeadings}></UsersTable>
</Suspense> </Suspense>
</div> </div>

View File

@@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { ChevronDownIcon } from "@heroicons/react/20/solid"; import { ChevronDownIcon } from "@heroicons/react/20/solid";
import { PlusCircleIcon } from "@heroicons/react/20/solid"; import { PlusCircleIcon } from "@heroicons/react/20/solid";
import { ColumnHeadings } from "@src/lib/bb_utils"; import { ColumnHeadings } from "@src/lib/utils";
import styles from '../styles.module.css'; import styles from '../styles.module.css';
import PageHero from "@components/PageHero"; import PageHero from "@components/PageHero";
@@ -66,6 +66,7 @@ export default async function AccountsTable( props: any ) {
</tr> </tr>
</thead> </thead>
<tbody className=" divide-y divide-gray-200 bg-white"> <tbody className=" divide-y divide-gray-200 bg-white">
<Suspense fallback={<Loading />}>
{props.data.map((item: any) => ( {props.data.map((item: any) => (
<tr key={item.uuid}> <tr key={item.uuid}>
<td className="whitespace-wrap flex items-center py-4 pl-4 pr-3 text-xs font-medium text-gray-900 "> <td className="whitespace-wrap flex items-center py-4 pl-4 pr-3 text-xs font-medium text-gray-900 ">
@@ -96,6 +97,7 @@ export default async function AccountsTable( props: any ) {
</td> </td>
</tr> </tr>
))} ))}
</Suspense>
</tbody> </tbody>
</table> </table>

View File

@@ -1,5 +1,5 @@
import { pgTableCreator, integer, varchar, text, numeric, timestamp, unique, check, bigserial, date, boolean, uuid, bigint, real, doublePrecision, primaryKey, pgView, index, serial } from "drizzle-orm/pg-core" import { pgTableCreator, integer, varchar, text, numeric, timestamp, unique, check, date, boolean, uuid, bigint, real, doublePrecision, primaryKey, pgView, index, serial } from "drizzle-orm/pg-core";
import { ConsoleLogWriter, relations, sql } from "drizzle-orm" import { relations, sql } from "drizzle-orm";
import { DATABASE_PREFIX as prefix } from "@lib/constants"; import { DATABASE_PREFIX as prefix } from "@lib/constants";
export const pgTable = pgTableCreator((name) => (prefix == "" || prefix == null) ? name: `${prefix}_${name}`); export const pgTable = pgTableCreator((name) => (prefix == "" || prefix == null) ? name: `${prefix}_${name}`);

View File

@@ -14,6 +14,7 @@ export class ColumnHeadings {
this.headingNames = headingNames; this.headingNames = headingNames;
this.current = 0; this.current = 0;
} }
getHeading = () => { getHeading = () => {
const returnedHeading:string = this.headingNames[this.current]; const returnedHeading:string = this.headingNames[this.current];

View File

@@ -1,5 +1,5 @@
export default { const constants = {
APP_NAME: 'Ballistic Builder', APP_NAME: 'Ballistic Builder',
SITE_NAME: 'Ballistic Builder', SITE_NAME: 'Ballistic Builder',
COMPANY_NAME: 'Forward Group, LLC', COMPANY_NAME: 'Forward Group, LLC',
@@ -7,10 +7,12 @@ export default {
AUTHOR: 'Forward Group, LLC', AUTHOR: 'Forward Group, LLC',
META_KEYWORDS: 'Pew Pew', META_KEYWORDS: 'Pew Pew',
META_DESCRIPTION: 'Pow Pow', META_DESCRIPTION: 'Pow Pow',
DESCRIPTION: 'Generated by Forward Group, LLC', DESCRIPTION: 'Developed by Forward Group, LLC',
PJAM_RAINIER: 'https://api.pepperjamnetwork.com/20120402/publisher/creative/product?apiKey=17c11367569cc10dce51e6a5900d0c7c8b390c9cb2d2cecc25b3ed53a3b8649b&format=json&programIds=8713', PJAM_RAINIER: 'https://api.pepperjamnetwork.com/20120402/publisher/creative/product?apiKey=17c11367569cc10dce51e6a5900d0c7c8b390c9cb2d2cecc25b3ed53a3b8649b&format=json&programIds=8713',
PJAM_BARRETTA: 'https://api.pepperjamnetwork.com/20120402/publisher/creative/product?apiKey=17c11367569cc10dce51e6a5900d0c7c8b390c9cb2d2cecc25b3ed53a3b8649b&format=json&programIds=8342' PJAM_BARRETTA: 'https://api.pepperjamnetwork.com/20120402/publisher/creative/product?apiKey=17c11367569cc10dce51e6a5900d0c7c8b390c9cb2d2cecc25b3ed53a3b8649b&format=json&programIds=8342'
} };
export default constants;
export enum SITE_CONT_TYPE { export enum SITE_CONT_TYPE {
@@ -23,10 +25,10 @@ export enum SITE_CONT_TYPE {
DISCLOSURE="DISCLOSURE" DISCLOSURE="DISCLOSURE"
} }
export const APP_TITLE = "BB Test"; export const APP_TITLE = "Ballistics Builder";
export const DATABASE_PREFIX = ""; export const DATABASE_PREFIX = "";
export const TEST_DB_PREFIX = "test_acme"; export const TEST_DB_PREFIX = "test_acme";
export const EMAIL_SENDER = '"BB" <don@goforward.group>'; export const EMAIL_SENDER = '"Ballistics Builder" <don@goforward.group>';
export enum Paths { export enum Paths {
Home = "/", Home = "/",

View File

@@ -7,3 +7,10 @@ export type manufacturerType = {
id: number; id: number;
name: string; name: string;
}; };
//field is named componentType
export type componentTypeType = {
id: number;
name: string;
};

View File

@@ -1,6 +0,0 @@
export type brandType = {
id: number;
name: string;
};
export default brandType;

View File

@@ -1,5 +0,0 @@
//field is named componentType
export type componentTypeType = {
id: number;
name: string;
};

View File

@@ -1,4 +0,0 @@
export type manufacturerType = {
id: number;
name: string;
};

View File

@@ -54,3 +54,22 @@ export function formatPrice(
export function absoluteUrl(path: string) { export function absoluteUrl(path: string) {
return new URL(path, env.NEXT_PUBLIC_APP_URL).href return new URL(path, env.NEXT_PUBLIC_APP_URL).href
} }
/** Ballistic Builder cusom functions */
export class ColumnHeadings {
headingNames: string[];
current: number;
constructor(headingNames: string[]) {
console.log(headingNames.length);
this.headingNames = headingNames;
this.current = 0;
}
getHeading = () => {
const returnedHeading:string = this.headingNames[this.current];
this.current = this.current+1;
return returnedHeading;
}
}

View File

@@ -3,7 +3,7 @@ import { AuthenticationError } from "@/app/(main)/util";
import { createSession, generateSessionToken, validateRequest } from "@lib/wdcStarter/auth"; import { createSession, generateSessionToken, validateRequest } from "@lib/wdcStarter/auth";
import { cache } from "react"; import { cache } from "react";
import { cookies } from "next/headers"; import { cookies } from "next/headers";
import { UserId } from "@/use-cases/types"; import { UserId } from "@src/use-cases/types";
const SESSION_COOKIE_NAME = "session"; const SESSION_COOKIE_NAME = "session";