diff --git a/cypress/.gitignore b/cypress/.gitignore new file mode 100644 index 000000000..827e55e43 --- /dev/null +++ b/cypress/.gitignore @@ -0,0 +1 @@ +fixtures/grafik.xlsx diff --git a/cypress/fixtures/grafik.xlsx b/cypress/fixtures/grafik.xlsx index 5c6c0aca2..e0174b37e 100644 Binary files a/cypress/fixtures/grafik.xlsx and b/cypress/fixtures/grafik.xlsx differ diff --git a/cypress/integration/e2e/table/range-selection-test.ts b/cypress/integration/e2e/table/range-selection-test.ts index c20a282df..9793d1062 100644 --- a/cypress/integration/e2e/table/range-selection-test.ts +++ b/cypress/integration/e2e/table/range-selection-test.ts @@ -147,6 +147,7 @@ const foundationTestCases: FoundationTestCase[] = [ }, ]; +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type function validateHorizontalShifts( workerType: WorkerType, workerIdx: number, @@ -164,6 +165,7 @@ function validateHorizontalShifts( } } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type function validateVerticalShifts( workerType: WorkerType, shiftIdx: number, @@ -181,6 +183,7 @@ function validateVerticalShifts( } } +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type function validateChange({ startShiftCell, endShiftCell, desiredShiftCode }: WorkerTestCase) { const { workerType: startWorkerType, diff --git a/cypress/integration/e2e/table/undo-redo.spec.ts b/cypress/integration/e2e/table/undo-redo.spec.ts index 32c940566..78653b956 100644 --- a/cypress/integration/e2e/table/undo-redo.spec.ts +++ b/cypress/integration/e2e/table/undo-redo.spec.ts @@ -34,7 +34,7 @@ const testCases: TestCase[] = [ }, ]; -function performShiftChanges(testCase) { +function performShiftChanges(testCase: TestCase): void { cy.changeWorkerShift({ ...testCase.testedShiftCell, newShiftCode: testCase.firstShift }); cy.changeWorkerShift({ ...testCase.testedShiftCell, newShiftCode: testCase.secondShift }); } diff --git a/cypress/integration/unit/logic/schedule-parser/children-info.parser.spec.ts b/cypress/integration/unit/logic/schedule-parser/children-info.parser.spec.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/package-lock.json b/package-lock.json index 43fb7ed7b..6a1a3431a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2258,6 +2258,11 @@ "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", "dev": true }, + "@types/lodash": { + "version": "4.14.167", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.167.tgz", + "integrity": "sha512-w7tQPjARrvdeBkX/Rwg95S592JwxqOjmms3zWQ0XZgSyxSLdzWaYH3vErBhdVS/lRBX7F8aBYcYJYTr5TMGOzw==" + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -4143,8 +4148,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.0.2.tgz", "integrity": "sha512-RwywHlpCRc3/Wh81MiCKun4ydaIFyW5Ea6JbL6sRCVx5q5irDw7pMXBUFYF/jArQ6YrG36q0kpovc9P/Kd3I4g==", - "dev": true, - "optional": true + "dev": true }, "boxen": { "version": "4.2.0", diff --git a/package.json b/package.json index 6948e5619..5521950eb 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", + "@types/lodash": "^4.14.167", "@types/pouchdb": "^6.4.0", "axios": "^0.20.0", "classnames": "^2.2.6", diff --git a/src/components/common-components/month-switch/use-actual-month.tsx b/src/components/common-components/month-switch/use-actual-month.tsx index 6ce761491..cc31a7dd0 100644 --- a/src/components/common-components/month-switch/use-actual-month.tsx +++ b/src/components/common-components/month-switch/use-actual-month.tsx @@ -5,18 +5,21 @@ import { useSelector } from "react-redux"; import { StringHelper } from "../../../helpers/string.helper"; import { ApplicationStateModel } from "../../../state/models/application-state.model"; import { TranslationHelper } from "../../../helpers/translations.helper"; +import { useEffect, useState } from "react"; export function useActualMonth(): string { /* eslint-disable @typescript-eslint/camelcase */ const { month_number, year } = useSelector( (state: ApplicationStateModel) => state.actualState.temporarySchedule.present.schedule_info ); - - let actualMonth = ""; - if (month_number && year) { - actualMonth = StringHelper.capitalize( - `${TranslationHelper.polishMonths[month_number]} ${year}` - ); - } + const [actualMonth, setActualMonth] = useState(""); + useEffect(() => { + if (month_number && year) { + const month = StringHelper.capitalize( + `${TranslationHelper.polishMonths[month_number]} ${year}` + ); + setActualMonth(month); + } + }, [month_number, year]); return actualMonth; } diff --git a/src/components/schedule-page/edit-page/edit-page-toolbar.component.tsx b/src/components/schedule-page/edit-page/edit-page-toolbar.component.tsx index 36fac67f7..211dd00a5 100644 --- a/src/components/schedule-page/edit-page/edit-page-toolbar.component.tsx +++ b/src/components/schedule-page/edit-page/edit-page-toolbar.component.tsx @@ -14,7 +14,7 @@ import UndoIcon from "@material-ui/icons/Undo"; import RedoIcon from "@material-ui/icons/Redo"; import { ScheduleLogicContext } from "../table/schedule/use-schedule-state"; import { UndoActionCreator } from "../../../state/reducers/undoable.action-creator"; -import { TEMPORARY_SCHEDULE_UNDOABLE_CONFIG } from "../../../state/reducers/month-state/schedule-data/temporary-schedule.reducer"; +import { TEMPORARY_SCHEDULE_UNDOABLE_CONFIG } from "../../../state/reducers/month-state/schedule-data/schedule.actions"; interface EditPageToolbarOptions { closeEdit: () => void; diff --git a/src/components/schedule-page/edit-page/schedule-edit.page.tsx b/src/components/schedule-page/edit-page/schedule-edit.page.tsx index f037d1b4f..866c8245e 100644 --- a/src/components/schedule-page/edit-page/schedule-edit.page.tsx +++ b/src/components/schedule-page/edit-page/schedule-edit.page.tsx @@ -8,7 +8,7 @@ import { ScheduleComponent } from "../table/schedule/schedule.component"; import { ScheduleLogicContext, useScheduleState } from "../table/schedule/use-schedule-state"; import { EditPageToolbar } from "./edit-page-toolbar.component"; import { UndoableHotkeys } from "../../common-components"; -import { TEMPORARY_SCHEDULE_UNDOABLE_CONFIG } from "../../../state/reducers/month-state/schedule-data/temporary-schedule.reducer"; +import { TEMPORARY_SCHEDULE_UNDOABLE_CONFIG } from "../../../state/reducers/month-state/schedule-data/schedule.actions"; interface ScheduleEditPageOptions { closeEdit: () => void; diff --git a/src/components/schedule-page/new-month-page.component.tsx b/src/components/schedule-page/new-month-page.component.tsx index b1bd07ede..97cb0496b 100644 --- a/src/components/schedule-page/new-month-page.component.tsx +++ b/src/components/schedule-page/new-month-page.component.tsx @@ -2,11 +2,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import React from "react"; +import { useDispatch } from "react-redux"; +import { ScheduleDataActionCreator } from "../../state/reducers/month-state/schedule-data/schedule-data.action-creator"; import { Button } from "../common-components"; import { useActualMonth } from "../common-components/month-switch/use-actual-month"; export function NewMonthPlanComponent(): JSX.Element { const actualMonth = useActualMonth(); + const dispatch = useDispatch(); return ( <>
@@ -16,7 +19,14 @@ export function NewMonthPlanComponent(): JSX.Element { />

Nie masz planu na ten miesiÄ…c

-