mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Improved Timer UI, removed the Tab
This commit is contained in:
parent
d7c8b1ef61
commit
a9f9ac3aa8
14 changed files with 1079 additions and 241 deletions
|
|
@ -15,8 +15,11 @@ struct DynamicIslandHeader: View {
|
|||
@ObservedObject var coordinator = DynamicIslandViewCoordinator.shared
|
||||
@ObservedObject var clipboardManager = ClipboardManager.shared
|
||||
@ObservedObject var tvm = TrayDrop.shared
|
||||
@ObservedObject var timerManager = TimerManager.shared
|
||||
@State private var showClipboardPopover = false
|
||||
@State private var showColorPickerPopover = false
|
||||
@State private var showTimerPopover = false
|
||||
@Default(.enableTimerFeature) var enableTimerFeature
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
|
|
@ -141,6 +144,36 @@ struct DynamicIslandHeader: View {
|
|||
}
|
||||
}
|
||||
|
||||
if Defaults[.enableTimerFeature] {
|
||||
Button(action: {
|
||||
withAnimation(.smooth) {
|
||||
showTimerPopover.toggle()
|
||||
}
|
||||
}) {
|
||||
Capsule()
|
||||
.fill(.black)
|
||||
.frame(width: 30, height: 30)
|
||||
.overlay {
|
||||
Image(systemName: "timer")
|
||||
.foregroundColor(.white)
|
||||
.padding()
|
||||
.imageScale(.medium)
|
||||
}
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
.popover(isPresented: $showTimerPopover, arrowEdge: .bottom) {
|
||||
TimerPopover()
|
||||
}
|
||||
.onChange(of: showTimerPopover) { isActive in
|
||||
vm.isTimerPopoverActive = isActive
|
||||
if !isActive {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
vm.shouldRecheckHover.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if Defaults[.settingsIconInNotch] {
|
||||
Button(action: {
|
||||
SettingsWindowController.shared.showWindow()
|
||||
|
|
@ -204,6 +237,12 @@ struct DynamicIslandHeader: View {
|
|||
showClipboardPopover.toggle()
|
||||
}
|
||||
}
|
||||
.onChange(of: enableTimerFeature) { _, newValue in
|
||||
if !newValue {
|
||||
showTimerPopover = false
|
||||
vm.isTimerPopoverActive = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue