diff --git a/.env b/.env new file mode 100644 index 000000000000..96f40908d3d2 --- /dev/null +++ b/.env @@ -0,0 +1,26 @@ +# Created by Vercel CLI +NX_DAEMON="" +POSTGRES_DATABASE="verceldb" +POSTGRES_HOST="ep-empty-mountain-a2fmoxsa-pooler.eu-central-1.aws.neon.tech" +POSTGRES_PASSWORD="ZaPBur8MYdp4" +POSTGRES_PRISMA_URL="postgres://default:ZaPBur8MYdp4@ep-empty-mountain-a2fmoxsa-pooler.eu-central-1.aws.neon.tech/verceldb?pgbouncer=true&connect_timeout=15&sslmode=require" +POSTGRES_URL="postgres://default:ZaPBur8MYdp4@ep-empty-mountain-a2fmoxsa-pooler.eu-central-1.aws.neon.tech/verceldb?sslmode=require" +POSTGRES_URL_NON_POOLING="postgres://default:ZaPBur8MYdp4@ep-empty-mountain-a2fmoxsa.eu-central-1.aws.neon.tech/verceldb?sslmode=require" +POSTGRES_URL_NO_SSL="postgres://default:ZaPBur8MYdp4@ep-empty-mountain-a2fmoxsa-pooler.eu-central-1.aws.neon.tech/verceldb" +POSTGRES_USER="default" +TURBO_REMOTE_ONLY="" +TURBO_RUN_SUMMARY="" +VERCEL="1" +VERCEL_ENV="development" +VERCEL_GIT_COMMIT_AUTHOR_LOGIN="" +VERCEL_GIT_COMMIT_AUTHOR_NAME="" +VERCEL_GIT_COMMIT_MESSAGE="" +VERCEL_GIT_COMMIT_REF="" +VERCEL_GIT_COMMIT_SHA="" +VERCEL_GIT_PREVIOUS_SHA="" +VERCEL_GIT_PROVIDER="" +VERCEL_GIT_PULL_REQUEST_ID="" +VERCEL_GIT_REPO_ID="" +VERCEL_GIT_REPO_OWNER="" +VERCEL_GIT_REPO_SLUG="" +VERCEL_URL="" diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000000..bffb357a7122 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..fd3dbb571a12 --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js +.yarn/install-state.gz + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts diff --git a/README.md b/README.md new file mode 100644 index 000000000000..2824b91cb1c1 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. + +This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. +# blog-users-newui +# blog-users-newui +# blog-users-newui diff --git a/README.mdgit b/README.mdgit new file mode 100644 index 000000000000..211d03c881bf --- /dev/null +++ b/README.mdgit @@ -0,0 +1,3 @@ +# blog-users-newui initgit add README.mdgit commit -m first commitgit branch -M maingit remote add origin https://github.com/Avrahamyb/blog-users-newui.gitgit push -u origin main +# blog-users-newui initgit add README.mdgit commit -m first commitgit branch -M maingit remote add origin https://github.com/Avrahamyb/blog-users-newui.gitgit push -u origin main +# blog-users-newui initgit add README.mdgit commit -m first commitgit branch -M maingit remote add origin https://github.com/Avrahamyb/blog-users-newui.gitgit push -u origin main diff --git a/app/components/Posts.tsx b/app/components/Posts.tsx new file mode 100644 index 000000000000..ef7ba8d709ae --- /dev/null +++ b/app/components/Posts.tsx @@ -0,0 +1,59 @@ +import { Button } from "@/components/ui/button"; +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card" + + +import { Post } from "@prisma/client"; +import { PrismaClient } from "@prisma/client"; +import Link from "next/link"; + +const prisma = new PrismaClient(); + +export default async function Posts() { + + const posts = await prisma.post.findMany({}) + + + async function getAuthorName(id: string) { + const author = await prisma.user.findUnique({ + where: { + id: id || 'cjioeuvo8' + } + }) + return author?.name + } + + return ( +
+ { + posts.map((post: Post) => ( +
+ + + {post.title} + + {/* {((post.published == true) ? "PubliƩ" : "Non PubliƩ") + ", by " + (async () => {return await getAuthorName(post.authorId as string)})} */} + + + +

{post.content?.slice(0, 100).concat(" ...")}

+
+ + + +
+ +
+ )) + } +
+ ); +} \ No newline at end of file diff --git a/app/components/Users.tsx b/app/components/Users.tsx new file mode 100644 index 000000000000..7a3df881b319 --- /dev/null +++ b/app/components/Users.tsx @@ -0,0 +1,53 @@ +import { Button } from "@/components/ui/button"; +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card" + + +import { User } from "@prisma/client"; +import { PrismaClient } from "@prisma/client"; +import Link from "next/link"; + +const prisma = new PrismaClient(); + +export default async function Posts() { + + const users = await prisma.user.findMany({}) + + + + + return ( +
+ { + users.map((user: User) => ( +
+ + + {user.name} + + + + {user.email} + + + + + +

{"Created at " + user.createdAt.toDateString()}

+

{"Last time updated at " + user.updatedAt.toDateString()}

+
+ +
+ +
+ )) + } +
+ ); +} \ No newline at end of file diff --git a/app/favicon.ico b/app/favicon.ico new file mode 100644 index 000000000000..718d6fea4835 Binary files /dev/null and b/app/favicon.ico differ diff --git a/app/globals.css b/app/globals.css new file mode 100644 index 000000000000..b5c61c956711 --- /dev/null +++ b/app/globals.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/app/home/layout.tsx b/app/home/layout.tsx new file mode 100644 index 000000000000..a8db1c7a47b5 --- /dev/null +++ b/app/home/layout.tsx @@ -0,0 +1,133 @@ +import Image from "next/image" + +import { + File, + Home, + LineChart, + ListFilter, + MoreHorizontal, + Package, + Package2, + PanelLeft, + PlusCircle, + Search, + Settings, + ShoppingCart, + Users2, +} from "lucide-react" + +import { Badge } from "@/components/ui/badge" +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator, +} from "@/components/ui/breadcrumb" +import { Button } from "@/components/ui/button" +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card" +import { + DropdownMenu, + DropdownMenuCheckboxItem, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { Input } from "@/components/ui/input" +import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" +import { + Tabs, + TabsContent, + TabsList, + TabsTrigger, +} from "@/components/ui/tabs" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" +import Posts from '../components/Posts' + + +import Link from "next/link" + +export default function Layout({ children }: { children: React.ReactNode }) { + + return ( +
+ + + +
+ + + + + +
+ + + + {children} +
+ +
+
+ ) + +} \ No newline at end of file diff --git a/app/home/page.tsx b/app/home/page.tsx new file mode 100644 index 000000000000..cb02f6bfe9c2 --- /dev/null +++ b/app/home/page.tsx @@ -0,0 +1,131 @@ +import Image from "next/image" + +import { + File, + Home, + LineChart, + ListFilter, + MoreHorizontal, + Package, + Package2, + PanelLeft, + PlusCircle, + Search, + Settings, + ShoppingCart, + Users2, +} from "lucide-react" + +import { Badge } from "@/components/ui/badge" +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator, +} from "@/components/ui/breadcrumb" +import { Button } from "@/components/ui/button" +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card" +import { + DropdownMenu, + DropdownMenuCheckboxItem, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { Input } from "@/components/ui/input" +import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" +import { + Tabs, + TabsContent, + TabsList, + TabsTrigger, +} from "@/components/ui/tabs" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" +import Posts from '../components/Posts' +import Users from "../components/Users" +import { AddPostForm } from "@/components/AddPostForm" +import { AddUserForm } from "@/components/add-user-form" + +export default function HomePage() { + return ( +
+
+ + +
+ + Posts + Users + Add + +
+ + + + +

