Skip to content

Commit

Permalink
perf: improve macro editor UX
Browse files Browse the repository at this point in the history
  • Loading branch information
DriftKingTW committed Feb 28, 2024
1 parent 935a689 commit a025389
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
15 changes: 10 additions & 5 deletions src/components/MacrosEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "vue3-json-viewer/dist/index.css";
import PlusIcon from "icons/Plus.vue";
import MenuRightIcon from "icons/MenuRight.vue";
import MenuLeftIcon from "icons/MenuLeft.vue";
import CloseIcon from "icons/Close.vue";
import DragHorizontalVariantIcon from "icons/DragHorizontalVariant.vue";
import { getSpecialKeyCode, checkSpecialKey } from "../utils/specialKeyHandler";
Expand Down Expand Up @@ -174,6 +175,10 @@ initializeLayout();
<plus-icon :size="18" class="self-center mr-2" />
{{ $t("addMacro") }}
</button>
<button class="btn btn-reset flex" @click="removeEmptyMacros">
<close-icon :size="18" class="self-center mr-2" />
{{ $t("removeEmptyMacro") }}
</button>
</div>

<div class="overflow-y-auto overflow-x-hidden" style="max-height: 30rem">
Expand Down Expand Up @@ -229,22 +234,22 @@ initializeLayout();
</select>
<input
type="text"
placeholder=""
placeholder="Macro Name"
class="col-span-7 w-full text-input"
v-model="macro.name"
@input="updateOuputData"
v-model.lazy="macro.name"
@change="updateOuputData"
/>
<input
v-if="macro.type === 1 || macro.type === 2"
type="text"
placeholder=""
placeholder="Type string here..."
class="col-span-12 w-full text-input"
v-model="macro.stringContent"
@input="updateOuputData"
/>
<div
v-else
class="col-span-12 w-full text-input outline-0 cursor-pointer"
class="col-span-12 w-full text-input outline-0 cursor-pointer h-9"
:class="activeMacroIndex === index ? 'macro-active' : ''"
@click="toggleActive(index)"
tabindex="0"
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
"buttonShow": "Show Tutorial"
},
"uploadKeyConfigToDevice": "Upload Configuration to Device",
"rotaryEncoderEditorTitle": "Rotary Encoder Editor"
"rotaryEncoderEditorTitle": "Rotary Encoder Editor",
"removeEmptyMacro": "Remove Empty"
}
3 changes: 2 additions & 1 deletion src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
"buttonShow": "使用教程"
},
"uploadKeyConfigToDevice": "上传设置文件到装置",
"rotaryEncoderEditorTitle": "旋钮编辑"
"rotaryEncoderEditorTitle": "旋钮编辑",
"removeEmptyMacro": "移除空巨集"
}
3 changes: 2 additions & 1 deletion src/locales/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
"buttonShow": "使用說明"
},
"uploadKeyConfigToDevice": "上傳設定檔到裝置",
"rotaryEncoderEditorTitle": "旋鈕編輯"
"rotaryEncoderEditorTitle": "旋鈕編輯",
"removeEmptyMacro": "刪除空巨集"
}

0 comments on commit a025389

Please sign in to comment.