Skip to content

Commit 0041dd6

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents aa01d39 + 71c711e commit 0041dd6

File tree

1 file changed

+31
-22
lines changed

1 file changed

+31
-22
lines changed

components/ProfilePage/MyProfile.tsx

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { axiosInstance } from "@/lib/api/axios";
66
import { useUserStore } from "@/lib/store";
77
import Image from "next/image";
88
import Link from "next/link";
9+
import { useRouter } from "next/navigation";
910
import {
1011
SiX,
1112
SiInstagram,
@@ -101,6 +102,7 @@ const MyProfile: React.FC = () => {
101102
const id = useUserStore((state) => state.user?.id);
102103
const [isUserModalOpen, setIsUserModalOpen] = useState(false);
103104
const [isAlumniModalOpen, setIsAlumniModalOpen] = useState(false);
105+
const router = useRouter();
104106

105107
const { data, error, isLoading } = useQuery<UserProfileData>({
106108
queryKey: ["myProfile"],
@@ -148,28 +150,35 @@ const MyProfile: React.FC = () => {
148150
</div>
149151
{/* Username */}
150152
<h3 className="text-3xl font-semibold">a.k.a. {data?.username}</h3>
151-
{/* Edit Profile Button */}
152-
<ModalProvider>
153-
<EditUserDetails
154-
userData={{
155-
id: id || "",
156-
name: data.name,
157-
personalEmail: data.personalEmail,
158-
username: data.username,
159-
profiles: data.profiles.map((profile) => ({
160-
type: profile.type,
161-
link: profile.link,
162-
visibility: profile.visibility === "yes",
163-
})),
164-
bio: data.bio,
165-
}}
166-
/>
167-
</ModalProvider>
168-
{data.role === "student" && (
169-
<button className="px-4 py-2 bg-black text-white rounded-lg">
170-
Register as Alumni
171-
</button>
172-
)}
153+
{/* Edit Profile Button and Register as alumni Button */}
154+
<div className="flex items-center gap-4">
155+
<ModalProvider>
156+
<EditUserDetails
157+
userData={{
158+
id: id || "",
159+
name: data.name,
160+
personalEmail: data.personalEmail,
161+
username: data.username,
162+
profiles: data.profiles.map((profile) => ({
163+
type: profile.type,
164+
link: profile.link,
165+
visibility: profile.visibility === "yes",
166+
})),
167+
bio: data.bio,
168+
}}
169+
/>
170+
</ModalProvider>
171+
172+
{data.role === "student" && (
173+
<button
174+
className="bg-blue-500 text-white px-4 py-2 rounded-md"
175+
onClick={() => router.push("/alumnidetails")}
176+
>
177+
Register as Alumni
178+
</button>
179+
)}
180+
</div>
181+
173182
{/* Social Media Links */}
174183
<div className="flex space-x-4">
175184
{data?.profiles &&

0 commit comments

Comments
 (0)