Posts

+ +
+ + +

This is a list of all Users Blog

+ +
+ + + + + + Add Post + Add User + + + + + + + +

Add User

+ +
+
+ + + + +
+ + + +
+ + + +
+
+ ) +} \ No newline at end of file diff --git a/app/home/post/[id]/page.tsx b/app/home/post/[id]/page.tsx new file mode 100644 index 000000000000..2805190e64d7 --- /dev/null +++ b/app/home/post/[id]/page.tsx @@ -0,0 +1,39 @@ +import { Post, PrismaClient } from "@prisma/client" + +const prisma = new PrismaClient() + +export default async function Home({ params }: { params: { id: string } }) { + + + + const post:Post = await prisma.post.findUnique({ + where: { + id: params.id + } + }) + + async function getAuthorName(id: string) { + const author = await prisma.user.findUnique({ + where: { + id: id || 'cjioeuvo8' + } + }) + return author?.name + } + + const author = await getAuthorName(post.authorId as string) + + return ( +
+

+ {post.title} +

+ +

{author}

+ +

+ {post.content} +

+
+ ) +} \ No newline at end of file diff --git a/app/home/test/page.tsx b/app/home/test/page.tsx new file mode 100644 index 000000000000..0618de1c5f62 --- /dev/null +++ b/app/home/test/page.tsx @@ -0,0 +1,7 @@ +export default function Page() { + return ( +
+

It works

+
+ ) +} \ No newline at end of file diff --git a/app/home2/layout.tsx b/app/home2/layout.tsx new file mode 100644 index 000000000000..6974837a3ecc --- /dev/null +++ b/app/home2/layout.tsx @@ -0,0 +1,591 @@ +import Image from "next/image" + +import { + File, + Home, + LineChart, + ListFilter, + MoreHorizontal, + Package, + Package2, + PanelLeft, + PlusCircle, + Search, + Settings, + ShoppingCart, + Users2, +} from "lucide-react" + +import { Badge } from "@/components/ui/badge" +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator, +} from "@/components/ui/breadcrumb" +import { Button } from "@/components/ui/button" +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card" +import { + DropdownMenu, + DropdownMenuCheckboxItem, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { Input } from "@/components/ui/input" +import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" +import { + Tabs, + TabsContent, + TabsList, + TabsTrigger, +} from "@/components/ui/tabs" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" +import Posts from '../components/Posts' + + +import Link from "next/link" + +export default function Layout({ children } : { children: React.ReactNode }) { + + return ( +
+ + +
+
+ + + + + + + + + + + +
+ +
+ + +
+ + All + Posts + Users + Add + +
+ + + + + + Products + + Manage your products and view their sales performance. + + + + + + + + Image + + Name + Status + + Price + + + Total Sales + + + Created at + + + Actions + + + + + + + + + + Laser Lemonade Machine + + + Draft + + + $499.99 + + + 25 + + + 2023-07-12 10:42 AM + + + + + + + + Actions + Edit + Delete + + + + + + + + + + Hypernova Headphones + + + Active + + + $129.99 + + + 100 + + + 2023-10-18 03:21 PM + + + + + + + + Actions + Edit + Delete + + + + + + + + + + AeroGlow Desk Lamp + + + Active + + + $39.99 + + + 50 + + + 2023-11-29 08:15 AM + + + + + + + + Actions + Edit + Delete + + + + + + + + + + TechTonic Energy Drink + + + Draft + + + $2.99 + + + 0 + + + 2023-12-25 11:59 PM + + + + + + + + Actions + Edit + Delete + + + + + + + + + + Gamer Gear Pro Controller + + + Active + + + $59.99 + + + 75 + + + 2024-01-01 12:00 AM + + + + + + + + Actions + Edit + Delete + + + + + + + + + + Luminous VR Headset + + + Active + + + $199.99 + + + 30 + + + 2024-02-14 02:14 PM + + + + + + + + Actions + Edit + Delete + + + + + +
+
+ +
+ Showing 1-10 of 32{" "} + products +
+
+
+
+ + + +

