Skip to content

Commit b4caf9a

Browse files
committed
Improve details view for network requests on macOS
1 parent e3a8179 commit b4caf9a

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

Sources/PulseUI/Features/Inspector/NetworkInspectorView.swift

+38-4
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,62 @@ struct NetworkInspectorView: View {
1919
@EnvironmentObject private var environment: ConsoleEnvironment
2020
@Environment(\.store) private var store
2121

22+
#if os(iOS) || os(visionOS)
2223
var body: some View {
2324
List {
2425
contents
2526
}
2627
.animation(.default, value: task.state)
27-
#if os(iOS) || os(visionOS)
2828
.listStyle(.insetGrouped)
2929
.safeAreaInset(edge: .bottom) {
3030
OpenOnMacOverlay(entity: task)
3131
}
3232
.inlineNavigationTitle(environment.delegate.getShortTitle(for: task))
3333
.sheet(item: $shareItems, content: ShareView.init)
34-
#else
35-
.listStyle(.sidebar)
36-
#endif
3734
.toolbar {
3835
ToolbarItemGroup(placement: .automatic) {
3936
trailingNavigationBarItems
4037
}
4138
}
4239
}
4340

41+
#else
42+
var body: some View {
43+
ScrollView(.horizontal) {
44+
HStack(spacing: 0) {
45+
List {
46+
contents
47+
.listRowSeparator(.hidden)
48+
}
49+
.animation(.default, value: task.state)
50+
.frame(minWidth: 320, maxWidth: 420)
51+
52+
Divider()
53+
54+
if task.hasMetrics {
55+
metrics
56+
.frame(minWidth: 360, idealWidth: 360, maxWidth: 420)
57+
}
58+
}
59+
}
60+
.toolbar {
61+
ToolbarItemGroup(placement: .automatic) {
62+
trailingNavigationBarItems
63+
}
64+
}
65+
}
66+
67+
@ViewBuilder
68+
private var metrics: some View {
69+
List {
70+
ForEach(task.orderedTransactions, id: \.index) {
71+
NetworkInspectorTransactionView(viewModel: .init(transaction: $0, task: task))
72+
}
73+
}
74+
.listStyle(.inset(alternatesRowBackgrounds: false))
75+
}
76+
#endif
77+
4478
@ViewBuilder
4579
private var contents: some View {
4680
Section { NetworkInspectorView.makeHeaderView(task: task, store: store) }

0 commit comments

Comments
 (0)