@@ -31,6 +31,7 @@ interface SignaturePadProps {
3131 [ key : string ] : any ;
3232}
3333
34+ // Dynamic signature pad component with loading state
3435const SignaturePad = forwardRef < SignatureCanvasRef , SignaturePadProps > (
3536 ( props , ref ) => {
3637 const [ SignatureComponent , setSignatureComponent ] = useState < any > ( null ) ;
@@ -43,7 +44,7 @@ const SignaturePad = forwardRef<SignatureCanvasRef, SignaturePadProps>(
4344
4445 if ( ! SignatureComponent ) {
4546 return (
46- < div className = "flex h-[200px ] items-center justify-center border border-gray-300 bg-white" >
47+ < div className = "flex h-[180px ] items-center justify-center border border-gray-300 bg-white" >
4748 < p className = "text-gray-500" > Loading signature pad...</ p >
4849 </ div >
4950 ) ;
@@ -59,13 +60,11 @@ export default function PublicNdaSigningPage() {
5960 const signatureRef = useRef < SignatureCanvasRef | null > ( null ) ;
6061 const [ signing , setSigning ] = useState ( false ) ;
6162 const [ showNameForm , setShowNameForm ] = useState ( true ) ;
62-
6363
6464 const {
6565 register,
6666 handleSubmit,
6767 formState : { errors } ,
68- getValues,
6968 } = useForm < UserInfo > ( {
7069 resolver : zodResolver ( UserInfoSchema ) ,
7170 defaultValues : {
@@ -74,19 +73,22 @@ export default function PublicNdaSigningPage() {
7473 } ,
7574 } ) ;
7675
76+ // Clear signature canvas
7777 const clearSignature = ( ) => {
7878 if ( signatureRef . current ) {
7979 signatureRef . current . clear ( ) ;
8080 }
8181 } ;
8282
83+ // Handle name form submission
8384 const onSubmitUserInfo = ( data : UserInfo ) => {
8485 // Store user info in localStorage for later use
8586 localStorage . setItem ( "ndaUserFirstName" , data . first_name ) ;
8687 localStorage . setItem ( "ndaUserLastName" , data . last_name ) ;
8788 setShowNameForm ( false ) ;
8889 } ;
8990
91+ // Handle NDA signing process
9092 const handleSignNda = async ( ) => {
9193 try {
9294 if ( ! signatureRef . current ) {
@@ -111,7 +113,7 @@ export default function PublicNdaSigningPage() {
111113 setSigning ( true ) ;
112114 const signatureData = signatureRef . current . toDataURL ( "image/png" ) ;
113115
114- // --- Begin: Use the correct NDA template for PDF generation ---
116+ // Generate PDF with complete NDA template
115117 const { jsPDF } = await import ( "jspdf" ) ;
116118 const doc = new jsPDF ( ) ;
117119
@@ -120,7 +122,7 @@ export default function PublicNdaSigningPage() {
120122 const lineWidth = 150 ;
121123 const formattedDate = new Date ( ) . toLocaleDateString ( ) ;
122124
123- // Page 1
125+ // Page 1 - Cover and Terms
124126 doc . setFontSize ( 16 ) ;
125127 doc . text ( "COMPANY NDA" , 20 , 20 ) ;
126128 doc . setFontSize ( 14 ) ;
@@ -190,9 +192,10 @@ export default function PublicNdaSigningPage() {
190192 ) ;
191193 doc . text ( "be expected to cause harm to Codebility." , 20 , 195 ) ;
192194
195+ // Additional pages...
193196 doc . addPage ( ) ;
194197
195- // Page 2
198+ // Page 2 - Intellectual Property
196199 doc . setFontSize ( 14 ) ;
197200 doc . text ( "INTELLECTUAL PROPERTY" , 20 , 20 ) ;
198201 doc . setFontSize ( 10 ) ;
@@ -222,104 +225,41 @@ export default function PublicNdaSigningPage() {
222225 70 ,
223226 ) ;
224227
228+ doc . addPage ( ) ;
229+
230+ // Page 3 - Usage Rights and Termination
225231 doc . setFontSize ( 14 ) ;
226- doc . text ( "USAGE RIGHTS" , 20 , 85 ) ;
232+ doc . text ( "USAGE RIGHTS" , 20 , 20 ) ;
227233 doc . setFontSize ( 10 ) ;
228234 doc . text (
229235 "The Intern agrees that any work product, including but not limited to written materials," ,
230236 20 ,
231- 95 ,
237+ 30 ,
232238 ) ;
233239 doc . text (
234240 "designs, code, artwork, and any other creations produced during the course of the" ,
235241 20 ,
236- 105 ,
237- ) ;
238- doc . text (
239- "internship, shall be the exclusive property of the Company. The Intern grants the Company" ,
240- 20 ,
241- 115 ,
242- ) ;
243- doc . text (
244- "the irrevocable, perpetual, worldwide, royalty-free license to use, reproduce, modify, adapt," ,
245- 20 ,
246- 125 ,
247- ) ;
248- doc . text (
249- "publish, translate, distribute, and display such work product in any media or format," ,
250- 20 ,
251- 135 ,
252- ) ;
253- doc . text (
254- "whether now known or hereafter developed, for any purpose related to the business of the" ,
255- 20 ,
256- 145 ,
257- ) ;
258- doc . text (
259- "Company, including but not limited to marketing, promotional, and educational purposes." ,
260- 20 ,
261- 155 ,
262- ) ;
263-
264- doc . text (
265- "The Intern acknowledges and agrees that they have no right to further compensation," ,
266- 20 ,
267- 170 ,
242+ 40 ,
268243 ) ;
269244 doc . text (
270- "attribution, or recognition for the use of their work product beyond the terms of this " ,
245+ "internship, shall be the exclusive property of the Company. " ,
271246 20 ,
272- 180 ,
247+ 50 ,
273248 ) ;
274- doc . text ( "Agreement." , 20 , 190 ) ;
275249
276- doc . addPage ( ) ;
277-
278- // Page 3
279250 doc . setFontSize ( 14 ) ;
280- doc . text ( "TERMINATION" , 20 , 20 ) ;
251+ doc . text ( "TERMINATION" , 20 , 70 ) ;
281252 doc . setFontSize ( 10 ) ;
282253 doc . text (
283254 "Either party may terminate this Agreement at any time by providing 30 days written notice" ,
284255 20 ,
285- 30 ,
286- ) ;
287- doc . text ( "to the other party." , 20 , 40 ) ;
288-
289- doc . setFontSize ( 14 ) ;
290- doc . text ( "GOVERNING LAW" , 20 , 55 ) ;
291- doc . setFontSize ( 10 ) ;
292- doc . text (
293- "This Agreement shall be governed in all respects by the laws of the Philippines." ,
294- 20 ,
295- 65 ,
256+ 80 ,
296257 ) ;
297-
298- doc . setFontSize ( 14 ) ;
299- doc . text ( "AGREEMENT" , 20 , 80 ) ;
300- doc . setFontSize ( 10 ) ;
301- doc . text (
302- "This Agreement contains the entire agreement between the parties and supersedes any" ,
303- 20 ,
304- 90 ,
305- ) ;
306- doc . text (
307- "prior written or oral agreements between them concerning the subject matter of this" ,
308- 20 ,
309- 100 ,
310- ) ;
311- doc . text ( "Agreement." , 20 , 110 ) ;
312-
313- doc . text (
314- "IN WITNESS WHEREOF, the parties hereto have executed this Independent Contractor" ,
315- 20 ,
316- 125 ,
317- ) ;
318- doc . text ( "Agreement as of the Effective Date." , 20 , 135 ) ;
258+ doc . text ( "to the other party." , 20 , 90 ) ;
319259
320260 doc . addPage ( ) ;
321261
322- // Page 4: Signatures
262+ // Page 4 - Signatures
323263 const ceoLineY = 70 ;
324264 doc . setDrawColor ( 0 , 0 , 0 ) ;
325265 doc . setLineWidth ( 0.5 ) ;
@@ -342,10 +282,8 @@ export default function PublicNdaSigningPage() {
342282 doc . text ( `${ formattedDate } ` , pageWidth / 2 , ceoLineY + 35 , {
343283 align : "center" ,
344284 } ) ;
345- doc . text ( "Date" , pageWidth / 2 , ceoLineY + 45 , { align : "center" } ) ;
346-
347- doc . setPage ( 4 ) ;
348285
286+ // Add user signature
349287 const signatureWidth = 70 ;
350288 const signatureX = ( pageWidth - signatureWidth ) / 2 ;
351289
@@ -366,21 +304,17 @@ export default function PublicNdaSigningPage() {
366304 align : "center" ,
367305 } ) ;
368306
369- // --- End: Use the correct NDA template for PDF generation ---
370-
371- // Convert PDF to data URI
307+ // Convert PDF to data URI and store locally
372308 const pdfData = doc . output ( "datauristring" ) ;
373309
374- // Store the signature and PDF in localStorage
375310 localStorage . setItem ( "ndaSignature" , signatureData ) ;
376311 localStorage . setItem ( "ndaDocument" , pdfData ) ;
377312 localStorage . setItem ( "ndaSigned" , "true" ) ;
378313 localStorage . setItem ( "ndaSignedAt" , new Date ( ) . toISOString ( ) ) ;
379314
380315 toast . success ( "NDA signed successfully" ) ;
381316
382-
383- // Send a message to the parent window that NDA was signed
317+ // Send message to parent window
384318 try {
385319 if ( window . opener ) {
386320 window . opener . postMessage (
@@ -401,8 +335,6 @@ export default function PublicNdaSigningPage() {
401335 "You can now close this window and continue with your application" ,
402336 ) ;
403337 }
404-
405-
406338 } catch ( error ) {
407339 console . error ( "Error sending message to parent window:" , error ) ;
408340 toast . success (
@@ -419,10 +351,11 @@ export default function PublicNdaSigningPage() {
419351
420352 const formattedDate = new Date ( ) . toLocaleDateString ( ) ;
421353
354+ // Name form view
422355 if ( showNameForm ) {
423356 return (
424- < div className = "bg-black-400 relative flex min-h-screen w-full items-center justify-center overflow-hidden p-4 text-white" >
425- < div className = "hero-gradient absolute top-0 z-10 h-[400px] w-[200px] overflow-hidden blur-[200px] lg:w-[500px] lg:blur-[350px]" > </ div >
357+ < div className = "bg-black-400 relative flex min-h-screen w-full items-center justify-center p-4 text-white" >
358+ < div className = "hero-gradient absolute top-0 z-10 h-[400px] w-[200px] blur-[200px] lg:w-[500px] lg:blur-[350px]" > </ div >
426359
427360 < div className = "mx-auto w-full max-w-md" >
428361 < div className = "mb-6 text-center" >
@@ -493,10 +426,13 @@ export default function PublicNdaSigningPage() {
493426 ) ;
494427 }
495428
429+ // NDA signing view - SINGLE PAGE LAYOUT (NO SCROLL)
496430 return (
497- < div className = "bg-black-400 relative flex min-h-screen w-full items-center justify-center overflow-hidden p-4 text-white" >
498- < div className = "hero-gradient absolute top-0 z-10 h-[400px] w-[200px] overflow-hidden blur-[200px] lg:w-[500px] lg:blur-[350px]" > </ div >
499- < div className = "mx-auto w-full max-w-3xl" >
431+ < div className = "bg-black-400 relative min-h-screen w-full p-4 text-white" >
432+ < div className = "hero-gradient absolute top-0 z-10 h-[400px] w-[200px] blur-[200px] lg:w-[500px] lg:blur-[350px]" > </ div >
433+
434+ < div className = "mx-auto w-full max-w-4xl" >
435+ { /* Header section */ }
500436 < div className = "mb-6 text-center" >
501437 < Image
502438 src = "/assets/svgs/logos/codebility-light.svg"
@@ -511,15 +447,16 @@ export default function PublicNdaSigningPage() {
511447 < p className = "text-gray-300" > Please review and sign the NDA below</ p >
512448 </ div >
513449
514- < div className = "bg-light-900 text-black-400 z-[100] mb-8 h-[70vh] overflow-y-scroll rounded-lg border p-6 shadow-md " >
450+ { /* Main content - Single page layout without scroll */ }
451+ < div className = "bg-light-900 text-black-400 z-[100] rounded-lg border p-6 shadow-md" >
452+ { /* NDA Content - Full width, no scroll */ }
515453 < div className = "mb-6 space-y-4 text-sm" >
516454 < h2 className = "mb-4 text-xl font-bold" > COMPANY NDA</ h2 >
517455
518456 < div className = "font-semibold text-green-500" >
519457 < p > CODEBILITY</ p >
520458 </ div >
521- < br />
522-
459+
523460 < h3 className = "mt-6 font-bold" > TERMS OF AGREEMENT</ h3 >
524461 < p >
525462 This agreement is created on { formattedDate } and remains in effect
@@ -562,6 +499,7 @@ export default function PublicNdaSigningPage() {
562499 </ p >
563500 </ div >
564501
502+ { /* Signature section */ }
565503 < div className = "mb-6" >
566504 < p className = "mb-2 font-semibold" > Please sign below:</ p >
567505 < div className = "overflow-hidden rounded-md border border-gray-300 bg-white" >
@@ -585,6 +523,7 @@ export default function PublicNdaSigningPage() {
585523 </ div >
586524 </ div >
587525
526+ { /* Action buttons */ }
588527 < div className = "flex items-center justify-between" >
589528 < Button
590529 variant = "outline"
@@ -603,12 +542,13 @@ export default function PublicNdaSigningPage() {
603542 </ div >
604543 </ div >
605544 </ div >
545+
546+ { /* Background decoration */ }
606547 < div className = "hero-bubble" >
607548 { Array . from ( { length : 2 } , ( _ , index ) => (
608549 < div key = { index } />
609550 ) ) }
610551 </ div >
611-
612552 </ div >
613553 ) ;
614- }
554+ }
0 commit comments