Skip to content

Commit

Permalink
refactor: avoid macro modal duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
mishamyrt committed Apr 6, 2024
1 parent 7c9e7ae commit 2a7356e
Show file tree
Hide file tree
Showing 19 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ui/src/features/keys/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './macro'
export * from './record-keystroke'
export * from './restore-default'
export * from './select-action'
export * from './select-key'
export * from './select-macro'
7 changes: 7 additions & 0 deletions ui/src/features/keys/macro/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import EditMacroModal from './ui/EditMacroModal.svelte'
import SelectMacros from './ui/SelectMacros.svelte'

export {
EditMacroModal,
SelectMacros
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
}
$: macroSteps = $currentMacroStepsStore
$: dndZoneParams = {
items: macroSteps,
flipDurationMs,
dropTargetStyle: {
outline: 'none'
}
}
onMount(() => {
subscriptions = observeStepsOn(stepsContainer,
Expand All @@ -51,13 +58,7 @@
<div
class="steps"
bind:this={stepsContainer}
use:dndzone="{{
items: macroSteps,
flipDurationMs,
dropTargetStyle: {
outline: 'none'
}
}}"
use:dndzone="{dndZoneParams}"
on:consider="{handleDndConsider}"
on:finalize="{handleDndFinalize}"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import { MoreButton } from '$shared/ui'
import { macroCreated, macroEdited } from '../model'
import MacroModal from './MacroModal.svelte'
export let keyCode: string
Expand Down Expand Up @@ -61,7 +60,6 @@
</div>
</FormRow>
{/each}
<MacroModal />
</FormGroup>
<div class="add">
<Stack direction="horizontal" align="start" justify="space-between">
Expand Down
5 changes: 0 additions & 5 deletions ui/src/features/keys/select-macro/index.ts

This file was deleted.

2 changes: 2 additions & 0 deletions ui/src/pages/keys/KeysPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { selectedKeyStore } from '$entities/keys'
import { DeviceSupports } from '$features/device'
import { EditMacroModal } from '$features/keys'
import { KeySettings, KeysNotSupported } from '$widgets'
$: selectedKey = $selectedKeyStore
Expand All @@ -28,4 +29,5 @@
<KeysNotSupported slot="not-supported" />
</DeviceSupports>
</Stack>
<EditMacroModal />
</div>
5 changes: 2 additions & 3 deletions ui/src/widgets/ui/KeySettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import { actionChanged, keyMapStore } from '$entities/keys'
import { getShortName } from '$entities/keys/lib'
import type { KeyAction } from '$entities/keys/model/types'
import { CustomActionToggle, KeyActionSelect, KeystrokeInput } from '$features/keys'
import KeyMacros from '$features/keys/select-macro/ui/KeyMacros.svelte'
import { CustomActionToggle, KeyActionSelect, KeystrokeInput, SelectMacros } from '$features/keys'
export let keyCode: string
export let secondary: boolean = false
Expand Down Expand Up @@ -56,5 +55,5 @@
{/if}
</FormGroup>
{#if selectedType === 'macro'}
<KeyMacros {keyCode} />
<SelectMacros {keyCode} />
{/if}

0 comments on commit 2a7356e

Please sign in to comment.