File tree Expand file tree Collapse file tree
programs/FileBrowser/MainContent Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,20 @@ function MainContent({
3939 setContextMenuOpen ( true ) ;
4040 }
4141
42+ function getFSObjects ( ) {
43+ const objects = Object . values < FSObject > ( currentDirectory . contents ) . sort (
44+ ( a , b ) => {
45+ const nameA = a . name . toLowerCase ( ) ;
46+ const nameB = b . name . toLowerCase ( ) ;
47+ if ( nameA < nameB ) return - 1 ;
48+ if ( nameA > nameB ) return 1 ;
49+ return 0 ;
50+ }
51+ ) ;
52+
53+ return objects ;
54+ }
55+
4256 return (
4357 < StyledMainContent onContextMenu = { handleRightClick } >
4458 { contextMenuOpen && (
@@ -56,7 +70,7 @@ function MainContent({
5670 close = { ( ) => setPromptFor ( null ) }
5771 />
5872 ) }
59- { Object . values < FSObject > ( currentDirectory . contents ) . map ( ( fsObject ) => (
73+ { getFSObjects ( ) . map ( ( fsObject ) => (
6074 < DirectoryOrFile
6175 fsObject = { fsObject }
6276 openFSObject = { openFSObject }
Original file line number Diff line number Diff line change @@ -295,10 +295,8 @@ export const useLocalFS = create<LocalFSState>()(
295295 // store the path on each FSObject and instead store a reference to
296296 // the parent FSDirectory, but this would very tricky to persist
297297 function updatePathRecursive ( fsObject : FSObject ) {
298- console . log ( "Updating" , fsObject . path ) ;
299298 const regex = new RegExp ( `^${ oldPath } ` ) ;
300299 fsObject . path = fsObject . path . replace ( regex , newPath ) ;
301- console . log ( "Updated to" , fsObject . path ) ;
302300
303301 if ( ! isFSDirectory ( fsObject ) ) return ;
304302
You can’t perform that action at this time.
0 commit comments