Skip to content

Commit 6d16c90

Browse files
Added activity viewer inactive state (#1971)
* Added inactive state for activity viewer * Added inactive states to the start and stop task buttons
1 parent a1d4da4 commit 6d16c90

File tree

6 files changed

+23
-0
lines changed

6 files changed

+23
-0
lines changed

CodeEdit/Features/ActivityViewer/Notifications/TaskNotificationView.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 TaskNotificationView: View {
11+
@Environment(\.controlActiveState)
12+
private var activeState
13+
1114
@ObservedObject var taskNotificationHandler: TaskNotificationHandler
1215
@State private var isPresented: Bool = false
1316
@State var notification: TaskNotificationModel?
@@ -46,6 +49,7 @@ struct TaskNotificationView: View {
4649
}
4750
}
4851
.transition(.opacity.combined(with: .move(edge: .trailing)))
52+
.opacity(activeState == .inactive ? 0.4 : 1.0)
4953
.padding(3)
5054
.padding(-3)
5155
.padding(.trailing, 3)

CodeEdit/Features/ActivityViewer/Tasks/SchemeDropDownView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ struct SchemeDropDownView: View {
1111
@Environment(\.colorScheme)
1212
private var colorScheme
1313

14+
@Environment(\.controlActiveState)
15+
private var activeState
16+
1417
@State var isSchemePopOverPresented: Bool = false
1518
@State private var isHoveringScheme: Bool = false
1619

@@ -33,7 +36,9 @@ struct SchemeDropDownView: View {
3336
Image(systemName: "folder.badge.gearshape")
3437
.imageScale(.medium)
3538
Text(workspaceDisplayName)
39+
.frame(minWidth: 0)
3640
}
41+
.opacity(activeState == .inactive ? 0.4 : 1.0)
3742
.font(.subheadline)
3843
.padding(.trailing, 11.5)
3944
.padding(.horizontal, 2.5)

CodeEdit/Features/ActivityViewer/Tasks/TaskDropDownView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ struct TaskDropDownView: View {
1111
@Environment(\.colorScheme)
1212
private var colorScheme
1313

14+
@Environment(\.controlActiveState)
15+
private var activeState
16+
1417
@ObservedObject var taskManager: TaskManager
1518

1619
@State private var isTaskPopOverPresented: Bool = false
@@ -28,8 +31,10 @@ struct TaskDropDownView: View {
2831
}
2932
} else {
3033
Text("Create Tasks")
34+
.frame(minWidth: 0)
3135
}
3236
}
37+
.opacity(activeState == .inactive ? 0.4 : 1.0)
3338
.font(.subheadline)
3439
.padding(.trailing, 11.5)
3540
.padding(.horizontal, 2.5)

CodeEdit/Features/ActivityViewer/Tasks/TaskView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ struct TaskView: View {
1818
HStack(spacing: 5) {
1919
Image(systemName: "gearshape")
2020
Text(task.name)
21+
.frame(minWidth: 0)
2122
Spacer(minLength: 0)
2223
}
2324
.padding(.trailing, 7.5)

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)