Commit 488ca82002
Unsigned
Layout: unified · split
Hutch/Views/Repositories/RepositorySettingsView.swift +21 −7
| @@ -10,6 +10,7 @@ struct RepositorySettingsView: View { | ||
| 10 | 10 | @Environment(\.dismiss) private var dismiss |
| 11 | 11 | @State private var viewModel: RepositorySettingsViewModel? |
| 12 | 12 | @State private var showDeleteConfirmation = false |
| 13 | @State private var showRenameConfirmation = false | |
| 13 | 14 | @State private var pendingACLDeletion: ACLEntry? |
| 14 | 15 | @State private var saveResultAlert: SaveResultAlert? |
| 15 | 16 | |
| @@ -54,6 +55,25 @@ struct RepositorySettingsView: View { | ||
| 54 | 55 | deleteSection(viewModel) |
| 55 | 56 | } |
| 56 | 57 | .srhtErrorBanner(error: $vm.error) |
| 58 | .alert( | |
| 59 | "Rename repository to \(viewModel.editedName.trimmingCharacters(in: .whitespacesAndNewlines))?", | |
| 60 | isPresented: $showRenameConfirmation | |
| 61 | ) { | |
| 62 | Button("Cancel", role: .cancel) { | |
| 63 | // Alert dismissal is implicit; no additional action required. | |
| 64 | } | |
| 65 | Button("Rename", role: .destructive) { | |
| 66 | Task { | |
| 67 | await viewModel.rename() | |
| 68 | if let newName = viewModel.updatedName { | |
| 69 | onRenamed(newName) | |
| 70 | dismiss() | |
| 71 | } | |
| 72 | } | |
| 73 | } | |
| 74 | } message: { | |
| 75 | Text("This will change the repository URL. Existing clones will be redirected but links may break.") | |
| 76 | } | |
| 57 | 77 | .alert( |
| 58 | 78 | "Permanently delete \(repository.owner.canonicalName)/\(repository.name)?", |
| 59 | 79 | isPresented: $showDeleteConfirmation |
| @@ -168,13 +188,7 @@ struct RepositorySettingsView: View { | ||
| 168 | 188 | .foregroundStyle(.secondary) |
| 169 | 189 | |
| 170 | 190 | Button { |
| 171 | Task { | |
| 172 | await viewModel.rename() | |
| 173 | if let newName = viewModel.updatedName { | |
| 174 | onRenamed(newName) | |
| 175 | dismiss() | |
| 176 | } | |
| 177 | } | |
| 191 | showRenameConfirmation = true | |
| 178 | 192 | } label: { |
| 179 | 193 | if viewModel.isRenaming { |
| 180 | 194 | ProgressView() |