iOS Folders: New File and New Folder under + in the navigation bar !217

merged merged by cmc on 2026-10-10 20:31 UTC · krz/orgstar:folders-new-toolbar into main

2 files changed, +23 −3

Layout: unified · split

Sources/OrgstarMobile/FoldersScreen.swift +22 −2
@@ -19,8 +19,6 @@ struct FoldersScreen: View {
1919 ForEach(workspace.rootPaths, id: \.self) { root in
2020 Section((root as NSString).lastPathComponent) {
2121 FolderContents(workspace: workspace, root: root, folder: "", deleting: $deleting, changes: changes)
22 Button("New File…", systemImage: "doc.badge.plus") { creating = NewItem(folder: root, isFolder: false) }
23 Button("New Folder…", systemImage: "folder.badge.plus") { creating = NewItem(folder: root, isFolder: true) }
2422 Button("Remove Folder", role: .destructive) { try? workspace.removeRoot(path: root) }
2523 }
2624 }
@@ -49,6 +47,20 @@ struct FoldersScreen: View {
4947 ToolbarItem(placement: .topBarLeading) {
5048 Button("Add Folder", systemImage: "folder.badge.plus") { importing = true }
5149 }
50 if !workspace.rootPaths.isEmpty {
51 ToolbarItem(placement: .primaryAction) {
52 Menu("New", systemImage: "plus") {
53 // One added folder takes them directly; several each get a submenu.
54 if workspace.rootPaths.count == 1, let root = workspace.rootPaths.first {
55 newItems(in: root)
56 } else {
57 ForEach(workspace.rootPaths, id: \.self) { root in
58 Menu((root as NSString).lastPathComponent) { newItems(in: root) }
59 }
60 }
61 }
62 }
63 }
5264 }
5365 .fileImporter(isPresented: $importing, allowedContentTypes: [.folder]) { result in
5466 guard case .success(let url) = result else { return }
@@ -166,6 +178,14 @@ private extension View {
166178 }
167179}
168180
181extension FoldersScreen {
182 @ViewBuilder
183 private func newItems(in folder: String) -> some View {
184 Button("New File…", systemImage: "doc.badge.plus") { creating = NewItem(folder: folder, isFolder: false) }
185 Button("New Folder…", systemImage: "folder.badge.plus") { creating = NewItem(folder: folder, isFolder: true) }
186 }
187}
188
169189/// A subfolder to show, relative to its root.
170190struct FolderRoute: Hashable {
171191 let root: String
docs/manual/guide/14-ios.org +1 −1
@@ -22,7 +22,7 @@ orgstar on iOS works on folders you choose, in iCloud Drive or in another app's
2222
2323orgstar keeps access to the folder across launches. Each folder appears as a section listing its =.org= files by their path inside the folder. Remove Folder at the end of a section removes it from orgstar; the files stay where they are.
2424
25Swipe left on a file, or touch and hold it, to delete it. orgstar asks first. A file in iCloud Drive goes to Recently Deleted in the Files app; elsewhere it is removed. New File… and New Folder… at the end of a folder's section, or under + in a subfolder, make one there; a file name without an extension gets =.org=. Empty folders are listed too and delete the same way; a folder with anything in it other than hidden files can't be deleted from orgstar.
25Swipe left on a file, or touch and hold it, to delete it. orgstar asks first. A file in iCloud Drive goes to Recently Deleted in the Files app; elsewhere it is removed. New File… and New Folder… under + at the top right make one in the folder shown, or with several added folders, in the one you pick; a file name without an extension gets =.org=. Empty folders are listed too and delete the same way; a folder with anything in it other than hidden files can't be deleted from orgstar.
2626
2727Files that iCloud hasn't downloaded to the device yet appear in grey with a cloud icon. orgstar asks iCloud to download them and lists them as files once they arrive.
2828