Posts

+ +
+ + +

Users

+
+ + + + + + Add Post + Add User + + + +

Add Post

+
+ + +

Add User

+
+
+ + + + +
+ + + +
+ + + +
+ + +
+ {children} +
+ +
+
+ ) + +} \ No newline at end of file diff --git a/app/home2/page.tsx b/app/home2/page.tsx new file mode 100644 index 000000000000..385b35cb4c95 --- /dev/null +++ b/app/home2/page.tsx @@ -0,0 +1,11 @@ +import Link from 'next/link' + +export default function Home() { + return ( +
+

Home Page Linked babwidfhedci3

+ + Posts +
+ ) +} \ No newline at end of file diff --git a/app/home2/posts2/page.tsx b/app/home2/posts2/page.tsx new file mode 100644 index 000000000000..88984652b81b --- /dev/null +++ b/app/home2/posts2/page.tsx @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+

Bonjouuuen

+
+ ) +} diff --git a/app/layout.tsx b/app/layout.tsx new file mode 100644 index 000000000000..3314e4780a0c --- /dev/null +++ b/app/layout.tsx @@ -0,0 +1,22 @@ +import type { Metadata } from "next"; +import { Inter } from "next/font/google"; +import "./globals.css"; + +const inter = Inter({ subsets: ["latin"] }); + +export const metadata: Metadata = { + title: "Create Next App", + description: "Generated by create next app", +}; + +export default function RootLayout({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + return ( + + {children} + + ); +} diff --git a/app/page.tsx b/app/page.tsx new file mode 100644 index 000000000000..c5110af47968 --- /dev/null +++ b/app/page.tsx @@ -0,0 +1,626 @@ +import Image from "next/image" +import Link from "next/link" +import { + File, + Home, + LineChart, + ListFilter, + MoreHorizontal, + Package, + Package2, + PanelLeft, + PlusCircle, + Search, + Settings, + ShoppingCart, + Users2, +} from "lucide-react" + +import { Badge } from "@/components/ui/badge" +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator, +} from "@/components/ui/breadcrumb" +import { Button } from "@/components/ui/button" +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card" +import { + DropdownMenu, + DropdownMenuCheckboxItem, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { Input } from "@/components/ui/input" +import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" +import { + Tabs, + TabsContent, + TabsList, + TabsTrigger, +} from "@/components/ui/tabs" +import { + Tooltip, + TooltipContent, + TooltipTrigger, + TooltipProvider, +} from "@/components/ui/tooltip" + +export default function Dashboard() { + return ( + +
+ +
+
+ + + + + + + + + + + + + Dashboard + + + + + + Products + + + + + All Products + + + +
+ + +
+ + + + + + My Account + + Settings + Support + + Logout + + +
+
+ +
+ + All + Active + Draft + + Archived + + +
+ + + + + + Filter by + + + Active + + Draft + + Archived + + + + + +
+
+ + + + Products + + Manage your products and view their sales performance. + + + + + + + + Image + + Name + Status + + Price + + + Total Sales + + + Created at + + + Actions + + + + + + + + + + Laser Lemonade Machine + + + Draft + + + $499.99 + + + 25 + + + 2023-07-12 10:42 AM + + + + + + + + Actions + Edit + Delete + + + + + + + + + + Hypernova Headphones + + + Active + + + $129.99 + + + 100 + + + 2023-10-18 03:21 PM + + + + + + + + Actions + Edit + Delete + + + + + + + + + + AeroGlow Desk Lamp + + + Active + + + $39.99 + + + 50 + + + 2023-11-29 08:15 AM + + + + + + + + Actions + Edit + Delete + + + + + + + + + + TechTonic Energy Drink + + + Draft + + + $2.99 + + + 0 + + + 2023-12-25 11:59 PM + + + + + + + + Actions + Edit + Delete + + + + + + + + + + Gamer Gear Pro Controller + + + Active + + + $59.99 + + + 75 + + + 2024-01-01 12:00 AM + + + + + + + + Actions + Edit + Delete + + + + + + + + + + Luminous VR Headset + + + Active + + + $199.99 + + + 30 + + + 2024-02-14 02:14 PM + + + + + + + + Actions + Edit + Delete + + + + + +
+
+ +
+ Showing 1-10 of 32{" "} + products +
+
+
+
+
+
+
+
+ + ) +} diff --git a/app/test/page.tsx b/app/test/page.tsx new file mode 100644 index 000000000000..373a15d4f09f --- /dev/null +++ b/app/test/page.tsx @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+

Bonjouuuen

+
+ ) +} \ No newline at end of file diff --git a/components.json b/components.json new file mode 100644 index 000000000000..7e413e33fab9 --- /dev/null +++ b/components.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "default", + "rsc": true, + "tsx": true, + "tailwind": { + "config": "tailwind.config.ts", + "css": "app/globals.css", + "baseColor": "slate", + "cssVariables": false, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils" + } +} \ No newline at end of file diff --git a/components/AddPostForm.tsx b/components/AddPostForm.tsx new file mode 100644 index 000000000000..e044d8753031 --- /dev/null +++ b/components/AddPostForm.tsx @@ -0,0 +1,34 @@ +"use client"; +import { Label } from "@/components/ui/label"; +import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; +import { Button } from "@/components/ui/button"; +import { useState } from "react"; + +import handleSubmit from "./handleSubmitAddPostForm"; +export function AddPostForm() { + + const [title, setTitle] = useState(''); + const [content, setContent] = useState(''); + + + + + + + return ( +
+
+ + + setTitle(e.target.value)} /> + +
+
+ +