diff --git a/Demo/macOS/Pulse_Demo_macOSApp.swift b/Demo/macOS/Pulse_Demo_macOSApp.swift index 8de578c90..4e5aa62ad 100644 --- a/Demo/macOS/Pulse_Demo_macOSApp.swift +++ b/Demo/macOS/Pulse_Demo_macOSApp.swift @@ -11,6 +11,7 @@ struct Pulse_Demo_macOSApp: App { WindowGroup { ConsoleView(store: .demo) } + .windowStyle(.hiddenTitleBar) .windowToolbarStyle(.unified(showsTitle: false)) } } diff --git a/Sources/PulseUI/Features/Console/ConsoleView-macos.swift b/Sources/PulseUI/Features/Console/ConsoleView-macos.swift index 3266d4775..ee474539e 100644 --- a/Sources/PulseUI/Features/Console/ConsoleView-macos.swift +++ b/Sources/PulseUI/Features/Console/ConsoleView-macos.swift @@ -18,21 +18,42 @@ public struct ConsoleView: View { public var body: some View { if #available(macOS 13, *) { - NavigationSplitView(sidebar: { - ConsoleMainView(environment: environment) - }, detail: { - NavigationStack { - Text("No Selection") - } - }) - .injecting(environment) - .navigationTitle("") + _ConsoleView(environment: environment) } else { PlaceholderView(imageName: "xmark.octagon", title: "Unsupported", subtitle: "Pulse requires macOS 13 or later").padding() } } } +@available(macOS 13, *) +private struct _ConsoleView: View { + @StateObject private var environment: ConsoleEnvironment + @State private var columnVisibility = NavigationSplitViewVisibility.all + + init(environment: ConsoleEnvironment) { + _environment = StateObject(wrappedValue: environment) + } + + public var body: some View { + NavigationSplitView( + columnVisibility: $columnVisibility, + sidebar: { + ConsoleMainView(environment: environment) + .navigationSplitViewColumnWidth(min: 320, ideal: 420, max: 640) + }, + content: { + EmptyView() + .navigationSplitViewColumnWidth(320) + }, + detail: { + EmptyView() + } + ) + .injecting(environment) + .navigationTitle("") + } +} + /// This view contains the console itself along with the details (no sidebar). @available(macOS 13, *) @MainActor @@ -46,7 +67,7 @@ private struct ConsoleMainView: View { var body: some View { ConsoleListView() - .frame(minWidth: 400, idealWidth: 500, minHeight: 120, idealHeight: 480) + .frame(minWidth: 300, idealWidth: 500, minHeight: 120, idealHeight: 480) .toolbar { ToolbarItemGroup(placement: .automatic) { Button(action: { isSharingStore = true }) { diff --git a/Sources/PulseUI/Features/Console/List/ConsoleListView.swift b/Sources/PulseUI/Features/Console/List/ConsoleListView.swift index caeacee75..00a0424e6 100644 --- a/Sources/PulseUI/Features/Console/List/ConsoleListView.swift +++ b/Sources/PulseUI/Features/Console/List/ConsoleListView.swift @@ -50,10 +50,10 @@ private struct _InternalConsoleListView: View { @ViewBuilder private var contents: some View { _ConsoleListView() - .environment(\.defaultMinListRowHeight, 8) #if os(macOS) .searchable(text: $searchBarViewModel.text, placement: .sidebar) #else + .environment(\.defaultMinListRowHeight, 8) .searchable(text: $searchBarViewModel.text) .textInputAutocapitalization(.never) #endif @@ -133,10 +133,8 @@ private struct _ConsoleListView: View { ConsoleListContentView() } } + .listRowSeparator(.hidden) .scrollContentBackground(.hidden) - .environment(\.defaultMinListRowHeight, 1) - - Divider() if isSearching { ConsoleSearchToolbar() diff --git a/Sources/PulseUI/Features/Console/Views/ConsoleEntityCell.swift b/Sources/PulseUI/Features/Console/Views/ConsoleEntityCell.swift index cc46efb93..3e1c540a2 100644 --- a/Sources/PulseUI/Features/Console/Views/ConsoleEntityCell.swift +++ b/Sources/PulseUI/Features/Console/Views/ConsoleEntityCell.swift @@ -15,14 +15,8 @@ struct ConsoleEntityCell: View { switch LoggerEntity(entity) { case .message(let message): _ConsoleMessageCell(message: message) -#if os(macOS) - .listRowSeparator(.visible) -#endif case .task(let task): _ConsoleTaskCell(task: task) -#if os(macOS) - .listRowSeparator(.visible) -#endif } } } diff --git a/Sources/PulseUI/Features/Inspector/NetworkInspectorView.swift b/Sources/PulseUI/Features/Inspector/NetworkInspectorView.swift index 182539b86..4de2760f5 100644 --- a/Sources/PulseUI/Features/Inspector/NetworkInspectorView.swift +++ b/Sources/PulseUI/Features/Inspector/NetworkInspectorView.swift @@ -37,43 +37,21 @@ struct NetworkInspectorView: View { } } } - - #else +#else var body: some View { - ScrollView(.horizontal) { - HStack(spacing: 0) { - List { - contents - .listRowSeparator(.hidden) - } - .animation(.default, value: task.state) - .frame(minWidth: 320, maxWidth: 420) - - Divider() - - if task.hasMetrics { - metrics - .frame(minWidth: 360, idealWidth: 360, maxWidth: 420) - } - } + List { + contents + .listRowSeparator(.hidden) } + .scrollContentBackground(.hidden) + .animation(.default, value: task.state) .toolbar { ToolbarItemGroup(placement: .automatic) { trailingNavigationBarItems } } } - - @ViewBuilder - private var metrics: some View { - List { - ForEach(task.orderedTransactions, id: \.index) { - NetworkInspectorTransactionView(viewModel: .init(transaction: $0, task: task)) - } - } - .listStyle(.inset(alternatesRowBackgrounds: false)) - } - #endif +#endif @ViewBuilder private var contents: some View { @@ -106,8 +84,10 @@ struct NetworkInspectorView: View { .pickerStyle(.segmented) .labelsHidden() .fixedSize() +#if os(iOS) || os(visionOS) .padding(.bottom, 4) .padding(.top, -10) +#endif } }