From e4cc4e5ef7b87137e08bd7c9767f4cbfc5f67edb Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Thu, 2 Dec 2021 15:00:11 +0100 Subject: [PATCH] Fix unit formatting in number input --- .github/workflows/deploy.yaml | 12 ++++++------ .github/workflows/test-external-integrations.yaml | 4 ++-- package.json | 2 +- site/source/components/conversation/NumberInput.tsx | 8 +++++++- yarn.lock | 8 ++++---- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 252eb6bc7..c5b9feec1 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -206,15 +206,15 @@ jobs: path: | ~/.cache/Cypress node_modules - key: cypress-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + key: cypress-cache-${{ runner.os }}-${{ hashFiles('package-lock.json', 'package.json') }} - - run: node site/scripts/get-cypress-packages.js | xargs npm i + - run: node site/scripts/get-cypress-packages.js | xargs npm i --legacy-peer-deps - name: Test e2e mon-entreprise on preview (site=${{ matrix.site }}, browser=${{ matrix.browser}}, viewport=${{ matrix.viewport }}) uses: cypress-io/github-action@v2 with: install: false - working-directory: mon-entreprise + working-directory: site record: true tag: ${{ needs.deploy-context.outputs.env-name }}_deploy config: integrationFolder=cypress/integration/${{ matrix.integrationFolder }},baseUrl=${{ matrix.baseUrl }}${{ matrix.viewport == 'small' && ',viewportHeight=740,viewportWidth=360' || '' }} @@ -272,15 +272,15 @@ jobs: path: | ~/.cache/Cypress node_modules - key: cypress-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + key: cypress-cache-${{ runner.os }}-${{ hashFiles('package-lock.json', 'package.json') }} - - run: node site/scripts/get-cypress-packages.js | xargs npm i + - run: node site/scripts/get-cypress-packages.js | xargs npm i --legacy-peer-deps - name: Test e2e mon-entreprise on production (site=${{ matrix.site }}, browser=${{ matrix.browser}}, viewport=${{ matrix.viewport }}) uses: cypress-io/github-action@v2 with: install: false - working-directory: mon-entreprise + working-directory: site record: true tag: ${{ needs.deploy-context.outputs.env-name }}_deploy config: integrationFolder=cypress/integration/${{ matrix.integrationFolder }},baseUrl=${{ matrix.baseUrl }}${{ matrix.viewport == 'small' && ',viewportHeight=740,viewportWidth=360' || '' }} diff --git a/.github/workflows/test-external-integrations.yaml b/.github/workflows/test-external-integrations.yaml index 6345ac6ba..7605e23bc 100644 --- a/.github/workflows/test-external-integrations.yaml +++ b/.github/workflows/test-external-integrations.yaml @@ -19,9 +19,9 @@ jobs: path: | ~/.cache/Cypress node_modules - key: cypress-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }} + key: cypress-cache-${{ runner.os }}-${{ hashFiles('package-lock.json', 'package.json') }} - - run: node site/scripts/get-cypress-packages.js | xargs npm i + - run: node site/scripts/get-cypress-packages.js | xargs npm i --legacy-peer-deps - name: Test external integration uses: cypress-io/github-action@v2 diff --git a/package.json b/package.json index 1a577aa83..2824f2428 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "eslint-config-prettier": "^4.0.0", "eslint-plugin-mocha": "^8.0.0", "eslint-plugin-react": "^7.12.4", - "eslint-plugin-react-hooks": "^2.0.1", + "eslint-plugin-react-hooks": "^4.3.0", "express": "^4.16.3", "file-loader": "^1.1.11", "html-loader": "^0.5.5", diff --git a/site/source/components/conversation/NumberInput.tsx b/site/source/components/conversation/NumberInput.tsx index b15748dc4..83e709c9f 100644 --- a/site/source/components/conversation/NumberInput.tsx +++ b/site/source/components/conversation/NumberInput.tsx @@ -110,7 +110,13 @@ function getSerializedUnit( const formatUnit = getFormatUnit(unit) if (!formatUnit) { - return t(serializeUnit(unit)?.replace('/', 'par')) ?? '' + return ( + t( + serializeUnit(unit) + ?.replace(/\/([^\s])/, '/ $1') + .replace('/', 'par') + ) ?? '' + ) } return ( Intl.NumberFormat(locale, { diff --git a/yarn.lock b/yarn.lock index c3ff83317..ee3dd55df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6466,10 +6466,10 @@ eslint-plugin-mocha@^8.0.0: eslint-utils "^2.1.0" ramda "^0.27.1" -eslint-plugin-react-hooks@^2.0.1: - version "2.5.1" - resolved "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.5.1.tgz" - integrity sha512-Y2c4b55R+6ZzwtTppKwSmK/Kar8AdLiC2f9NADCuxbcTgPPg41Gyqa6b9GppgXSvCtkRw43ZE86CT5sejKC6/g== +eslint-plugin-react-hooks@^4.3.0: + version "4.3.0" + resolved "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.3.0.tgz" + integrity sha512-XslZy0LnMn+84NEG9jSGR6eGqaZB3133L8xewQo3fQagbQuGt7a63gf+P1NGKZavEYEC3UXaWEAA/AqDkuN6xA== eslint-plugin-react@^7.12.4: version "7.27.1"