From af692e8fc3cb8e68742df4a440652a2105a5a849 Mon Sep 17 00:00:00 2001 From: SiddharthaMishra-dev Date: Fri, 16 Feb 2024 23:18:34 +0530 Subject: [PATCH] [feat]: add profile image in the blog post --- actions/actions.ts | 13 +++++++++++++ app/blogs/page.tsx | 1 - app/layout.tsx | 2 +- app/page.tsx | 8 ++++++-- components/BlogCard.tsx | 24 ++++++++++++++++++++++-- components/BlogList.tsx | 1 + components/Navbar.tsx | 4 ++-- 7 files changed, 45 insertions(+), 8 deletions(-) diff --git a/actions/actions.ts b/actions/actions.ts index 65260d4..b8dfd8f 100644 --- a/actions/actions.ts +++ b/actions/actions.ts @@ -168,3 +168,16 @@ export async function DeleteBlog(props: string | string[]) { console.log(err); } } + +export async function GetUserImage(props: string) { + try { + const usr = await prisma.users.findFirst({ + where: { + id: props, + }, + }); + return usr?.image || ""; + } catch (err) { + console.log(err); + } +} diff --git a/app/blogs/page.tsx b/app/blogs/page.tsx index 096c928..67d4be5 100644 --- a/app/blogs/page.tsx +++ b/app/blogs/page.tsx @@ -1,4 +1,3 @@ -// "use client"; import { FetchAll } from "@/actions/actions"; import BlogList from "@/components/BlogList"; diff --git a/app/layout.tsx b/app/layout.tsx index 928b586..fa3224e 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -10,7 +10,7 @@ const roboto = Roboto({ }); export const metadata: Metadata = { - title: "blog-g-gers", + title: "blog-g-ers", description: "Be yourself", }; diff --git a/app/page.tsx b/app/page.tsx index fd6e5af..89942ab 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -4,8 +4,12 @@ import Link from "next/link"; export default function Home() { return (
-

Blog-g-ers

-

Share who you are

+

+ blog-g-ers +

+

Share who you are

)}