diff --git a/@types/next-auth.d.ts b/@types/next-auth.d.ts new file mode 100644 index 0000000..118fff6 --- /dev/null +++ b/@types/next-auth.d.ts @@ -0,0 +1,28 @@ +// Ref: https://next-auth.js.org/getting-started/typescript#module-augmentation + +import { DefaultSession, DefaultUser } from 'next-auth'; +import { JWT, DefaultJWT } from 'next-auth/jwt'; +import type { UserRole } from '@prisma/client'; + +declare module 'next-auth' { + interface Session { + user: { + id: string; + role: UserRole; + name: string; + image: string; + }; + } + + interface User extends DefaultUser { + id: number; + role: UserRole; + } +} + +declare module 'next-auth/jwt' { + interface JWT extends DefaultJWT { + id: string; + role: UserRole; + } +} diff --git a/app/(root)/adt/[id]/page.tsx b/app/(root)/adt/[id]/page.tsx index 45e6968..c4005e1 100644 --- a/app/(root)/adt/[id]/page.tsx +++ b/app/(root)/adt/[id]/page.tsx @@ -1,7 +1,7 @@ import React from 'react'; // import { useParams } from 'next/navigation'; import { MapPin, Calendar, Phone, MessageCircle, Share2, Flag, Heart } from 'lucide-react'; -import { adts } from '@/data/adt'; +// import { adts } from '@/data/adt'; import { prisma } from '@/prisma/prisma-client'; import Header from '@/components/Header'; import { notFound } from 'next/navigation'; @@ -27,12 +27,12 @@ export default async function AdtPage({params: { id } }: { params: { id: string return ( <> -
+
- {adt.title} + {adt.title}

{adt.title}

@@ -79,8 +79,8 @@ export default async function AdtPage({params: { id } }: { params: { id: string className="w-12 h-12 rounded-full" />
-

{user.name}

-

Member {String(user.createdAt)}

+

{user?.name}

+

Member {String(user?.createdAt)}

diff --git a/app/(root)/adt/create/page.tsx b/app/(root)/adt/create/page.tsx index 80352b8..db0da10 100644 --- a/app/(root)/adt/create/page.tsx +++ b/app/(root)/adt/create/page.tsx @@ -1,105 +1,112 @@ +// 'use client' + import React from 'react'; import { ImagePlus, X } from 'lucide-react'; +import { AdtCreateForm } from '@/components/shared/adt-create/adt-create-form'; export default function CreateListing() { return ( -
-
-

Create New Listing

+ + + + + //
+ //
+ //

Create New Listing

-
-
- - -
+ // + //
+ // + // + //
-
- - -
+ //
+ // + // + //
-
- -
- $ - -
-
+ //
+ // + //
+ // $ + // + //
+ //
-
- -