From c56c5a636df696f3ebab24cd5afbf71c3790ceaa Mon Sep 17 00:00:00 2001 From: Carlos Valente <34649812+cpvalente@users.noreply.github.com> Date: Wed, 7 Dec 2022 09:58:11 +0100 Subject: [PATCH] v2: refactor (#264) * chore: upgrade dependencies * chore: remove unused * fix: issue with missing index data * fix: discrepancy on counting events * fix: swapped classes * fix: prevent attempting load in empty list * chore: cleanup completed * chore: remove unused * refactor: convert to typescript * refactor: migrate to new endpoints * refactor: convert to typescript * fix: prevent issue with undefined process * fix: small code smells * fix: issue with missing version variable on build * refactor: configure retries on data fetching * style: design review * fix: prevent cursor out of range * lint: react query linting * style: checkbox styles --- .github/workflows/ontime_cy.yml | 2 +- client/.eslintrc | 6 +- client/index.html | 2 +- client/package.json | 14 +- client/src/{App.jsx => App.tsx} | 3 +- client/src/{AppRouter.jsx => AppRouter.tsx} | 0 .../src/{appConstants.js => appConstants.ts} | 0 .../api/{apiConstants.js => apiConstants.ts} | 0 .../buttons/TooltipLoadingActionBtn.tsx | 33 -- .../errorBoundary/ErrorBoundary.jsx | 16 +- .../navigation-menu/NavigationMenu.tsx | 3 +- client/src/common/components/state/Empty.jsx | 19 - .../common/components/state/Empty.module.scss | 15 +- client/src/common/components/state/Empty.tsx | 17 + client/src/common/context/CollapseContext.jsx | 72 --- client/src/common/hooks-query/useAliases.ts | 8 +- client/src/common/hooks-query/useEvent.ts | 8 +- client/src/common/hooks-query/useInfo.ts | 8 +- .../src/common/hooks-query/useOscSettings.ts | 8 +- client/src/common/hooks-query/useRundown.ts | 8 +- client/src/common/hooks-query/useSettings.ts | 8 +- .../src/common/hooks-query/useUserFields.ts | 8 +- .../src/common/hooks-query/useViewSettings.ts | 8 +- client/src/common/hooks/useMutateEvents.js | 37 -- .../src/common/hooks/useRuntimeStylesheet.js | 4 +- client/src/common/hooks/useSocket.ts | 2 +- .../utils/__tests__/generate_id.test.js | 2 +- .../common/utils/{aliases.js => aliases.ts} | 2 +- client/src/common/utils/entryValidator.js | 13 - client/src/common/utils/entryValidator.ts | 0 client/src/common/utils/eventsManager.ts | 4 +- .../utils/{generate_id.js => generate_id.ts} | 1 + client/src/common/utils/{math.js => math.ts} | 2 +- ...{FeatureWrapper.jsx => FeatureWrapper.tsx} | 12 +- .../src/features/editors/Editor.module.scss | 21 +- ...EditorExport.jsx => EventEditorExport.tsx} | 1 - client/src/features/info/Info.module.scss | 4 +- .../info/{InfoExport.jsx => InfoExport.tsx} | 0 client/src/features/info/InfoLogger.tsx | 14 +- .../src/features/menu/RundownMenu.module.scss | 9 +- client/src/features/menu/RundownMenu.tsx | 10 +- client/src/features/rundown/Rundown.jsx | 16 +- .../src/features/rundown/Rundown.module.scss | 8 +- client/src/features/rundown/RundownEntry.tsx | 19 +- .../src/features/rundown/RundownWrapper.tsx | 11 +- client/src/features/rundown/_blockMixins.scss | 4 +- .../block-block/BlockBlock.module.scss | 3 +- .../event-block/EventBlock.module.scss | 28 +- .../rundown/event-block/EventBlock.tsx | 21 +- .../event-block/composite/BlockActionMenu.tsx | 3 +- .../quick-add-block/QuickAddBlock.module.scss | 14 +- .../rundown/quick-add-block/QuickAddBlock.tsx | 18 +- client/src/features/table/OntimeTable.jsx | 2 +- client/src/features/table/TableWrapper.jsx | 11 +- client/src/features/viewers/ViewWrapper.jsx | 5 +- .../features/viewers/countdown/Countdown.jsx | 4 +- client/src/{index.jsx => index.tsx} | 7 +- .../src/{ontimeConfig.js => ontimeConfig.ts} | 0 client/src/theme/_v2Styles.scss | 9 +- client/src/theme/ontimeButton.ts | 5 +- client/src/theme/ontimeCheckbox.ts | 2 +- client/yarn.lock | 447 ++++++++++++++++-- server/.gitignore | 1 + server/main.js | 12 +- server/package.json | 4 +- server/src/app.js | 3 +- .../src/classes/data-provider/DataProvider.js | 4 +- .../src/classes/event-loader/EventLoader.js | 18 +- server/src/classes/timer/EventTimer.js | 11 +- server/src/controllers/ontimeController.js | 2 +- server/src/modules/loadDb.js | 4 +- server/src/package.json | 4 +- server/src/services/rundownService.js | 16 +- server/src/utils/__tests__/url.test.js | 7 +- server/src/utils/time.js | 80 ++-- server/src/yarn.lock | 30 +- 76 files changed, 718 insertions(+), 519 deletions(-) rename client/src/{App.jsx => App.tsx} (94%) rename client/src/{AppRouter.jsx => AppRouter.tsx} (100%) rename client/src/{appConstants.js => appConstants.ts} (100%) rename client/src/common/api/{apiConstants.js => apiConstants.ts} (100%) delete mode 100644 client/src/common/components/buttons/TooltipLoadingActionBtn.tsx delete mode 100644 client/src/common/components/state/Empty.jsx create mode 100644 client/src/common/components/state/Empty.tsx delete mode 100644 client/src/common/context/CollapseContext.jsx delete mode 100644 client/src/common/hooks/useMutateEvents.js rename client/src/common/utils/{aliases.js => aliases.ts} (94%) delete mode 100644 client/src/common/utils/entryValidator.js create mode 100644 client/src/common/utils/entryValidator.ts rename client/src/common/utils/{generate_id.js => generate_id.ts} (99%) rename client/src/common/utils/{math.js => math.ts} (79%) rename client/src/features/{FeatureWrapper.jsx => FeatureWrapper.tsx} (58%) rename client/src/features/event-editor/{EventEditorExport.jsx => EventEditorExport.tsx} (97%) rename client/src/features/info/{InfoExport.jsx => InfoExport.tsx} (100%) rename client/src/{index.jsx => index.tsx} (60%) rename client/src/{ontimeConfig.js => ontimeConfig.ts} (100%) diff --git a/.github/workflows/ontime_cy.yml b/.github/workflows/ontime_cy.yml index 7952f0f35..627e4d693 100644 --- a/.github/workflows/ontime_cy.yml +++ b/.github/workflows/ontime_cy.yml @@ -43,7 +43,7 @@ jobs: # App - name: Electron - Install dependencies - run: yarn install && yarn setdb + run: yarn setup working-directory: ./server - name: Server - run tests diff --git a/client/.eslintrc b/client/.eslintrc index 27e0ad027..c1e08bcb1 100644 --- a/client/.eslintrc +++ b/client/.eslintrc @@ -12,12 +12,14 @@ "eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/recommended", - "eslint-config-prettier" + "eslint-config-prettier", + "plugin:@tanstack/eslint-plugin-query/recommended" ], "plugins": [ "react", "testing-library", - "simple-import-sort" + "simple-import-sort", + "@tanstack/query" ], "rules": { "no-useless-concat": "warn", diff --git a/client/index.html b/client/index.html index 4a2721dee..c6a234f36 100644 --- a/client/index.html +++ b/client/index.html @@ -32,6 +32,6 @@
- +