Browse Source

toolbar: destructive actions should not be the primary button

osy 1 year ago
parent
commit
2d46829996
1 changed files with 12 additions and 12 deletions
  1. 12 12
      Platform/Shared/VMConfirmActionModifier.swift

+ 12 - 12
Platform/Shared/VMConfirmActionModifier.swift

@@ -37,43 +37,43 @@ struct VMConfirmActionModifier: ViewModifier {
             switch action {
             case .confirmCloneVM:
                 if vm.isShortcut {
-                    return Alert(title: Text("Do you want to copy this VM and all its data to internal storage?"), primaryButton: .default(Text("Yes")) {
+                    return Alert(title: Text("Do you want to copy this VM and all its data to internal storage?"), primaryButton: .cancel(), secondaryButton: .default(Text("Yes")) {
                         data.busyWorkAsync {
                             try await data.clone(vm: vm)
                         }
                         onConfirm()
-                    }, secondaryButton: .cancel())
+                    })
                 } else {
-                    return Alert(title: Text("Do you want to duplicate this VM and all its data?"), primaryButton: .default(Text("Yes")) {
+                    return Alert(title: Text("Do you want to duplicate this VM and all its data?"), primaryButton: .cancel(),  secondaryButton: .default(Text("Yes")) {
                         data.busyWorkAsync {
                             try await data.clone(vm: vm)
                         }
                         onConfirm()
-                    }, secondaryButton: .cancel())
+                    })
                 }
             case .confirmDeleteVM:
-                return Alert(title: Text("Do you want to delete this VM and all its data?"), primaryButton: .destructive(Text("Delete")) {
+                return Alert(title: Text("Do you want to delete this VM and all its data?"), primaryButton: .cancel(), secondaryButton: .destructive(Text("Delete")) {
                     data.busyWorkAsync {
                         try await data.delete(vm: vm)
                     }
                     onConfirm()
-                }, secondaryButton: .cancel())
+                })
             case .confirmDeleteShortcut:
-                return Alert(title: Text("Do you want to remove this shortcut? The data will not be deleted."), primaryButton: .destructive(Text("Remove")) {
+                return Alert(title: Text("Do you want to remove this shortcut? The data will not be deleted."), primaryButton: .cancel(), secondaryButton: .destructive(Text("Remove")) {
                     data.busyWorkAsync {
                         await data.listRemove(vm: vm)
                     }
                     onConfirm()
-                }, secondaryButton: .cancel())
+                })
             case .confirmStopVM:
-                return Alert(title: Text("Do you want to force stop this VM and lose all unsaved data?"), primaryButton: .destructive(Text("Stop")) {
+                return Alert(title: Text("Do you want to force stop this VM and lose all unsaved data?"), primaryButton: .cancel(), secondaryButton: .destructive(Text("Stop")) {
                     data.stop(vm: vm)
                     onConfirm()
-                }, secondaryButton: .cancel())
+                })
             case .confirmMoveVM:
-                return Alert(title: Text("Do you want to move this VM to another location? This will copy the data to the new location, delete the data from the original location, and then create a shortcut."), primaryButton: .destructive(Text("Confirm")) {
+                return Alert(title: Text("Do you want to move this VM to another location? This will copy the data to the new location, delete the data from the original location, and then create a shortcut."), primaryButton: .cancel(), secondaryButton: .destructive(Text("Confirm")) {
                     onConfirm()
-                }, secondaryButton: .cancel())
+                })
             }
         }
     }