Skip to content

Commit

Permalink
fix(effects): small UI errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoronex committed Feb 2, 2025
1 parent e829138 commit 8ba8479
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<MultiSelect
v-model="switchIds"
filter
:model-value="switchIds"
option-label="name"
option-value="id"
:options="store.lightsSwitches"
Expand Down
14 changes: 11 additions & 3 deletions src/stores/effects-controller.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,20 @@ export const useEffectsControllerStore = defineStore('effectsController', {
},
async turnOnLightsSwitch(id: number) {
await turnOnLightsSwitch({ path: { id } });
const index = this.lightsSwitches.findIndex((s) => s.id === id);
if (index >= 0) {
this.lightsSwitches[index].enabled = true;
}
},
async turnOnLightsSwitches(ids: number[]) {
await Promise.all(ids.map((id) => turnOnLightsSwitch({ path: { id } })));
},
async turnOffLightsSwitch(id: number) {
await turnOffLightsSwitch({ path: { id } });
const index = this.lightsSwitches.findIndex((s) => s.id === id);
if (index >= 0) {
this.lightsSwitches[index].enabled = false;
}
},
async turnOffLightsSwitches(ids: number[]) {
await Promise.all(ids.map((id) => turnOffLightsSwitch({ path: { id } })));
Expand Down Expand Up @@ -200,9 +208,9 @@ export const useEffectsControllerStore = defineStore('effectsController', {
this.buttonEffects = response.data;
}
this.buttonEffects.sort((a, b) => a.buttonId - b.buttonId);
for (let i = 1; i <= 64; i++) {
if (this.buttonEffects[i - 1]?.buttonId !== i) {
this.buttonEffects.splice(i, 0, this.createNullButtonEffect(i));
for (let i = 0; i < 64; i++) {
if (this.buttonEffects[i]?.buttonId !== i + 1) {
this.buttonEffects.splice(i, 0, this.createNullButtonEffect(i + 1));
}
}
},
Expand Down

0 comments on commit 8ba8479

Please sign in to comment.