Skip to content

Commit 834a53f

Browse files
fix/Auditlogs-Filters-now-can-be-press-on-filter
1 parent 56274c0 commit 834a53f

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

apps/dashboard/app/(app)/audit/[bucket]/filter.tsx

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,41 +72,35 @@ export const Filter: React.FC<Props> = ({ options, title, param }) => {
7272
const isSelected = selected.includes(option.value);
7373

7474
return (
75+
<div
76+
onMouseDownCapture={() => {
77+
78+
const next = isSelected
79+
? selected.filter((v) => v !== option.value)
80+
: Array.from(new Set([...selected, option.value]));
81+
setSelected(next);
82+
}}
83+
>
7584
<CommandItem
76-
/**
77-
* We're simulating next/link behavior here and prefetching the page when they hover over an item
78-
*/
79-
onMouseEnter={() => {
80-
const copySelected = new Set(selected);
81-
if (isSelected) {
82-
copySelected.delete(option.value);
83-
} else {
84-
copySelected.add(option.value);
85-
}
86-
// params.prefetch(param, Array.from(copySelected).join(","));
87-
}}
8885
key={option.value}
8986
onSelect={() => {
9087
const next = isSelected
9188
? selected.filter((v) => v !== option.value)
9289
: Array.from(new Set([...selected, option.value]));
93-
9490
setSelected(next);
95-
// params.set(param, next);
9691
}}
9792
>
98-
<div
99-
className={cn(
100-
"mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
101-
isSelected
102-
? "bg-primary text-primary-foreground"
103-
: "opacity-50 [&_svg]:invisible",
104-
)}
105-
>
93+
<div className={cn(
94+
"mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
95+
isSelected
96+
? "bg-primary text-primary-foreground"
97+
: "opacity-50 [&_svg]:invisible",
98+
)}>
10699
<Check className={cn("h-4 w-4")} />
107100
</div>
108101
<span className="truncate text-ellipsis">{option.label}</span>
109102
</CommandItem>
103+
</div>
110104
);
111105
})}
112106
</CommandGroup>

0 commit comments

Comments
 (0)