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
|
// Public method to open settings window
|
||||||
func openSettings(tab: Int = 0) {
|
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 {
|
if let existingWindow = settingsWindowController?.window {
|
||||||
|
NotificationCenter.default.post(
|
||||||
|
name: Notification.Name("SwitchToSettingsTab"),
|
||||||
|
object: tab
|
||||||
|
)
|
||||||
existingWindow.makeKeyAndOrderFront(nil)
|
existingWindow.makeKeyAndOrderFront(nil)
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -173,9 +173,7 @@ struct TimerStatusRow: View {
|
|||||||
@State private var isHoveredBody = false
|
@State private var isHoveredBody = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button(action: {
|
HStack {
|
||||||
onTap?()
|
|
||||||
}) {
|
|
||||||
HStack {
|
HStack {
|
||||||
Image(systemName: type.iconName)
|
Image(systemName: type.iconName)
|
||||||
.foregroundColor(iconColor)
|
.foregroundColor(iconColor)
|
||||||
@@ -190,51 +188,54 @@ struct TimerStatusRow: View {
|
|||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
.monospacedDigit()
|
.monospacedDigit()
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
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)
|
.contentShape(Rectangle())
|
||||||
.padding(.vertical, 6)
|
.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(
|
.glassEffect(
|
||||||
isHoveredBody ? .regular.tint(.accentColor.opacity(0.5)) : .regular,
|
isHoveredBody ? .regular.tint(.accentColor) : .regular,
|
||||||
in: .rect(cornerRadius: 6)
|
in: .rect(cornerRadius: 6)
|
||||||
)
|
)
|
||||||
.padding(.horizontal, 8)
|
.padding(.horizontal, 8)
|
||||||
|
|||||||
@@ -95,6 +95,11 @@ struct SettingsWindowView: View {
|
|||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
.frame(width: 600, height: 550)
|
.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() {
|
private func applySettings() {
|
||||||
|
|||||||
Reference in New Issue
Block a user