File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,17 +97,33 @@ export default function Page() {
9797 ( file ) => file . type === "application/pdf" ,
9898 ) ;
9999
100- if (
101- ( isNewPdf && acceptedFiles . length > 1 ) ||
102- ( isNewPdf && hasExistingImages ) ||
103- ( isNewPdf && hasExistingPdf ) ||
104- ( ! isNewPdf && hasExistingPdf )
105- ) {
106- toast . error ( "PDFs must be uploaded separately from images" , {
107- id : toastId ,
108- } ) ;
109- return ;
110- }
100+ if ( isNewPdf && acceptedFiles . length > 1 ) {
101+ toast . error ( "Only one PDF can be uploaded at a time." , {
102+ id : toastId ,
103+ } ) ;
104+ return ;
105+ }
106+
107+ if ( isNewPdf && hasExistingImages ) {
108+ toast . error ( "PDFs cannot be uploaded together with images." , {
109+ id : toastId ,
110+ } ) ;
111+ return ;
112+ }
113+
114+ if ( isNewPdf && hasExistingPdf ) {
115+ toast . error ( "Only one PDF is allowed. You’ve already uploaded a PDF." , {
116+ id : toastId ,
117+ } ) ;
118+ return ;
119+ }
120+
121+ if ( ! isNewPdf && hasExistingPdf ) {
122+ toast . error ( "Images cannot be uploaded after a PDF. Upload them separately." , {
123+ id : toastId ,
124+ } ) ;
125+ return ;
126+ }
111127
112128 const allFiles = [ ...files , ...acceptedFiles ] ;
113129 if ( allFiles . length > 5 ) {
You can’t perform that action at this time.
0 commit comments