implement fixes for review

This commit is contained in:
Kavin
2026-03-27 20:06:35 +05:30
parent 75201a8083
commit 1e9c5dff5d
10 changed files with 63 additions and 49 deletions

View File

@@ -3,12 +3,12 @@
<div class="flex min-w-[50vw] flex-col">
<div class="h-[70vh] overflow-y-scroll pr-4">
<span v-t="'actions.add_to_group'" class="mb-3 inline-block w-max text-2xl" />
<div v-for="(group, index) in channelGroups" :key="group.groupName" class="px-1">
<div v-for="group in channelGroups" :key="group.groupName" class="px-1">
<div class="flex items-center justify-between">
<span>{{ group.groupName }}</span>
<UiCheckbox
:model-value="group.channels.includes(channelId)"
@update:model-value="onCheckedChange(index, group)"
@update:model-value="onCheckedChange(group)"
/>
</div>
<hr class="h-1 w-full" />
@@ -56,9 +56,12 @@ onMounted(() => {
loadChannelGroups();
});
function onCheckedChange(index, group) {
function onCheckedChange(group) {
if (group.channels.includes(props.channelId)) {
group.channels.splice(index, 1);
const channelIndex = group.channels.indexOf(props.channelId);
if (channelIndex !== -1) {
group.channels.splice(channelIndex, 1);
}
} else {
group.channels.push(props.channelId);
}