Skip to content

Commit c4999e2

Browse files
committed
Added inactive states to the start and stop task buttons
1 parent 371272e commit c4999e2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CodeEdit/Features/Tasks/Views/StartTaskToolbarButton.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
import SwiftUI
99

1010
struct StartTaskToolbarButton: View {
11+
@Environment(\.controlActiveState)
12+
private var activeState
13+
1114
@UpdatingWindowController var windowController: CodeEditWindowController?
1215

1316
@ObservedObject var taskManager: TaskManager
@@ -28,6 +31,7 @@ struct StartTaskToolbarButton: View {
2831
} label: {
2932
Label("Start", systemImage: "play.fill")
3033
.labelStyle(.iconOnly)
34+
.opacity(activeState == .inactive ? 0.5 : 1.0)
3135
.font(.system(size: 18, weight: .regular))
3236
.help("Start selected task")
3337
.frame(width: 28)

CodeEdit/Features/Tasks/Views/StopTaskToolbarButton.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import SwiftUI
99
import Combine
1010

1111
struct StopTaskToolbarButton: View {
12+
@Environment(\.controlActiveState)
13+
private var activeState
14+
1215
@ObservedObject var taskManager: TaskManager
1316

1417
/// Tracks the current selected task's status. Updated by `updateStatusListener`
@@ -25,6 +28,7 @@ struct StopTaskToolbarButton: View {
2528
} label: {
2629
Label("Stop", systemImage: "stop.fill")
2730
.labelStyle(.iconOnly)
31+
.opacity(activeState == .inactive ? 0.5 : 1.0)
2832
.font(.system(size: 15, weight: .regular))
2933
.help("Stop selected task")
3034
.frame(width: 28)

0 commit comments

Comments
 (0)