Skip to content

Commit 1f0079c

Browse files
fix type error
1 parent 334025a commit 1f0079c

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

src/pages/assessment.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const Assessment: PageWithLayout = () => {
7676
}
7777
}, [status, router, devSession, devSessionLoaded]);
7878

79-
const currentQuestion = assessmentQuestions[currentQuestionIndex];
79+
const currentQuestion: AssessmentQuestion = assessmentQuestions[currentQuestionIndex];
8080

8181
// Initialize code with starter code when question changes
8282
useEffect(() => {
@@ -342,12 +342,12 @@ const Assessment: PageWithLayout = () => {
342342
{/* Notification */}
343343
{notification && (
344344
<div
345-
className={`tw-fixed tw-top-4 tw-right-4 tw-z-50 tw-rounded-lg tw-p-4 tw-shadow-lg tw-animate-in tw-fade-in tw-slide-in-from-top-5 tw-duration-300 ${
345+
className={`tw-fixed tw-right-4 tw-top-4 tw-z-50 tw-rounded-lg tw-p-4 tw-shadow-lg tw-duration-300 tw-animate-in tw-fade-in tw-slide-in-from-top-5 ${
346346
notification.type === "success"
347-
? "tw-bg-green-50 tw-text-green-800 tw-border tw-border-green-200"
347+
? "tw-border tw-border-green-200 tw-bg-green-50 tw-text-green-800"
348348
: notification.type === "error"
349-
? "tw-bg-red-50 tw-text-red-800 tw-border tw-border-red-200"
350-
: "tw-bg-blue-50 tw-text-blue-800 tw-border tw-border-blue-200"
349+
? "tw-border tw-border-red-200 tw-bg-red-50 tw-text-red-800"
350+
: "tw-border tw-border-blue-200 tw-bg-blue-50 tw-text-blue-800"
351351
}`}
352352
>
353353
<div className="tw-flex tw-items-center tw-space-x-2">
@@ -401,7 +401,7 @@ const Assessment: PageWithLayout = () => {
401401
<div className="tw-grid tw-grid-cols-1 tw-gap-6 lg:tw-grid-cols-2">
402402
{/* Question Panel */}
403403
<div className="tw-rounded-lg tw-bg-white tw-p-6 tw-shadow-md">
404-
<div className="tw-mb-4 tw-inline-block tw-rounded tw-bg-primary/10 tw-px-3 tw-py-1 tw-text-sm tw-font-semibold tw-text-primary tw-uppercase">
404+
<div className="tw-mb-4 tw-inline-block tw-rounded tw-bg-primary/10 tw-px-3 tw-py-1 tw-text-sm tw-font-semibold tw-uppercase tw-text-primary">
405405
{currentQuestion.level}
406406
</div>
407407
<h2 className="tw-mb-2 tw-text-xl tw-font-bold tw-text-gray-900">
@@ -448,8 +448,8 @@ const Assessment: PageWithLayout = () => {
448448
<div
449449
className={`tw-rounded-lg tw-p-4 ${
450450
testResults.passed === testResults.total
451-
? "tw-bg-green-50 tw-border tw-border-green-200"
452-
: "tw-bg-red-50 tw-border tw-border-red-200"
451+
? "tw-border tw-border-green-200 tw-bg-green-50"
452+
: "tw-border tw-border-red-200 tw-bg-red-50"
453453
}`}
454454
>
455455
<div className="tw-flex tw-items-center tw-space-x-2">
@@ -517,12 +517,18 @@ const Assessment: PageWithLayout = () => {
517517
<button
518518
type="button"
519519
onClick={handleNext}
520-
className="tw-flex-1 tw-rounded-lg tw-bg-primary tw-px-4 tw-py-3 tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-primary/90"
520+
disabled={
521+
isSaving &&
522+
currentQuestionIndex === assessmentQuestions.length - 1
523+
}
524+
className="tw-flex-1 tw-rounded-lg tw-bg-primary tw-px-4 tw-py-3 tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-primary/90 disabled:tw-cursor-not-allowed disabled:tw-opacity-50"
521525
>
522526
{currentQuestionIndex === assessmentQuestions.length - 1 ? (
523527
<>
524-
<i className="fas fa-check tw-mr-2" />
525-
Finish
528+
<i
529+
className={`fas ${isSaving ? "fa-spinner fa-spin" : "fa-check"} tw-mr-2`}
530+
/>
531+
{isSaving ? "Saving..." : "Finish"}
526532
</>
527533
) : (
528534
<>

0 commit comments

Comments
 (0)