mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-21 09:23:00 +00:00
fix: chord conflict shows "undefined"
This commit is contained in:
@@ -120,7 +120,7 @@ const de = {
|
|||||||
conflict: {
|
conflict: {
|
||||||
TITLE: "Akkordkonflikt",
|
TITLE: "Akkordkonflikt",
|
||||||
DESCRIPTION:
|
DESCRIPTION:
|
||||||
"Der Akkord {0} würde einen bereits existierenden Akkord überschreiben. Wirklich fortfahren?",
|
"Der Akkord würde einen bereits existierenden Akkord überschreiben. Wirklich fortfahren?",
|
||||||
CONFIRM: "Überschreiben",
|
CONFIRM: "Überschreiben",
|
||||||
ABORT: "Überspringen",
|
ABORT: "Überspringen",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ const en = {
|
|||||||
conflict: {
|
conflict: {
|
||||||
TITLE: "Chord conflict",
|
TITLE: "Chord conflict",
|
||||||
DESCRIPTION:
|
DESCRIPTION:
|
||||||
"Your chord {0} conflicts with an existing chord. Are you sure you want to overwrite this chord?",
|
"Your chord conflicts with an existing chord. Are you sure you want to overwrite this chord?",
|
||||||
CONFIRM: "Overwrite",
|
CONFIRM: "Overwrite",
|
||||||
ABORT: "Skip",
|
ABORT: "Skip",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
import Dialog from "$lib/dialogs/Dialog.svelte";
|
import Dialog from "$lib/dialogs/Dialog.svelte";
|
||||||
|
import ActionString from "$lib/components/ActionString.svelte";
|
||||||
|
|
||||||
export let title: string;
|
export let title: string;
|
||||||
export let message: string | undefined;
|
export let message: string | undefined;
|
||||||
export let abortTitle: string;
|
export let abortTitle: string;
|
||||||
export let confirmTitle: string;
|
export let confirmTitle: string;
|
||||||
|
|
||||||
|
export let actions: number[] = [];
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -15,6 +18,7 @@
|
|||||||
{#if message}
|
{#if message}
|
||||||
<p>{@html message}</p>
|
<p>{@html message}</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
<p><ActionString {actions} /></p>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button on:click={() => dispatch("abort")}>{abortTitle}</button>
|
<button on:click={() => dispatch("abort")}>{abortTitle}</button>
|
||||||
<button class="primary" on:click={() => dispatch("confirm")}
|
<button class="primary" on:click={() => dispatch("confirm")}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export async function askForConfirmation(
|
|||||||
message: string,
|
message: string,
|
||||||
confirmTitle: string,
|
confirmTitle: string,
|
||||||
abortTitle: string,
|
abortTitle: string,
|
||||||
|
actions: number[],
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
const dialog = new ConfirmDialog({
|
const dialog = new ConfirmDialog({
|
||||||
target: document.body,
|
target: document.body,
|
||||||
@@ -13,6 +14,7 @@ export async function askForConfirmation(
|
|||||||
message,
|
message,
|
||||||
confirmTitle,
|
confirmTitle,
|
||||||
abortTitle,
|
abortTitle,
|
||||||
|
actions,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
{#each paths as { href, title, icon }, i}
|
{#each paths as { href, title, icon }}
|
||||||
<a {href} class:active={$page.url.pathname.startsWith(href)}>
|
<a {href} class:active={$page.url.pathname.startsWith(href)}>
|
||||||
<span class="icon">{icon}</span>
|
<span class="icon">{icon}</span>
|
||||||
{title}
|
{title}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
syncStatus,
|
syncStatus,
|
||||||
} from "$lib/serial/connection";
|
} from "$lib/serial/connection";
|
||||||
import { askForConfirmation } from "$lib/dialogs/confirm-dialog";
|
import { askForConfirmation } from "$lib/dialogs/confirm-dialog";
|
||||||
import { KEYMAP_CODES } from "$lib/serial/keymap-codes";
|
|
||||||
|
|
||||||
function undo(event: MouseEvent) {
|
function undo(event: MouseEvent) {
|
||||||
if (event.shiftKey) {
|
if (event.shiftKey) {
|
||||||
@@ -56,13 +55,10 @@
|
|||||||
existingChord !== undefined &&
|
existingChord !== undefined &&
|
||||||
!(await askForConfirmation(
|
!(await askForConfirmation(
|
||||||
$LL.configure.chords.conflict.TITLE(),
|
$LL.configure.chords.conflict.TITLE(),
|
||||||
$LL.configure.chords.conflict.DESCRIPTION(
|
$LL.configure.chords.conflict.DESCRIPTION(),
|
||||||
actions
|
|
||||||
.map((it) => `<kbd>${KEYMAP_CODES.get(it)?.id}</kbd>`)
|
|
||||||
.join(" "),
|
|
||||||
),
|
|
||||||
$LL.configure.chords.conflict.CONFIRM(),
|
$LL.configure.chords.conflict.CONFIRM(),
|
||||||
$LL.configure.chords.conflict.ABORT(),
|
$LL.configure.chords.conflict.ABORT(),
|
||||||
|
actions.slice(0, actions.lastIndexOf(0)),
|
||||||
))
|
))
|
||||||
) {
|
) {
|
||||||
changes.update((changes) =>
|
changes.update((changes) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user