Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions CloudNow/UI/StatsHUDView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,21 @@ struct StatsHUDView: View {
case .off:
EmptyView()
case .compact:
panel { compactRows }
panel { column { compactRows } }
case .standard:
panel { standardSections }
// Diagnostics roughly doubles the panel height by appending the Debug section,
// which can run off the bottom of the screen. Split into two columns then —
// core stats on the left, Debug on the right — so it stays on screen.
if streamController.diagnosticsEnabled {
panel {
HStack(alignment: .top, spacing: 28) {
column { coreSections }
column { debugSection }
}
}
} else {
panel { column { coreSections } }
}
}
}

Expand All @@ -60,14 +72,11 @@ struct StatsHUDView: View {

// MARK: Standard

@ViewBuilder private var standardSections: some View {
@ViewBuilder private var coreSections: some View {
networkSection
videoSection
audioSection
sessionSection
if streamController.diagnosticsEnabled {
debugSection
}
}

@ViewBuilder private var networkSection: some View {
Expand Down Expand Up @@ -211,15 +220,21 @@ struct StatsHUDView: View {

// MARK: Building blocks

private let columnWidth: CGFloat = 380

private func panel(@ViewBuilder content: () -> some View) -> some View {
content()
.font(.system(size: 21).monospacedDigit())
.padding(20)
.background(.black.opacity(0.65), in: RoundedRectangle(cornerRadius: 12))
.allowsHitTesting(false)
}

private func column(@ViewBuilder content: () -> some View) -> some View {
VStack(alignment: .leading, spacing: 6) {
content()
}
.font(.system(size: 21).monospacedDigit())
.frame(width: 380)
.padding(20)
.background(.black.opacity(0.65), in: RoundedRectangle(cornerRadius: 12))
.allowsHitTesting(false)
.frame(width: columnWidth, alignment: .leading)
}

private func header(_ title: String) -> some View {
Expand Down
Loading