web: filter events by name (all events and profile events)

This commit is contained in:
Carl-Gerhard Lindesvärd
2023-12-13 11:08:10 +01:00
parent 13d7ad2a8c
commit 0a15a773e2
7 changed files with 93 additions and 45 deletions

View File

@@ -1,7 +1,5 @@
import { useMemo } from 'react';
import { DataTable } from '@/components/DataTable';
import { Pagination } from '@/components/Pagination';
import type { PaginationProps } from '@/components/Pagination';
import { Avatar, AvatarFallback } from '@/components/ui/avatar';
import { Table, TableBody, TableCell, TableRow } from '@/components/ui/table';
import { useOrganizationParams } from '@/hooks/useOrganizationParams';
@@ -17,10 +15,9 @@ const columnHelper =
interface EventsTableProps {
data: RouterOutputs['event']['list'];
pagination: PaginationProps;
}
export function EventsTable({ data, pagination }: EventsTableProps) {
export function EventsTable({ data }: EventsTableProps) {
const params = useOrganizationParams();
const columns = useMemo(() => {
return [
@@ -94,11 +91,5 @@ export function EventsTable({ data, pagination }: EventsTableProps) {
];
}, [params]);
return (
<>
<Pagination {...pagination} />
<DataTable data={data} columns={columns} />
<Pagination {...pagination} />
</>
);
return <DataTable data={data} columns={columns} />;
}

View File

@@ -5,7 +5,7 @@ import { Command, CommandGroup, CommandItem } from '@/components/ui/command';
import { Checkbox } from './checkbox';
import { Input } from './input';
type IValue = string | number | boolean | null;
type IValue = any;
type IItem = Record<'value' | 'label', IValue>;
interface ComboboxAdvancedProps {
@@ -60,7 +60,7 @@ export function ComboboxAdvanced({
);
};
const renderUnknownItem = (value: string | number | null | boolean) => {
const renderUnknownItem = (value: IValue) => {
const item = items.find((item) => item.value === value);
return item ? renderItem(item) : renderItem({ value, label: value });
};
@@ -92,7 +92,7 @@ export function ComboboxAdvanced({
</button>
<div className="relative mt-2">
{open && (
<div className="max-h-80 absolute w-full z-10 top-0 rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in">
<div className="max-h-80 min-w-[300px] absolute w-full z-10 top-0 rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in">
<CommandGroup className="max-h-80 overflow-auto">
<div className="p-1 mb-2">
<Input