From 1a59ac8373cbdd267d668a23f77da7f3cc66930b Mon Sep 17 00:00:00 2001 From: Don Strawsburg Date: Tue, 21 Jan 2025 17:18:32 -0500 Subject: [PATCH] bunch of fixes --- .idea/dataSources.xml | 12 ++++++ src/app/Admin/Users/page.tsx | 2 +- src/app/Products/barrels/page.tsx | 2 +- src/app/UserProfile/[uuid]/page.tsx | 43 +++++++------------ src/components/AccountsTable/index.tsx | 4 +- src/components/Brand/BrandsList.tsx | 4 +- .../ComponentType/ComponentTypeList.tsx | 6 +-- .../ComponentType/componentType.tsx | 2 +- src/{app => }/components/Loading/loading.tsx | 0 src/components/SortTable/index.tsx | 2 +- .../components/TestProductPage/index.tsx | 0 src/components/admin/UsersTable/index.tsx | 2 +- 12 files changed, 40 insertions(+), 39 deletions(-) create mode 100644 .idea/dataSources.xml rename src/{app => }/components/Loading/loading.tsx (100%) rename src/{app => }/components/TestProductPage/index.tsx (100%) diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..55ee736 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + postgresql + true + org.postgresql.Driver + jdbc:postgresql://r710.gofwd.group:5433/postgres + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/src/app/Admin/Users/page.tsx b/src/app/Admin/Users/page.tsx index 04fedfe..c2e8c60 100644 --- a/src/app/Admin/Users/page.tsx +++ b/src/app/Admin/Users/page.tsx @@ -3,7 +3,7 @@ import styles from '../styles.module.css'; import PageHero from "@components/PageHero"; import UsersTable from "@src/components/admin/UsersTable"; import { Suspense } from "react"; -import Loading from "@src/app/components/Loading/loading"; +import Loading from "@src/components/Loading/loading"; import { ColumnHeadings } from "@src/lib/utils"; export default async function UsersPage() { diff --git a/src/app/Products/barrels/page.tsx b/src/app/Products/barrels/page.tsx index 625cc9e..ece3880 100644 --- a/src/app/Products/barrels/page.tsx +++ b/src/app/Products/barrels/page.tsx @@ -3,7 +3,7 @@ import styles from '../styles.module.css'; import PageHero from "@components/PageHero"; import SortTable from "@components/SortTable"; import { Suspense } from "react"; -import Loading from "@src/app/components/Loading/loading"; +import Loading from "@src/components/Loading/loading"; export default async function BarrelsPage() { const data = await getProductType('Barrels'); diff --git a/src/app/UserProfile/[uuid]/page.tsx b/src/app/UserProfile/[uuid]/page.tsx index 1aaf1cc..748b75a 100644 --- a/src/app/UserProfile/[uuid]/page.tsx +++ b/src/app/UserProfile/[uuid]/page.tsx @@ -1,28 +1,19 @@ -'use client'; import { getUserByUUID } from "@actions/userActions"; import { NextPage } from "next"; import { Herr_Von_Muellerhoff } from "next/font/google"; -import { useEffect, useState } from "react"; -import { useParams, usePathname, useRouter } from "next/navigation"; +export default async function UserProfilePage(props: any) { -export default function UserProfilePage(props: any) { +let a_user:any = ""; +const {uuid} = await props.params; -const router = useRouter(); -const params = useParams<{ uuid: string }>() -const [user, setUser] = useState<{ uuid: string | null; id: string; username: string; email: string; emailVerifiedOn: Date | null; password_hash: string; first_name: string | null; last_name: string | null; full_name: string | null; isAdmin:boolean, buildPrivacySetting: string | null; } | null>(null); - -useEffect(() => { - if (params?.uuid) { - getUserByUUID(params?.uuid as unknown as string) - .then((user) => setUser(user)) - .catch((error) => console.error("Error fetching user data:", error)); - } -}, [params?.uuid]); - -if (!params || !params.uuid || !user ) { - return
Loading...
; +if (uuid) { + a_user = await getUserByUUID(uuid as unknown as string); } + +if (!props.params || !uuid || !a_user ) { + return
Loading...
; +} return (
@@ -30,16 +21,14 @@ if (!params || !params.uuid || !user ) { {/* User Info */}
-

User Profile

- - +

User Profile

-

{user.first_name}{" "}{user.last_name}

-

{user.email}

-

{user.username}

-

{(user.isAdmin)? "True":"False"}

-

{user.first_name}{" "}{user.last_name}

-

{user.first_name}{" "}{user.last_name}

+

{a_user.first_name}{" "}{a_user.last_name}

+

{a_user.email}

+

{a_user.username}

+

{(a_user.isAdmin)? "True":"False"}

+

{a_user.first_name}{" "}{a_user.last_name}

+

{a_user.first_name}{" "}{a_user.last_name}

diff --git a/src/components/AccountsTable/index.tsx b/src/components/AccountsTable/index.tsx index c154cda..88a256a 100644 --- a/src/components/AccountsTable/index.tsx +++ b/src/components/AccountsTable/index.tsx @@ -6,7 +6,7 @@ import styles from '../styles.module.css'; import PageHero from "@components/PageHero"; import { Suspense } from "react"; -import Loading from "@src/app/components/Loading/loading"; +import Loading from "@src/components/Loading/loading"; import Link from "next/link"; export default async function AccountsTable( props: any ) { @@ -70,7 +70,7 @@ export default async function AccountsTable( props: any ) { - {item.first_name} + {item.first_name} {item.last_name} diff --git a/src/components/Brand/BrandsList.tsx b/src/components/Brand/BrandsList.tsx index a7eacea..1e28a93 100644 --- a/src/components/Brand/BrandsList.tsx +++ b/src/components/Brand/BrandsList.tsx @@ -1,10 +1,10 @@ "use client"; import { FC, useState } from "react"; -import { brandType } from "src/types/brandType"; +import { brandType } from "@lib/types/brandType"; import Brand from "./brand"; import AddBrand from "./addBrand"; import { addBrand, deleteBrand, editBrand } from "../../actions/brandActions"; -import Footer from "@src/app/site/Footer/page"; +import Footer from "@src/app/(siteInfo)/Footer/page"; import constants from "@src/lib/constants"; interface Props { brands: brandType[]; diff --git a/src/components/ComponentType/ComponentTypeList.tsx b/src/components/ComponentType/ComponentTypeList.tsx index bb4bad0..9baa1e1 100644 --- a/src/components/ComponentType/ComponentTypeList.tsx +++ b/src/components/ComponentType/ComponentTypeList.tsx @@ -1,13 +1,13 @@ "use client"; import { FC, useState } from "react"; -import { componentTypeType } from "src/types/componentTypeType"; +import { componentTypeType } from "@lib/types/componentTypeType"; import { componentType } from './componentType' // import AddBrand from "./addBrand"; -import { getData } from "src/actions/componentTypeActions"; +import { getData } from "@actions/componentTypeActions"; import constants from "@src/lib/constants"; interface Props { - componentType: componentType[]; + componentType: any[]; } const ComponentTypeList: FC = ({ componentType }) => { diff --git a/src/components/ComponentType/componentType.tsx b/src/components/ComponentType/componentType.tsx index e71762e..2888535 100644 --- a/src/components/ComponentType/componentType.tsx +++ b/src/components/ComponentType/componentType.tsx @@ -1,6 +1,6 @@ "use client"; import { ChangeEvent, FC, useState } from "react"; -import { componentTypeType } from "src/types/componentTypeType"; +import { componentTypeType } from "@lib/types/componentTypeType"; interface Props { componentType: componentTypeType; diff --git a/src/app/components/Loading/loading.tsx b/src/components/Loading/loading.tsx similarity index 100% rename from src/app/components/Loading/loading.tsx rename to src/components/Loading/loading.tsx diff --git a/src/components/SortTable/index.tsx b/src/components/SortTable/index.tsx index 1b53b8e..d264392 100644 --- a/src/components/SortTable/index.tsx +++ b/src/components/SortTable/index.tsx @@ -3,7 +3,7 @@ import { PlusCircleIcon } from "@heroicons/react/20/solid"; import Image from "next/image"; import Link from "next/link"; -import { TestProductPage } from "@src/app/components/TestProductPage"; +import { TestProductPage } from "@src/components/TestProductPage"; export default async function SortTable(props: any) { return ( diff --git a/src/app/components/TestProductPage/index.tsx b/src/components/TestProductPage/index.tsx similarity index 100% rename from src/app/components/TestProductPage/index.tsx rename to src/components/TestProductPage/index.tsx diff --git a/src/components/admin/UsersTable/index.tsx b/src/components/admin/UsersTable/index.tsx index ee61c10..de7b977 100644 --- a/src/components/admin/UsersTable/index.tsx +++ b/src/components/admin/UsersTable/index.tsx @@ -92,7 +92,7 @@ export default async function UsersTable(props: any) { - {item.email} + {item.email} {item.first_name}