Skip to content

Commit

Permalink
Added activity viewer inactive state (#1971)
Browse files Browse the repository at this point in the history
* Added inactive state for activity viewer

* Added inactive states to the start and stop task buttons
  • Loading branch information
austincondiff authored Jan 16, 2025
1 parent a1d4da4 commit 6d16c90
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import SwiftUI

struct TaskNotificationView: View {
@Environment(\.controlActiveState)
private var activeState

@ObservedObject var taskNotificationHandler: TaskNotificationHandler
@State private var isPresented: Bool = false
@State var notification: TaskNotificationModel?
Expand Down Expand Up @@ -46,6 +49,7 @@ struct TaskNotificationView: View {
}
}
.transition(.opacity.combined(with: .move(edge: .trailing)))
.opacity(activeState == .inactive ? 0.4 : 1.0)
.padding(3)
.padding(-3)
.padding(.trailing, 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ struct SchemeDropDownView: View {
@Environment(\.colorScheme)
private var colorScheme

@Environment(\.controlActiveState)
private var activeState

@State var isSchemePopOverPresented: Bool = false
@State private var isHoveringScheme: Bool = false

Expand All @@ -33,7 +36,9 @@ struct SchemeDropDownView: View {
Image(systemName: "folder.badge.gearshape")
.imageScale(.medium)
Text(workspaceDisplayName)
.frame(minWidth: 0)
}
.opacity(activeState == .inactive ? 0.4 : 1.0)
.font(.subheadline)
.padding(.trailing, 11.5)
.padding(.horizontal, 2.5)
Expand Down
5 changes: 5 additions & 0 deletions CodeEdit/Features/ActivityViewer/Tasks/TaskDropDownView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ struct TaskDropDownView: View {
@Environment(\.colorScheme)
private var colorScheme

@Environment(\.controlActiveState)
private var activeState

@ObservedObject var taskManager: TaskManager

@State private var isTaskPopOverPresented: Bool = false
Expand All @@ -28,8 +31,10 @@ struct TaskDropDownView: View {
}
} else {
Text("Create Tasks")
.frame(minWidth: 0)
}
}
.opacity(activeState == .inactive ? 0.4 : 1.0)
.font(.subheadline)
.padding(.trailing, 11.5)
.padding(.horizontal, 2.5)
Expand Down
1 change: 1 addition & 0 deletions CodeEdit/Features/ActivityViewer/Tasks/TaskView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct TaskView: View {
HStack(spacing: 5) {
Image(systemName: "gearshape")
Text(task.name)
.frame(minWidth: 0)
Spacer(minLength: 0)
}
.padding(.trailing, 7.5)
Expand Down
4 changes: 4 additions & 0 deletions CodeEdit/Features/Tasks/Views/StartTaskToolbarButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import SwiftUI

struct StartTaskToolbarButton: View {
@Environment(\.controlActiveState)
private var activeState

@UpdatingWindowController var windowController: CodeEditWindowController?

@ObservedObject var taskManager: TaskManager
Expand All @@ -28,6 +31,7 @@ struct StartTaskToolbarButton: View {
} label: {
Label("Start", systemImage: "play.fill")
.labelStyle(.iconOnly)
.opacity(activeState == .inactive ? 0.5 : 1.0)
.font(.system(size: 18, weight: .regular))
.help("Start selected task")
.frame(width: 28)
Expand Down
4 changes: 4 additions & 0 deletions CodeEdit/Features/Tasks/Views/StopTaskToolbarButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import SwiftUI
import Combine

struct StopTaskToolbarButton: View {
@Environment(\.controlActiveState)
private var activeState

@ObservedObject var taskManager: TaskManager

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

0 comments on commit 6d16c90

Please sign in to comment.