From 333e23bf70448807671ce9a93cd1e1c4ebb0da2d Mon Sep 17 00:00:00 2001 From: Michael Stewart Date: Mon, 20 May 2024 09:31:51 -0400 Subject: [PATCH 01/28] with node 22.2.0, i seem to be able to npm install with no issues. the code does not seem to work yet though --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 0091c56..c704d58 100644 --- a/package.json +++ b/package.json @@ -7,19 +7,19 @@ "start": "next start" }, "engines": { - "node": ">=16.13.0 <17" + "node": "^22.2.0" }, "dependencies": { "bootstrap": "^5.1.3", "date-fns": "^2.28.0", "flat-embed": "^1.4.0", "mic-recorder-to-mp3": "^2.2.2", - "next": "12.0.9", - "next-auth": "4.0.6", - "next-redux-wrapper": "^7.0.5", - "react": "^17.0.2", + "next": "^14.2.3", + "next-auth": "^4.2.1", + "next-redux-wrapper": "^8.1.0", + "react": "^18.3.1", "react-bootstrap": "^2.1.0", - "react-dom": "^17.0.2", + "react-dom": "^18.3.1", "react-icons": "^4.3.1", "react-query": "^3.34.17", "react-redux": "^7.1.0", @@ -31,7 +31,7 @@ "devDependencies": { "eslint": "^8.7.0", "eslint-config-airbnb": "^19.0.4", - "eslint-config-next": "12.0.8", + "eslint-config-next": "^14.2.3", "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.25.4", "eslint-plugin-jsx-a11y": "^6.5.1", From e035b955cf41bda0d8832919fd041786a8e86955 Mon Sep 17 00:00:00 2001 From: Michael Stewart Date: Sat, 25 May 2024 14:46:14 -0400 Subject: [PATCH 02/28] 'use client' directive is attempting to opt us out of server side rendering --- components/layout.js | 1 + components/nav.js | 1 + pages/_app.js | 1 + pages/about.js | 1 + pages/index.js | 1 + 5 files changed, 5 insertions(+) diff --git a/components/layout.js b/components/layout.js index 4a11a58..720ddbc 100644 --- a/components/layout.js +++ b/components/layout.js @@ -1,3 +1,4 @@ +'use client'; import Container from 'react-bootstrap/Container'; import Head from 'next/head'; import { useRouter } from 'next/router'; diff --git a/components/nav.js b/components/nav.js index 10d59da..c1965bc 100644 --- a/components/nav.js +++ b/components/nav.js @@ -1,3 +1,4 @@ +'use client'; import Nav from 'react-bootstrap/Nav'; import Navbar from 'react-bootstrap/Navbar'; import Container from 'react-bootstrap/Container'; diff --git a/pages/_app.js b/pages/_app.js index bbbc126..88a2dd9 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -1,3 +1,4 @@ +'use client'; import { SessionProvider } from 'next-auth/react'; // Importing the Bootstrap CSS import 'bootstrap/dist/css/bootstrap.min.css'; diff --git a/pages/about.js b/pages/about.js index d3359cc..78a7ccf 100644 --- a/pages/about.js +++ b/pages/about.js @@ -1,3 +1,4 @@ +'use client'; import { Button, Card, Col, Row } from 'react-bootstrap'; import Layout from '../components/layout'; diff --git a/pages/index.js b/pages/index.js index 9a15b25..506eeee 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,3 +1,4 @@ +'use client'; import { useEffect } from 'react'; import { useDispatch } from 'react-redux'; import Link from 'next/link'; From 94829a8170802e12979c9fa54c4743024ce7fa69 Mon Sep 17 00:00:00 2001 From: Michael Stewart Date: Sat, 25 May 2024 14:46:46 -0400 Subject: [PATCH 03/28] update react bootstrap --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c704d58..25b2bb6 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "next-auth": "^4.2.1", "next-redux-wrapper": "^8.1.0", "react": "^18.3.1", - "react-bootstrap": "^2.1.0", + "react-bootstrap": "^2.10.2", "react-dom": "^18.3.1", "react-icons": "^4.3.1", "react-query": "^3.34.17", From 6e563185e4b4bbc11a39871d7ed3b54138b4cd7d Mon Sep 17 00:00:00 2001 From: Michael Stewart Date: Sat, 25 May 2024 14:48:30 -0400 Subject: [PATCH 04/28] somehow these were using the wrong url param --- components/student/respond.js | 4 ++-- .../courses/[slug]/[piece]/[actCategory]/[partType]/index.js | 2 +- pages/courses/[slug]/[piece]/[actCategory]/index.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/student/respond.js b/components/student/respond.js index 2a7dd8f..e9c5cdc 100644 --- a/components/student/respond.js +++ b/components/student/respond.js @@ -27,8 +27,8 @@ export default function RespondActivity() { const assignmentId = loadedActivities && activities && - activities?.[slug] && - activities?.[slug].filter( + activities?.[piece] && + activities?.[piece].filter( (assn) => assn.piece_slug === piece && assn.activity_type_category === actCategory )?.[0]?.id; diff --git a/pages/courses/[slug]/[piece]/[actCategory]/[partType]/index.js b/pages/courses/[slug]/[piece]/[actCategory]/[partType]/index.js index 0a8e28a..2f2ef9a 100644 --- a/pages/courses/[slug]/[piece]/[actCategory]/[partType]/index.js +++ b/pages/courses/[slug]/[piece]/[actCategory]/[partType]/index.js @@ -45,7 +45,7 @@ export default function PerformMelody() { } else if (comparablePartType.startsWith('Bassline')) { comparablePartType = comparablePartType.substring(0, 'Bassline'.length) } - const assignmentId = activities[slug].filter( + const assignmentId = activities[piece].filter( (assn) => { return assn.piece_slug === piece && diff --git a/pages/courses/[slug]/[piece]/[actCategory]/index.js b/pages/courses/[slug]/[piece]/[actCategory]/index.js index e1aa1d6..96177ea 100644 --- a/pages/courses/[slug]/[piece]/[actCategory]/index.js +++ b/pages/courses/[slug]/[piece]/[actCategory]/index.js @@ -31,7 +31,7 @@ export default function PerformMelody() { ); useEffect(() => { if (loadedActivities) { - const assignmentId = activities[slug].filter( + const assignmentId = activities[piece].filter( (assn) => assn.piece_slug === piece && (assn.activity_type_category === actCategory || assn.activity_type_category.split(' ')[0] === actCategory) From d8054db6ddce065e58f9f07a3e686b3f42ecc4d9 Mon Sep 17 00:00:00 2001 From: Michael Stewart Date: Sat, 25 May 2024 14:49:24 -0400 Subject: [PATCH 05/28] don't try to continue the action if we don't have all the info --- actions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/actions.js b/actions.js index 49fcfa0..9f8894a 100644 --- a/actions.js +++ b/actions.js @@ -600,6 +600,10 @@ export function postRespond({ slug, assignmentId, response }) { const { currentUser: { token }, } = getState(); + if (!slug || !assignmentId || !response) { + console.error('missing requirements to submit', slug, assignmentId, response) + return; + } dispatch(beginUpload(assignmentId)); const body = JSON.stringify({ content: JSON.stringify(response) }); return fetch( From e64230007871a055a97a3fdc39cb3344347348b3 Mon Sep 17 00:00:00 2001 From: Michael Stewart Date: Sat, 25 May 2024 14:50:28 -0400 Subject: [PATCH 06/28] default the RTE to empty or else the student would have to delete the 0 to enter their score (if they didn't want a leading 0) --- components/teacher/grade/rte.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/teacher/grade/rte.js b/components/teacher/grade/rte.js index a0ef021..6d25288 100644 --- a/components/teacher/grade/rte.js +++ b/components/teacher/grade/rte.js @@ -18,9 +18,9 @@ export default function RTE({ submission, submitAction, autoFocus = false }) { const userInfo = useSelector((state) => state.currentUser); const { slug } = router.query; const [isFormFocused, setFormFocus] = useState(false); - const [rhythm, setRhythm] = useState(submission?.grade?.rhythm ?? 0); - const [tone, setTone] = useState(submission?.grade?.tone ?? 0); - const [expression, setExpression] = useState(submission?.grade?.expression ?? 0); + const [rhythm, setRhythm] = useState(submission?.grade?.rhythm ?? ''); + const [tone, setTone] = useState(submission?.grade?.tone ?? ''); + const [expression, setExpression] = useState(submission?.grade?.expression ?? ''); const audioRef = useRef(); const dispatch = useDispatch(); const queryClient = useQueryClient(); From bb470813aaeed34e2d4fc8f2b8dc394337440019 Mon Sep 17 00:00:00 2001 From: Michael Stewart Date: Sat, 25 May 2024 14:51:15 -0400 Subject: [PATCH 07/28] it's more correct to set textareas by value prop --- components/student/recentSubmission.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/student/recentSubmission.js b/components/student/recentSubmission.js index 33eae91..ad743e2 100644 --- a/components/student/recentSubmission.js +++ b/components/student/recentSubmission.js @@ -44,8 +44,7 @@ export default function RecentSubmission(assn) { ) : ctgy === 'Respond' ? ( - From 4065a22647fcfdc4b552ce507e21fea20d2b1b3d Mon Sep 17 00:00:00 2001 From: Michael Stewart Date: Sat, 25 May 2024 14:51:53 -0400 Subject: [PATCH 08/28] alwaysOpen seems to require the array of keys --- components/student/respond.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/student/respond.js b/components/student/respond.js index e9c5cdc..324cf3e 100644 --- a/components/student/respond.js +++ b/components/student/respond.js @@ -66,7 +66,7 @@ export default function RespondActivity() { />

Rating Scales

- + Rhythm From 32ebd0e649fb18c9794dd29e817573235d599469 Mon Sep 17 00:00:00 2001 From: Michael Stewart Date: Sat, 25 May 2024 14:53:12 -0400 Subject: [PATCH 09/28] there's some change to the NextJS Link component that requires we also give legacyBehavior prop when we do the passHref --- components/enrollments.js | 100 ++++++++++++------------- components/loginout.js | 4 +- components/nav.js | 4 +- components/student/activityPicker.js | 10 +-- components/student/pieceAssignments.js | 2 +- components/teacher/course.js | 2 +- 6 files changed, 59 insertions(+), 63 deletions(-) diff --git a/components/enrollments.js b/components/enrollments.js index 07ad22e..4034302 100644 --- a/components/enrollments.js +++ b/components/enrollments.js @@ -25,60 +25,56 @@ export default function Enrollments({ children }) {
{enrollments && enrollments.map((enrollment) => ( - - - - - - {enrollment.course.name} - - {/* */} - {format(new Date(enrollment.course.start_date), 'MMM d')} -  - {/*
*/} - {/* */} - {format(new Date(enrollment.course.end_date), 'MMM d')} -
-
- {/* - - - - - - - */} -
-
+ + + + + {enrollment.course.name} + + {/* */} + {format(new Date(enrollment.course.start_date), 'MMM d')} -  + {/*
*/} + {/* */} + {format(new Date(enrollment.course.end_date), 'MMM d')} +
+
+ {/* + + + + + + + */} +
))} - { groups && groups.some(gName=>gName==="Teacher") && - - - - - Add New Course - {/* - - */} - - {/* - - - - - - - */} - - + {groups && groups.some(gName => gName === "Teacher") && + + + + Add New Course + {/* + + */} + + {/* + + + + + + + */} + }
); diff --git a/components/loginout.js b/components/loginout.js index 4b212d6..4997b02 100644 --- a/components/loginout.js +++ b/components/loginout.js @@ -8,7 +8,7 @@ function LoginOut() { const currentUserInfo = useSelector((state) => state.currentUser); // const loginStatus = useSelector((state) => state.loginStatus); return session ? ( - + Logout { currentUserInfo.loaded ? ` ${currentUserInfo.username}` : "" @@ -16,7 +16,7 @@ function LoginOut() { ) : ( - + Login ); diff --git a/components/nav.js b/components/nav.js index c1965bc..9014bd2 100644 --- a/components/nav.js +++ b/components/nav.js @@ -28,7 +28,7 @@ function Navigation() {