Skip to content

Commit 7420c53

Browse files
author
raineer
committed
github url submission not working
1 parent 1e2b8e5 commit 7420c53

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

‎apps/codebility/app/applicant/waiting/_components/applicantStep2.tsx‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import React from "react";
44
import { Button } from "@/components/ui/button";
55
import { useToast } from "@/components/ui/use-toast";
6-
import { Input } from "@mui/material";
76
import { Loader2Icon } from "lucide-react";
87
import { useForm } from "react-hook-form";
98

@@ -26,8 +25,8 @@ export default function ApplicantStep2({
2625
user: any;
2726
applicantData: ApplicantType;
2827
}) {
29-
const takenTest = applicantData.test_taken ? true : false; // Replace with actual logic to check if the test has been taken
30-
const submittedTest = applicantData.fork_url ? true : false; // Replace with actual logic to check if the test has been submitted
28+
const takenTest = applicantData.test_taken ? true : false;
29+
const submittedTest = applicantData.fork_url ? true : false;
3130

3231
return (
3332
<div className="my-20 flex flex-col items-center gap-8 text-center lg:gap-10">
@@ -149,10 +148,9 @@ function PostReadInstructions({
149148
const onSubmit = async (data: any) => {
150149
setLoading(true);
151150
try {
152-
153151
/* if non ui/ux role */
154152
if (user?.display_position.includes("UI/UX Designer") === false) {
155-
//validate the fork url
153+
// Validate the fork url
156154
const urlPattern =
157155
/^(https?:\/\/)?(www\.)?github\.com\/[a-zA-Z0-9_-]+\/codebility-assessment(\/.*)?$/;
158156

@@ -204,7 +202,8 @@ function PostReadInstructions({
204202

205203
<form onSubmit={handleSubmit(onSubmit)}>
206204
<div className="flex w-full max-w-md flex-col gap-4">
207-
<Input
205+
{/* FIX: replaced MUI Input with native input — MUI Input breaks react-hook-form's ref, causing data.fork_url to always be undefined on submit */}
206+
<input
208207
{...register("fork_url", {
209208
required: "This field is required",
210209
})}
@@ -222,6 +221,7 @@ function PostReadInstructions({
222221
{String(errors.fork_url.message)}
223222
</p>
224223
)}
224+
225225
<div className="flex flex-col gap-4 *:w-[16rem] sm:flex-row sm:*:w-auto">
226226
{user?.display_position.includes("UI/UX Designer") ? (
227227
<TestQAInstruction applicantData={applicantData}>
@@ -281,10 +281,9 @@ function PostSubmitted({
281281
const onSubmit = async (data: any) => {
282282
setLoading(true);
283283
try {
284-
285284
/* if non ui/ux role */
286285
if (user?.display_position.includes("UI/UX Designer") === false) {
287-
//validate the fork url
286+
// Validate the fork url
288287
const urlPattern =
289288
/^(https?:\/\/)?(www\.)?github\.com\/[a-zA-Z0-9_-]+\/codebility-assessment(\/.*)?$/;
290289

@@ -322,6 +321,7 @@ function PostSubmitted({
322321
}
323322
setLoading(false);
324323
};
324+
325325
return (
326326
<>
327327
<div className="flex flex-col items-center gap-4">
@@ -336,7 +336,8 @@ function PostSubmitted({
336336

337337
<form onSubmit={handleSubmit(onSubmit)}>
338338
<div className="flex w-full max-w-md flex-col gap-4">
339-
<Input
339+
{/* FIX: replaced MUI Input with native input — same ref issue as PostReadInstructions */}
340+
<input
340341
{...register("fork_url", {
341342
required: "This field is required",
342343
})}
@@ -398,4 +399,4 @@ function PostSubmitted({
398399
</div>
399400
</>
400401
);
401-
}
402+
}

0 commit comments

Comments
 (0)