Skip to content

Commit

Permalink
feat: fix error linter
Browse files Browse the repository at this point in the history
  • Loading branch information
vapersmile committed Sep 15, 2023
1 parent 2eaa326 commit 387bbcd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
1 change: 1 addition & 0 deletions packages/react-front-kit/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
extends: ['custom'],
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
root: true,
rules: {
Expand Down
45 changes: 23 additions & 22 deletions packages/react-front-kit/src/3-custom/Components/Table/Table.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use client';

import type { MRT_ColumnDef } from 'mantine-react-table';
import type { ReactNode } from 'react';

Expand Down Expand Up @@ -214,7 +213,7 @@ export function Table(): JSX.Element {
header: 'Date publication',
},
],
[]
[],
);
const table = useMantineReactTable({
columns,
Expand All @@ -232,9 +231,11 @@ export function Table(): JSX.Element {
enableRowSelection: true,

icons: {
IconArrowsSort: CaretUpDown,
// eslint-disable-next-line react/no-unstable-nested-components, react/no-multi-comp
IconFilter: () => <Funnel size={18} />,
// eslint-disable-next-line react/no-unstable-nested-components, react/no-multi-comp
IconFilterOff: () => <Funnel size={18} />,
IconArrowsSort: CaretUpDown,
IconSortAscending: CaretUp,
IconSortDescending: CaretDown,
},
Expand Down Expand Up @@ -288,37 +289,37 @@ export function Table(): JSX.Element {
>
{arbo}
</ActionIcon>,
'Déplacer dans l’arborescence'
'Déplacer dans l’arborescence',
)}
{tooltip(
<ActionIcon
onClick={() =>
sendCurrentElementValueWithAction(
cell.row.original,
'OPEN_ELEMENT'
'OPEN_ELEMENT',
)
}
radius={4}
type="button"
>
<Eye color="#5C5F66" size={16} />
</ActionIcon>,
'Ouvrir le document'
'Ouvrir le document',
)}
{tooltip(
<ActionIcon
onClick={() =>
sendCurrentElementValueWithAction(
cell.row.original,
'UPDATE_ELEMENT'
'UPDATE_ELEMENT',
)
}
radius={4}
type="button"
>
{edit}
</ActionIcon>,
'Modifier le document'
'Modifier le document',
)}
{tooltip(
<ActionIcon radius={4} type="button">
Expand Down Expand Up @@ -347,7 +348,7 @@ export function Table(): JSX.Element {
onClick={() =>
sendCurrentElementValueWithAction(
cell.row.original,
'DOWNLOAD'
'DOWNLOAD',
)
}
>
Expand All @@ -363,7 +364,7 @@ export function Table(): JSX.Element {
</Menu.Dropdown>
</Menu>
</ActionIcon>,
'Affiche les autres actions'
'Affiche les autres actions',
)}
</div>
),
Expand All @@ -387,7 +388,7 @@ export function Table(): JSX.Element {
onClick={() => {
sendSelectedElementsValueWithAction(
cell.table.getSelectedRowModel().rows.map((x) => x.original),
'ARBO_CHANGE_LOCATION'
'ARBO_CHANGE_LOCATION',
);
}}
style={{ display: 'block', margin: 'auto 0px auto' }}
Expand All @@ -399,7 +400,7 @@ export function Table(): JSX.Element {
leftIcon={<Trash size={12} />}
onClick={() => {
multiRemoveHandle(
cell.table.getSelectedRowModel().rows.map((x) => x.original)
cell.table.getSelectedRowModel().rows.map((x) => x.original),
);
}}
style={{ display: 'block', margin: 'auto 10px auto' }}
Expand Down Expand Up @@ -474,14 +475,14 @@ export function Table(): JSX.Element {
onClick={() =>
sendCurrentElementValueWithAction(
currentElement,
'ADD_TO_FAVORITES'
'ADD_TO_FAVORITES',
)
}
>
Ajouter aux favoris
</Button>
</div>
</>
</>,
);
open();
};
Expand Down Expand Up @@ -513,7 +514,7 @@ export function Table(): JSX.Element {
Partager
</Button>
</div>
</>
</>,
);
open();
};
Expand Down Expand Up @@ -550,7 +551,7 @@ export function Table(): JSX.Element {
Supprimer
</Button>
</div>
</>
</>,
);
open();
};
Expand Down Expand Up @@ -584,31 +585,31 @@ export function Table(): JSX.Element {
Supprimer
</Button>
</div>
</>
</>,
);
open();
};
const actionButtonOnMouseHandler = (
rowIndex: number,
enter: boolean
enter: boolean,
): void => {
const elementIndex = rowIndex;
const newDisplayActionsButtonArray = displayActionsButtons.map((_, index) =>
elementIndex === index ? enter : false
const newDisplayActionsButtonArray = displayActionsButtons.map(
(_, index) => (elementIndex === index ? enter : false),
);
setDisplayActionsButtons(newDisplayActionsButtonArray);
};
const sendCurrentElementValueWithAction = (
currentElement: IDocument,
action: string
action: string,
): void => {
// eslint-disable-next-line no-console
console.log(currentElement, action);
close();
};
const sendSelectedElementsValueWithAction = (
values: IDocument[],
action: string
action: string,
): void => {
// eslint-disable-next-line no-console
console.log(values, action);
Expand Down

0 comments on commit 387bbcd

Please sign in to comment.