Allow for desecting communications

This commit is contained in:
Eli Ribble 2026-03-22 18:25:02 +00:00
parent a4a8bcdaa9
commit 11f56bfd1c
No known key found for this signature in database
2 changed files with 10 additions and 1 deletions

View file

@ -151,6 +151,7 @@ interface Props {
selectedId?: string | null;
}
interface Emits {
(e: "deselect", id: string): void;
(e: "select", id: string): void;
}
@ -160,7 +161,11 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits<Emits>();
const handleClick = (id: string) => {
emit("select", id);
if (props.selectedId == null) {
emit("select", id);
} else {
emit("deselect", id);
}
};
const searchFilter = ref("");
const typeFilter = ref("all");

View file

@ -15,6 +15,7 @@
<template #left>
<CommunicationColumnList
:all="communication.all"
@deselect="handleDeselect"
:loading="loading"
:selected-id="selectedId"
@select="handleSelect"
@ -105,6 +106,9 @@ const selectedCommunication = computed<Communication | null>(() => {
const result = communication.all.find((c) => c.id == selectedId.value);
return result;
});
const handleDeselect = (id: string) => {
selectedId.value = null;
};
const handleSelect = (id: string) => {
selectedId.value = id;
};