diff --git a/Benjamin/app/(auth)/login/page.tsx b/Benjamin/app/(auth)/login/page.tsx index c644730..6ce563c 100644 --- a/Benjamin/app/(auth)/login/page.tsx +++ b/Benjamin/app/(auth)/login/page.tsx @@ -2,42 +2,41 @@ import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Spinner } from "@/components/ui/spinner"; -import { Loader2, Lock, Mail, User } from "lucide-react"; -import { signIn, useSession } from "next-auth/react"; +import { Lock, Mail, User } from "lucide-react"; import { useState } from "react"; import toast, { Toaster } from "react-hot-toast"; const Login = () => { // BE logic and states - const session= useSession(); + // const session= useSession(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); - const [loading, setloading] =useState(false); + const [loading] =useState(false); if (error != "") { toast.error(error); setError(""); } - const handleSubmit = async (e: React.FormEvent) => { - setloading(true) - e.preventDefault(); + // const handleSubmit = async (e: React.FormEvent) => { + // setloading(true) + // e.preventDefault(); - const result = await signIn("credentials", { - email, - password, - redirect: false, - }); - console.log(result) - if (result?.error) setError("Invalid email or password"); - else { - toast.success(`Welcome ${session.data?.user?.name}`) - window.location.href = "/"; // Redirect on success - } - setloading(false) - }; + // const result = await signIn("credentials", { + // email, + // password, + // redirect: false, + // }); + // console.log(result) + // if (result?.error) setError("Invalid email or password"); + // else { + // toast.success(`Welcome ${session.data?.user?.name}`) + // window.location.href = "/"; // Redirect on success + // } + // setloading(false) + // }; // FE logic and states const [switchCss, setSwitchCss] = useState(true); diff --git a/Benjamin/app/Blog/[blogId]/page.tsx b/Benjamin/app/Blog/[blogId]/page.tsx index 0165b27..ae9fc8b 100644 --- a/Benjamin/app/Blog/[blogId]/page.tsx +++ b/Benjamin/app/Blog/[blogId]/page.tsx @@ -2,15 +2,15 @@ import Blog from "@/components/Blog/Blog"; const BlogPage = () => { return ( - <> +
-
+
Blog Page
- +
); } diff --git a/Benjamin/app/Blog/page.tsx b/Benjamin/app/Blog/page.tsx index 0c9d34a..d39394f 100644 --- a/Benjamin/app/Blog/page.tsx +++ b/Benjamin/app/Blog/page.tsx @@ -3,18 +3,18 @@ import SeperatorHeading from "@/components/ui/seperatorHeading"; const Blogs = () => { return ( - <> +
-
+
Our Blog
-
+
Latest articles from our blogs
- +
); }; diff --git a/Benjamin/app/MyOrders/[orderId]/page.tsx b/Benjamin/app/MyOrders/[orderId]/page.tsx index c0bfc55..59f391f 100644 --- a/Benjamin/app/MyOrders/[orderId]/page.tsx +++ b/Benjamin/app/MyOrders/[orderId]/page.tsx @@ -50,23 +50,23 @@ const orderItems = [ const Order = () => { return ( -
+
- -
Order Summary
+
Order Summary
Arrived at 9:59 pm
-
+
Download Invoice
{/* Scrollable Content Section */} -
+
{orderItems.map((item) => ( ))} diff --git a/Benjamin/app/MyOrders/components/columns.tsx b/Benjamin/app/MyOrders/components/columns.tsx index 94375a6..a61aa68 100644 --- a/Benjamin/app/MyOrders/components/columns.tsx +++ b/Benjamin/app/MyOrders/components/columns.tsx @@ -138,7 +138,7 @@ export const columns: ColumnDef[] = [ const orderId = row.getValue("orderId"); return ( - diff --git a/Benjamin/app/MyOrders/components/datatable.tsx b/Benjamin/app/MyOrders/components/datatable.tsx index 82134e4..196b1f2 100644 --- a/Benjamin/app/MyOrders/components/datatable.tsx +++ b/Benjamin/app/MyOrders/components/datatable.tsx @@ -44,15 +44,15 @@ export function DataTable({ }); return ( -
-
+
+
{table.getHeaderGroups().map((headerGroup) => ( {headerGroup.headers.map((header) => { return ( - + {header.isPlaceholder ? null : flexRender( @@ -65,12 +65,13 @@ export function DataTable({ ))} - + {table.getRowModel().rows?.length ? ( table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell) => ( @@ -101,7 +102,7 @@ export function DataTable({ size="sm" onClick={() => table.previousPage()} disabled={!table.getCanPreviousPage()} - className="text-gray-500 font-bold" + className="bg-customTeal text-gray-200 dark:text-gray-200 dark:bg-Green hover:opacity-80 font-bold" > Previous @@ -110,7 +111,7 @@ export function DataTable({ size="sm" onClick={() => table.nextPage()} disabled={!table.getCanNextPage()} - className="text-gray-500 font-bold" + className="bg-customTeal text-gray-200 dark:text-gray-200 dark:bg-Green hover:opacity-80 font-bold" > Next diff --git a/Benjamin/app/MyOrders/components/orderItem.tsx b/Benjamin/app/MyOrders/components/orderItem.tsx index 3a53c4b..3c084e4 100644 --- a/Benjamin/app/MyOrders/components/orderItem.tsx +++ b/Benjamin/app/MyOrders/components/orderItem.tsx @@ -12,8 +12,8 @@ export interface orderItemProps { const OrderItem: React.FC = ({ item }) => { return ( -
-
+
+
= ({ item }) => { height={"100"} alt="orderImage" /> -
+
{item.name}
@@ -30,7 +30,7 @@ const OrderItem: React.FC = ({ item }) => {
-
₹{item.price}
+
₹{item.price}
); diff --git a/Benjamin/app/MyOrders/page.tsx b/Benjamin/app/MyOrders/page.tsx index 2d8100a..69f756f 100644 --- a/Benjamin/app/MyOrders/page.tsx +++ b/Benjamin/app/MyOrders/page.tsx @@ -2,22 +2,22 @@ import { columns, order } from "./components/columns"; import { DataTable } from "./components/datatable"; const options: Intl.DateTimeFormatOptions = { - weekday: 'short', // 'Tue' - year: 'numeric', // '2024' - month: 'short', // 'Oct' - day: '2-digit', // '01' - hour: '2-digit', // '10' - minute: '2-digit', // '30' + weekday: "short", // 'Tue' + year: "numeric", // '2024' + month: "short", // 'Oct' + day: "2-digit", // '01' + hour: "2-digit", // '10' + minute: "2-digit", // '30' hour12: true, // 12-hour format }; -const orders:order[] = [ +const orders: order[] = [ { id: "1", avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1001", amount: 599, - date: new Date("2024-10-01T10:30:00").toLocaleString("en-IN",options), + date: new Date("2024-10-01T10:30:00").toLocaleString("en-IN", options), status: "delivered", }, { @@ -25,7 +25,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1002", amount: 249, - date: new Date("2024-10-02T14:00:00").toLocaleString("en-IN",options), + date: new Date("2024-10-02T14:00:00").toLocaleString("en-IN", options), status: "out for delivery", }, { @@ -33,7 +33,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1003", amount: 799, - date: new Date("2024-10-03T18:45:00").toLocaleString("en-IN",options), + date: new Date("2024-10-03T18:45:00").toLocaleString("en-IN", options), status: "processing", }, { @@ -41,7 +41,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1004", amount: 999, - date: new Date("2024-10-04T11:20:00").toLocaleString("en-IN",options), + date: new Date("2024-10-04T11:20:00").toLocaleString("en-IN", options), status: "failed", }, { @@ -49,7 +49,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1005", amount: 459, - date: new Date("2024-10-05T08:10:00").toLocaleString("en-IN",options), + date: new Date("2024-10-05T08:10:00").toLocaleString("en-IN", options), status: "delivered", }, { @@ -57,7 +57,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1006", amount: 350, - date: new Date("2024-10-06T12:45:00").toLocaleString("en-IN",options), + date: new Date("2024-10-06T12:45:00").toLocaleString("en-IN", options), status: "processing", }, { @@ -65,7 +65,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1007", amount: 1299, - date: new Date("2024-10-07T15:00:00").toLocaleString("en-IN",options), + date: new Date("2024-10-07T15:00:00").toLocaleString("en-IN", options), status: "out for delivery", }, { @@ -73,7 +73,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1008", amount: 699, - date: new Date("2024-10-08T09:30:00").toLocaleString("en-IN",options), + date: new Date("2024-10-08T09:30:00").toLocaleString("en-IN", options), status: "delivered", }, { @@ -81,7 +81,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1009", amount: 199, - date: new Date("2024-10-09T13:20:00").toLocaleString("en-IN",options), + date: new Date("2024-10-09T13:20:00").toLocaleString("en-IN", options), status: "failed", }, { @@ -89,7 +89,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1010", amount: 799, - date: new Date("2024-10-10T11:50:00").toLocaleString("en-IN",options), + date: new Date("2024-10-10T11:50:00").toLocaleString("en-IN", options), status: "out for delivery", }, { @@ -97,7 +97,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1011", amount: 1599, - date: new Date("2024-10-11T17:25:00").toLocaleString("en-IN",options), + date: new Date("2024-10-11T17:25:00").toLocaleString("en-IN", options), status: "delivered", }, { @@ -105,7 +105,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1012", amount: 999, - date: new Date("2024-10-12T16:10:00").toLocaleString("en-IN",options), + date: new Date("2024-10-12T16:10:00").toLocaleString("en-IN", options), status: "processing", }, { @@ -113,7 +113,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1013", amount: 599, - date: new Date("2024-10-13T08:45:00").toLocaleString("en-IN",options), + date: new Date("2024-10-13T08:45:00").toLocaleString("en-IN", options), status: "out for delivery", }, { @@ -121,7 +121,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1014", amount: 449, - date: new Date("2024-10-14T10:30:00").toLocaleString("en-IN",options), + date: new Date("2024-10-14T10:30:00").toLocaleString("en-IN", options), status: "failed", }, { @@ -129,7 +129,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1015", amount: 799, - date: new Date("2024-10-15T19:10:00").toLocaleString("en-IN",options), + date: new Date("2024-10-15T19:10:00").toLocaleString("en-IN", options), status: "delivered", }, { @@ -137,7 +137,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1016", amount: 300, - date: new Date("2024-10-16T15:45:00").toLocaleString("en-IN",options), + date: new Date("2024-10-16T15:45:00").toLocaleString("en-IN", options), status: "processing", }, { @@ -145,7 +145,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1017", amount: 1200, - date: new Date("2024-10-17T18:20:00").toLocaleString("en-IN",options), + date: new Date("2024-10-17T18:20:00").toLocaleString("en-IN", options), status: "out for delivery", }, { @@ -153,7 +153,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1018", amount: 750, - date: new Date("2024-10-18T20:10:00").toLocaleString("en-IN",options), + date: new Date("2024-10-18T20:10:00").toLocaleString("en-IN", options), status: "delivered", }, { @@ -161,7 +161,7 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1019", amount: 590, - date: new Date("2024-10-19T12:30:00").toLocaleString("en-IN",options), + date: new Date("2024-10-19T12:30:00").toLocaleString("en-IN", options), status: "failed", }, { @@ -169,27 +169,23 @@ const orders:order[] = [ avatar: "https://github.com/shadcn.png", orderId: "EZYSHOP1020", amount: 680, - date: new Date("2024-10-20T10:20:00").toLocaleString("en-IN",options), + date: new Date("2024-10-20T10:20:00").toLocaleString("en-IN", options), status: "out for delivery", }, ]; - const Orders = () => { return ( -
-
+
+
Your Orders
-
- -
- - - +
+ +
); }; diff --git a/Benjamin/components/Blog/Blog.tsx b/Benjamin/components/Blog/Blog.tsx index 03b33c4..bfdc3bf 100644 --- a/Benjamin/components/Blog/Blog.tsx +++ b/Benjamin/components/Blog/Blog.tsx @@ -9,13 +9,13 @@ import Image from "next/image"; const Blog = () => { return ( -
+
{/* left half */}
{/* blog heading */} -
+
10 Ways to Save on Groceries This Month
@@ -23,15 +23,15 @@ const Blog = () => {
- +
Shreya
- +
Shopping Tips
- +
23
@@ -62,7 +62,7 @@ const Blog = () => {
- {/* right */} + {/* right half*/}
diff --git a/Benjamin/components/Blog/BlogCard.tsx b/Benjamin/components/Blog/BlogCard.tsx index 6abf54f..84f2213 100644 --- a/Benjamin/components/Blog/BlogCard.tsx +++ b/Benjamin/components/Blog/BlogCard.tsx @@ -45,37 +45,37 @@ const blogData = [ const BlogCard = () => { return ( -
+
{blogData.map((card) => (
- + {card.title}
- +
- +
{card.author}
- +
{card.category}
- +
{card.comments}
-
{card.content}
+
{card.content}
@@ -83,7 +83,7 @@ const BlogCard = () => { diff --git a/Benjamin/components/Blog/CategoryByKeyword.tsx b/Benjamin/components/Blog/CategoryByKeyword.tsx index 686dc72..381fa78 100644 --- a/Benjamin/components/Blog/CategoryByKeyword.tsx +++ b/Benjamin/components/Blog/CategoryByKeyword.tsx @@ -31,18 +31,18 @@ const categories = [ const CategoryByKeyword = () => { return ( <> -
+
Filter categories by keywords
-
+
Categories
{categories.map((category)=>( - -
{category.label}
-
{category.count}
+ +
{category.label}
+
{category.count}
))}
diff --git a/Benjamin/components/Blog/Comments.tsx b/Benjamin/components/Blog/Comments.tsx index d0e01c4..ce5884b 100644 --- a/Benjamin/components/Blog/Comments.tsx +++ b/Benjamin/components/Blog/Comments.tsx @@ -50,18 +50,18 @@ const comments = [ const BlogComments = () => { return (
-
+
{comments.length} Comments
{comments.map((comment) => ( ))} - + diff --git a/Benjamin/components/Blog/RecentPosts.tsx b/Benjamin/components/Blog/RecentPosts.tsx index 22ae6b5..455d663 100644 --- a/Benjamin/components/Blog/RecentPosts.tsx +++ b/Benjamin/components/Blog/RecentPosts.tsx @@ -50,7 +50,7 @@ const blogData = [ const RecentPosts = () => { return ( <> -
+
Recent Posts
@@ -72,39 +72,39 @@ const RecentPosts = () => { - +
- - + + {card.title}
- +
{" "} {card.author}
- +
{card.category}
- +
{card.comments}
diff --git a/Benjamin/components/Blog/RelatedPosts.tsx b/Benjamin/components/Blog/RelatedPosts.tsx index db21d69..ecb18fb 100644 --- a/Benjamin/components/Blog/RelatedPosts.tsx +++ b/Benjamin/components/Blog/RelatedPosts.tsx @@ -50,12 +50,12 @@ const blogData = [ const RelatedPosts = () => { return ( <> -
+
Related Posts
{/* Ensure no overflow with max-width and padding adjustments */} -
+
{ className="flex items-center justify-center lg:block" > - +
- - + + {card.title} - +
- +
{card.author}
- +
{card.category}
- +
{card.comments}
diff --git a/Benjamin/components/Blog/blogAvatar.tsx b/Benjamin/components/Blog/blogAvatar.tsx index 5b5fa7e..26c7bee 100644 --- a/Benjamin/components/Blog/blogAvatar.tsx +++ b/Benjamin/components/Blog/blogAvatar.tsx @@ -2,12 +2,12 @@ import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar"; const BlogAvatar = () => { return ( -
+
CN -
+
Priya Verma
diff --git a/Benjamin/components/Blog/commentCard.tsx b/Benjamin/components/Blog/commentCard.tsx index 5d11f77..b5e7e50 100644 --- a/Benjamin/components/Blog/commentCard.tsx +++ b/Benjamin/components/Blog/commentCard.tsx @@ -20,9 +20,9 @@ const CommentCard = ({
-
{comment.name}
-
-
{comment.date}
+
{comment.name}
+
+
{comment.date}
{comment.text} diff --git a/Benjamin/components/authButtons.tsx b/Benjamin/components/authButtons.tsx index fc5ad2a..cf28750 100644 --- a/Benjamin/components/authButtons.tsx +++ b/Benjamin/components/authButtons.tsx @@ -1,4 +1,4 @@ -import { signIn, signOut } from "next-auth/react"; +import { signOut } from "next-auth/react"; import { useSession } from "next-auth/react"; import Link from "next/link"; import { Button } from "./ui/button"; diff --git a/Benjamin/components/navbar.tsx b/Benjamin/components/navbar.tsx index ec6a477..c5397ad 100644 --- a/Benjamin/components/navbar.tsx +++ b/Benjamin/components/navbar.tsx @@ -11,7 +11,7 @@ const Navbar = () => { const { theme} = useTheme() || {theme:"light"} // Get the current theme and toggle function return ( -
+
{value ? frameworks.find((framework) => framework.value === value)?.label diff --git a/Benjamin/components/ui/themeButton.tsx b/Benjamin/components/ui/themeButton.tsx index e42c1e6..ca9c1a9 100644 --- a/Benjamin/components/ui/themeButton.tsx +++ b/Benjamin/components/ui/themeButton.tsx @@ -4,12 +4,12 @@ import * as React from "react" import { Moon, Sun } from "lucide-react" import { Button } from "@/components/ui/button" -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu" +// import { +// DropdownMenu, +// DropdownMenuContent, +// DropdownMenuItem, +// DropdownMenuTrigger, +// } from "@/components/ui/dropdown-menu" import { useTheme } from "@/context/themeProvider" export function ModeToggle() { diff --git a/Benjamin/lib/auth.ts b/Benjamin/lib/auth.ts index 5d08f72..0d8efc8 100644 --- a/Benjamin/lib/auth.ts +++ b/Benjamin/lib/auth.ts @@ -2,15 +2,22 @@ import { PrismaClient } from "@prisma/client"; import CredentialsProvider from "next-auth/providers/credentials"; import bcrypt from "bcrypt"; +import { User as NextAuthUser } from "next-auth"; + +interface JWTToken { + uid?: string; + user?: NextAuthUser; +} + export const NEXT_AUTH_CONFIG = { providers: [ CredentialsProvider({ name: "Credentials", credentials: { - username: { label: "email", type: "text", placeholder: "" }, + email: { label: "email", type: "text", placeholder: "" }, password: { label: "password", type: "password", placeholder: "" }, }, - async authorize(credentials: any) { + async authorize(credentials:Record<"email" | "password", string> | undefined) { if (!credentials?.email || !credentials?.password) { throw new Error("Invalid credentials"); @@ -48,15 +55,18 @@ export const NEXT_AUTH_CONFIG = { ], secret: process.env.NEXTAUTH_SECRET, callbacks: { - jwt: async ({ user, token }: any) => { + jwt: async ({ user, token }: { user?: NextAuthUser; token: JWTToken }) => { if (user) { token.uid = user.id; } return token; }, - session: ({ session, token, user }: any) => { + session: ({ session, token }: { + session: { user?: NextAuthUser }; + token: JWTToken; + }) => { if (session.user) { - session.user.id = token.uid + session.user.id = token.uid ||"" } return session }