From 71c986bf0107b5c036d397e79695539b7676a6f7 Mon Sep 17 00:00:00 2001 From: Prajwal Pisal Date: Wed, 22 Feb 2023 23:46:14 +0000 Subject: [PATCH 1/2] Created a profile page for teachers. --- pages/classes/index.js | 3 ++ pages/index.js | 3 ++ pages/profile.js | 117 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 pages/profile.js diff --git a/pages/classes/index.js b/pages/classes/index.js index 7969ba77..41630aac 100644 --- a/pages/classes/index.js +++ b/pages/classes/index.js @@ -102,6 +102,9 @@ export default function Classes({
Menu
+
+ Profile +
diff --git a/pages/index.js b/pages/index.js index 9b42c8e5..1af6a171 100644 --- a/pages/index.js +++ b/pages/index.js @@ -19,6 +19,9 @@ export default function Home() {
Menu
+
+ Profile +

diff --git a/pages/profile.js b/pages/profile.js new file mode 100644 index 00000000..16a1fa2e --- /dev/null +++ b/pages/profile.js @@ -0,0 +1,117 @@ +import { useState, useEffect } from 'react'; +import Navbar from '../components/navbar'; +import Link from 'next/link'; + +function Profile() { + // Set up initial user data + const [userData, setUserData] = useState({ + name: '', + email: '', + university: '', + bio: '' + }); + + // Load user data from localStorage if available + useEffect(() => { + if (localStorage.getItem('userData')) { + setUserData(JSON.parse(localStorage.getItem('userData'))); + } + }, []); + + // Update user data and localStorage + function handleSave() { + localStorage.setItem('userData', JSON.stringify(userData)); + } + + return ( +
+ +
+ Classes +
+
+ Menu +
+
+
+
+
+
+
+ Profile picture +
+
{userData.name}
+
+
+ +
+ + setUserData({ ...userData, name: e.target.value }) + } + /> +
+
+
+ +
+ + setUserData({ ...userData, email: e.target.value }) + } + /> +
+
+
+ +
+ + setUserData({ ...userData, university: e.target.value }) + } + /> +
+
+
+ +
+ +
+
+ +
+
+
+
+
+
+ ); +} + +export default Profile; From bb99238fa39ecbe4b53804f65502e3cb42de331b Mon Sep 17 00:00:00 2001 From: Prajwal Pisal Date: Wed, 22 Feb 2023 23:55:29 +0000 Subject: [PATCH 2/2] Co-authored-by: Akhil Kalakota Co-authored-by: Anisha Jadhav --- pages/profile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/profile.js b/pages/profile.js index 16a1fa2e..d358a870 100644 --- a/pages/profile.js +++ b/pages/profile.js @@ -11,7 +11,7 @@ function Profile() { bio: '' }); - // Load user data from localStorage if available + // Load user data from localStorage if available. useEffect(() => { if (localStorage.getItem('userData')) { setUserData(JSON.parse(localStorage.getItem('userData')));