diff --git a/.gitignore b/.gitignore index 3141dbf6..cbc0ee59 100644 --- a/.gitignore +++ b/.gitignore @@ -103,9 +103,12 @@ stats.html .firebase -# src/firebase/firebase.js +# src/firebase/firebase.js node_modules/ + +dist + package-lock.json .env \ No newline at end of file diff --git a/src/pages/createSession/createSession.jsx b/src/pages/createSession/createSession.jsx index 7473baaf..fd9d55cb 100644 --- a/src/pages/createSession/createSession.jsx +++ b/src/pages/createSession/createSession.jsx @@ -1,10 +1,12 @@ -import React, { useState } from "react"; +// CreateSessionCard.jsx +import { useState } from "react"; import { Button } from "@components/Button"; import { Input } from "@components/Input"; -import BackButton from "@components/back"; +import { Card } from "@components/Cards"; +import { CardContent } from "@components/CardContent"; import { createNewSession } from "../../firebase/pmSideFunctions"; -export default function CreateSession() { +export default function CreateSession (){ const [courseName, setCourseName] = useState(""); const [sessionID, setSessionID] = useState(""); const [studentCode, setStudentCode] = useState(""); @@ -16,17 +18,14 @@ export default function CreateSession() { const handleSubmit = async (e) => { e.preventDefault(); - // Generate SessionID and StudentCode const newSessionID = generateRandomCode(); const newStudentCode = generateRandomCode(); setSessionID(newSessionID); setStudentCode(newStudentCode); - // You can handle other processes here, like saving the session to a database, etc. try { await createNewSession(newSessionID, newStudentCode, courseName); - console.log("Session successfully created!"); } catch (error) { console.error("Error creating session: ", error); @@ -34,58 +33,45 @@ export default function CreateSession() { }; return ( -
- {/* Back Button */} -
- -
- - {/* Form for Creating Session */} -
- {/* Course Name Input */} -
- - setCourseName(e.target.value)} - placeholder="Enter course name" - required - className="w-full mt-1 px-3 py-2 border border-gray-300 rounded" - /> -
+ + +
+
Create Session
+ +
+ setCourseName(e.target.value)} + placeholder="Enter course name" + required + className="w-full px-3 py-2 border border-gray-300 rounded" + /> +
- {/* Submit Button */} - - + + - {/* Display Generated Codes */} - {sessionID && studentCode && ( -
-

- Session Created! -

-

- Session ID: {sessionID} -

-

- Student Code: {studentCode} -

+ {sessionID && studentCode && ( +
+

+ Session Created! +

+

+ Session ID: {sessionID} +

+

+ Student Code: {studentCode} +

+
+ )}
- )} -
+
+
); } \ No newline at end of file diff --git a/src/pages/landingPage/landingPage.jsx b/src/pages/landingPage/landingPage.jsx index 4f0423f8..374de1ec 100644 --- a/src/pages/landingPage/landingPage.jsx +++ b/src/pages/landingPage/landingPage.jsx @@ -6,8 +6,8 @@ export default function LandingPage() { return (
-

- Welcome to OHours! +

+ Welcome to OHours

Office Hours scheduling made easy diff --git a/src/pages/pmLanding/pmLanding.jsx b/src/pages/pmLanding/pmLanding.jsx index 7512c8e4..cb951edf 100644 --- a/src/pages/pmLanding/pmLanding.jsx +++ b/src/pages/pmLanding/pmLanding.jsx @@ -1,13 +1,14 @@ +// PMLanding.jsx import { useState, useEffect } from "react"; import { useNavigate } from "react-router-dom"; import { Button } from "@components/Button"; import { Input } from "@components/Input"; import BackButton from "@components/back"; - -import { db } from "../../firebase/firebase"; -import { collection, getDocs } from "firebase/firestore"; +import { Card } from "@components/Cards"; +import { CardContent } from "@components/CardContent"; import { fetchAllActiveSessions } from "../../firebase/pmSideFunctions"; import { useDbData } from "../../firebase/firebaseDb"; +import CreateSession from "../createSession/createSession"; export default function PMLanding() { const navigate = useNavigate(); @@ -15,10 +16,6 @@ export default function PMLanding() { const [sessions, setSessions] = useState({}); const [PMSessions, error] = useDbData("pmToSession"); - const handleCreateSession = () => { - navigate("/pmCreateSess"); - }; - const handleJoinSession = () => { console.log(PMSessions, sessions); if (sessionCode.trim() in PMSessions) { @@ -41,59 +38,74 @@ export default function PMLanding() { }, []); return ( -

-
- -
- {/* Create New Session Button */} - +
+
+
+ +
+
+ Welcome, PMs! +
+
+
+ +
+ - {/* Join Existing Session Section */} -
- setSessionCode(e.target.value)} - placeholder="Enter session code" - className="px-4 py-2 text-lg border border-gray-300 rounded w-60" - /> - -
+ {/* Join Session Card */} + + +
+
Join Session
+
+ setSessionCode(e.target.value)} + placeholder="Enter session code" + className="flex-1 px-4 py-2 text-lg border border-gray-300 rounded" + /> + +
+
+
+
+
- {/* Active Sessions Table */} -
-

Active Sessions

- - - - - - - - - - - {sessions && - Object.entries(sessions).map(([key, session]) => ( - - - - - - - ))} - -
Session IDClass NamePM CodeQueue Length
{key}{session.className}{session.pmCode}{session.queueLength}
+ {/* Bottom card with Active Sessions table */} + + +
Active Sessions
+
+ + + + + + + + + + + {sessions && + Object.entries(sessions).map(([key, session]) => ( + + + + + + + ))} + +
Session IDClass NamePM CodeQueue Length
{key}{session.className}{session.pmCode}{session.queueLength}
+
+
+
);