diff --git a/app/admin/login/page.tsx b/app/admin/login/page.tsx
index 310a3de..89da19d 100644
--- a/app/admin/login/page.tsx
+++ b/app/admin/login/page.tsx
@@ -1,65 +1,83 @@
"use client";
-import { useState } from "react";
+import { useSession, signIn } from "next-auth/react";
+import { useRouter } from "next/navigation";
+import { useEffect } from "react";
export default function AdminLoginPage() {
- const [email, setEmail] = useState("");
- const [password, setPassword] = useState("");
+ const { data: session, status } = useSession();
+ const router = useRouter();
- const handleSubmit = (e: React.FormEvent) => {
- e.preventDefault();
- console.log({ email, password });
- };
+ useEffect(() => {
+ if (session) {
+ router.push("/admin");
+ }
+ }, [session, router]);
+ if (status === "loading") {
return (
-
-
-
-
Admin Login
-
- Sign in to access the admin dashboard
-
-
+
+ Loading...
+
+ );
+ }
-
+
+ );
}
diff --git a/app/admin/page.tsx b/app/admin/page.tsx
index 16a284c..05c59b8 100644
--- a/app/admin/page.tsx
+++ b/app/admin/page.tsx
@@ -1,11 +1,12 @@
+import ProfileDropdown from "@/components/admin/ProfileDropdown";
+
export default function AdminPage() {
- return (
-
-
Admin Dashboard
-
- Base admin layout shell is working & No auth yet.
-
+ return (
+
+
- );
- }
-
\ No newline at end of file
+
+ );
+}
diff --git a/components/admin/ProfileDropdown.tsx b/components/admin/ProfileDropdown.tsx
new file mode 100644
index 0000000..6e2a659
--- /dev/null
+++ b/components/admin/ProfileDropdown.tsx
@@ -0,0 +1,92 @@
+"use client";
+
+import { useSession, signOut } from "next-auth/react";
+import { useState, useRef, useEffect } from "react";
+
+export default function ProfileDropdown() {
+ const { data: session } = useSession();
+ const [open, setOpen] = useState(false);
+ const ref = useRef
(null);
+
+ useEffect(() => {
+ function handleClickOutside(e: MouseEvent) {
+ if (ref.current && !ref.current.contains(e.target as Node)) {
+ setOpen(false);
+ }
+ }
+ document.addEventListener("mousedown", handleClickOutside);
+ return () => document.removeEventListener("mousedown", handleClickOutside);
+ }, []);
+
+ return (
+
+ {session?.user?.image && (
+

setOpen(!open)}
+ style={{
+ borderRadius: "50%",
+ objectFit: "cover",
+ cursor: "pointer",
+ border: open ? "2px solid #111" : "2px solid transparent",
+ transition: "border 0.15s",
+ }}
+ />
+ )}
+
+ {open && (
+
+
+
+ {session?.user?.name}
+
+
+ {session?.user?.email}
+
+
+
+
+ )}
+
+ );
+}