Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main2 #57

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -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=""
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions README.mdgit
Original file line number Diff line number Diff line change
@@ -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
59 changes: 59 additions & 0 deletions app/components/Posts.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div>
{
posts.map((post: Post) => (
<div key={post.id} className="py-5">
<Card className="">
<CardHeader>
<CardTitle>{post.title}</CardTitle>
<CardDescription>
{/* {((post.published == true) ? "Publié" : "Non Publié") + ", by " + (async () => {return await getAuthorName(post.authorId as string)})} */}
</CardDescription>
</CardHeader>
<CardContent className="px-10">
<p>{post.content?.slice(0, 100).concat(" ...")}</p>
</CardContent>
<CardFooter>
<Button>
<Link href={"home/post/" + post.id as string}>Read More</Link>
</Button>
</CardFooter>
</Card>

</div>
))
}
</div>
);
}
53 changes: 53 additions & 0 deletions app/components/Users.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div>
{
users.map((user: User) => (
<div key={user.id} className="py-5">
<Card className="">
<CardHeader>
<CardTitle>{user.name}</CardTitle>


<CardDescription>
{user.email}
</CardDescription>


</CardHeader>
<CardContent className="px-10">
<p>{"Created at " + user.createdAt.toDateString()}</p>
<p>{"Last time updated at " + user.updatedAt.toDateString()}</p>
</CardContent>

</Card>

</div>
))
}
</div>
);
}
Binary file added app/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
133 changes: 133 additions & 0 deletions app/home/layout.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="flex min-h-screen w-full flex-col bg-muted/40">

<aside className="fixed inset-y-0 left-0 z-10 hidden w-14 flex-col border-r bg-background sm:flex">
<nav className="flex flex-col items-center gap-4 px-2 sm:py-5">





<TooltipProvider>


<Tooltip>
<TooltipTrigger asChild>
<Link
href="/home"
className="group flex h-9 w-9 shrink-0 items-center justify-center gap-2 rounded-full bg-primary text-lg font-semibold text-primary-foreground md:h-8 md:w-8 md:text-base"
>
<Home className="h-4 w-4 transition-all group-hover:scale-110" />
<p className="sr-only">Acme Inc</p>
</Link>
</TooltipTrigger>
<TooltipContent side="right">Home</TooltipContent>
</Tooltip>



</TooltipProvider>








</nav>

</aside>

<div className="flex flex-col sm:gap-4 sm:py-4 sm:pl-14">





<div className="p-10">



{children}
</div>

</div>
</div>
)

}
Loading