From 26763763df2bc69b398bd49aeca9a2f9724f7717 Mon Sep 17 00:00:00 2001 From: Iacopo Leardini Date: Thu, 15 Feb 2024 13:14:02 +0100 Subject: [PATCH] Remove unused code and update device filters --- .../{columns.ts => columns.tsx} | 27 +++++++++++++++++-- .../editPanel/newSelectionFilters/index.tsx | 2 -- src/pages/campaigns/selection/index.tsx | 3 +++ .../campaigns/selection/selectionSlice.ts | 12 +++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) rename src/pages/campaigns/selection/SelectionTable/{columns.ts => columns.tsx} (53%) diff --git a/src/pages/campaigns/selection/SelectionTable/columns.ts b/src/pages/campaigns/selection/SelectionTable/columns.tsx similarity index 53% rename from src/pages/campaigns/selection/SelectionTable/columns.ts rename to src/pages/campaigns/selection/SelectionTable/columns.tsx index 4ba47588..2cdc8deb 100644 --- a/src/pages/campaigns/selection/SelectionTable/columns.ts +++ b/src/pages/campaigns/selection/SelectionTable/columns.tsx @@ -1,4 +1,26 @@ -import { TableType } from "@appquality/appquality-design-system"; +import { Checkbox, TableType } from "@appquality/appquality-design-system"; +import { useState } from "react"; +import { useAppDispatch } from "src/store"; +import { + selectAll, + deselectAll, +} from "src/pages/campaigns/selection/selectionSlice"; + +const SelectAllCheckbox = () => { + const dispatch = useAppDispatch(); + const [isChecked, setIsChecked] = useState(false); + const onChange = () => { + if (isChecked) { + setIsChecked(false); + dispatch(deselectAll()); + } else { + setIsChecked(true); + dispatch(selectAll()); + } + }; + + return ; +}; export const columns: TableType.Column[] = [ { @@ -49,6 +71,7 @@ export const columns: TableType.Column[] = [ { dataIndex: "actions", key: "actions", - title: "", + title: , + maxWidth: "50px", }, ]; diff --git a/src/pages/campaigns/selection/editPanel/newSelectionFilters/index.tsx b/src/pages/campaigns/selection/editPanel/newSelectionFilters/index.tsx index 3e6508b5..e02aa53d 100644 --- a/src/pages/campaigns/selection/editPanel/newSelectionFilters/index.tsx +++ b/src/pages/campaigns/selection/editPanel/newSelectionFilters/index.tsx @@ -121,8 +121,6 @@ const NewSelectionFilters = ({ Device - -
diff --git a/src/pages/campaigns/selection/index.tsx b/src/pages/campaigns/selection/index.tsx index 3b6476a8..9cba9ad7 100644 --- a/src/pages/campaigns/selection/index.tsx +++ b/src/pages/campaigns/selection/index.tsx @@ -35,6 +35,9 @@ const SelectionPage = () => { Tester selection panel + + + ) { delete state.selectedDevices[action.payload.userId]; }, + selectAll(state) { + alert( + "seleziono il primo device di ciascun tryber in questa pagina (se la tabella è paginata)" + ); + }, + deselectAll(state) { + alert( + "rimuovo dalla selezione tutti i device di questa pagina (se la tabella è paginata)" + ); + }, clearSelectedDevice(state) { state.selectedDevices = {}; }, @@ -85,6 +95,8 @@ export const { checkUserDevice, changeTablePage, deselectDevice, + selectAll, + deselectAll, clearSelectedDevice, openConfirmModal, closeConfirmModal,