fix(collections): update window title on collection/document selection

.navigationTitle was hardcoded to the team name and never changed —
the actual macOS window title stayed on the workspace name even with
a collection or document open, while only the custom toolbar pill
updated. Now computed with the same priority so both agree.
This commit is contained in:
2026-08-14 01:00:13 +01:00
parent 62463d420c
commit eb01c07552
@@ -14,6 +14,20 @@ struct ContentView_macOS: View {
globalSearchQuery.trimmingCharacters(in: .whitespacesAndNewlines) globalSearchQuery.trimmingCharacters(in: .whitespacesAndNewlines)
} }
/// Mirrors leadingToolbarContent's priority (search > document > collection
/// > workspace) so the actual window title and the custom pill agree.
private var windowTitle: String {
if !trimmedGlobalQuery.isEmpty {
return "Search"
} else if let currentDocument = documentPath.last {
return currentDocument.title.isEmpty ? "Untitled" : currentDocument.title
} else if let selectedCollection {
return selectedCollection.name
} else {
return session.teamName ?? "Outpost"
}
}
var body: some View { var body: some View {
NavigationSplitView { NavigationSplitView {
VStack(spacing: 0) { VStack(spacing: 0) {
@@ -26,7 +40,10 @@ struct ContentView_macOS: View {
} detail: { } detail: {
detail detail
} }
.navigationTitle(session.teamName ?? "Outpost") // Was hardcoded to the team name and never updated the actual macOS
// window title (separate from the leadingToolbarContent pill below)
// stayed on the workspace name even with a collection/document open.
.navigationTitle(windowTitle)
.toolbar { .toolbar {
// Per HIG: "sidebar-toggle/back controls appear at the far leading // Per HIG: "sidebar-toggle/back controls appear at the far leading
// edge, followed by the view title" this is that title, not // edge, followed by the view title" this is that title, not