feat(library): projects & archive UI — S2 (#108)
CI / ci (push) Canceled after 0s

Variant B per the #104 prototype verdict: the library column groups
pieces by project (serif lowercase heads, collapse toggle, Pass-State
groups inside, 2px edge-bar selection shared with the new Archive
pane via LibraryPostRow). Move to Project / Archive / Move Back /
whole-project Unarchive are folder moves — post.md bytes untouched,
never clobbering, ids globally unique. File ▸ New Post ⌘N and New
Project… ⌥⌘N (CommandGroup, never CommandMenu per #84).

Every folder move flushes pending edits first and aborts when the
write failed — nothing moves without its text. Project membership and
the archived-refusal derive from freshly resolved disk paths, never
the scan snapshot. Slug and project-name comparisons fold through one
canonical key (NFC + lowercase). Two reviewer fanouts this session;
their findings are all fixed or visibly parked.

144/144 tests green (run twice), swiftformat/swiftlint clean.

Closes #108
This commit is contained in:
AlexKucera committed 2026-10-13 22:18:24 +02:00
1 parent 9da3a07f4a
commit e55747e7fe
15 files changed
+1205 -68

No files matched your search

+27
View File
@@ -88,6 +88,10 @@ struct MuseionApp: App {
// File menu after New — never CommandMenu("File"), which doubles
// it (#84 trap).
CommandGroup(after: .newItem) {
// #108: New Post / New Project… go FIRST in the group — the
// menu reads New Post / New Project… / Open… / Import…
NewPostButton(gate: gate)
NewProjectButton(gate: gate)
OpenExternalButton(gate: gate)
ImportFilesButton(gate: gate)
}
@@ -160,6 +164,29 @@ private struct FocusModeToggle: View {
}
}
/// #108: File ▸ New Post (⌘N) — same draft path as the library's + button.
/// The stock new-window item may swallow or duplicate ⌘N in some macOS
/// builds; the action still fires from the menu either way.
private struct NewPostButton: View {
let gate: AppGateState
var body: some View {
Button("New Post") { gate.posts.newPost() }
.keyboardShortcut("n", modifiers: .command)
}
}
/// #108: File ▸ New Project… (⌥⌘N) — stages the ask; WorkspaceView presents
/// the sheet (commands views can't; the pendingImportURLs pattern, #94).
private struct NewProjectButton: View {
let gate: AppGateState
var body: some View {
Button("New Project…") { gate.posts.stageNewProject() }
.keyboardShortcut("n", modifiers: [.command, .option])
}
}
/// #91: File ▸ Open… (⌘O) — NSOpenPanel (the Settings Home picker pattern),
/// .md/.markdown only (#96). Opens into the single external guest slot.
private struct OpenExternalButton: View {