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:
@@ -14,6 +14,20 @@ struct ContentView_macOS: View {
|
||||
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 {
|
||||
NavigationSplitView {
|
||||
VStack(spacing: 0) {
|
||||
@@ -26,7 +40,10 @@ struct ContentView_macOS: View {
|
||||
} 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 {
|
||||
// Per HIG: "sidebar-toggle/back controls appear at the far leading
|
||||
// edge, followed by the view title" — this is that title, not
|
||||
|
||||
Reference in New Issue
Block a user