@@ -42,6 +42,8 @@ const generateDefaultFolderName = (doc1: DocumentListDocument, doc2: DocumentLis
4242 // Use the first common word that's at least 3 characters long
4343 const significant = commonWords . find ( word => word . length >= 3 ) ;
4444 if ( significant ) {
45+ if ( significant === 'pdf' ) return 'PDFs' ;
46+ if ( significant === 'epub' ) return 'EPUBs' ;
4547 return `${ significant . charAt ( 0 ) . toUpperCase ( ) } ${ significant . slice ( 1 ) } ` ;
4648 }
4749 }
@@ -61,7 +63,7 @@ export function DocumentList() {
6163 isEPUBLoading,
6264 } = useDocuments ( ) ;
6365
64- const [ sortBy , setSortBy ] = useState < SortBy > ( 'date ' ) ;
66+ const [ sortBy , setSortBy ] = useState < SortBy > ( 'name ' ) ;
6567 const [ sortDirection , setSortDirection ] = useState < SortDirection > ( 'desc' ) ;
6668 const [ folders , setFolders ] = useState < Folder [ ] > ( [ ] ) ;
6769 const [ documentToDelete , setDocumentToDelete ] = useState < DocumentToDelete | null > ( null ) ;
@@ -71,6 +73,7 @@ export function DocumentList() {
7173 const [ pendingFolderDocs , setPendingFolderDocs ] = useState < { source : DocumentListDocument , target : DocumentListDocument } | null > ( null ) ;
7274 const [ collapsedFolders , setCollapsedFolders ] = useState < Set < string > > ( new Set ( ) ) ;
7375 const [ isInitialized , setIsInitialized ] = useState ( false ) ;
76+ const [ showHint , setShowHint ] = useState ( true ) ;
7477
7578 useEffect ( ( ) => {
7679 // Load saved state
@@ -81,6 +84,7 @@ export function DocumentList() {
8184 setSortDirection ( savedState . sortDirection ) ;
8285 setFolders ( savedState . folders ) ;
8386 setCollapsedFolders ( new Set ( savedState . collapsedFolders ) ) ;
87+ setShowHint ( savedState . showHint ?? true ) ; // Use saved hint state or default to true
8488 }
8589 setIsInitialized ( true ) ;
8690 } ;
@@ -94,15 +98,16 @@ export function DocumentList() {
9498 sortBy,
9599 sortDirection,
96100 folders,
97- collapsedFolders : Array . from ( collapsedFolders )
101+ collapsedFolders : Array . from ( collapsedFolders ) ,
102+ showHint
98103 } ;
99104 await saveDocumentListState ( state ) ;
100105 } ;
101106
102107 if ( isInitialized ) { // Prevents saving empty state on first render or back navigation
103108 saveState ( ) ;
104109 }
105- } , [ sortBy , sortDirection , folders , collapsedFolders ] ) ;
110+ } , [ sortBy , sortDirection , folders , collapsedFolders , showHint , isInitialized ] ) ;
106111
107112 const allDocuments : DocumentListDocument [ ] = [
108113 ...pdfDocs . map ( doc => ( {
@@ -214,6 +219,7 @@ export function DocumentList() {
214219 setNewFolderName ( '' ) ;
215220 setDropTargetDoc ( null ) ;
216221 setDraggedDoc ( null ) ;
222+ setShowHint ( false ) ;
217223 } , [ pendingFolderDocs , newFolderName ] ) ;
218224
219225 const handleFolderNameKeyDown = ( e : React . KeyboardEvent < HTMLInputElement > ) => {
@@ -443,6 +449,21 @@ export function DocumentList() {
443449 </ div >
444450
445451 < div className = "space-y-4" >
452+ { showHint && allDocuments . length > 1 && (
453+ < div className = "flex items-center justify-between bg-offbase rounded-lg px-3 py-2 text-sm" >
454+ < p className = "text-sm" > Drag files on top of each other to make folders</ p >
455+ < Button
456+ onClick = { ( ) => setShowHint ( false ) }
457+ className = "p-1 hover:bg-accent rounded-lg transition-colors"
458+ aria-label = "Dismiss hint"
459+ >
460+ < svg className = "w-4 h-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
461+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = "2" d = "M6 18L18 6M6 6l12 12" />
462+ </ svg >
463+ </ Button >
464+ </ div >
465+ ) }
466+
446467 { folders . map ( renderFolder ) }
447468
448469 < div className = "space-y-2" >
0 commit comments