Skip to content

Commit bf68f3a

Browse files
authored
Merge pull request #14 from devklick/dev
Dev
2 parents ad2e4a9 + f019088 commit bf68f3a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/programs/FileBrowser/MainContent/MainContent.tsx

+15-1
Original file line numberDiff line numberDiff 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}

src/stores/localFS.ts

-2
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)