From a4e920411c485dd8395a014428583f89654327c8 Mon Sep 17 00:00:00 2001 From: Newton Chung Date: Wed, 27 May 2026 12:22:15 -0700 Subject: [PATCH 1/4] Added UI Elements for Student Onboarding Workflow Fixed Join Page and added instructions for enabling permission on FreeCodeCamp Proper TODO: Implement 'Connect' button functionality. This requires Mrugesh's PR #66063 to be implemented. Currently, the Connect button just adds the user to the Classroom without verification. --- pages/join/[...joinCode].js | 89 ++++++++++++++++++++++++------------- pages/join/index.js | 27 +++++++---- 2 files changed, 78 insertions(+), 38 deletions(-) diff --git a/pages/join/[...joinCode].js b/pages/join/[...joinCode].js index cf2065ab2..94acd1d3a 100644 --- a/pages/join/[...joinCode].js +++ b/pages/join/[...joinCode].js @@ -7,16 +7,35 @@ import AuthButton from '../../components/authButton'; import DisplayNotification from '../../components/displayNotification'; import { ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; +import prisma from '../../prisma/prisma'; export async function getServerSideProps(ctx) { const userSession = await getSession(ctx); + + const params = ctx.params || {}; + const joinParam = params.joinCode || null; + const classroomId = Array.isArray(joinParam) ? joinParam[0] : joinParam; + + let classroom = null; + if (classroomId) { + try { + classroom = await prisma.classroom.findUnique({ + where: { classroomId }, + select: { classroomName: true, description: true, classroomId: true } + }); + } catch (err) { + classroom = null; + } + } + return { props: { - userSession: userSession + userSession: userSession, + classroom } }; } -export default function JoinWithCode({ userSession }) { +export default function JoinWithCode({ userSession, classroom }) { const [formData] = useState({}); const router = useRouter(); const { joinCode } = router.query; @@ -63,50 +82,60 @@ export default function JoinWithCode({ userSession }) { {userSession ? ( <> -
-
+
+
-

- Register for Classroom +

+ Join Classroom

+ {classroom && ( +

+ Joining:{' '} + + {classroom.classroomName || classroom.classroomId} + +

+ )}
-
+
+
+

+ If you have not enabled Classroom access on freeCodeCamp, + please open your settings and enable it before connecting. +

+ +

+ Note: If you change the email on your freeCodeCamp account + later, you may need to reconnect to this classroom. +

+
) : ( <> -
-
+
+
-

+

Sign In with FreeCodeCamp

diff --git a/pages/join/index.js b/pages/join/index.js index 82e401616..43ed2676a 100644 --- a/pages/join/index.js +++ b/pages/join/index.js @@ -1,21 +1,32 @@ import Layout from '../../components/layout'; import Head from 'next/head'; import Navbar from '../../components/navbar'; +import Link from 'next/link'; export default function Join() { return ( - Create Next App - + Join a Classroom + - -
  • -

    Welcome

    -
  • -
    - No code given + +
    +
    +

    No join code provided

    +

    + To join a Classroom, you must open the unique join link provided by + your instructor. The link should look like{' '} + /join/<classroomId>. +

    + + + Return to Home + + +
    +
    ); } From 9f6ec56fc68142dda66aec1d391371e2a831bc38 Mon Sep 17 00:00:00 2001 From: Newton Chung Date: Fri, 29 May 2026 23:05:14 -0700 Subject: [PATCH 2/4] Fix Undefined classroom link --- components/ClassInviteTable.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/ClassInviteTable.js b/components/ClassInviteTable.js index 5501a308a..f0ea0367c 100644 --- a/components/ClassInviteTable.js +++ b/components/ClassInviteTable.js @@ -30,12 +30,11 @@ export default function ClassInviteTable({ ); const ref = useRef(); - const userCurrentDomain = process.env.NEXTAUTH_URL; const copy = async () => { //Add the full URL to send to student await navigator.clipboard.writeText( - `${userCurrentDomain}/join/` + currentClass.classroomId + `${window.location.origin}/join/` + currentClass.classroomId ); toast('Class code successfully copied', { From c88b83b2def56cf952bc0953e57f42520c63fe74 Mon Sep 17 00:00:00 2001 From: Newton Chung Date: Sat, 30 May 2026 18:14:17 -0700 Subject: [PATCH 3/4] Added 'Classroom Not Found' error page Previously, when a user enters a join link for a classroom that does not exist, it would allow the user to enter the Join page and fail silently. --- pages/join/[...joinCode].js | 50 +++++++++++++++++++++++++------------ pages/join/index.js | 4 +-- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/pages/join/[...joinCode].js b/pages/join/[...joinCode].js index 94acd1d3a..0fc8390af 100644 --- a/pages/join/[...joinCode].js +++ b/pages/join/[...joinCode].js @@ -1,4 +1,5 @@ import Head from 'next/head'; +import Link from 'next/link'; import Navbar from '../../components/navbar'; import { useState } from 'react'; import { useRouter } from 'next/router'; @@ -80,7 +81,39 @@ export default function JoinWithCode({ userSession, classroom }) { - {userSession ? ( + {!userSession ? ( + <> +
    +
    +
    +

    + Sign In with FreeCodeCamp +

    +
    +
    + +
    +
    +
    + + ) : classroom === null ? ( +
    +
    +

    + Classroom Not Found +

    +

    + We could not find a classroom for this invite link. Please check + the link or ask your teacher to resend the invite. +

    +
    + + Back to Home + +
    +
    +
    + ) : ( <>
    @@ -130,21 +163,6 @@ export default function JoinWithCode({ userSession, classroom }) {
    - ) : ( - <> -
    -
    -
    -

    - Sign In with FreeCodeCamp -

    -
    -
    - -
    -
    -
    - )}
    diff --git a/pages/join/index.js b/pages/join/index.js index 43ed2676a..7e87c5df4 100644 --- a/pages/join/index.js +++ b/pages/join/index.js @@ -12,8 +12,8 @@ export default function Join() { -
    -
    +
    +

    No join code provided

    To join a Classroom, you must open the unique join link provided by From ac67a05492c14b47eb35e9d4d81b80bcf298409f Mon Sep 17 00:00:00 2001 From: Newton Chung Date: Sat, 30 May 2026 18:32:53 -0700 Subject: [PATCH 4/4] Added 'Sign in with FreeCodeCamp' case to Join Index page --- pages/join/index.js | 51 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/pages/join/index.js b/pages/join/index.js index 7e87c5df4..428f4e537 100644 --- a/pages/join/index.js +++ b/pages/join/index.js @@ -2,8 +2,10 @@ import Layout from '../../components/layout'; import Head from 'next/head'; import Navbar from '../../components/navbar'; import Link from 'next/link'; +import AuthButton from '../../components/authButton'; +import { getSession } from 'next-auth/react'; -export default function Join() { +export default function Join({ userSession }) { return ( @@ -12,21 +14,46 @@ export default function Join() { +

    -

    No join code provided

    -

    - To join a Classroom, you must open the unique join link provided by - your instructor. The link should look like{' '} - /join/<classroomId>. -

    - - - Return to Home - - + {!userSession ? ( +
    +
    +

    + Sign In with FreeCodeCamp +

    +
    + +
    +
    +
    + ) : ( +
    +

    No join code provided

    +

    + To join a Classroom, you must open the unique join link provided + by your instructor. The link should look like{' '} + /join/<classroomId>. +

    + + + Return to Home + + +
    + )}
    ); } + +export async function getServerSideProps(ctx) { + const session = await getSession(ctx); + return { + props: { + userSession: session || null + } + }; +}