blob: cdce7b936f95f075658e70b0af0d78a94f63d430 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import Link from 'next/link';
import { DataGrid } from '@/components/common/DataGrid';
import { useLoginQuery, useNavigation, useUserTeamsQuery } from '@/components/hooks';
import { TeamsTable } from './TeamsTable';
export function TeamsDataTable() {
const { user } = useLoginQuery();
const query = useUserTeamsQuery(user.id);
const { pathname } = useNavigation();
const isSettings = pathname.includes('/settings');
const renderLink = (row: any) => {
return (
<Link key={row.id} href={`${isSettings ? '/settings' : ''}/teams/${row.id}`}>
{row.name}
</Link>
);
};
return (
<DataGrid query={query}>
{({ data }) => {
return <TeamsTable data={data} renderLink={renderLink} />;
}}
</DataGrid>
);
}
|