import { useState } from 'react'; import { api } from '@/trpc/client'; import { Pagination } from '../pagination'; import { Tooltiper } from '../ui/tooltip'; import { WidgetTable } from '../widget-table'; interface Props { projectId: string; } function getPath(path: string) { try { return new URL(path).pathname; } catch { return path; } } const OverviewTopBots = ({ projectId }: Props) => { const [cursor, setCursor] = useState(0); const res = api.event.bots.useQuery( { projectId, cursor }, { keepPreviousData: true, } ); const data = res.data?.data ?? []; const count = res.data?.count ?? 0; return ( <>
item.id} columns={[ { name: 'Path', render(item) { return ( {getPath(item.path)} ); }, }, { name: 'Date', render(item) { return (
{item.name}
{item.createdAt.toLocaleDateString()}
); }, }, ]} />
); }; export default OverviewTopBots;