From aa833775ff26c65acab526c2f4bd8758b9d6f5c4 Mon Sep 17 00:00:00 2001 From: Prathmesh Sadake Date: Sat, 10 Jun 2023 09:40:45 +0530 Subject: [PATCH] Added notification and refactored code --- components/Form.tsx | 24 +------ components/Header.tsx | 8 +-- components/Input.tsx | 18 +---- components/Layout.tsx | 11 ++- components/Modal.tsx | 53 ++------------ components/NotificationsFeed.tsx | 38 ++++++++++ components/layout/SidebarItem.tsx | 32 +-------- components/layout/SidebarLogo.tsx | 12 +--- components/layout/SidebarTweetButton.tsx | 41 +---------- components/modals/LoginModal.tsx | 6 +- components/modals/RegisterModal.tsx | 6 +- components/posts/CommentItem.tsx | 26 +------ components/posts/PostItem.tsx | 51 ++------------ components/users/UserBio.tsx | 11 +-- hooks/useUser.ts | 4 +- hooks/useUsers.ts | 4 +- libs/prismadb.ts | 11 +-- libs/serverAuth.ts | 4 +- pages/_app.tsx | 37 ++++------ pages/_document.tsx | 13 ---- pages/api/auth/[...nextauth].ts | 3 +- pages/api/comments.ts | 66 ++++++++++++++++++ pages/api/current.ts | 7 +- pages/api/edit.ts | 12 +++- pages/api/follow.ts | 48 +++++++++++-- pages/api/like.ts | 89 ++++++++++++++++++++++++ pages/api/notifications/[userId].ts | 43 ++++++++++++ pages/api/posts/[postId].ts | 3 +- pages/api/posts/index.ts | 16 ++++- pages/api/register.ts | 17 +++-- pages/api/users/[userId].ts | 13 ++-- pages/api/users/index.ts | 6 +- pages/index.tsx | 15 ++-- pages/notifications.tsx | 35 ++++++++++ pages/search.tsx | 11 +++ public/thirteen.svg | 1 + styles/globals.css | 8 ++- tailwind.config.js | 14 ++-- tsconfig.json | 1 + 39 files changed, 454 insertions(+), 364 deletions(-) create mode 100644 components/NotificationsFeed.tsx delete mode 100644 pages/_document.tsx create mode 100644 pages/api/comments.ts create mode 100644 pages/api/like.ts create mode 100644 pages/api/notifications/[userId].ts create mode 100644 pages/notifications.tsx create mode 100644 pages/search.tsx create mode 100644 public/thirteen.svg diff --git a/components/Form.tsx b/components/Form.tsx index 5d91a45..ea43e58 100644 --- a/components/Form.tsx +++ b/components/Form.tsx @@ -59,30 +59,10 @@ const Form: React.FC = ({ placeholder, isComment, postId }) => { disabled={isLoading} onChange={(event) => setBody(event.target.value)} value={body} - className=' - disabled:opacity-80 - peer - resize-none - mt-3 - w-full - bg-black - ring-0 - outline-none - text-[20px] - placeholder-neutral-500 - text-white - ' + className='disabled:opacity-80 peer resize-none mt-3 w-full bg-black ring-0 outline-none text-[20px] placeholder-neutral-500 text-white' placeholder={placeholder} > -
+
); diff --git a/components/Input.tsx b/components/Input.tsx index 9db12e1..514d04e 100644 --- a/components/Input.tsx +++ b/components/Input.tsx @@ -26,23 +26,7 @@ const Input: React.FC = ({ value={value} placeholder={placeholder} type={type} - className=' - w-full - p-4 - text-lg - bg-black - border-2 - border-neutral-800 - rounded-md - outline-none - text-white - focus:border-sky-500 - focus:border-2 - transition - disabled:bg-neutral-900 - disabled:opacity-70 - disabled:cursor-not-allowed - ' + className='w-full p-4 text-lg bg-black border-2 border-neutral-800 rounded-md outline-none text-white focus:border-sky-500 focus:border-2 transition disabled:bg-neutral-900 disabled:opacity-70 disabled:cursor-not-allowed' /> ); diff --git a/components/Layout.tsx b/components/Layout.tsx index ae5d127..d3884cf 100644 --- a/components/Layout.tsx +++ b/components/Layout.tsx @@ -1,18 +1,15 @@ import React from "react"; -import Sidebar from "./layout/Sidebar"; -import FollowBar from "./layout/FollowBar"; -interface LayoutProps { - children: React.ReactNode; -} +import FollowBar from "@/components/layout/FollowBar"; +import Sidebar from "@/components/layout/Sidebar"; -const Layout: React.FC = ({ children }) => { +const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) => { return (
-
+
{children}
diff --git a/components/Modal.tsx b/components/Modal.tsx index 0c5fd26..6f37418 100644 --- a/components/Modal.tsx +++ b/components/Modal.tsx @@ -45,60 +45,15 @@ const Modal: React.FC = ({ return ( <> -
+
{/*content*/} -
+
{/*header*/} -
+

{title}