fixed package.json and a rfew othr things

This commit is contained in:
2025-02-03 12:57:15 -05:00
parent ffb42ba2d1
commit f614b064a0
8 changed files with 205 additions and 130 deletions

View File

@@ -0,0 +1,8 @@
"use client";
const ButtonProducts = ( props:any ) => {
const category = props.category;
return (
<button onClick={async () => { alert(category); return false;}} >{props.category}</button>
)
}
export default ButtonProducts;

View File

@@ -1,19 +1,26 @@
import React from "react";
import { getBBProductsCategories } from "@/db/queries/Products";
import Link from "next/link";
// import Link from "next/link";
import ButtonProducts from "../ButtonProduct";
const Filter: React.FC<{ [key: string]: any }> = async (props: unknown) => {
interface FilterProps {
heading: string;
[key: string]: unknown;
}
const Filter: React.FC<FilterProps> = async (props) => {
const bbCats = getBBProductsCategories();
return (
<div className="mt-20">
<h1 className="pt-10 ml-2 font-bold">{props.heading}</h1>
<div className="flex flex-col pt-2 pb-6 ml-2 rounded-r-lg text-white bg-[#334155]">
{(await bbCats).map((cat) => (
<div className="ml-2 " key={cat.category}>
<Link href={`/products/${cat.category}`} onClick={() => alert("Coming")}>
{cat.category}
</Link>
{/* <Link href={`/products/${cat.category}`}> */}
<ButtonProducts category={cat.category} />
{/* </Link> */}
</div>
))
}

View File

@@ -1,40 +1,43 @@
import Link from "next/link";
import constants from "@/lib/constants";
import { validateRequest } from "@/lib/auth/validate-request";
import { isAdmin } from "@/actions/userActions";
const navigation = {
armory: [
{ name: 'Builder', href: '/Builder' },
{ name: 'Lowers', href: '/Products/lowers' },
{ name: 'Uppers', href: '/Products/uppers' },
{ name: 'Optics', href: '/Products/optics' },
{ name: 'Accessories', href: '/Products/accessories' },
{ name: 'Suppressors', href: '/Products/suppressors' },
{ name: 'Builder', href: '/Builder', role: null },
{ name: 'Lowers', href: '/Products/lowers', role: null },
{ name: 'Uppers', href: '/Products/uppers', role: null },
{ name: 'Optics', href: '/Products/optics', role: null },
{ name: 'Accessories', href: '/Products/accessories', role: null },
{ name: 'Suppressors', href: '/Products/suppressors', role: null },
],
admin: [
{ name: 'Users', href: '/Admin/Users' },
{ name: 'Users', href: '/Admin/Users', role: "Admin" },
],
account: [
{ name: 'Accounts', href: '/Admin/Accounts' },
{ name: 'My Account', href: '/MyAccount' },
{ name: 'Register', href: '/login' },
{ name: 'Guides', href: '/Guides' },
{ name: 'Accounts', href: '/Admin/Accounts', role: null },
{ name: 'My Account', href: '/MyAccount', role: null },
{ name: 'Register', href: '/login', role: null },
{ name: 'Guides', href: '/Guides', role: null },
],
about: [
{ name: 'About', href: '/About' },
{ name: 'Blog', href: '/Blog' },
{ name: 'Jobs', href: '/Jobs' },
{ name: 'Press', href: '/Press' },
{ name: 'Contact', href: '/Contact' },
{ name: 'About', href: '/About', role: null },
{ name: 'Blog', href: '/Blog', role: null },
{ name: 'Jobs', href: '/Jobs', role: null },
{ name: 'Press', href: '/Press', role: null },
{ name: 'Contact', href: '/Contact', role: null },
],
legal: [
{ name: 'Terms of service', href: '/TOS' },
{ name: 'Privacy policy', href: '/PP' },
{ name: 'Affiliate Disclosure', href: '/Disclosure' },
{ name: 'Terms of service', href: '/TOS', role: null },
{ name: 'Privacy policy', href: '/PP', role: null },
{ name: 'Affiliate Disclosure', href: '/Disclosure', role: null },
],
social: [
{
name: 'Facebook',
href: '#',
role: null,
icon: (props: any) => (
<svg fill="currentColor" viewBox="0 0 24 24" {...props}>
<path
@@ -48,6 +51,7 @@ const navigation = {
{
name: 'Instagram',
href: '#',
role: null,
icon: (props: any) => (
<svg fill="currentColor" viewBox="0 0 24 24" {...props}>
<path
@@ -61,6 +65,7 @@ const navigation = {
{
name: 'X',
href: '#',
role: null,
icon: (props: any) => (
<svg fill="currentColor" viewBox="0 0 24 24" {...props}>
<path d="M13.6823 10.6218L20.2391 3H18.6854L12.9921 9.61788L8.44486 3H3.2002L10.0765 13.0074L3.2002 21H4.75404L10.7663 14.0113L15.5685 21H20.8131L13.6819 10.6218H13.6823ZM11.5541 13.0956L10.8574 12.0991L5.31391 4.16971H7.70053L12.1742 10.5689L12.8709 11.5655L18.6861 19.8835H16.2995L11.5541 13.096V13.0956Z" />
@@ -70,6 +75,7 @@ const navigation = {
{
name: 'YouTube',
href: '#',
role: null,
icon: (props: any) => (
<svg fill="currentColor" viewBox="0 0 24 24" {...props}>
<path
@@ -83,11 +89,24 @@ const navigation = {
],
}
export default function Footer() {
export default async function Footer() {
const newDate = new Date();
const year = newDate.getFullYear();
const { session, user } = await validateRequest();
let message = user?.id ?? '';
let isAdminFlag:boolean = false;
console.log("console log:"+ message);
console.log(user?.email);
if(session != null) {
message = (await isAdmin(message)) ? user.id : '';
isAdminFlag = (await isAdmin(message)) ?? false;
} else{
console.log("session is empty");
}
return (
<footer className="bg-zinc-900">
<div className="bg-white">{message}should be something here</div>
<div className="mx-auto max-w-7xl px-6 pb-8 pt-20 sm:pt-24 lg:px-8 lg:pt-32">
<div className="xl:grid xl:grid-cols-3 xl:gap-8">
<div className="grid grid-cols-2 gap-8 xl:col-span-2">
@@ -117,6 +136,7 @@ export default function Footer() {
))}
</ul>
</div>
{(isAdminFlag) ?
<div className="mt-10 md:mt-0">
<h3 className="text-sm/6 font-semibold text-white">Administration</h3>
<ul role="list" className="mt-6 space-y-4">
@@ -130,6 +150,7 @@ export default function Footer() {
))}
</ul>
</div>
:""}
</div>
<div className="md:grid md:grid-cols-2 md:gap-8">
<div>

View File

@@ -120,7 +120,7 @@ export default async function SortTable(props: any) {
type="button"
className="inline-flex items-center gap-x-1.5 rounded-xl 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"
>
Add
Add to Build
<PlusCircleIcon
aria-hidden="true"
className="-mr-0.5 size-5"