mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +00:00
Add context menu with delete option to player controls editor buttons
Buttons in the section, mini player, and pill editors can now be removed via long-press/right-click context menu instead of only swipe-to-delete. This also gives macOS a delete affordance in the section editor, which previously had none.
This commit is contained in:
@@ -105,17 +105,31 @@ struct MiniPlayerEditorView: View {
|
||||
|
||||
@ViewBuilder
|
||||
private func buttonRow(for config: ControlButtonConfiguration) -> some View {
|
||||
if config.buttonType.hasSettings {
|
||||
NavigationLink {
|
||||
MiniPlayerButtonConfigurationView(
|
||||
buttonID: config.id,
|
||||
viewModel: viewModel
|
||||
)
|
||||
} label: {
|
||||
Group {
|
||||
if config.buttonType.hasSettings {
|
||||
NavigationLink {
|
||||
MiniPlayerButtonConfigurationView(
|
||||
buttonID: config.id,
|
||||
viewModel: viewModel
|
||||
)
|
||||
} label: {
|
||||
buttonRowContent(for: config)
|
||||
}
|
||||
} else {
|
||||
buttonRowContent(for: config)
|
||||
}
|
||||
} else {
|
||||
buttonRowContent(for: config)
|
||||
}
|
||||
.contextMenu {
|
||||
Button(role: .destructive) {
|
||||
if let index = viewModel.miniPlayerButtons.firstIndex(where: { $0.id == config.id }) {
|
||||
viewModel.removeMiniPlayerButton(at: index)
|
||||
}
|
||||
} label: {
|
||||
Label(
|
||||
String(localized: "settings.playerControls.delete"),
|
||||
systemImage: "trash"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user