Skip to content

Commit 2ae770f

Browse files
author
Leshe4ka
committed
eslint fix
1 parent e3c13ba commit 2ae770f

File tree

2 files changed

+35
-24
lines changed

2 files changed

+35
-24
lines changed

frontend/src/components/Connect/Details/Topics/Topics.tsx

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import React from 'react';
22
import useAppParams from 'lib/hooks/useAppParams';
3-
import {
4-
clusterTopicPath,
5-
RouterParamsClusterConnectConnector,
6-
} from 'lib/paths';
3+
import { RouterParamsClusterConnectConnector } from 'lib/paths';
74
import { useConnector } from 'lib/hooks/api/kafkaConnect';
85
import Table from 'components/common/NewTable';
96
import { ColumnDef } from '@tanstack/react-table';
10-
import { Link } from 'react-router-dom';
11-
import { TableKeyLink } from 'components/common/table/Table/TableKeyLink.styled';
7+
8+
import { TopicNameCell } from './cells/TopicNameCell';
9+
10+
const columns: ColumnDef<{ topicName: string }>[] = [
11+
{
12+
header: 'Topic',
13+
accessorKey: 'topicName',
14+
cell: TopicNameCell,
15+
},
16+
];
1217

1318
const Topics = () => {
1419
const routerProps = useAppParams<RouterParamsClusterConnectConnector>();
@@ -17,24 +22,6 @@ const Topics = () => {
1722

1823
const connector = { ...raw, topics: ['wikimedia.recentchange.connect'] };
1924

20-
const columns: ColumnDef<{ topicName: string }>[] = [
21-
{
22-
header: 'Topic',
23-
accessorKey: 'topicName',
24-
cell: ({ getValue }) => {
25-
const topicName = getValue<string>();
26-
27-
return (
28-
<TableKeyLink>
29-
<Link to={clusterTopicPath(routerProps.clusterName, topicName)}>
30-
{topicName}
31-
</Link>
32-
</TableKeyLink>
33-
);
34-
},
35-
},
36-
];
37-
3825
const tableData = (connector?.topics ?? []).map((topicName) => ({
3926
topicName,
4027
}));
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react';
2+
import useAppParams from 'lib/hooks/useAppParams';
3+
import {
4+
clusterTopicPath,
5+
RouterParamsClusterConnectConnector,
6+
} from 'lib/paths';
7+
import { CellContext } from '@tanstack/react-table';
8+
import { TableKeyLink } from 'components/common/table/Table/TableKeyLink.styled';
9+
import { Link } from 'react-router-dom';
10+
11+
type TopicNameCellProps = CellContext<{ topicName: string }, unknown>;
12+
13+
export const TopicNameCell = ({ getValue }: TopicNameCellProps) => {
14+
const routerProps = useAppParams<RouterParamsClusterConnectConnector>();
15+
const topicName = getValue<string>();
16+
17+
return (
18+
<TableKeyLink>
19+
<Link to={clusterTopicPath(routerProps.clusterName, topicName)}>
20+
{topicName}
21+
</Link>
22+
</TableKeyLink>
23+
);
24+
};

0 commit comments

Comments
 (0)