Skip to content

Commit

Permalink
feat: add info for current and after next save action
Browse files Browse the repository at this point in the history
  • Loading branch information
Theaninova committed Dec 8, 2023
1 parent f9a63a8 commit fe850f4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/i18n/de/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const de = {
actionSearch: {
PLACEHOLDER: "Nach Aktionen suchen",
CURRENT_ACTION: "Aktuelle Aktion",
NEXT_ACTION: "Aktion nach dem nächsten Speichern",
DELETE: "Entfernen",
filter: {
ALL: "Alle",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const en = {
actionSearch: {
PLACEHOLDER: "Search for actions",
CURRENT_ACTION: "Current action",
NEXT_ACTION: "Action after next save",
DELETE: "Remove",
filter: {
ALL: "All",
Expand Down
7 changes: 7 additions & 0 deletions src/lib/components/layout/ActionSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import {action} from "$lib/title"
export let currentAction: number | undefined = undefined
export let nextAction: number | undefined = undefined
const index = new Index({tokenize: "full"})
for (const action of Object.values(KEYMAP_CODES)) {
Expand Down Expand Up @@ -121,6 +122,12 @@
<h3>{$LL.actionSearch.CURRENT_ACTION()}</h3>
<ActionListItem id={currentAction} />
</aside>
<aside>
{#if nextAction}
<h3>{$LL.actionSearch.NEXT_ACTION()}</h3>
<ActionListItem id={nextAction} />
{/if}
</aside>
{/if}
<ul bind:this={resultList}>
{#if exact !== undefined}
Expand Down
9 changes: 7 additions & 2 deletions src/lib/components/layout/GenericLayout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import KeyboardKey from "$lib/components/layout/KeyboardKey.svelte"
import {getContext} from "svelte"
import type {VisualLayoutConfig} from "./visual-layout.js"
import {changes, ChangeType} from "$lib/undo-redo"
import {changes, ChangeType, layout} from "$lib/undo-redo"
const {scale, margin, strokeWidth, fontSize, iconFontSize} =
getContext<VisualLayoutConfig>("visual-layout-config")
Expand Down Expand Up @@ -113,9 +113,14 @@
function edit(index: number) {
const keyInfo = layoutInfo.keys[index]
const clickedGroup = groupParent.children.item(index) as SVGGElement
const nextAction = get(layout)[get(activeLayer)][keyInfo.id]
const currentAction = get(deviceLayout)[get(activeLayer)][keyInfo.id]
const component = new ActionSelector({
target: document.body,
props: {currentAction: get(deviceLayout)[get(activeLayer)][keyInfo.id]},
props: {
currentAction,
nextAction: nextAction.isApplied ? undefined : nextAction.action,
},
})
const dialog = document.querySelector("dialog > div") as HTMLDivElement
const backdrop = document.querySelector("dialog") as HTMLDialogElement
Expand Down

0 comments on commit fe850f4

Please sign in to comment.