Skip to content

Commit 2cf3d2a

Browse files
author
ComputelessComputer
committed
Replace floating capture indicator with toolbar status
Remove the bottom-left capture overlay and show capture status in the toolbar, switching the label to pause or resume on hover.
1 parent 54f7e18 commit 2cf3d2a

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

Sources/OpenbirdApp/RootView.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ struct RootView: View {
2727
SettingsView(model: model)
2828
}
2929
}
30-
.overlay(alignment: .bottomLeading) {
31-
CaptureStatusView(model: model)
32-
.padding()
33-
}
3430
}
3531
.safeAreaInset(edge: .top, spacing: 0) {
3632
if let update = model.availableUpdate {
@@ -45,9 +41,7 @@ struct RootView: View {
4541
}
4642
.toolbar {
4743
ToolbarItem(placement: .automatic) {
48-
Button(model.settings.capturePaused ? "Resume Capture" : "Pause Capture") {
49-
model.toggleCapturePaused()
50-
}
44+
CaptureToolbarButton(model: model)
5145
}
5246
ToolbarItem(placement: .automatic) {
5347
Button("Refresh") {
@@ -116,8 +110,9 @@ private struct UpdateBannerView: View {
116110
}
117111
}
118112

119-
private struct CaptureStatusView: View {
113+
private struct CaptureToolbarButton: View {
120114
@ObservedObject var model: AppModel
115+
@State private var isHovering = false
121116

122117
private var statusColor: Color {
123118
if model.settings.capturePaused { return .orange }
@@ -133,22 +128,27 @@ private struct CaptureStatusView: View {
133128
}
134129
}
135130

131+
private var buttonTitle: String {
132+
if isHovering {
133+
return model.settings.capturePaused ? "Resume Capture" : "Pause Capture"
134+
}
135+
return model.captureStatusLabel
136+
}
137+
136138
var body: some View {
137-
HStack(spacing: 10) {
138-
Circle()
139-
.fill(statusColor)
140-
.frame(width: 10, height: 10)
141-
VStack(alignment: .leading, spacing: 2) {
142-
Text(model.captureStatusLabel)
143-
.font(.headline)
144-
Text(model.captureStatusDetail)
145-
.font(.caption)
146-
.foregroundStyle(.secondary)
139+
Button {
140+
model.toggleCapturePaused()
141+
} label: {
142+
HStack(spacing: 8) {
143+
Circle()
144+
.fill(statusColor)
145+
.frame(width: 8, height: 8)
146+
Text(buttonTitle)
147147
}
148-
Spacer(minLength: 0)
149148
}
150-
.padding(14)
151-
.background(.thinMaterial, in: RoundedRectangle(cornerRadius: 16, style: .continuous))
152-
.frame(maxWidth: 320)
149+
.help("\(model.captureStatusLabel)\n\(model.captureStatusDetail)")
150+
.onHover { hovering in
151+
isHovering = hovering
152+
}
153153
}
154154
}

0 commit comments

Comments
 (0)