mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Update alert UI and button changes
This commit is contained in:
parent
adc28fcf2f
commit
24009f7b81
7 changed files with 96 additions and 9 deletions
|
|
@ -22,6 +22,8 @@ struct DynamicIslandHeader: View {
|
|||
@State private var showTimerPopover = false
|
||||
@Default(.enableTimerFeature) var enableTimerFeature
|
||||
@Default(.timerDisplayMode) var timerDisplayMode
|
||||
@Default(.showClipboardIcon) var showClipboardIcon
|
||||
@Default(.clipboardDisplayMode) var clipboardDisplayMode
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
|
|
@ -68,10 +70,12 @@ struct DynamicIslandHeader: View {
|
|||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
|
||||
if Defaults[.enableClipboardManager] && Defaults[.showClipboardIcon] {
|
||||
if Defaults[.enableClipboardManager]
|
||||
&& showClipboardIcon
|
||||
&& clipboardDisplayMode != .separateTab {
|
||||
Button(action: {
|
||||
// Switch behavior based on display mode
|
||||
switch Defaults[.clipboardDisplayMode] {
|
||||
switch clipboardDisplayMode {
|
||||
case .panel:
|
||||
ClipboardPanelManager.shared.toggleClipboardPanel()
|
||||
case .popover:
|
||||
|
|
@ -237,7 +241,7 @@ struct DynamicIslandHeader: View {
|
|||
.onChange(of: coordinator.shouldToggleClipboardPopover) { _ in
|
||||
// Only toggle if clipboard is enabled
|
||||
if Defaults[.enableClipboardManager] {
|
||||
switch Defaults[.clipboardDisplayMode] {
|
||||
switch clipboardDisplayMode {
|
||||
case .panel:
|
||||
ClipboardPanelManager.shared.toggleClipboardPanel()
|
||||
case .popover:
|
||||
|
|
@ -253,7 +257,7 @@ struct DynamicIslandHeader: View {
|
|||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("ToggleClipboardPopover"))) { _ in
|
||||
// Handle keyboard shortcut for popover mode
|
||||
if Defaults[.enableClipboardManager] && Defaults[.clipboardDisplayMode] == .popover {
|
||||
if Defaults[.enableClipboardManager] && clipboardDisplayMode == .popover {
|
||||
showClipboardPopover.toggle()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,6 +351,8 @@ struct NotchClipboardList: View {
|
|||
@State private var justCopiedId: UUID?
|
||||
@State private var suppressionToken = UUID()
|
||||
@State private var isSuppressing = false
|
||||
@State private var showClearHistoryAlert = false
|
||||
@State private var autoCloseToken = UUID()
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
|
|
@ -363,10 +365,10 @@ struct NotchClipboardList: View {
|
|||
Spacer()
|
||||
|
||||
if !clipboardManager.clipboardHistory.isEmpty {
|
||||
Button(action: { clipboardManager.clearHistory() }) {
|
||||
Button(action: { showClearHistoryAlert = true }) {
|
||||
Image(systemName: "trash")
|
||||
.font(.system(size: 14))
|
||||
.foregroundStyle(.white.opacity(0.6))
|
||||
.foregroundStyle(.red)
|
||||
.padding(6)
|
||||
.background(Color.white.opacity(0.1))
|
||||
.clipShape(Circle())
|
||||
|
|
@ -432,6 +434,17 @@ struct NotchClipboardList: View {
|
|||
.onDisappear {
|
||||
updateSuppression(for: false)
|
||||
}
|
||||
.alert("Clear Clipboard History?", isPresented: $showClearHistoryAlert) {
|
||||
Button("Clear History", role: .destructive) {
|
||||
clipboardManager.clearHistory()
|
||||
}
|
||||
Button("Cancel", role: .cancel) {}
|
||||
} message: {
|
||||
Text("This removes every saved clipboard item from the notch tab.")
|
||||
}
|
||||
.onChange(of: showClearHistoryAlert) { _, isShowing in
|
||||
vm.setAutoCloseSuppression(isShowing, token: autoCloseToken)
|
||||
}
|
||||
}
|
||||
|
||||
private func updateSuppression(for hovering: Bool) {
|
||||
|
|
@ -513,6 +526,8 @@ struct NoteListView: View {
|
|||
@State private var isSearchExpanded = false
|
||||
@State private var suppressionToken = UUID()
|
||||
@State private var isSuppressing = false
|
||||
@State private var showClearNotesAlert = false
|
||||
@State private var autoCloseToken = UUID()
|
||||
|
||||
var sortedNotes: [NoteItem] {
|
||||
var filtered = searchText.isEmpty ? notes : notes.filter {
|
||||
|
|
@ -575,11 +590,11 @@ struct NoteListView: View {
|
|||
}
|
||||
|
||||
if !notes.isEmpty {
|
||||
Button(action: onClearAll) {
|
||||
Button(action: { showClearNotesAlert = true }) {
|
||||
Image(systemName: "trash")
|
||||
.font(.system(size: 14))
|
||||
.frame(width: 16, height: 16)
|
||||
.foregroundStyle(.white.opacity(0.6))
|
||||
.foregroundStyle(.red)
|
||||
.padding(5)
|
||||
.background(Color.white.opacity(0.1))
|
||||
.clipShape(Circle())
|
||||
|
|
@ -710,6 +725,17 @@ struct NoteListView: View {
|
|||
.onDisappear {
|
||||
updateSuppression(for: false)
|
||||
}
|
||||
.alert("Delete All Notes?", isPresented: $showClearNotesAlert) {
|
||||
Button("Delete", role: .destructive) {
|
||||
onClearAll()
|
||||
}
|
||||
Button("Cancel", role: .cancel) {}
|
||||
} message: {
|
||||
Text("This permanently removes every saved note and its attachments.")
|
||||
}
|
||||
.onChange(of: showClearNotesAlert) { _, isShowing in
|
||||
vm.setAutoCloseSuppression(isShowing, token: autoCloseToken)
|
||||
}
|
||||
}
|
||||
|
||||
private func updateSuppression(for hovering: Bool) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue