fix: timer row click properly opens in menu
This commit is contained in:
@@ -188,8 +188,12 @@ private func showReminderWindow(_ content: AnyView) {
|
||||
|
||||
// Public method to open settings window
|
||||
func openSettings(tab: Int = 0) {
|
||||
// If window already exists, just bring it to front
|
||||
// If window already exists, switch to the tab and bring it to front
|
||||
if let existingWindow = settingsWindowController?.window {
|
||||
NotificationCenter.default.post(
|
||||
name: Notification.Name("SwitchToSettingsTab"),
|
||||
object: tab
|
||||
)
|
||||
existingWindow.makeKeyAndOrderFront(nil)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
return
|
||||
|
||||
@@ -173,9 +173,7 @@ struct TimerStatusRow: View {
|
||||
@State private var isHoveredBody = false
|
||||
|
||||
var body: some View {
|
||||
Button(action: {
|
||||
onTap?()
|
||||
}) {
|
||||
HStack {
|
||||
HStack {
|
||||
Image(systemName: type.iconName)
|
||||
.foregroundColor(iconColor)
|
||||
@@ -192,49 +190,52 @@ struct TimerStatusRow: View {
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
#if DEBUG
|
||||
if let onDevTrigger = onDevTrigger {
|
||||
Button(action: onDevTrigger) {
|
||||
Image(systemName: "bolt.fill")
|
||||
.font(.caption)
|
||||
.foregroundColor(.yellow)
|
||||
.padding(6)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.glassEffect(
|
||||
isHoveredDevTrigger ? .regular.tint(.yellow) : .regular,
|
||||
in: .circle
|
||||
)
|
||||
.help("Trigger \(type.displayName) reminder now (dev)")
|
||||
.onHover { hovering in
|
||||
isHoveredDevTrigger = hovering
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Button(action: onSkip) {
|
||||
Image(systemName: "forward.fill")
|
||||
.font(.caption)
|
||||
.foregroundColor(.accentColor)
|
||||
.padding(6)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.glassEffect(
|
||||
isHoveredSkip ? .regular.tint(.accentColor.opacity(0.5)) : .regular,
|
||||
in: .circle
|
||||
)
|
||||
.help("Skip to next \(type.displayName) reminder")
|
||||
.onHover { hovering in
|
||||
isHoveredSkip = hovering
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 6)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
onTap?()
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if let onDevTrigger = onDevTrigger {
|
||||
Button(action: onDevTrigger) {
|
||||
Image(systemName: "bolt.fill")
|
||||
.font(.caption)
|
||||
.foregroundColor(.yellow)
|
||||
.padding(6)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.glassEffect(
|
||||
isHoveredDevTrigger ? .regular.tint(.yellow) : .regular,
|
||||
in: .circle
|
||||
)
|
||||
.help("Trigger \(type.displayName) reminder now (dev)")
|
||||
.onHover { hovering in
|
||||
isHoveredDevTrigger = hovering
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Button(action: onSkip) {
|
||||
Image(systemName: "forward.fill")
|
||||
.font(.caption)
|
||||
.foregroundColor(.accentColor)
|
||||
.padding(6)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.glassEffect(
|
||||
isHoveredSkip ? .regular.tint(.accentColor) : .regular,
|
||||
in: .circle
|
||||
)
|
||||
.help("Skip to next \(type.displayName) reminder")
|
||||
.onHover { hovering in
|
||||
isHoveredSkip = hovering
|
||||
}
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 6)
|
||||
.glassEffect(
|
||||
isHoveredBody ? .regular.tint(.accentColor.opacity(0.5)) : .regular,
|
||||
isHoveredBody ? .regular.tint(.accentColor) : .regular,
|
||||
in: .rect(cornerRadius: 6)
|
||||
)
|
||||
.padding(.horizontal, 8)
|
||||
|
||||
@@ -95,6 +95,11 @@ struct SettingsWindowView: View {
|
||||
.padding()
|
||||
}
|
||||
.frame(width: 600, height: 550)
|
||||
.onReceive(NotificationCenter.default.publisher(for: Notification.Name("SwitchToSettingsTab"))) { notification in
|
||||
if let tab = notification.object as? Int {
|
||||
currentTab = tab
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func applySettings() {
|
||||
|
||||
Reference in New Issue
Block a user