From 7b40ce2c1a8db98cd21d3728f1677e4f4ab6990b Mon Sep 17 00:00:00 2001 From: Zikil Date: Wed, 20 Nov 2024 18:58:35 +0700 Subject: [PATCH] add bd, pages: adt, create, profile --- app/(root)/adt/[id]/page.tsx | 109 +++++ app/(root)/adt/create/page.tsx | 105 ++++ app/(root)/layout.tsx | 25 + app/(root)/page.tsx | 39 ++ app/(root)/profile/page.tsx | 66 +++ app/api/category/route.ts | 8 + app/fonts/GeistMonoVF.woff | Bin 67864 -> 0 bytes app/fonts/GeistVF.woff | Bin 66268 -> 0 bytes app/globals.css | 20 +- app/layout.tsx | 18 +- app/page.tsx | 101 ---- components.json | 21 + components/Categories.tsx | 42 ++ components/Header.tsx | 53 ++ components/ListingCard.tsx | 51 ++ components/ui/button.tsx | 57 +++ data/adt.ts | 74 +++ lib/utils.ts | 6 + package-lock.json | 868 ++++++++++++++++++++++++++++----- package.json | 27 +- prisma/constant.ts | 101 ++++ prisma/prisma-client.ts | 13 + prisma/schema.prisma | 62 +++ prisma/seed.ts | 67 +++ services/adt.ts | 9 + services/api-client.ts | 7 + services/category.ts | 9 + services/constant.tsx | 5 + services/instance.ts | 5 + tailwind.config.ts | 22 +- 30 files changed, 1714 insertions(+), 276 deletions(-) create mode 100644 app/(root)/adt/[id]/page.tsx create mode 100644 app/(root)/adt/create/page.tsx create mode 100644 app/(root)/layout.tsx create mode 100644 app/(root)/page.tsx create mode 100644 app/(root)/profile/page.tsx create mode 100644 app/api/category/route.ts delete mode 100644 app/fonts/GeistMonoVF.woff delete mode 100644 app/fonts/GeistVF.woff delete mode 100644 app/page.tsx create mode 100644 components.json create mode 100644 components/Categories.tsx create mode 100644 components/Header.tsx create mode 100644 components/ListingCard.tsx create mode 100644 components/ui/button.tsx create mode 100644 data/adt.ts create mode 100644 lib/utils.ts create mode 100644 prisma/constant.ts create mode 100644 prisma/prisma-client.ts create mode 100644 prisma/schema.prisma create mode 100644 prisma/seed.ts create mode 100644 services/adt.ts create mode 100644 services/api-client.ts create mode 100644 services/category.ts create mode 100644 services/constant.tsx create mode 100644 services/instance.ts diff --git a/app/(root)/adt/[id]/page.tsx b/app/(root)/adt/[id]/page.tsx new file mode 100644 index 0000000..45e6968 --- /dev/null +++ b/app/(root)/adt/[id]/page.tsx @@ -0,0 +1,109 @@ +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 { prisma } from '@/prisma/prisma-client'; +import Header from '@/components/Header'; +import { notFound } from 'next/navigation'; + +export default async function AdtPage({params: { id } }: { params: { id: string } }) { + const adt = await prisma.adt.findUnique({ + where: { + id: Number(id), + }, + include: { + user: true + } + }) + + if (!adt) { + return notFound(); + } + + const user = adt.user + + // const { id } = params(); + // const adt = adts.find(l => l.id === id) || adts[0]; + + return ( + <> +
+
+
+
+
+ {adt.title} +
+
+

{adt.title}

+ {adt.price} +
+ +
+
+ + {adt.location} +
+
+ + {String(adt.createdAt)} +
+
+ +

Description

+

+ This is a detailed description of the listing. It includes all the important information + about the item, its condition, and any special features or considerations. +

+ +
+ + +
+
+
+
+ +
+
+
+ Seller +
+

{user.name}

+

Member {String(user.createdAt)}

+
+
+ +
+ {/* TODO всплывающее окно для показа номера */} + + + + +
+
+
+
+
+ + ); +} \ No newline at end of file diff --git a/app/(root)/adt/create/page.tsx b/app/(root)/adt/create/page.tsx new file mode 100644 index 0000000..80352b8 --- /dev/null +++ b/app/(root)/adt/create/page.tsx @@ -0,0 +1,105 @@ +import React from 'react'; +import { ImagePlus, X } from 'lucide-react'; + +export default function CreateListing() { + return ( +
+
+

Create New Listing

+ +
+
+ + +
+ +
+ + +
+ +
+ +
+ $ + +
+
+ +
+ +