feat: reject new chords that override another chord

This commit is contained in:
2023-12-16 15:24:51 +01:00
parent 766bc44a85
commit eb33b64100
3 changed files with 7 additions and 0 deletions

View File

@@ -108,6 +108,7 @@ const de = {
TITLE: "Akkorde",
HOLD_KEYS: "Akkord halten",
NEW_CHORD: "Neuer Akkord",
DUPLICATE: "Akkord existiert bereits",
search: {
PLACEHOLDER: "{0} Akkord{{|e}} durchsuchen",
},

View File

@@ -104,6 +104,7 @@ const en = {
TITLE: "Chords",
HOLD_KEYS: "Hold chord",
NEW_CHORD: "New chord",
DUPLICATE: "Chord already exists",
search: {
PLACEHOLDER: "Search {0} chord{{|s}}",
},

View File

@@ -55,6 +55,11 @@
}
function insertChord(actions: number[]) {
const id = JSON.stringify(actions)
if ($chords.some(it => JSON.stringify(it.actions) === id)) {
alert($LL.configure.chords.DUPLICATE())
return
}
changes.update(changes => {
changes.push({
type: ChangeType.Chord,