11import React , { useRef , useState , useEffect } from 'react' ;
2- import { Upload , FileText , Info , RefreshCw , Plus } from 'lucide-react' ;
2+ import { Upload , FileText , Info } from 'lucide-react' ;
33
44const FileUpload = ( { onFileUpload, isDragOver, setIsDragOver, themeStyles } ) => {
55 const fileInputRef = useRef ( null ) ;
@@ -104,7 +104,7 @@ const FileUpload = ({ onFileUpload, isDragOver, setIsDragOver, themeStyles }) =>
104104 }
105105
106106 if ( foundFiles . length === 0 ) {
107- setScanError ( 'No CSV files found. Place your CSV files in the public/ folder and click "Rescan". ' ) ;
107+ setScanError ( 'No CSV files found.' ) ;
108108 }
109109
110110 // Sort by name for better organization
@@ -147,36 +147,6 @@ const FileUpload = ({ onFileUpload, isDragOver, setIsDragOver, themeStyles }) =>
147147 }
148148 } ;
149149
150- const handleCustomFileTest = async ( ) => {
151- if ( ! customFileName . trim ( ) ) return ;
152-
153- const filename = customFileName . trim ( ) ;
154- if ( ! filename . endsWith ( '.csv' ) ) {
155- alert ( 'Please include .csv extension' ) ;
156- return ;
157- }
158-
159- try {
160- const response = await fetch ( `/${ filename } ` , { method : 'HEAD' } ) ;
161- if ( response . ok ) {
162- console . log ( `✅ Custom file found: ${ filename } ` ) ;
163- handlePresetLoad ( filename ) ;
164- setCustomFileName ( '' ) ;
165- setShowCustomInput ( false ) ;
166- // Rescan to potentially add it to the list if it matches our hardcoded names
167- scanForCSVFiles ( ) ;
168- } else {
169- alert ( `File "${ filename } " not found in public/ directory (Status: ${ response . status } )` ) ;
170- }
171- } catch ( error ) {
172- alert ( `Error checking file "${ filename } ": ${ error . message } ` ) ;
173- }
174- } ;
175-
176- const handleRescan = ( ) => {
177- scanForCSVFiles ( ) ;
178- } ;
179-
180150 const styles = {
181151 container : {
182152 maxWidth : '800px' ,
@@ -276,7 +246,9 @@ const FileUpload = ({ onFileUpload, isDragOver, setIsDragOver, themeStyles }) =>
276246 color : isDragOver ? '#2563eb' : themeStyles . text . primary ,
277247 transition : 'all 0.2s' ,
278248 width : '100%' ,
279- minHeight : '80px'
249+ minHeight : '80px' ,
250+ margin : '0 auto' ,
251+ boxSizing : 'border-box'
280252 } ,
281253 presetSection : {
282254 backgroundColor : themeStyles . card . backgroundColor ,
@@ -287,42 +259,15 @@ const FileUpload = ({ onFileUpload, isDragOver, setIsDragOver, themeStyles }) =>
287259 presetHeader : {
288260 display : 'flex' ,
289261 alignItems : 'center' ,
290- justifyContent : 'space-between ' ,
262+ justifyContent : 'center ' ,
291263 marginBottom : '16px'
292264 } ,
293265 presetTitle : {
294266 fontSize : '20px' ,
295267 fontWeight : '600' ,
296268 color : themeStyles . text . primary ,
297- margin : '0'
298- } ,
299- rescanButton : {
300- display : 'flex' ,
301- alignItems : 'center' ,
302- gap : '6px' ,
303- padding : '8px 12px' ,
304- borderRadius : '6px' ,
305- fontSize : '13px' ,
306- fontWeight : '500' ,
307- cursor : 'pointer' ,
308- border : 'none' ,
309- transition : 'all 0.2s' ,
310- backgroundColor : themeStyles . button . secondary . backgroundColor ,
311- color : themeStyles . button . secondary . color
312- } ,
313- presetSubtitle : {
314- color : themeStyles . text . secondary ,
315- fontSize : '15px' ,
316- marginBottom : '24px' ,
317- lineHeight : '1.5'
318- } ,
319- customFileSection : {
320- backgroundColor : themeStyles . hover . background ,
321- border : `1px solid ${ themeStyles . border } ` ,
322- borderRadius : '8px' ,
323- padding : '20px' ,
324- marginBottom : '24px' ,
325- textAlign : 'left'
269+ margin : '0' ,
270+ textAlign : 'center'
326271 } ,
327272 scanningMessage : {
328273 padding : '40px 20px' ,
@@ -506,28 +451,8 @@ const FileUpload = ({ onFileUpload, isDragOver, setIsDragOver, themeStyles }) =>
506451 < div style = { styles . presetSection } >
507452 < div style = { styles . presetHeader } >
508453 < h2 style = { styles . presetTitle } > Pre-loaded Rankings</ h2 >
509- < button
510- onClick = { handleRescan }
511- disabled = { isScanning }
512- style = { {
513- ...styles . rescanButton ,
514- opacity : isScanning ? 0.6 : 1 ,
515- cursor : isScanning ? 'not-allowed' : 'pointer'
516- } }
517- title = "Rescan for CSV files"
518- >
519- < RefreshCw size = { 14 } style = { {
520- animation : isScanning ? 'spin 1s linear infinite' : 'none'
521- } } />
522- { isScanning ? 'Scanning...' : 'Rescan' }
523- </ button >
524454 </ div >
525455
526- < p style = { styles . presetSubtitle } >
527- Rankings files automatically detected in your public/ directory.
528- Place CSV files there and click "Rescan" to refresh this list.
529- </ p >
530-
531456 { /* Scanning State */ }
532457 { isScanning && (
533458 < div style = { styles . scanningMessage } >
@@ -547,7 +472,7 @@ const FileUpload = ({ onFileUpload, isDragOver, setIsDragOver, themeStyles }) =>
547472 { ! isScanning && ! scanError && availableCSVs . length === 0 && (
548473 < div style = { styles . noFilesMessage } >
549474 < div style = { styles . noFilesTitle } > No Pre-loaded Rankings Found</ div >
550- < p > Place CSV files in your < code > public/</ code > directory using supported filenames and click "Rescan" .</ p >
475+ < p > Place CSV files in your < code > public/</ code > directory using supported filenames.</ p >
551476 < p style = { { fontSize : '13px' , marginTop : '12px' , color : themeStyles . text . muted } } >
552477 < strong > Supported filenames include:</ strong > < br />
553478 FantasyPros 2025 PPR.csv, ESPN 2024.csv, Yahoo 2025 PPR.csv, sample_rankings.csv, and { csvFilesToCheck . length - 4 } others.
0 commit comments