Skip to content

Commit

Permalink
fix logic to show selected labels in compact mode
Browse files Browse the repository at this point in the history
  • Loading branch information
powerpaul17 committed Oct 11, 2024
1 parent 5999d0a commit 7905bd6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/components/TodoItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@
>
<LabelList
class="mr-1 last:mr-0"
:labels="labels.filter((l) => l.id === route.params.labelId)"
:labels="labels.filter((l) => labelIdsInQuery.includes(l.id))"
:compact="true"
/>

<LabelList
class="mr-1 last:mr-0"
:labels="labels.filter((l) => l.id !== route.params.labelId)"
:labels="labels.filter((l) => !labelIdsInQuery.includes(l.id))"
:compact="false"
/>
</div>
Expand Down Expand Up @@ -104,6 +105,16 @@
computed(() => todo.value.id)
);
const labelIdsInQuery = computed(() => {
const labelIdQueryParam = route.query.filter_label;
if (Array.isArray(labelIdQueryParam)) {
return labelIdQueryParam;
} else {
return [labelIdQueryParam];
}
});
function handleToggleOpenClicked(): void {
if (route.query.todoId === props.todo.id) {
emit('open');
Expand Down

0 comments on commit 7905bd6

Please sign in to comment.