@@ -25,7 +25,7 @@ import { CSS } from "@dnd-kit/utilities";
2525import Dropzone from "react-dropzone" ;
2626import { Upload , XIcon } from "lucide-react" ;
2727import { GlobalWorkerOptions } from "pdfjs-dist" ;
28- import type { ApiResponse } from "@/interface"
28+ import type { ApiResponse } from "@/interface" ;
2929
3030GlobalWorkerOptions . workerSrc =
3131 "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.8.69/pdf.worker.min.mjs" ;
@@ -79,7 +79,6 @@ export default function Page() {
7979
8080 const fileCheckAndSelect = useCallback (
8181 ( acceptedFiles : File [ ] ) => {
82- const maxFileSize = 5 * 1024 * 1024 ;
8382 const allowedFileTypes = [
8483 "application/pdf" ,
8584 "image/jpeg" ,
@@ -137,28 +136,18 @@ export default function Page() {
137136 }
138137
139138 const allFiles = [ ...files , ...acceptedFiles ] ;
140- if ( allFiles . length > 5 ) {
141- toast . error ( "You can upload up to 5 files only" , { id : toastId } ) ;
142- return ;
143- }
144-
145- const totalSize = allFiles . reduce (
146- ( sum , f ) => sum + f . size ,
147- 0 ,
148- ) ;
149- if ( totalSize > maxFileSize ) {
150- toast . error ( "The total upload size exceeds 5MB." , { id : toastId } ) ;
139+ if ( allFiles . length > 10 ) {
140+ toast . error ( "You can upload up to 10 files only" , { id : toastId } ) ;
151141 return ;
152142 }
153143
154144 const invalidFiles = acceptedFiles . filter (
155- ( file ) =>
156- file . size > maxFileSize || ! allowedFileTypes . includes ( file . type ) ,
145+ ( file ) => ! allowedFileTypes . includes ( file . type ) ,
157146 ) ;
158147
159148 if ( invalidFiles . length > 0 ) {
160149 toast . error (
161- "Some files are invalid. Make sure the total size is below 5MB and files are of allowed types (PDF, JPEG, PNG, GIF) ." ,
150+ "Some files are invalid. Make sure they are PDFs, JPEGs, PNGs, or GIFs ." ,
162151 { id : toastId } ,
163152 ) ;
164153 return ;
@@ -279,7 +268,10 @@ export default function Page() {
279268 await toast . promise (
280269 async ( ) => {
281270 try {
282- await axios . post < ApiResponse < uploadResponse > > ( "/api/upload" , formData ) ;
271+ await axios . post < ApiResponse < uploadResponse > > (
272+ "/api/upload" ,
273+ formData ,
274+ ) ;
283275 return { message : "Papers uploaded successfully!" } ;
284276 } catch ( error ) {
285277 if ( error instanceof AxiosError ) {
@@ -447,12 +439,14 @@ export default function Page() {
447439 ) ;
448440
449441 return (
450- < section
442+ < section
451443 { ...getRootProps ( ) }
452- className = "mt-6 flex w-full flex-col items-center" >
444+ className = "mt-6 flex w-full flex-col items-center"
445+ >
453446 < input { ...getInputProps ( ) } />
454447 < div className = "flex w-max gap-4" >
455- < div className = "scrollbar-hide flex w-[80vw] max-w-4xl flex-col justify-between overflow-x-auto overflow-y-hidden rounded-[40px] border-[6px] border-[#A78BFA] bg-indigo-900/10 p-4 dark:border-indigo-900 sm:p-6 md:w-max md:p-8" > j
448+ < div className = "scrollbar-hide flex w-[80vw] max-w-4xl flex-col justify-between overflow-x-auto overflow-y-hidden rounded-[40px] border-[6px] border-[#A78BFA] bg-indigo-900/10 p-4 dark:border-indigo-900 sm:p-6 md:w-max md:p-8" >
449+ j
456450 < DndContext
457451 sensors = { sensors }
458452 collisionDetection = { closestCenter }
@@ -528,10 +522,9 @@ export default function Page() {
528522 </ div >
529523 ) }
530524 </ section >
531- )
525+ ) ;
532526 } }
533527 </ Dropzone >
534-
535528 ) }
536529
537530 < Button
@@ -543,7 +536,6 @@ export default function Page() {
543536 </ Button >
544537 </ div >
545538 </ div >
546-
547539
548540 { zoomIndex !== null && (
549541 < div className = "fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-70" >
0 commit comments