Commit f85e3ec801

f85e3ec801b2d7630446b19999a9b7971d7a6889

parent: cba778d55e

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-10 18:26 UTC

iOS Folders: subfolders push by value, so files inside them open on the first tap

Layout: unified · split

Sources/OrgstarMobile/FoldersScreen.swift +12 −4
@@ -21,6 +21,10 @@ struct FoldersScreen: View {
2121 }
2222 }
2323 .navigationTitle("Folders")
24 .navigationDestination(for: FolderRoute.self) { route in
25 List { FolderContents(workspace: workspace, root: route.root, folder: route.folder) }
26 .navigationTitle((route.folder as NSString).lastPathComponent)
27 }
2428 .overlay {
2529 if workspace.rootPaths.isEmpty {
2630 ContentUnavailableView {
@@ -51,6 +55,12 @@ struct FoldersScreen: View {
5155 }
5256 }
5357}
58/// A subfolder to show, relative to its root.
59struct FolderRoute: Hashable {
60 let root: String
61 let folder: String
62}
63
5464/// One folder's subfolders, which open their own contents, then its org files and the files
5565/// still downloading into it. `folder` is relative to `root`, empty for the root itself.
5666private struct FolderContents: View {
@@ -72,10 +82,8 @@ private struct FolderContents: View {
7282 path.firstIndex(of: "/").map { String(path[..<$0]) }
7383 }).sorted { $0.localizedStandardCompare($1) == .orderedAscending }
7484 ForEach(subfolders, id: \.self) { name in
75 NavigationLink {
76 List { FolderContents(workspace: workspace, root: root, folder: prefix + name) }
77 .navigationTitle(name)
78 } label: {
85 // A value, as the files' links are: a stack mixing the two kinds pushes wrongly.
86 NavigationLink(value: FolderRoute(root: root, folder: prefix + name)) {
7987 Label(name, systemImage: "folder")
8088 }
8189 }