Skip to content

Commit

Permalink
Hide scroll view background
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jul 15, 2024
1 parent b4caf9a commit e37d31b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 49 deletions.
1 change: 1 addition & 0 deletions Demo/macOS/Pulse_Demo_macOSApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct Pulse_Demo_macOSApp: App {
WindowGroup {
ConsoleView(store: .demo)
}
.windowStyle(.hiddenTitleBar)
.windowToolbarStyle(.unified(showsTitle: false))
}
}
41 changes: 31 additions & 10 deletions Sources/PulseUI/Features/Console/ConsoleView-macos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }) {
Expand Down
6 changes: 2 additions & 4 deletions Sources/PulseUI/Features/Console/List/ConsoleListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -133,10 +133,8 @@ private struct _ConsoleListView: View {
ConsoleListContentView()
}
}
.listRowSeparator(.hidden)
.scrollContentBackground(.hidden)
.environment(\.defaultMinListRowHeight, 1)

Divider()

if isSearching {
ConsoleSearchToolbar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
38 changes: 9 additions & 29 deletions Sources/PulseUI/Features/Inspector/NetworkInspectorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -106,8 +84,10 @@ struct NetworkInspectorView: View {
.pickerStyle(.segmented)
.labelsHidden()
.fixedSize()
#if os(iOS) || os(visionOS)
.padding(.bottom, 4)
.padding(.top, -10)
#endif
}
}

Expand Down

0 comments on commit e37d31b

Please sign in to comment.