From 683561dc06b779645c84bb538959a5ec7586bf91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Sat, 18 Nov 2023 11:21:50 +0100 Subject: [PATCH] feat: chord backup import --- src/lib/backup/backup.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/backup/backup.ts b/src/lib/backup/backup.ts index 1eb9a52a..7fe3996c 100644 --- a/src/lib/backup/backup.ts +++ b/src/lib/backup/backup.ts @@ -1,12 +1,12 @@ import type { CharaBackupFile, CharaChordFile, - CharaSettingsFile, - CharaLayoutFile, CharaFile, + CharaLayoutFile, + CharaSettingsFile, } from "$lib/share/chara-file.js" -import {changes, ChangeType, chords, layout, settings} from "$lib/undo-redo.js" import type {Change} from "$lib/undo-redo.js" +import {changes, ChangeType, chords, layout, settings} from "$lib/undo-redo.js" import {get} from "svelte/store" import {serialPort} from "../serial/connection" import {csvLayoutToJson, isCsvLayout} from "$lib/backup/compat/legacy-layout" @@ -109,7 +109,14 @@ export function restoreFromFile( export function getChangesFromChordFile(file: CharaChordFile) { const changes: Change[] = [] - // TODO... + for (const [input, output] of file.chords) { + changes.push({ + type: ChangeType.Chord, + actions: input, + phrase: output, + id: input, + }) + } return changes }