Skip to content

Commit

Permalink
fix/Auditlogs-Filters-now-can-be-press-on-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
BadriVishalPadhy committed Nov 3, 2024
1 parent 56274c0 commit 834a53f
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions apps/dashboard/app/(app)/audit/[bucket]/filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,41 +72,35 @@ export const Filter: React.FC<Props> = ({ options, title, param }) => {
const isSelected = selected.includes(option.value);

return (
<div
onMouseDownCapture={() => {

const next = isSelected
? selected.filter((v) => v !== option.value)
: Array.from(new Set([...selected, option.value]));
setSelected(next);
}}
>
<CommandItem
/**
* We're simulating next/link behavior here and prefetching the page when they hover over an item
*/
onMouseEnter={() => {
const copySelected = new Set(selected);
if (isSelected) {
copySelected.delete(option.value);
} else {
copySelected.add(option.value);
}
// params.prefetch(param, Array.from(copySelected).join(","));
}}
key={option.value}
onSelect={() => {
const next = isSelected
? selected.filter((v) => v !== option.value)
: Array.from(new Set([...selected, option.value]));

setSelected(next);
// params.set(param, next);
}}
>
<div
className={cn(
"mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
isSelected
? "bg-primary text-primary-foreground"
: "opacity-50 [&_svg]:invisible",
)}
>
<div className={cn(
"mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
isSelected
? "bg-primary text-primary-foreground"
: "opacity-50 [&_svg]:invisible",
)}>
<Check className={cn("h-4 w-4")} />
</div>
<span className="truncate text-ellipsis">{option.label}</span>
</CommandItem>
</div>
);
})}
</CommandGroup>
Expand Down

0 comments on commit 834a53f

Please sign in to comment.