Skip to content

Commit

Permalink
Remove unused code and update device filters
Browse files Browse the repository at this point in the history
  • Loading branch information
iacopolea committed Feb 15, 2024
1 parent eeb8064 commit 2676376
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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 <Checkbox label="All" checked={isChecked} onChange={onChange} />;
};

export const columns: TableType.Column[] = [
{
Expand Down Expand Up @@ -49,6 +71,7 @@ export const columns: TableType.Column[] = [
{
dataIndex: "actions",
key: "actions",
title: "",
title: <SelectAllCheckbox />,
maxWidth: "50px",
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ const NewSelectionFilters = ({
<strong>Device</strong>
<Checkbox label="Android" value="Android" onChange={handleOsChange} />
<Checkbox label="iOS" value="iOS" onChange={handleOsChange} />
<Checkbox label="Windows" value="sticazz" disabled />
<Checkbox label="MacOS" value="sticazz" disabled />
</div>
<div className="aq-mb-3">
<strong>
Expand Down
3 changes: 3 additions & 0 deletions src/pages/campaigns/selection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const SelectionPage = () => {
<PageTitle size="regular">Tester selection panel</PageTitle>
<BSGrid className="aq-my-4">
<BSCol size="col-lg-3">
<Card className="aq-mb-3" title="Columns">
<ColumnsConfigurator id={id} />
</Card>
<Card className="aq-mb-3" title="Filters">
<NewSelectionFilters
mail={mail}
Expand Down
12 changes: 12 additions & 0 deletions src/pages/campaigns/selection/selectionSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ const selectionSlice = createSlice({
deselectDevice(state, action: PayloadAction<{ userId: string }>) {
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 = {};
},
Expand All @@ -85,6 +95,8 @@ export const {
checkUserDevice,
changeTablePage,
deselectDevice,
selectAll,
deselectAll,
clearSelectedDevice,
openConfirmModal,
closeConfirmModal,
Expand Down

0 comments on commit 2676376

Please sign in to comment.