diff --git a/next.config.ts b/next.config.ts index e9ffa30..30a0170 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,9 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - /* config options here */ + images: { + domains: ["lh3.googleusercontent.com"], + }, }; export default nextConfig; diff --git a/package-lock.json b/package-lock.json index ea65d21..c7ff29e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "dotenv": "^17.2.3", - "framer-motion": "^12.31.0", + "framer-motion": "^12.33.0", "lucide-react": "^0.563.0", "next": "16.1.6", "next-auth": "^4.24.13", diff --git a/package.json b/package.json index 6bd68cb..d79b1e0 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "dotenv": "^17.2.3", - "framer-motion": "^12.31.0", + "framer-motion": "^12.33.0", "lucide-react": "^0.563.0", "next": "16.1.6", "next-auth": "^4.24.13", diff --git a/src/app/profile/lib/action.ts b/src/app/profile/lib/action.ts new file mode 100644 index 0000000..900019a --- /dev/null +++ b/src/app/profile/lib/action.ts @@ -0,0 +1,24 @@ +import { getServerSession } from "next-auth/next"; +import { authOptions } from "../../api/auth/[...nextauth]/route"; +import prisma from "@/lib/prisma"; + +export const getAnotherUserData = async () => { + try { + const session = await getServerSession(authOptions); + + if (!session?.user?.email) return null; + + const user = await prisma.user.findUnique({ + where: { email: session.user.email }, + select: { + gender: true, + productReference: true, + }, + }); + + return user; + } catch (error) { + console.error("Error fetching user data:", error); + return null; + } +}; diff --git a/src/app/profile/page.tsx b/src/app/profile/page.tsx new file mode 100644 index 0000000..a786348 --- /dev/null +++ b/src/app/profile/page.tsx @@ -0,0 +1,18 @@ +import { Header } from "@/src/components/dashboards/Header"; +import { getAnotherUserData } from "./lib/action"; +import ProfileClient from "@/src/components/dashboards/ProfileClient"; +import { UserGender } from "@prisma/client"; + +export default async function ProfilePage() { + const user = await getAnotherUserData(); + + return ( + <> +
+ + + ); +} diff --git a/src/components/dashboards/DashboardClient.tsx b/src/components/dashboards/DashboardClient.tsx index 34e8008..d8b4ee1 100644 --- a/src/components/dashboards/DashboardClient.tsx +++ b/src/components/dashboards/DashboardClient.tsx @@ -79,7 +79,6 @@ export default function DashboardClient() {
- {/* Hero Section */}
-
+
@@ -46,7 +47,7 @@ export function Header() { Analisis Sentimen Ulasan Laptop Tokopedia

-
+
@@ -79,10 +80,12 @@ export function Header() { align="end" className="w-max bg-card border-border shadow-md" > - - - Menu Profil - + + + + Menu Profil + + diff --git a/src/components/dashboards/ProfileClient.tsx b/src/components/dashboards/ProfileClient.tsx new file mode 100644 index 0000000..6360b33 --- /dev/null +++ b/src/components/dashboards/ProfileClient.tsx @@ -0,0 +1,89 @@ +"use client"; +import Image from "next/image"; +import { Button } from "../ui/button"; +import { ArrowLeft, Pencil } from "lucide-react"; +import { Separator } from "../ui/separator"; +import { useSession } from "next-auth/react"; +import { UserGender } from "@prisma/client"; +import Link from "next/link"; +import { motion } from "framer-motion"; + +interface ProfileClientProps { + gender?: UserGender; + productReference?: string; +} + +export default function ProfileClient({ + gender, + productReference, +}: ProfileClientProps) { + const session = useSession(); + + return ( + + + + Back to Dashboard + + + +
+
+ User Avatar +
+

+ {session?.data?.user?.name || "Guest"} +

+

+ {session?.data?.user?.email || "Not logged in"} +

+
+
+ + +
+ + + +
+
+

Gender

+

{gender || "Not specified"}

+
+ +
+

Product Preference

+

{productReference || "None"}

+
+
+
+
+ ); +}