Skip to content

Commit

Permalink
Added confermation alert to the delete theme action.
Browse files Browse the repository at this point in the history
  • Loading branch information
austincondiff committed Oct 26, 2024
1 parent acc2d35 commit 7fccb9b
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ struct ThemeSettingsThemeRow: View {

@State private var isHovering = false

@State private var deleteConfirmationIsPresented = false

var body: some View {
HStack {
Image(systemName: "checkmark")
Expand Down Expand Up @@ -52,8 +54,8 @@ struct ThemeSettingsThemeRow: View {
}
.disabled(theme.isBundled)
Divider()
Button("Delete") {
themeModel.delete(theme)
Button("Delete...") {
deleteConfirmationIsPresented = true
}
.disabled(theme.isBundled)
} label: {
Expand All @@ -66,5 +68,18 @@ struct ThemeSettingsThemeRow: View {
.onHover { hovering in
isHovering = hovering
}
.alert(
Text("Are you sure you want to delete the theme “\(theme.displayName)”?"),
isPresented: $deleteConfirmationIsPresented
) {
Button("Delete Theme") {
themeModel.delete(theme)
}
Button("Cancel") {
deleteConfirmationIsPresented = false
}
} message: {
Text("This action cannot be undone.")
}
}
}

0 comments on commit 7fccb9b

Please sign in to comment.