From 8f4fcb5632b9e1543e0236f82457f90e73f8acfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kurczewski?= Date: Tue, 8 Oct 2024 10:29:05 +0200 Subject: [PATCH] [CP-2995] Contacts list (#2079) Co-authored-by: Daniel Karski --- apps/mudita-center-e2e/wdio.conf.js | 346 ------------- apps/mudita-center/src/app.tsx | 1 + apps/mudita-center/src/wdyr.ts | 13 + .../components/core/text/text.component.tsx | 2 +- .../header/__snapshots__/header.test.tsx.snap | 1 + .../rest/header/header.component.tsx | 1 + .../__deprecated__/renderer/store/reducers.ts | 2 + .../contact-support-modal-error.component.tsx | 10 +- ...ontact-support-modal-success.component.tsx | 10 +- .../contact-edit/contact-edit.component.tsx | 36 +- .../api-device-initialization-modal-flow.tsx | 3 +- .../template-form/template-form.component.tsx | 5 +- .../entities-config.validator.test.ts | 14 + .../lib/entities/entities-config.validator.ts | 89 +++- .../lib/feature/data-provider-config.test.ts | 140 +++++- .../src/lib/feature/data-provider-config.ts | 78 ++- .../models/src/lib/feature/extra-config.ts | 35 ++ .../src/lib/feature/feature-config.test.ts | 29 +- .../models/src/lib/feature/feature-config.ts | 2 + libs/device/models/src/lib/feature/index.ts | 3 +- .../feature/src/lib/generic-toasts.tsx | 57 +++ .../feature/src/lib/generic-view.tsx | 16 +- .../src/lib/seed-data/contacts-seed-data.ts | 464 ++++++++++++++++++ .../feature/src/lib/setup-component.tsx | 317 ++++++++---- .../feature/src/lib/use-dev-console.ts | 15 + .../src/lib/use-dev-views/use-dev-views.tsx | 3 +- .../lib/use-dev-views/views/contacts-view.ts | 231 +-------- libs/generic-view/models/src/index.ts | 26 +- .../generic-view/models/src/lib/app-portal.ts | 20 + .../models/src/lib/button-primary.ts | 6 +- .../models/src/lib/button-text.ts | 8 +- .../models/src/lib/common-validators.ts | 63 ++- .../models/src/lib/conditional-renderer.ts | 19 + libs/generic-view/models/src/lib/device.ts | 29 +- .../models/src/lib/entities-loader.ts | 1 + .../models/src/lib/form-checkbox-input.ts | 2 + libs/generic-view/models/src/lib/form.ts | 2 + .../models/src/lib/format-message.ts | 27 + .../models/src/lib/modal-close-button.ts | 4 +- .../generic-view/models/src/lib/paragraphs.ts | 26 +- .../models/src/lib/selection-manager.ts | 18 + .../generic-view/models/src/lib/table-cell.ts | 2 +- libs/generic-view/models/src/lib/table.ts | 10 +- libs/generic-view/models/src/lib/toast.ts | 22 + libs/generic-view/store/src/index.ts | 8 + .../store/src/lib/action-names.ts | 8 +- .../lib/entities/create-entity-data.action.ts | 5 +- .../entities/delete-entities-data.action.ts | 39 +- .../lib/entities/get-entities-data.action.ts | 17 +- .../entities/helpers/compute-field.test.ts | 451 +++++++++++++++++ .../src/lib/entities/helpers/compute-field.ts | 106 ++++ .../lib/entities/helpers/enhance-entity.ts | 22 + .../store/src/lib/entities/reducer.ts | 1 + .../lib/entities/update-entity-data.action.ts | 5 +- .../store/src/lib/selectors/component.ts | 5 + .../store/src/lib/selectors/entities.ts | 28 +- .../store/src/lib/selectors/index.ts | 1 + .../store/src/lib/selectors/view.ts | 10 + .../store/src/lib/toasts/actions.ts | 13 + .../store/src/lib/toasts/open-toast.action.ts | 21 + .../store/src/lib/toasts/reducer.ts | 30 ++ .../store/src/lib/use-form-field.ts | 55 +++ .../store/src/lib/use-form-register.ts | 43 ++ .../store/src/lib/views/actions.ts | 25 +- .../store/src/lib/views/reducer.ts | 51 +- libs/generic-view/theme/src/lib/font-size.ts | 1 + .../generic-view/theme/src/lib/line-height.ts | 1 + libs/generic-view/ui/src/index.ts | 5 +- .../lib/buttons/button-base/button-base.tsx | 8 +- .../button-base/use-button-action.test.ts | 77 ++- .../buttons/button-base/use-button-action.ts | 176 ++++--- .../ui/src/lib/buttons/button-primary.tsx | 22 +- .../ui/src/lib/buttons/button-secondary.tsx | 10 +- .../ui/src/lib/buttons/button-text.tsx | 40 +- .../ui/src/lib/data-rows/app-portal.tsx | 14 + .../ui/src/lib/data-rows/badge.tsx | 15 +- .../ui/src/lib/data-rows/data-rows.ts | 3 + .../ui/src/lib/data-rows/text-formatted.tsx | 2 +- .../ui/src/lib/entities/entities-loader.tsx | 49 +- .../generated/mc-import-contacts-button.ts | 12 +- .../ui/src/lib/icon/get-icon.helper.tsx | 2 + .../ui/src/lib/icon/svg/delete.svg | 5 + .../lib/interactive/conditional-renderer.tsx | 17 + .../ui/src/lib/interactive/form/form.tsx | 12 +- .../interactive/form/input/checkbox-input.tsx | 178 ++++++- .../ui/src/lib/interactive/format-message.tsx | 34 ++ .../ui/src/lib/interactive/interactive.ts | 9 + .../modal/helpers/modal-close-button.tsx | 4 +- .../modal/helpers/modal-title-icon.tsx | 13 +- .../ui/src/lib/interactive/modal/modal.tsx | 2 +- .../src/lib/interactive/modal/text-modal.tsx | 6 +- .../ui/src/lib/interactive/toast/toast.tsx | 123 +++++ .../interactive/tooltip/tooltip-helpers.tsx | 48 ++ .../src/lib/interactive/tooltip/tooltip.tsx | 192 +++++++- .../backup-restore/backup-restore-error.tsx | 5 +- .../backup-restore-password.tsx | 5 +- .../backup-restore/backup-restore-select.tsx | 7 +- .../backup-restore/backup-restore-success.tsx | 10 +- .../backup-restore/backup-restore.tsx | 8 +- .../lib/predefined/backup/backup-create.tsx | 8 +- .../lib/predefined/backup/backup-error.tsx | 5 +- .../lib/predefined/backup/backup-features.tsx | 8 +- .../lib/predefined/backup/backup-password.tsx | 7 +- .../lib/predefined/backup/backup-success.tsx | 7 +- .../components/cancel-confirm-modal.tsx | 7 +- .../data-migration/components/device-card.tsx | 2 +- .../data-migration/components/error-modal.tsx | 5 +- .../components/features-selector.tsx | 4 + .../components/progress-modal.tsx | 6 +- .../components/success-modal.tsx | 5 +- .../components/transfer-cancelled-modal.tsx | 5 +- .../data-migration/transfer-setup.tsx | 10 +- .../import-contacts/import-contacts-error.tsx | 5 +- .../import-contacts/import-contacts-list.tsx | 46 +- .../import-contacts-progress.tsx | 25 +- .../import-contacts-provider.tsx | 50 +- .../import-contacts-success.tsx | 5 +- .../import-contacts/import-contacts.tsx | 6 +- .../ui/src/lib/predefined/predefined.ts | 3 + .../recovery-mode/recovery-mode.tsx | 10 +- .../src/lib/predefined/selection-manager.tsx | 23 + .../ui/src/lib/shared/spinner-loader.tsx | 14 +- .../ui/src/lib/table/table-cell.tsx | 15 +- libs/generic-view/ui/src/lib/table/table.tsx | 51 +- libs/generic-view/ui/src/lib/texts/index.ts | 12 +- .../ui/src/lib/texts/paragraphs.tsx | 84 +++- libs/generic-view/utils/src/index.ts | 4 +- .../data-provider-filter.test.ts | 32 +- .../data-provider-filter.ts | 10 +- .../data-provider-sort.test.ts | 59 ++- .../data-provider-sort.ts | 18 +- .../src/lib/forms-provider/forms-provider.tsx | 80 +++ .../utils/src/lib/models/api-views.types.ts | 3 +- .../utils/src/lib/models/button.types.ts | 54 -- .../utils/src/lib/models/icons.types.ts | 1 + .../utils/src/lib/use-current-view-key.ts | 14 + .../mc-about/list-modal/list-modal.test.ts | 10 +- .../src/lib/mc-about/list-modal/list-modal.ts | 12 +- .../section-backup/section-backup.ts | 24 +- .../src/lib/mc-overview/summary/summary.ts | 10 +- .../ui/src/lib/components/article-content.tsx | 10 +- .../ui/src/lib/components/article-footer.tsx | 10 +- .../ui/src/lib/components/article-header.tsx | 10 +- .../ui/src/lib/components/help-footer.tsx | 10 +- package-lock.json | 25 +- package.json | 3 +- 146 files changed, 3740 insertions(+), 1354 deletions(-) delete mode 100644 apps/mudita-center-e2e/wdio.conf.js create mode 100644 apps/mudita-center/src/wdyr.ts create mode 100644 libs/device/models/src/lib/feature/extra-config.ts create mode 100644 libs/generic-view/feature/src/lib/generic-toasts.tsx create mode 100644 libs/generic-view/feature/src/lib/seed-data/contacts-seed-data.ts create mode 100644 libs/generic-view/models/src/lib/app-portal.ts create mode 100644 libs/generic-view/models/src/lib/conditional-renderer.ts create mode 100644 libs/generic-view/models/src/lib/format-message.ts create mode 100644 libs/generic-view/models/src/lib/selection-manager.ts create mode 100644 libs/generic-view/models/src/lib/toast.ts create mode 100644 libs/generic-view/store/src/lib/entities/helpers/compute-field.test.ts create mode 100644 libs/generic-view/store/src/lib/entities/helpers/compute-field.ts create mode 100644 libs/generic-view/store/src/lib/entities/helpers/enhance-entity.ts create mode 100644 libs/generic-view/store/src/lib/toasts/actions.ts create mode 100644 libs/generic-view/store/src/lib/toasts/open-toast.action.ts create mode 100644 libs/generic-view/store/src/lib/toasts/reducer.ts create mode 100644 libs/generic-view/store/src/lib/use-form-field.ts create mode 100644 libs/generic-view/store/src/lib/use-form-register.ts create mode 100644 libs/generic-view/ui/src/lib/data-rows/app-portal.tsx create mode 100644 libs/generic-view/ui/src/lib/icon/svg/delete.svg create mode 100644 libs/generic-view/ui/src/lib/interactive/conditional-renderer.tsx create mode 100644 libs/generic-view/ui/src/lib/interactive/format-message.tsx create mode 100644 libs/generic-view/ui/src/lib/interactive/toast/toast.tsx create mode 100644 libs/generic-view/ui/src/lib/interactive/tooltip/tooltip-helpers.tsx create mode 100644 libs/generic-view/ui/src/lib/predefined/selection-manager.tsx create mode 100644 libs/generic-view/utils/src/lib/forms-provider/forms-provider.tsx delete mode 100644 libs/generic-view/utils/src/lib/models/button.types.ts create mode 100644 libs/generic-view/utils/src/lib/use-current-view-key.ts diff --git a/apps/mudita-center-e2e/wdio.conf.js b/apps/mudita-center-e2e/wdio.conf.js deleted file mode 100644 index 6f1e461bb9..0000000000 --- a/apps/mudita-center-e2e/wdio.conf.js +++ /dev/null @@ -1,346 +0,0 @@ -"use strict"; -/** - * Copyright (c) Mudita sp. z o.o. All rights reserved. - * For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md - */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.config = void 0; -var dotenv = require("dotenv"); -var test_filenames_1 = require("./src/test-filenames"); -dotenv.config(); -exports.config = { - // - // ==================== - // Runner Configuration - // ==================== - // - // - // ===================== - // ts-node Configurations - // ===================== - // - // You can write tests using TypeScript to get autocompletion and type safety. - // You will need typescript and ts-node installed as devDependencies. - // WebdriverIO will automatically detect if these dependencies are installed - // and will compile your config and tests for you. - // If you need to configure how ts-node runs please use the - // environment variables for ts-node or use wdio config's autoCompileOpts section. - // - autoCompileOpts: { - autoCompile: true, - // see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options - // for all available options - tsNodeOpts: { - transpileOnly: true, - project: "tsconfig.json", - }, - }, - // - // ================== - // Specify Test Files - // ================== - // Define which test specs should run. The pattern is relative to the directory - // from which `wdio` was called. - // - // The specs are defined as an array of spec files (optionally using wildcards - // that will be expanded). The test for each spec file will be run in a separate - // worker process. In order to have a group of spec files run in the same worker - // process simply enclose them in an array within the specs array. - // - // If you are calling `wdio` from an NPM script (see https://docs.npmjs.com/cli/run-script), - // then the current working directory is where your `package.json` resides, so `wdio` - // will be called from there. - // - specs: [ - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.messagesInAppNavigationTest), - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.helpWindowCheckTest), - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.mcCheckForUpdatesTest), - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.homePageTestDeviceNotConnectedTest) - ], - suites: { - standalone: [ - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.helpWindowCheckTest), - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.mcCheckForUpdatesTest), - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.homePageTestDeviceNotConnectedTest) - ], - multidevicePureHarmony: [], - multideviceSingleHarmony: [], - multideviceSinglePure: [], - multideviceSingleKompakt: [], - multidevicePureKompakt: [], - multideviceHarmonyKompakt: [], - multideviceGeneral: [], - harmony: [], - pure: [ - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.messagesInAppNavigationTest), - ], - kompakt: [], - deviceUpdate: [], - cicd: [ - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.helpWindowCheckTest), - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.mcCheckForUpdatesTest), - (0, test_filenames_1.toRelativePath)(test_filenames_1.TestFilesPaths.homePageTestDeviceNotConnectedTest) - ], - }, - // Patterns to exclude. - exclude: [ - // 'path/to/excluded/files' - ], - filesToWatch: ["./src/specs/**/*.e2e.ts"], - // - // ============ - // Capabilities - // ============ - // Define your capabilities here. WebdriverIO can run multiple capabilities at the same - // time. Depending on the number of capabilities, WebdriverIO launches several test - // sessions. Within your capabilities you can overwrite the spec and exclude options in - // order to group specific specs to a specific capability. - // - // First, you can define how many instances should be started at the same time. Let's - // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have - // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec - // files and you set maxInstances to 10, all spec files will get tested at the same time - // and 30 processes will get spawned. The property handles how many capabilities - // from the same test should run tests. - // - maxInstances: 1, - // - // If you have trouble getting all important capabilities together, check out the - // Sauce Labs platform configurator - a great tool to configure your capabilities: - // https://saucelabs.com/platform/platform-configurator - // - capabilities: [ - { - // maxInstances can get overwritten per capability. So if you have an in-house Selenium - // grid with only 5 firefox instances available you can make sure that not more than - // 5 instances get started at a time. - // maxInstances: 5, - // - browserName: "chrome", - "goog:chromeOptions": { - binary: process.env.TEST_BINARY_PATH, - args: [], - }, - // If outputDir is provided WebdriverIO can capture driver session logs - // it is possible to configure which logTypes to include/exclude. - // excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs - // excludeDriverLogs: ['bugreport', 'server'], - }, - ], - // - // =================== - // Test Configurations - // =================== - // Define all options that are relevant for the WebdriverIO instance here - // - // Level of logging verbosity: trace | debug | info | warn | error | silent - logLevel: process.env.TEST_LOG_LEVEL || "info", - // - // Set specific log levels per logger - // loggers: - // - webdriver, webdriverio - // - @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service - // - @wdio/mocha-framework, @wdio/jasmine-framework - // - @wdio/local-runner - // - @wdio/sumologic-reporter - // - @wdio/cli, @wdio/config, @wdio/utils - // Level of logging verbosity: trace | debug | info | warn | error | silent - // logLevels: { - // webdriver: 'info', - // '@wdio/appium-service': 'info' - // }, - // - // If you only want to run your tests until a specific amount of tests have failed use - // bail (default is 0 - don't bail, run all tests). - bail: 0, - // - // Set a base URL in order to shorten url command calls. If your `url` parameter starts - // with `/`, the base url gets prepended, not including the path portion of your baseUrl. - // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url - // gets prepended directly. - baseUrl: "http://localhost", - // - // Default timeout for all waitFor* commands. - waitforTimeout: 6000, - // - // Default timeout in milliseconds for request - // if browser driver or grid doesn't send response - connectionRetryTimeout: 120000, - // - // Default request retries count - connectionRetryCount: 3, - // - // Test runner services - // Services take over a specific job you don't want to take care of. They enhance - // your test setup with almost no effort. Unlike plugins, they don't add new - // commands. Instead, they hook themselves up into the test process. - services: ["chromedriver"], - // Framework you want to run your specs with. - // The following are supported: Mocha, Jasmine, and Cucumber - // see also: https://webdriver.io/docs/frameworks - // - // Make sure you have the wdio adapter package for the specific framework installed - // before running any tests. - framework: "mocha", - // - // The number of times to retry the entire specfile when it fails as a whole - // specFileRetries: 1, - // - // Delay in seconds between the spec file retry attempts - // specFileRetriesDelay: 0, - // - // Whether or not retried specfiles should be retried immediately or deferred to the end of the queue - // specFileRetriesDeferred: false, - // - // Test reporter for stdout. - // The only one supported by default is 'dot' - // see also: https://webdriver.io/docs/dot-reporter - reporters: [ - "spec", - [ - "json", - { - outputDir: "./results", - }, - ], - ], - // - // Options to be passed to Mocha. - // See the full list at http://mochajs.org/ - mochaOpts: { - ui: "bdd", - timeout: 60000000, - }, - // - // ===== - // Hooks - // ===== - // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance - // it and to build services around it. You can either apply a single function or an array of - // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got - // resolved to continue. - /** - * Gets executed once before all workers get launched. - * @param {Object} config wdio configuration object - * @param {Array.} capabilities list of capabilities details - */ - // onPrepare: async function (_config, _capabilities) {}, - /** - * Gets executed before a worker process is spawned and can be used to initialise specific service - * for that worker as well as modify runtime environments in an async fashion. - * @param {String} cid capability id (e.g 0-0) - * @param {[type]} caps object containing capabilities for session that will be spawn in the worker - * @param {[type]} specs specs to be run in the worker process - * @param {[type]} args object that will be merged with the main configuration once worker is initialised - * @param {[type]} execArgv list of string arguments passed to the worker process - */ - // onWorkerStart: function (cid, caps, specs, args, execArgv) {}, - /** - * Gets executed just before initialising the webdriver session and test framework. It allows you - * to manipulate configurations depending on the capability or spec. - * @param {Object} config wdio configuration object - * @param {Array.} capabilities list of capabilities details - * @param {Array.} specs List of spec file paths that are to be run - * @param {String} cid worker id (e.g. 0-0) - */ - // beforeSession: async function (_config, _capabilities, specs, _cid) {}, - /** - * Gets executed before test execution begins. At this point you can access to all global - * variables like `browser`. It is the perfect place to define custom commands. - * @param {Array.} capabilities list of capabilities details - * @param {Array.} specs List of spec file paths that are to be run - * @param {Object} browser instance of created browser/device session - */ - // before: function (capabilities, specs) { - // }, - /** - * Runs before a WebdriverIO command gets executed. - * @param {String} commandName hook command name - * @param {Array} args arguments that command would receive - */ - // beforeCommand: function (commandName, args) { - // }, - /** - * Hook that gets executed before the suite starts - * @param {Object} suite suite details - */ - // beforeSuite: function (suite) { - // }, - /** - * Function to be executed before a test (in Mocha/Jasmine) starts. - */ - // beforeTest: function (test, context) { - // }, - /** - * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling - * beforeEach in Mocha) - */ - // beforeHook: function (test, context) { - // }, - /** - * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling - * afterEach in Mocha) - */ - // afterHook: function (test, context, { error, result, duration, passed, retries }) { - // }, - /** - * Function to be executed after a test (in Mocha/Jasmine only) - * @param {Object} test test object - * @param {Object} context scope object the test was executed with - * @param {Error} result.error error object in case the test fails, otherwise `undefined` - * @param {Any} result.result return object of test function - * @param {Number} result.duration duration of test - * @param {Boolean} result.passed true if test has passed, otherwise false - * @param {Object} result.retries informations to spec related retries, e.g. `{ attempts: 0, limit: 0 }` - */ - // afterTest: function(test, context, { error, result, duration, passed, retries }) { - // }, - /** - * Hook that gets executed after the suite has ended - * @param {Object} suite suite details - */ - // afterSuite: function (suite) { - // }, - /** - * Runs after a WebdriverIO command gets executed - * @param {String} commandName hook command name - * @param {Array} args arguments that command would receive - * @param {Number} result 0 - command success, 1 - command error - * @param {Object} error error object if any - */ - // afterCommand: function (commandName, args, result, error) { - // }, - /** - * Gets executed after all tests are done. You still have access to all global variables from - * the test. - * @param {Number} result 0 - test pass, 1 - test fail - * @param {Array.} capabilities list of capabilities details - * @param {Array.} specs List of spec file paths that ran - */ - // after: function (result, capabilities, specs) { - // }, - /** - * Gets executed right after terminating the webdriver session. - * @param {Object} config wdio configuration object - * @param {Array.} capabilities list of capabilities details - * @param {Array.} specs List of spec file paths that ran - */ - // afterSession: async function (_config, _capabilities, _specs) {}, - /** - * Gets executed after all workers got shut down and the process is about to exit. An error - * thrown in the onComplete hook will result in the test run failing. - * @param {Object} exitCode 0 - success, 1 - fail - * @param {Object} config wdio configuration object - * @param {Array.} capabilities list of capabilities details - * @param {} results object containing test results - */ - // onComplete: function(exitCode, config, capabilities, results) { - // }, - /** - * Gets executed when a refresh happens. - * @param {String} oldSessionId session ID of the old session - * @param {String} newSessionId session ID of the new session - */ - //onReload: function(oldSessionId, newSessionId) { - //} -}; diff --git a/apps/mudita-center/src/app.tsx b/apps/mudita-center/src/app.tsx index e3c5a2b39f..cab83f0456 100644 --- a/apps/mudita-center/src/app.tsx +++ b/apps/mudita-center/src/app.tsx @@ -3,6 +3,7 @@ * For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md */ +import "./wdyr" import "reflect-metadata" import translationConfig from "App/translations.config.json" import App from "App/app.component" diff --git a/apps/mudita-center/src/wdyr.ts b/apps/mudita-center/src/wdyr.ts new file mode 100644 index 0000000000..bcd74bcdf4 --- /dev/null +++ b/apps/mudita-center/src/wdyr.ts @@ -0,0 +1,13 @@ +/** + * Copyright (c) Mudita sp. z o.o. All rights reserved. + * For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md + */ + +import React from "react" + +if (process.env.NODE_ENV === "development") { + const whyDidYouRender = require("@welldone-software/why-did-you-render") + whyDidYouRender(React, { + trackAllPureComponents: false, + }) +} diff --git a/libs/core/__deprecated__/renderer/components/core/text/text.component.tsx b/libs/core/__deprecated__/renderer/components/core/text/text.component.tsx index 942a55012f..b72c909919 100644 --- a/libs/core/__deprecated__/renderer/components/core/text/text.component.tsx +++ b/libs/core/__deprecated__/renderer/components/core/text/text.component.tsx @@ -121,6 +121,7 @@ export interface TextProps { readonly onClick?: () => void readonly testId?: string readonly textRef?: React.Ref + readonly id?: string } export enum TextDisplayStyle { @@ -185,7 +186,6 @@ const Text: FunctionComponent = ({ {message && typeof message !== "string" && ( )} - {!message && children} ) diff --git a/libs/core/__deprecated__/renderer/components/rest/header/__snapshots__/header.test.tsx.snap b/libs/core/__deprecated__/renderer/components/rest/header/__snapshots__/header.test.tsx.snap index 31e38428d9..cf836f30fe 100644 --- a/libs/core/__deprecated__/renderer/components/rest/header/__snapshots__/header.test.tsx.snap +++ b/libs/core/__deprecated__/renderer/components/rest/header/__snapshots__/header.test.tsx.snap @@ -43,6 +43,7 @@ exports[`matches snapshot without tabs 1`] = ` class="c1 c2" color="primary" data-testid="location" + id="app-header" > [value] module.overview diff --git a/libs/core/__deprecated__/renderer/components/rest/header/header.component.tsx b/libs/core/__deprecated__/renderer/components/rest/header/header.component.tsx index 3d319f3adf..b765349bc1 100644 --- a/libs/core/__deprecated__/renderer/components/rest/header/header.component.tsx +++ b/libs/core/__deprecated__/renderer/components/rest/header/header.component.tsx @@ -122,6 +122,7 @@ const Header: FunctionComponent = ({ ) : ( = ({ diff --git a/libs/core/contact-support/components/contact-support-modal-success.component.tsx b/libs/core/contact-support/components/contact-support-modal-success.component.tsx index 911630a3e1..674407149d 100644 --- a/libs/core/contact-support/components/contact-support-modal-success.component.tsx +++ b/libs/core/contact-support/components/contact-support-modal-success.component.tsx @@ -38,10 +38,12 @@ export const ContactSupportModalSuccess: FunctionComponent = ({ data-testid={ContactSupportModalTestIds.CloseButton} config={{ text: intl.formatMessage(messages.closeButtonLabel), - action: { - type: "custom", - callback: closeContactSupportFlow, - }, + actions: [ + { + type: "custom", + callback: closeContactSupportFlow, + }, + ], }} /> diff --git a/libs/core/contacts/components/contact-edit/contact-edit.component.tsx b/libs/core/contacts/components/contact-edit/contact-edit.component.tsx index 29976af023..c0a2710d3b 100644 --- a/libs/core/contacts/components/contact-edit/contact-edit.component.tsx +++ b/libs/core/contacts/components/contact-edit/contact-edit.component.tsx @@ -211,7 +211,10 @@ const ContactEdit: FunctionComponent = ({ = ({ = ({ @@ -260,7 +266,10 @@ const ContactEdit: FunctionComponent = ({ = ({ = ({