Skip to content

Commit 40ca4cb

Browse files
committed
Update ProjectsList.tsx
1 parent 9aa2ff1 commit 40ca4cb

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

src/components/Projects/ProjectsList.tsx

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AnalyticalTable, AnalyticalTableColumnDefinition, Link } from '@ui5/webcomponents-react';
1+
import { AnalyticalTable, Link } from '@ui5/webcomponents-react';
22

33
import { CopyButton } from '../Shared/CopyButton.tsx';
44
import useLuigiNavigate from '../Shared/useLuigiNavigate.tsx';
@@ -13,12 +13,26 @@ import { YamlViewButtonWithLoader } from '../Yaml/YamlViewButtonWithLoader.tsx';
1313
import { useMemo } from 'react';
1414
import { ProjectsListItemMenu } from './ProjectsListItemMenu.tsx';
1515

16+
type ProjectListRow = {
17+
projectName: string;
18+
nameSpace: string;
19+
};
20+
21+
type ProjectListCellInstance<T> = {
22+
cell: {
23+
value: string;
24+
row: {
25+
original: T;
26+
};
27+
};
28+
};
29+
1630
export default function ProjectsList() {
1731
const navigate = useLuigiNavigate();
1832
const { data, error } = useApiResource(ListProjectNames, {
1933
refreshInterval: 3000,
2034
});
21-
const stabilizedData = useMemo(
35+
const stabilizedData = useMemo<ProjectListRow[]>(
2236
() =>
2337
data?.map((projectName) => {
2438
return {
@@ -28,13 +42,12 @@ export default function ProjectsList() {
2842
}) ?? [],
2943
[data],
3044
);
31-
const stabilizedColumns: AnalyticalTableColumnDefinition[] = useMemo(
45+
const stabilizedColumns = useMemo(
3246
() => [
3347
{
3448
Header: t('ProjectsListView.title'),
3549
accessor: 'projectName',
36-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
37-
Cell: (instance: any) => (
50+
Cell: (instance: ProjectListCellInstance<ProjectListRow>) => (
3851
<Link
3952
design={'Emphasized'}
4053
style={{
@@ -55,16 +68,14 @@ export default function ProjectsList() {
5568
Header: 'Namespace',
5669
accessor: 'nameSpace',
5770
width: 340,
58-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
59-
Cell: (instance: any) => (
71+
Cell: (instance: ProjectListCellInstance<ProjectListRow>) => (
6072
<div
6173
style={{
6274
display: 'flex',
6375
justifyContent: 'start',
6476
gap: '0.5rem',
6577
alignItems: 'center',
6678
width: '100%',
67-
6879
cursor: 'pointer',
6980
}}
7081
>
@@ -77,9 +88,8 @@ export default function ProjectsList() {
7788
accessor: 'yaml',
7889
width: 75,
7990
disableFilters: true,
80-
hAlign: 'Center',
81-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
82-
Cell: (instance: any) => (
91+
hAlign: 'Center' as const,
92+
Cell: (instance: ProjectListCellInstance<ProjectListRow>) => (
8393
<div
8494
style={{
8595
width: '100%',
@@ -100,9 +110,8 @@ export default function ProjectsList() {
100110
accessor: 'options',
101111
width: 60,
102112
disableFilters: true,
103-
hAlign: 'Center',
104-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
105-
Cell: (instance: any) => (
113+
hAlign: 'Center' as const,
114+
Cell: (instance: ProjectListCellInstance<ProjectListRow>) => (
106115
<div
107116
style={{
108117
width: '100%',

0 commit comments

Comments
 (0)