From 40ce847033cb97ceb409607f27e193503d7949fa Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Mon, 30 Dec 2024 11:11:11 +0100 Subject: [PATCH 01/12] feat: enable playwright on the CI --- .github/workflows/playwright.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index f12a6a44b..e1634e395 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -4,7 +4,6 @@ on: branches: [main, master] jobs: playwright: - if: false timeout-minutes: 60 runs-on: ubuntu-latest steps: From b6f7b154b7735b37b616b04b2c250255314f869c Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Mon, 30 Dec 2024 11:13:55 +0100 Subject: [PATCH 02/12] fix: remove syntax error --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index e1634e395..432cca8d9 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -26,7 +26,7 @@ jobs: test-command: 'chmod 777 ./playwright/db/init.sh && ./playwright/db/init.sh && npx playwright test' - uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} - with: I + with: name: playwright-report path: playwright-report/ retention-days: 30 From 9ea9c1771b11f6afa97a36956140e5b72038722d Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Mon, 30 Dec 2024 11:51:19 +0100 Subject: [PATCH 03/12] feat: write first playwright test --- playwright/first.spec.ts | 6 ------ playwright/operations/families.spec.ts | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) delete mode 100644 playwright/first.spec.ts create mode 100644 playwright/operations/families.spec.ts diff --git a/playwright/first.spec.ts b/playwright/first.spec.ts deleted file mode 100644 index 94fff5580..000000000 --- a/playwright/first.spec.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Should display an error is the backend is not on', async ({ page }) => { - await page.goto('/'); - await expect(page.getByText('Metadata management application')).toBeVisible(); -}); diff --git a/playwright/operations/families.spec.ts b/playwright/operations/families.spec.ts new file mode 100644 index 000000000..bc892521b --- /dev/null +++ b/playwright/operations/families.spec.ts @@ -0,0 +1,23 @@ +import { test, expect } from '@playwright/test'; + +test('Should create a new family', async ({ page }) => { + await page.goto('/'); + await page.getByRole('link', { name: 'Operations' }).click(); + await page.getByRole('link', { name: 'Families' }).click(); + await page.getByRole('link', { name: 'New' }).click(); + await page.getByLabel('Intitulé*').click(); + await page.getByLabel('Intitulé*').fill('Familie 1'); + await page.getByLabel('Title*').click(); + await page.getByLabel('Title*').fill('Familie 2'); + await page.getByLabel('Thème').click(); + await page.getByLabel('Thème').fill('Theme 1'); + await page.getByLabel('Theme').click(); + await page.getByLabel('Theme').fill('Theme 2'); + await page.getByRole('button', { name: 'Save' }).click(); + await expect(page.locator('h2')).toContainText('Familie 1'); + await page.getByText('Display second language').click(); + await expect(page.locator('h2')).toContainText('" Familie 2 "'); + await page.getByRole('link', { name: 'Families' }).click(); + await expect(page.locator('#root-app')).toContainText('1 result'); + await expect(page.getByRole('link', { name: 'Familie 1' })).toBeVisible(); +}); From 68ec70435ca9cd95e8225a9ce9437a59aa611994 Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Mon, 30 Dec 2024 12:11:34 +0100 Subject: [PATCH 04/12] fix: add unit test and remove scss file --- .../back-to-top/{index.scss => index.css} | 14 ++--- src/packages/components/back-to-top/index.tsx | 2 +- .../{index.scss => index.css} | 0 .../components/check-second-lang/index.tsx | 2 +- .../home-container.spec.tsx | 57 +++++++++++++++++++ .../home-container.tsx | 2 +- .../visualization/{links.scss => links.css} | 0 .../modules-concepts/visualization/links.jsx | 2 +- src/packages/utils/hooks/classifications.ts | 4 +- 9 files changed, 71 insertions(+), 12 deletions(-) rename src/packages/components/back-to-top/{index.scss => index.css} (65%) rename src/packages/components/check-second-lang/{index.scss => index.css} (100%) create mode 100644 src/packages/modules-classifications/home-container.spec.tsx rename src/packages/modules-concepts/visualization/{links.scss => links.css} (100%) diff --git a/src/packages/components/back-to-top/index.scss b/src/packages/components/back-to-top/index.css similarity index 65% rename from src/packages/components/back-to-top/index.scss rename to src/packages/components/back-to-top/index.css index 9ec67d5bb..a92bcbdb4 100644 --- a/src/packages/components/back-to-top/index.scss +++ b/src/packages/components/back-to-top/index.css @@ -12,13 +12,13 @@ button.sticky-top { line-height: 18px; text-align: center; color: white; +} - &.block { - display: block !important; - } +button.sticky-top.block { + display: block !important; +} - span { - text-transform: uppercase; - font-weight: 700; - } +button.sticky-top span { + text-transform: uppercase; + font-weight: 700; } diff --git a/src/packages/components/back-to-top/index.tsx b/src/packages/components/back-to-top/index.tsx index e61c4e221..e9cb6bbc1 100644 --- a/src/packages/components/back-to-top/index.tsx +++ b/src/packages/components/back-to-top/index.tsx @@ -2,7 +2,7 @@ import { useCallback } from 'react'; import { createAllDictionary } from '@utils/dictionnary'; -import './index.scss'; +import './index.css'; const className = 'sticky-top'; diff --git a/src/packages/components/check-second-lang/index.scss b/src/packages/components/check-second-lang/index.css similarity index 100% rename from src/packages/components/check-second-lang/index.scss rename to src/packages/components/check-second-lang/index.css diff --git a/src/packages/components/check-second-lang/index.tsx b/src/packages/components/check-second-lang/index.tsx index d29dc40b2..b3458b46a 100644 --- a/src/packages/components/check-second-lang/index.tsx +++ b/src/packages/components/check-second-lang/index.tsx @@ -1,7 +1,7 @@ import { useSecondLang } from '@utils/hooks/second-lang'; import { createAllDictionary } from '../../utils/dictionnary'; -import './index.scss'; +import './index.css'; const { D } = createAllDictionary({ displayLg2: { diff --git a/src/packages/modules-classifications/home-container.spec.tsx b/src/packages/modules-classifications/home-container.spec.tsx new file mode 100644 index 000000000..0e236f113 --- /dev/null +++ b/src/packages/modules-classifications/home-container.spec.tsx @@ -0,0 +1,57 @@ +import { render, screen } from '@testing-library/react'; +import { Mock, vi } from 'vitest'; + +import { useClassifications } from '@utils/hooks/classifications'; + +import { PartialClassification } from '../model/Classification'; +import { Component } from './home-container'; + +vi.mock('@utils/hooks/classifications', () => ({ + useClassifications: vi.fn(), +})); + +vi.mock('@components/loading', () => ({ + Loading: () =>
Loading...
, +})); + +vi.mock('./home', () => ({ + default: ({ + classifications, + }: { + classifications: PartialClassification[]; + }) => ( +
+ {JSON.stringify(classifications)} +
+ ), +})); + +describe('Component', () => { + it('renders the Loading component when isLoading is true', () => { + (useClassifications as Mock).mockReturnValue({ + isLoading: true, + data: null, + }); + + render(); + + screen.getByTestId('loading'); + }); + + it('renders the ClassificationsHome component when isLoading is false', () => { + const mockClassifications = [ + { id: 1, name: 'Classification 1' }, + { id: 2, name: 'Classification 2' }, + ]; + + (useClassifications as Mock).mockReturnValue({ + isLoading: false, + data: mockClassifications, + }); + + render(); + + const home = screen.getByTestId('classifications-home'); + expect(home.innerText).toContain(JSON.stringify(mockClassifications)); + }); +}); diff --git a/src/packages/modules-classifications/home-container.tsx b/src/packages/modules-classifications/home-container.tsx index 55b9f6b78..014a956db 100644 --- a/src/packages/modules-classifications/home-container.tsx +++ b/src/packages/modules-classifications/home-container.tsx @@ -8,5 +8,5 @@ export const Component = () => { const { isLoading, data: classifications } = useClassifications(); if (isLoading) return ; - return ; + return ; }; diff --git a/src/packages/modules-concepts/visualization/links.scss b/src/packages/modules-concepts/visualization/links.css similarity index 100% rename from src/packages/modules-concepts/visualization/links.scss rename to src/packages/modules-concepts/visualization/links.css diff --git a/src/packages/modules-concepts/visualization/links.jsx b/src/packages/modules-concepts/visualization/links.jsx index bf828f55a..65aafa7bd 100644 --- a/src/packages/modules-concepts/visualization/links.jsx +++ b/src/packages/modules-concepts/visualization/links.jsx @@ -14,7 +14,7 @@ import { import { D1, D2 } from '../../deprecated-locales'; import { sortArray } from '../../utils/array-utils'; -import './links.scss'; +import './links.css'; const CloseMatchLinks = ({ links, Dictionnary }) => { return ( diff --git a/src/packages/utils/hooks/classifications.ts b/src/packages/utils/hooks/classifications.ts index c78f23f4f..f7a5ba77b 100644 --- a/src/packages/utils/hooks/classifications.ts +++ b/src/packages/utils/hooks/classifications.ts @@ -2,8 +2,10 @@ import { useQuery } from '@tanstack/react-query'; import { ClassificationsApi } from '@sdk/classification'; +import { PartialClassification } from '../../model/Classification'; + export const useClassifications = () => { - return useQuery({ + return useQuery({ queryKey: ['classifications'], queryFn: ClassificationsApi.getList, }); From e2532dbad579b74858e2bc3a93128446b7f15149 Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Tue, 31 Dec 2024 11:34:26 +0100 Subject: [PATCH 05/12] fix: migrate to typescript and CSS --- package-lock.json | 226 ++++++++++-------- package.json | 2 +- src/packages/model/concepts/concept.ts | 35 ++- .../collections/modal/index.css | 3 + .../collections/modal/index.jsx | 2 +- .../collections/modal/index.scss | 5 - ...{home-container.jsx => home-container.tsx} | 45 ++-- .../modules-concepts/visualization/home.jsx | 2 +- .../modules-concepts/visualization/links.jsx | 138 ----------- .../links/CloseMatchLinks.spec.tsx | 40 ++++ .../visualization/links/CloseMatchLinks.tsx | 23 ++ .../visualization/links/InternalLinks.tsx | 27 +++ .../visualization/links/LinkList.tsx | 71 ++++++ .../visualization/links/Links.tsx | 58 +++++ .../visualization/{ => links}/links.css | 0 .../visualization/loading.tsx | 12 +- .../sims-creation/document-form-panel.css | 3 + .../sims-creation/document-form-panel.scss | 5 - .../sims-creation/document-form-panel.tsx | 2 +- .../modules-operations/tree/index.jsx | 2 +- tsconfig.json | 1 + 21 files changed, 423 insertions(+), 279 deletions(-) create mode 100644 src/packages/modules-concepts/collections/modal/index.css delete mode 100644 src/packages/modules-concepts/collections/modal/index.scss rename src/packages/modules-concepts/visualization/{home-container.jsx => home-container.tsx} (64%) delete mode 100644 src/packages/modules-concepts/visualization/links.jsx create mode 100644 src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx create mode 100644 src/packages/modules-concepts/visualization/links/CloseMatchLinks.tsx create mode 100644 src/packages/modules-concepts/visualization/links/InternalLinks.tsx create mode 100644 src/packages/modules-concepts/visualization/links/LinkList.tsx create mode 100644 src/packages/modules-concepts/visualization/links/Links.tsx rename src/packages/modules-concepts/visualization/{ => links}/links.css (100%) create mode 100644 src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.css delete mode 100644 src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.scss diff --git a/package-lock.json b/package-lock.json index 428b2669b..e92433a7b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -66,7 +66,7 @@ "stylelint": "^16.11.0", "stylelint-config-standard": "^36.0.1", "typescript-eslint": "^8.13.0", - "vite": "^6.0.3", + "vite": "^6.0.6", "vite-envs": "^4.4.10", "vite-tsconfig-paths": "^5.1.4", "vitest": "^2.1.8" @@ -496,9 +496,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz", - "integrity": "sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz", + "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==", "cpu": [ "ppc64" ], @@ -513,9 +513,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.0.tgz", - "integrity": "sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz", + "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==", "cpu": [ "arm" ], @@ -530,9 +530,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz", - "integrity": "sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz", + "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==", "cpu": [ "arm64" ], @@ -547,9 +547,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.0.tgz", - "integrity": "sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz", + "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==", "cpu": [ "x64" ], @@ -564,9 +564,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz", - "integrity": "sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz", + "integrity": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==", "cpu": [ "arm64" ], @@ -581,9 +581,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz", - "integrity": "sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz", + "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==", "cpu": [ "x64" ], @@ -598,9 +598,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz", - "integrity": "sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz", + "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==", "cpu": [ "arm64" ], @@ -615,9 +615,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz", - "integrity": "sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz", + "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==", "cpu": [ "x64" ], @@ -632,9 +632,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz", - "integrity": "sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz", + "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==", "cpu": [ "arm" ], @@ -649,9 +649,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz", - "integrity": "sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz", + "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==", "cpu": [ "arm64" ], @@ -666,9 +666,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz", - "integrity": "sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz", + "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==", "cpu": [ "ia32" ], @@ -683,9 +683,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz", - "integrity": "sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz", + "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==", "cpu": [ "loong64" ], @@ -700,9 +700,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz", - "integrity": "sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz", + "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==", "cpu": [ "mips64el" ], @@ -717,9 +717,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz", - "integrity": "sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz", + "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==", "cpu": [ "ppc64" ], @@ -734,9 +734,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz", - "integrity": "sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz", + "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==", "cpu": [ "riscv64" ], @@ -751,9 +751,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz", - "integrity": "sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz", + "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==", "cpu": [ "s390x" ], @@ -768,9 +768,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz", - "integrity": "sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz", + "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==", "cpu": [ "x64" ], @@ -784,10 +784,27 @@ "node": ">=18" } }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz", + "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz", - "integrity": "sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz", + "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==", "cpu": [ "x64" ], @@ -802,9 +819,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz", - "integrity": "sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz", + "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==", "cpu": [ "arm64" ], @@ -819,9 +836,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz", - "integrity": "sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz", + "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==", "cpu": [ "x64" ], @@ -836,9 +853,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz", - "integrity": "sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz", + "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==", "cpu": [ "x64" ], @@ -853,9 +870,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz", - "integrity": "sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz", + "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==", "cpu": [ "arm64" ], @@ -870,9 +887,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz", - "integrity": "sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz", + "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==", "cpu": [ "ia32" ], @@ -887,9 +904,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz", - "integrity": "sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz", + "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==", "cpu": [ "x64" ], @@ -4007,9 +4024,9 @@ } }, "node_modules/esbuild": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz", - "integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz", + "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -4020,30 +4037,31 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.24.0", - "@esbuild/android-arm": "0.24.0", - "@esbuild/android-arm64": "0.24.0", - "@esbuild/android-x64": "0.24.0", - "@esbuild/darwin-arm64": "0.24.0", - "@esbuild/darwin-x64": "0.24.0", - "@esbuild/freebsd-arm64": "0.24.0", - "@esbuild/freebsd-x64": "0.24.0", - "@esbuild/linux-arm": "0.24.0", - "@esbuild/linux-arm64": "0.24.0", - "@esbuild/linux-ia32": "0.24.0", - "@esbuild/linux-loong64": "0.24.0", - "@esbuild/linux-mips64el": "0.24.0", - "@esbuild/linux-ppc64": "0.24.0", - "@esbuild/linux-riscv64": "0.24.0", - "@esbuild/linux-s390x": "0.24.0", - "@esbuild/linux-x64": "0.24.0", - "@esbuild/netbsd-x64": "0.24.0", - "@esbuild/openbsd-arm64": "0.24.0", - "@esbuild/openbsd-x64": "0.24.0", - "@esbuild/sunos-x64": "0.24.0", - "@esbuild/win32-arm64": "0.24.0", - "@esbuild/win32-ia32": "0.24.0", - "@esbuild/win32-x64": "0.24.0" + "@esbuild/aix-ppc64": "0.24.2", + "@esbuild/android-arm": "0.24.2", + "@esbuild/android-arm64": "0.24.2", + "@esbuild/android-x64": "0.24.2", + "@esbuild/darwin-arm64": "0.24.2", + "@esbuild/darwin-x64": "0.24.2", + "@esbuild/freebsd-arm64": "0.24.2", + "@esbuild/freebsd-x64": "0.24.2", + "@esbuild/linux-arm": "0.24.2", + "@esbuild/linux-arm64": "0.24.2", + "@esbuild/linux-ia32": "0.24.2", + "@esbuild/linux-loong64": "0.24.2", + "@esbuild/linux-mips64el": "0.24.2", + "@esbuild/linux-ppc64": "0.24.2", + "@esbuild/linux-riscv64": "0.24.2", + "@esbuild/linux-s390x": "0.24.2", + "@esbuild/linux-x64": "0.24.2", + "@esbuild/netbsd-arm64": "0.24.2", + "@esbuild/netbsd-x64": "0.24.2", + "@esbuild/openbsd-arm64": "0.24.2", + "@esbuild/openbsd-x64": "0.24.2", + "@esbuild/sunos-x64": "0.24.2", + "@esbuild/win32-arm64": "0.24.2", + "@esbuild/win32-ia32": "0.24.2", + "@esbuild/win32-x64": "0.24.2" } }, "node_modules/esbuild-plugin-react-virtualized": { @@ -9914,13 +9932,13 @@ } }, "node_modules/vite": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.3.tgz", - "integrity": "sha512-Cmuo5P0ENTN6HxLSo6IHsjCLn/81Vgrp81oaiFFMRa8gGDj5xEjIcEpf2ZymZtZR8oU0P2JX5WuUp/rlXcHkAw==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.6.tgz", + "integrity": "sha512-NSjmUuckPmDU18bHz7QZ+bTYhRR0iA72cs2QAxCqDpafJ0S6qetco0LB3WW2OxlMHS0JmAv+yZ/R3uPmMyGTjQ==", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.24.0", + "esbuild": "^0.24.2", "postcss": "^8.4.49", "rollup": "^4.23.0" }, diff --git a/package.json b/package.json index 275ea5dae..1591b84d5 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "stylelint": "^16.11.0", "stylelint-config-standard": "^36.0.1", "typescript-eslint": "^8.13.0", - "vite": "^6.0.3", + "vite": "^6.0.6", "vite-envs": "^4.4.10", "vite-tsconfig-paths": "^5.1.4", "vitest": "^2.1.8" diff --git a/src/packages/model/concepts/concept.ts b/src/packages/model/concepts/concept.ts index bf1e12aa3..e73076e18 100644 --- a/src/packages/model/concepts/concept.ts +++ b/src/packages/model/concepts/concept.ts @@ -1,11 +1,29 @@ +import { + BROADER, + IS_REPLACED_BY, + NARROWER, + REFERENCES, + RELATED, + SUCCEED, +} from '@sdk/constants'; + import { linkTypes } from '../../modules-concepts/utils/links'; export interface ConceptGeneral { + id: string; prefLabelLg1: string; prefLabelLg2: string; + altLabelLg1?: string[] | string; + altLabelLg2?: string[] | string; conceptVersion: string; creator: string; + contributor: string; disseminationStatus: string; + created: string; + modified: string; + isValidated: string; + valid: boolean; + additionalMaterial?: string; } export interface ConceptNotes { @@ -19,11 +37,26 @@ export interface ConceptNotes { editorialNoteLg2?: string; } -export type Concept = ConceptGeneral & ConceptNotes; +export interface Concept { + general: ConceptGeneral; + notes: ConceptNotes; + links: Link[]; +} + +export interface Links { + [NARROWER]: Link[]; + [BROADER]: Link[]; + [REFERENCES]: Link[]; + [SUCCEED]: Link[]; + [RELATED]: Link[]; + [IS_REPLACED_BY]: Link[]; + closeMatch: Link[]; +} export interface Link { id: string; typeOfLink: keyof typeof linkTypes; prefLabelLg1: string; prefLabelLg2: string; + urn: string; } diff --git a/src/packages/modules-concepts/collections/modal/index.css b/src/packages/modules-concepts/collections/modal/index.css new file mode 100644 index 000000000..e60c57143 --- /dev/null +++ b/src/packages/modules-concepts/collections/modal/index.css @@ -0,0 +1,3 @@ +.collections-modal legend { + padding-left: 1em; +} diff --git a/src/packages/modules-concepts/collections/modal/index.jsx b/src/packages/modules-concepts/collections/modal/index.jsx index 574af8bc4..3f3599a26 100644 --- a/src/packages/modules-concepts/collections/modal/index.jsx +++ b/src/packages/modules-concepts/collections/modal/index.jsx @@ -6,7 +6,7 @@ import { CloseIconButton } from '@components/buttons/buttons-with-icons'; import { Row } from '@components/layout'; import D from '../../../deprecated-locales/build-dictionary'; -import './index.scss'; +import './index.css'; export const CollectionExportModal = ({ close, ids, exportOdt, exportOds }) => { const [lang, setLang] = useState('lg1'); diff --git a/src/packages/modules-concepts/collections/modal/index.scss b/src/packages/modules-concepts/collections/modal/index.scss deleted file mode 100644 index 895117bcc..000000000 --- a/src/packages/modules-concepts/collections/modal/index.scss +++ /dev/null @@ -1,5 +0,0 @@ -.collections-modal { - legend { - padding-left: 1em; - } -} diff --git a/src/packages/modules-concepts/visualization/home-container.jsx b/src/packages/modules-concepts/visualization/home-container.tsx similarity index 64% rename from src/packages/modules-concepts/visualization/home-container.jsx rename to src/packages/modules-concepts/visualization/home-container.tsx index 0193b6a11..5dc6c4278 100644 --- a/src/packages/modules-concepts/visualization/home-container.jsx +++ b/src/packages/modules-concepts/visualization/home-container.tsx @@ -9,35 +9,41 @@ import { useSecondLang } from '@utils/hooks/second-lang'; import { useLocales } from '@utils/hooks/useLocales'; import { rmesHtmlToRawHtml } from '@utils/html-utils'; +import { + Concept, + ConceptGeneral, + ConceptNotes, +} from '../../model/concepts/concept'; import { usePermission } from '../../redux/hooks/usePermission'; import { emptyNotes } from '../utils/notes'; import ConceptVisualization from './home'; -import { LoadingProvider } from './loading'; +import { LoadingProvider, LoadingType } from './loading'; -const formatNotes = (notes) => { +const formatNotes = (notes: ConceptNotes) => { + const keys = Object.keys(notes) as unknown as (keyof ConceptNotes)[]; return { ...emptyNotes, - ...Object.keys(notes).reduce((formatted, noteName) => { - formatted[noteName] = rmesHtmlToRawHtml(notes[noteName]); + ...keys.reduce((formatted: ConceptNotes, noteName) => { + formatted[noteName] = rmesHtmlToRawHtml(notes[noteName]!); return formatted; - }, {}), + }, {} as ConceptNotes), }; }; export const Component = () => { - const { id } = useParams(); + const { id } = useParams<{ id: string }>(); const navigate = useNavigate(); const langs = useLocales(); const permission = usePermission(); const [secondLang] = useSecondLang(); - const [loading, setLoading] = useState('loading'); - const [concept, setConcept] = useState({}); - const [error, setError] = useState(); + const [loading, setLoading] = useState('loading'); + const [concept, setConcept] = useState(); + const [error, setError] = useState(); - const fetchConcept = (id) => { + const fetchConcept = (id: string) => { return ConceptsApi.getConceptGeneral(id) - .then((general) => { + .then((general: ConceptGeneral) => { const { conceptVersion } = general; return Promise.all([ ConceptsApi.getNoteVersionList(id, conceptVersion), @@ -50,20 +56,20 @@ export const Component = () => { }); }); }) - .finally(() => setLoading()); + .finally(() => setLoading(undefined)); }; useEffect(() => { - fetchConcept(id); + fetchConcept(id!); }, [id]); - const handleConceptValidation = useCallback((id) => { + const handleConceptValidation = useCallback((id: string) => { setLoading('validating'); ConceptsApi.putConceptValidList([id]) .then(() => fetchConcept(id)) - .catch((e) => setError(e)) + .catch((e: string) => setError(e)) .finally(() => { - setLoading(); + setLoading(undefined); }); }, []); @@ -71,16 +77,15 @@ export const Component = () => { setLoading('deleting'); ConceptsApi.deleteConcept(id) .then(() => navigate(`/concepts`)) - .catch((e) => setError(e)) - .finally(() => setLoading()); + .catch((e: string) => setError(e)) + .finally(() => setLoading(undefined)); }, [navigate, id]); if (loading) { return ; } - const { general, links } = concept; - let { notes } = concept; + const { general, links, notes } = concept!; return ( diff --git a/src/packages/modules-concepts/visualization/home.jsx b/src/packages/modules-concepts/visualization/home.jsx index 1ef52fec5..4167858c5 100644 --- a/src/packages/modules-concepts/visualization/home.jsx +++ b/src/packages/modules-concepts/visualization/home.jsx @@ -14,7 +14,7 @@ import { getModalMessage } from '../utils/build-validation-message'; import { buildNotes } from '../utils/notes'; import ConceptVisualizationControls from './controls'; import ConceptGeneral from './general'; -import ConceptLinks from './links'; +import ConceptLinks from './links/Links'; const ConceptVisualization = ({ id, diff --git a/src/packages/modules-concepts/visualization/links.jsx b/src/packages/modules-concepts/visualization/links.jsx deleted file mode 100644 index 65aafa7bd..000000000 --- a/src/packages/modules-concepts/visualization/links.jsx +++ /dev/null @@ -1,138 +0,0 @@ -import { Link } from 'react-router-dom'; - -import { Note } from '@components/note'; - -import { - BROADER, - CLOSE_MATCH, - IS_REPLACED_BY, - NARROWER, - REFERENCES, - RELATED, - SUCCEED, -} from '@sdk/constants'; - -import { D1, D2 } from '../../deprecated-locales'; -import { sortArray } from '../../utils/array-utils'; -import './links.css'; - -const CloseMatchLinks = ({ links, Dictionnary }) => { - return ( - links.length > 0 && ( -
  • - {Dictionnary.equivalentTitle} : - -
  • - ) - ); -}; - -const InternalLinks = ({ links, title, labelProperty }) => { - return ( - links.length > 0 && ( - <> -
    {title}
    - {sortArray(labelProperty)(links).map((link) => ( -
    - {link[labelProperty]} -
    - ))} - - ) - ); -}; - -const LinksList = ({ links, lang, alone, Dictionnary = D1 }) => { - const labelProperty = lang === 'lg1' ? 'prefLabelLg1' : 'prefLabelLg2'; - return ( - - - - - - - - - - } - title={Dictionnary.linksTitle} - lang={lang} - alone={alone} - /> - ); -}; - -function ConceptLinks({ secondLang, links }) { - const linksGroupByType = links.reduce( - (acc, link) => { - if (!Array.isArray(acc[link.typeOfLink])) { - return acc; - } - return { - ...acc, - [link.typeOfLink]: [...acc[[link.typeOfLink]], link], - }; - }, - { - [NARROWER]: [], - [BROADER]: [], - [REFERENCES]: [], - [SUCCEED]: [], - [RELATED]: [], - [CLOSE_MATCH]: [], - [IS_REPLACED_BY]: [], - }, - ); - const numberOfLinks = Object.values(linksGroupByType).flat().length; - if (numberOfLinks === 0) return null; - - return ( -
    - - {secondLang && ( - - )} -
    - ); -} - -export default ConceptLinks; diff --git a/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx b/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx new file mode 100644 index 000000000..cebf95fa3 --- /dev/null +++ b/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx @@ -0,0 +1,40 @@ +import { Link } from '@model/concepts/concept'; +import { render, screen } from '@testing-library/react'; +import { describe, it, expect } from 'vitest'; + +import { CloseMatchLinks } from './CloseMatchLinks'; + +const mockLinks = [ + { urn: 'http://example.com/link1' }, + { urn: 'http://example.com/link2' }, +] as Link[]; + +const mockDictionnary = { + equivalentTitle: 'Equivalent links', +}; + +describe('CloseMatchLinks', () => { + it.only('renders the equivalent links when links are provided', () => { + render(); + + screen.getByText(/Equivalent links/); + + const items = screen.queryAllByRole('listitem'); + screen.debug(); + expect(items).toHaveLength(mockLinks.length + 1); + + mockLinks.forEach((link) => { + const linkElement = screen.getByText(link.urn); + expect(linkElement.getAttribute('href')).toBe(link.urn); + expect(linkElement.getAttribute('target')).toBe('_blank'); + expect(linkElement.getAttribute('rel')).toBe('noopener noreferrer'); + }); + }); + + it('does not render anything when no links are provided', () => { + render(); + + const items = screen.queryAllByRole('listitem'); + expect(items).toHaveLength(0); + }); +}); diff --git a/src/packages/modules-concepts/visualization/links/CloseMatchLinks.tsx b/src/packages/modules-concepts/visualization/links/CloseMatchLinks.tsx new file mode 100644 index 000000000..cf4067ab3 --- /dev/null +++ b/src/packages/modules-concepts/visualization/links/CloseMatchLinks.tsx @@ -0,0 +1,23 @@ +import { Link as LinkType } from '../../../model/concepts/concept'; + +export const CloseMatchLinks = ({ + links, + Dictionnary, +}: Readonly<{ links: LinkType[]; Dictionnary: Record }>) => { + return ( + links.length > 0 && ( +
  • + {Dictionnary.equivalentTitle} : + +
  • + ) + ); +}; diff --git a/src/packages/modules-concepts/visualization/links/InternalLinks.tsx b/src/packages/modules-concepts/visualization/links/InternalLinks.tsx new file mode 100644 index 000000000..3004516c2 --- /dev/null +++ b/src/packages/modules-concepts/visualization/links/InternalLinks.tsx @@ -0,0 +1,27 @@ +import { Link as LinkType } from '@model/concepts/concept'; +import { Link } from 'react-router-dom'; + +import { sortArray } from '@utils/array-utils'; + +export const InternalLinks = ({ + links, + title, + labelProperty, +}: Readonly<{ + links: LinkType[]; + title: string; + labelProperty: string; +}>) => { + return ( + links.length > 0 && ( + <> +
    {title}
    + {sortArray(labelProperty)(links).map((link) => ( +
    + {link[labelProperty]} +
    + ))} + + ) + ); +}; diff --git a/src/packages/modules-concepts/visualization/links/LinkList.tsx b/src/packages/modules-concepts/visualization/links/LinkList.tsx new file mode 100644 index 000000000..c765eedca --- /dev/null +++ b/src/packages/modules-concepts/visualization/links/LinkList.tsx @@ -0,0 +1,71 @@ +import { Links } from '@model/concepts/concept'; + +import { Note } from '@components/note'; + +import { + BROADER, + IS_REPLACED_BY, + NARROWER, + REFERENCES, + RELATED, + SUCCEED, +} from '@sdk/constants'; + +import { D1 } from '../../../deprecated-locales'; +import { CloseMatchLinks } from './CloseMatchLinks'; +import { InternalLinks } from './InternalLinks'; + +export const LinksList = ({ + links, + lang, + alone, + Dictionnary = D1, +}: Readonly<{ + links: Links; + lang: 'lg1' | 'lg2'; + alone: boolean; + Dictionnary?: Record; +}>) => { + const labelProperty = lang === 'lg1' ? 'prefLabelLg1' : 'prefLabelLg2'; + return ( + + + + + + + + + + } + title={Dictionnary.linksTitle} + alone={alone} + /> + ); +}; diff --git a/src/packages/modules-concepts/visualization/links/Links.tsx b/src/packages/modules-concepts/visualization/links/Links.tsx new file mode 100644 index 000000000..a21d422e3 --- /dev/null +++ b/src/packages/modules-concepts/visualization/links/Links.tsx @@ -0,0 +1,58 @@ +import { + BROADER, + CLOSE_MATCH, + IS_REPLACED_BY, + NARROWER, + REFERENCES, + RELATED, + SUCCEED, +} from '@sdk/constants'; + +import { D2 } from '../../../deprecated-locales'; +import { Links, Link as LinkType } from '../../../model/concepts/concept'; +import { LinksList } from './LinkList'; +import './links.css'; + +const ConceptLinks = ({ + secondLang, + links, +}: Readonly<{ secondLang: boolean; links: LinkType[] }>) => { + const linksGroupByType: Links = links.reduce( + (acc, link) => { + if (!Array.isArray(acc[link.typeOfLink])) { + return acc; + } + return { + ...acc, + [link.typeOfLink]: [...acc[link.typeOfLink], link], + }; + }, + { + [NARROWER]: [], + [BROADER]: [], + [REFERENCES]: [], + [SUCCEED]: [], + [RELATED]: [], + [CLOSE_MATCH]: [], + [IS_REPLACED_BY]: [], + }, + ); + const numberOfLinks = Object.values(linksGroupByType).flat().length; + if (numberOfLinks === 0) return null; + + return ( +
    + + {secondLang && ( + + )} +
    + ); +}; + +export default ConceptLinks; diff --git a/src/packages/modules-concepts/visualization/links.css b/src/packages/modules-concepts/visualization/links/links.css similarity index 100% rename from src/packages/modules-concepts/visualization/links.css rename to src/packages/modules-concepts/visualization/links/links.css diff --git a/src/packages/modules-concepts/visualization/loading.tsx b/src/packages/modules-concepts/visualization/loading.tsx index d1b782646..89ea8a512 100644 --- a/src/packages/modules-concepts/visualization/loading.tsx +++ b/src/packages/modules-concepts/visualization/loading.tsx @@ -1,6 +1,16 @@ import { createContext, useContext } from 'react'; -const LoadingContext = createContext({ loading: '', setLoading: () => {} }); +export type LoadingType = + | '' + | 'loading' + | 'validating' + | 'deleting' + | undefined; + +const LoadingContext = createContext<{ + loading: LoadingType; + setLoading: (value: LoadingType) => void; +}>({ loading: '', setLoading: () => {} }); export const LoadingProvider = LoadingContext.Provider; export const useLoading = () => useContext(LoadingContext); diff --git a/src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.css b/src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.css new file mode 100644 index 000000000..8849c3ab0 --- /dev/null +++ b/src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.css @@ -0,0 +1,3 @@ +.documents-form-panel .container { + width: 100%; +} diff --git a/src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.scss b/src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.scss deleted file mode 100644 index d91436847..000000000 --- a/src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.scss +++ /dev/null @@ -1,5 +0,0 @@ -.documents-form-panel { - .container { - width: 100%; - } -} diff --git a/src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.tsx b/src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.tsx index 852e1572f..6d584e972 100644 --- a/src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.tsx +++ b/src/packages/modules-operations/msd/pages/sims-creation/document-form-panel.tsx @@ -7,7 +7,7 @@ import { useCodesList } from '@utils/hooks/codeslist'; import { Document } from '../../../../model/operations/document'; import OperationsDocumentationEdition from '../../../document/edition/edition'; -import './document-form-panel.scss'; +import './document-form-panel.css'; import { useDocumentsStoreContext } from './documents-store-context'; import { getDocumentsList } from './useDocumentsList'; diff --git a/src/packages/modules-operations/tree/index.jsx b/src/packages/modules-operations/tree/index.jsx index b510e522c..268b6fc7d 100644 --- a/src/packages/modules-operations/tree/index.jsx +++ b/src/packages/modules-operations/tree/index.jsx @@ -52,7 +52,7 @@ export const updateParent = ( export const updateTree = (treeData, leaf, familyIndex, seriesIndex) => { return treeData.map((data, i) => { if (i === familyIndex) { - if (!(seriesIndex >= 0)) { + if (seriesIndex < 0) { return leaf; } else { return { diff --git a/tsconfig.json b/tsconfig.json index 761810f78..91ba91e8b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,6 +18,7 @@ "types": ["vitest/globals", "vite/client"], "paths": { "@components/*": ["./src/packages/components/*"], + "@model/*": ["./src/packages/model/*"], "@sdk/*": ["./src/packages/sdk/*"], "@utils/*": ["./src/packages/utils/*"] } From 1d15c71fdf5065e905d7b907a754b848af01c432 Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Tue, 31 Dec 2024 11:38:19 +0100 Subject: [PATCH 06/12] fix: remove .only --- .../visualization/links/CloseMatchLinks.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx b/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx index cebf95fa3..4c07ad420 100644 --- a/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx +++ b/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx @@ -14,7 +14,7 @@ const mockDictionnary = { }; describe('CloseMatchLinks', () => { - it.only('renders the equivalent links when links are provided', () => { + it('renders the equivalent links when links are provided', () => { render(); screen.getByText(/Equivalent links/); From fdf0206a16f7dee56bcaae33e65738cff02d9c4e Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Wed, 1 Jan 2025 20:38:53 +0100 Subject: [PATCH 07/12] feat: add unit test --- src/packages/modules-concepts/home.spec.tsx | 47 +++++++++++++++++++ .../modules-concepts/{home.jsx => home.tsx} | 0 2 files changed, 47 insertions(+) create mode 100644 src/packages/modules-concepts/home.spec.tsx rename src/packages/modules-concepts/{home.jsx => home.tsx} (100%) diff --git a/src/packages/modules-concepts/home.spec.tsx b/src/packages/modules-concepts/home.spec.tsx new file mode 100644 index 000000000..04b7f77db --- /dev/null +++ b/src/packages/modules-concepts/home.spec.tsx @@ -0,0 +1,47 @@ +import { render, screen, waitFor } from '@testing-library/react'; +import { vi } from 'vitest'; + +import { ConceptsApi } from '../sdk'; +import { renderWithRouter } from '../tests-utils/render'; +import { Component } from './home'; + +vi.mock('../sdk', () => ({ + ConceptsApi: { + getConceptList: vi.fn(), + }, +})); + +vi.mock('./menu', () => ({ + Menu: () =>
    Mock Menu
    , +})); + +describe('Component (home.tsx)', () => { + beforeEach(() => { + vi.clearAllMocks(); + }); + + it('renders the loading state initially', () => { + ConceptsApi.getConceptList.mockReturnValue(new Promise(() => {})); + + render(); + + screen.getByText(/loading/i); + }); + + it('renders the list of concepts after data is loaded', async () => { + const mockConcepts = [ + { id: 1, label: 'Concept 1' }, + { id: 2, label: 'Concept 2' }, + ]; + ConceptsApi.getConceptList.mockResolvedValue(mockConcepts); + + renderWithRouter(); + + await waitFor(() => expect(screen.queryByText(/loading/i)).toBeNull()); + + screen.getByPlaceholderText(/label/i); + mockConcepts.forEach((concept) => { + screen.getByText(concept.label); + }); + }); +}); diff --git a/src/packages/modules-concepts/home.jsx b/src/packages/modules-concepts/home.tsx similarity index 100% rename from src/packages/modules-concepts/home.jsx rename to src/packages/modules-concepts/home.tsx From 326993aeae444c42bc5751b311d9d59b0c0eab92 Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Wed, 1 Jan 2025 20:41:59 +0100 Subject: [PATCH 08/12] feat: migrate scss --- src/packages/components/buttons/button.css | 16 ++++++++++++++++ src/packages/components/buttons/button.scss | 15 --------------- src/packages/components/buttons/button.tsx | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 src/packages/components/buttons/button.css delete mode 100644 src/packages/components/buttons/button.scss diff --git a/src/packages/components/buttons/button.css b/src/packages/components/buttons/button.css new file mode 100644 index 000000000..35fdf23c2 --- /dev/null +++ b/src/packages/components/buttons/button.css @@ -0,0 +1,16 @@ +.bauhaus-btn { + background-color: var(--color-3); + color: white; + width: 100%; + margin-bottom: 0.5em; +} + +.bauhaus-btn:hover:not([disabled]), +.bauhaus-btn:focus { + background-color: var(--color-2); + color: white; +} + +.bauhaus-btn:hover { + color: white; +} diff --git a/src/packages/components/buttons/button.scss b/src/packages/components/buttons/button.scss deleted file mode 100644 index 71edc502b..000000000 --- a/src/packages/components/buttons/button.scss +++ /dev/null @@ -1,15 +0,0 @@ -.bauhaus-btn { - background-color: var(--color-3); - color: white; - width: 100%; - margin-bottom: 0.5em; - - &:hover:not([disabled]), - &:focus { - background-color: var(--color-2); - color: white; - } - &:hover { - color: white; - } -} diff --git a/src/packages/components/buttons/button.tsx b/src/packages/components/buttons/button.tsx index db0aaa011..b084ccba0 100644 --- a/src/packages/components/buttons/button.tsx +++ b/src/packages/components/buttons/button.tsx @@ -1,7 +1,7 @@ import { ComponentProps, PropsWithChildren, ReactNode } from 'react'; import { Link } from '../link'; -import './button.scss'; +import './button.css'; const DEFAULT_CLASSES: string[] = []; From 12bc611fd8e9e13c3d82ddfaf27d04da69709cdd Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Wed, 1 Jan 2025 20:43:42 +0100 Subject: [PATCH 09/12] fix: solve stylelint issue --- src/packages/components/buttons/button.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/packages/components/buttons/button.css b/src/packages/components/buttons/button.css index 35fdf23c2..b40f54bca 100644 --- a/src/packages/components/buttons/button.css +++ b/src/packages/components/buttons/button.css @@ -5,12 +5,12 @@ margin-bottom: 0.5em; } -.bauhaus-btn:hover:not([disabled]), -.bauhaus-btn:focus { - background-color: var(--color-2); +.bauhaus-btn:hover { color: white; } -.bauhaus-btn:hover { +.bauhaus-btn:focus, +.bauhaus-btn:hover:not([disabled]) { + background-color: var(--color-2); color: white; } From 243312083149f7cbd3962af579a5c02bd42fdd1f Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Thu, 2 Jan 2025 19:46:37 +0100 Subject: [PATCH 10/12] fix: migrate scss --- .../components/application-title/index.css | 31 +++++++++++++++++++ .../components/application-title/index.scss | 28 ----------------- .../components/application-title/index.tsx | 6 ++-- 3 files changed, 34 insertions(+), 31 deletions(-) create mode 100644 src/packages/components/application-title/index.css delete mode 100644 src/packages/components/application-title/index.scss diff --git a/src/packages/components/application-title/index.css b/src/packages/components/application-title/index.css new file mode 100644 index 000000000..bf6117b60 --- /dev/null +++ b/src/packages/components/application-title/index.css @@ -0,0 +1,31 @@ +.application-title { + background: #45374e; + padding-bottom: 0.5em; + padding-top: 0.5em; +} + +.application-title .application-title-container { + width: 50%; + margin: auto; +} + +.application-title .application-title-wrapper { + display: flex; + margin: auto; +} + +.application-title img { + width: 25%; +} + +.application-title h1 { + color: white; + font-size: 15.3pt; + float: right; + margin: 0; + display: flex; + justify-content: center; + align-items: center; + text-align: center; + flex-grow: 1; +} diff --git a/src/packages/components/application-title/index.scss b/src/packages/components/application-title/index.scss deleted file mode 100644 index 576f7ec72..000000000 --- a/src/packages/components/application-title/index.scss +++ /dev/null @@ -1,28 +0,0 @@ -.application-title { - background: #45374e; - padding-bottom: 0.5em; - padding-top: 0.5em; - - .application-title__container { - width: 50%; - margin: auto; - } - .application-title__wrapper { - display: flex; - margin: auto; - } - img { - width: 25%; - } - h1 { - color: white; - font-size: 15.3pt; - float: right; - margin: 0; - display: flex; - justify-content: center; - align-items: center; - text-align: center; - flex-grow: 1; - } -} diff --git a/src/packages/components/application-title/index.tsx b/src/packages/components/application-title/index.tsx index fdca6e949..7ff51acf0 100644 --- a/src/packages/components/application-title/index.tsx +++ b/src/packages/components/application-title/index.tsx @@ -1,6 +1,6 @@ import { createAllDictionary } from '@utils/dictionnary'; -import './index.scss'; +import './index.css'; const { D } = createAllDictionary({ welcome: { @@ -11,8 +11,8 @@ const { D } = createAllDictionary({ export const ApplicationTitle = () => { return (
    -
    -
    +
    +

    application logo {D.welcome} From a9516fd40e19055a35eb58f09be5eac486be5937 Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Fri, 3 Jan 2025 20:51:50 +0100 Subject: [PATCH 11/12] fix: remove some SCSS, add unit test, remove unused props, and migrate component to typescript --- .../filter-toggle-buttons.css | 7 ++ .../filter-toggle-buttons.scss | 6 -- .../filter-toggle-buttons.spec.tsx | 78 +++++++++++++++++++ .../filter-toggle-buttons/index.tsx | 4 +- .../modules-classifications/edition/index.jsx | 1 - .../item/edition/index.jsx | 1 - .../codelist-detail/{title.jsx => title.tsx} | 5 +- .../codelist-detail/view-container.jsx | 2 +- .../view-container.jsx | 2 +- .../links/equivalentLinks.scss | 1 + .../modules-concepts/visualization/home.jsx | 1 - .../modules-datasets/datasets/edit/edit.jsx | 1 - .../modules-datasets/distributions/edit.jsx | 1 - .../document/edition/edition.jsx | 1 - .../indicators/edition/edition.jsx | 1 - .../indicators/visualization/index.jsx | 1 - .../operations/edition/edition.jsx | 1 - .../operations/visualization/index.jsx | 1 - .../series/edition/edition.jsx | 1 - .../series/visualization/index.jsx | 1 - .../components/component-detail/index.jsx | 2 +- .../components/component-detail/title.jsx | 3 +- .../component-detail/view-container.jsx | 2 +- .../visualization/index.tsx | 8 +- 24 files changed, 97 insertions(+), 35 deletions(-) create mode 100644 src/packages/components/filter-toggle-buttons/filter-toggle-buttons.css delete mode 100644 src/packages/components/filter-toggle-buttons/filter-toggle-buttons.scss create mode 100644 src/packages/components/filter-toggle-buttons/filter-toggle-buttons.spec.tsx rename src/packages/modules-codelists/components/codelist-detail/{title.jsx => title.tsx} (73%) diff --git a/src/packages/components/filter-toggle-buttons/filter-toggle-buttons.css b/src/packages/components/filter-toggle-buttons/filter-toggle-buttons.css new file mode 100644 index 000000000..be1668bf6 --- /dev/null +++ b/src/packages/components/filter-toggle-buttons/filter-toggle-buttons.css @@ -0,0 +1,7 @@ +.bauhaus-filter-toggle-buttons { + margin-bottom: 1em; +} + +.bauhaus-filter-toggle-buttons-btn-active { + border: 2px var(--color-3) solid; +} diff --git a/src/packages/components/filter-toggle-buttons/filter-toggle-buttons.scss b/src/packages/components/filter-toggle-buttons/filter-toggle-buttons.scss deleted file mode 100644 index 6b801e055..000000000 --- a/src/packages/components/filter-toggle-buttons/filter-toggle-buttons.scss +++ /dev/null @@ -1,6 +0,0 @@ -.bauhaus-filter-toggle-buttons { - margin-bottom: 1em; - &__btn-active { - border: 2px var(--color-3) solid; - } -} diff --git a/src/packages/components/filter-toggle-buttons/filter-toggle-buttons.spec.tsx b/src/packages/components/filter-toggle-buttons/filter-toggle-buttons.spec.tsx new file mode 100644 index 000000000..1f9a45bf9 --- /dev/null +++ b/src/packages/components/filter-toggle-buttons/filter-toggle-buttons.spec.tsx @@ -0,0 +1,78 @@ +import { fireEvent, render, screen } from '@testing-library/react'; +import { describe, expect, it, vi } from 'vitest'; + +import FilterToggleButtons from '.'; +import { BOTH, DOCUMENT, LINK } from '../../modules-operations/document/utils'; + +describe('FilterToggleButtons Component', () => { + const mockHandleSelection = vi.fn(); + + const setup = (currentValue: string) => { + const options = [ + [BOTH, 'Both'], + [DOCUMENT, 'Document'], + [LINK, 'Link'], + ] as [typeof BOTH | typeof DOCUMENT | typeof LINK, string][]; + + render( + , + ); + }; + + afterEach(() => { + vi.restoreAllMocks(); + mockHandleSelection.mockClear(); + }); + + it('should render the correct number of buttons', () => { + setup(BOTH); + const buttons = screen.getAllByRole('button'); + expect(buttons).toHaveLength(3); + }); + + it('should apply the active class to the selected button', () => { + setup(DOCUMENT); + const activeButton = screen.getByText('Document'); + expect(activeButton).toHaveClass( + 'bauhaus-filter-toggle-buttons-btn-active', + ); + }); + + it('should not apply the active class to unselected buttons', () => { + setup(DOCUMENT); + const unselectedButton = screen.getByText('Both'); + expect(unselectedButton).not.toHaveClass( + 'bauhaus-filter-toggle-buttons-btn-active', + ); + }); + + it('should call handleSelection with the correct value when a button is clicked', () => { + setup(BOTH); + const button = screen.getByText('Link'); + fireEvent.click(button); + expect(mockHandleSelection).toHaveBeenCalledWith(LINK); + }); + + it('should render button labels correctly', () => { + setup(BOTH); + expect(screen.getByText('Both')).toBeDefined(); + expect(screen.getByText('Document')).toBeDefined(); + expect(screen.getByText('Link')).toBeDefined(); + }); + + it('should handle empty options gracefully', () => { + render( + , + ); + const buttons = screen.queryAllByRole('button'); + expect(buttons).toHaveLength(0); + }); +}); diff --git a/src/packages/components/filter-toggle-buttons/index.tsx b/src/packages/components/filter-toggle-buttons/index.tsx index 290b033e0..670720496 100644 --- a/src/packages/components/filter-toggle-buttons/index.tsx +++ b/src/packages/components/filter-toggle-buttons/index.tsx @@ -1,5 +1,5 @@ import { BOTH, DOCUMENT, LINK } from '../../modules-operations/document/utils'; -import './filter-toggle-buttons.scss'; +import './filter-toggle-buttons.css'; interface FilterToggleButtonsTypes { options: [typeof BOTH | typeof DOCUMENT | typeof LINK, string][]; @@ -24,7 +24,7 @@ const FilterToggleButtons = ({ type="button" className={`btn btn-default ${ currentValue === value - ? 'bauhaus-filter-toggle-buttons__btn-active' + ? 'bauhaus-filter-toggle-buttons-btn-active' : '' }`} onClick={() => handleSelection(value)} diff --git a/src/packages/modules-classifications/edition/index.jsx b/src/packages/modules-classifications/edition/index.jsx index bec967d99..5919c6eef 100644 --- a/src/packages/modules-classifications/edition/index.jsx +++ b/src/packages/modules-classifications/edition/index.jsx @@ -81,7 +81,6 @@ export const Component = () => {
    { formatAndSave(value))}> diff --git a/src/packages/modules-codelists/components/codelist-detail/title.jsx b/src/packages/modules-codelists/components/codelist-detail/title.tsx similarity index 73% rename from src/packages/modules-codelists/components/codelist-detail/title.jsx rename to src/packages/modules-codelists/components/codelist-detail/title.tsx index 68e76a549..0ea3d94a3 100644 --- a/src/packages/modules-codelists/components/codelist-detail/title.jsx +++ b/src/packages/modules-codelists/components/codelist-detail/title.tsx @@ -1,13 +1,14 @@ import { CheckSecondLang } from '@components/check-second-lang'; import { PageTitleBlock } from '@components/page-title-block'; -const ComponentTitle = ({ component, secondLang }) => { +const ComponentTitle = ({ + component, +}: Readonly<{ component: { labelLg1: string; labelLg2: string } }>) => { return ( <> diff --git a/src/packages/modules-codelists/components/codelist-detail/view-container.jsx b/src/packages/modules-codelists/components/codelist-detail/view-container.jsx index 2abda786b..f0110eeaf 100644 --- a/src/packages/modules-codelists/components/codelist-detail/view-container.jsx +++ b/src/packages/modules-codelists/components/codelist-detail/view-container.jsx @@ -70,7 +70,7 @@ export const Component = (props) => { return ( <> - + { return ( <> - + { )} diff --git a/src/packages/modules-datasets/distributions/edit.jsx b/src/packages/modules-datasets/distributions/edit.jsx index 799fab766..49c3ce251 100644 --- a/src/packages/modules-datasets/distributions/edit.jsx +++ b/src/packages/modules-datasets/distributions/edit.jsx @@ -101,7 +101,6 @@ export const Component = () => { )} diff --git a/src/packages/modules-operations/document/edition/edition.jsx b/src/packages/modules-operations/document/edition/edition.jsx index c43ec66a5..e755a1571 100644 --- a/src/packages/modules-operations/document/edition/edition.jsx +++ b/src/packages/modules-operations/document/edition/edition.jsx @@ -221,7 +221,6 @@ const OperationsDocumentationEdition = (props) => { )} diff --git a/src/packages/modules-operations/indicators/edition/edition.jsx b/src/packages/modules-operations/indicators/edition/edition.jsx index b2eba0659..c0c024089 100644 --- a/src/packages/modules-operations/indicators/edition/edition.jsx +++ b/src/packages/modules-operations/indicators/edition/edition.jsx @@ -169,7 +169,6 @@ class OperationsIndicatorEdition extends Component { )} { diff --git a/src/packages/modules-operations/operations/edition/edition.jsx b/src/packages/modules-operations/operations/edition/edition.jsx index 0eb054200..d0f45e4fa 100644 --- a/src/packages/modules-operations/operations/edition/edition.jsx +++ b/src/packages/modules-operations/operations/edition/edition.jsx @@ -125,7 +125,6 @@ class OperationsOperationEdition extends Component { )} { diff --git a/src/packages/modules-operations/series/edition/edition.jsx b/src/packages/modules-operations/series/edition/edition.jsx index 57c5b1d30..243c27b3a 100644 --- a/src/packages/modules-operations/series/edition/edition.jsx +++ b/src/packages/modules-operations/series/edition/edition.jsx @@ -191,7 +191,6 @@ class OperationsSerieEdition extends Component { )} diff --git a/src/packages/modules-operations/series/visualization/index.jsx b/src/packages/modules-operations/series/visualization/index.jsx index 84acbf862..781c9c28b 100644 --- a/src/packages/modules-operations/series/visualization/index.jsx +++ b/src/packages/modules-operations/series/visualization/index.jsx @@ -59,7 +59,6 @@ export const Component = () => { diff --git a/src/packages/modules-structures/components/component-detail/index.jsx b/src/packages/modules-structures/components/component-detail/index.jsx index a6deddf97..53aadd3a3 100644 --- a/src/packages/modules-structures/components/component-detail/index.jsx +++ b/src/packages/modules-structures/components/component-detail/index.jsx @@ -30,7 +30,7 @@ export const ComponentDetail = (props) => {
    {mode === 'VIEW' && ( <> - + { +const ComponentTitle = ({ component }) => { return ( <> diff --git a/src/packages/modules-structures/components/component-detail/view-container.jsx b/src/packages/modules-structures/components/component-detail/view-container.jsx index 275a010cd..0f0ef1ecb 100644 --- a/src/packages/modules-structures/components/component-detail/view-container.jsx +++ b/src/packages/modules-structures/components/component-detail/view-container.jsx @@ -68,7 +68,7 @@ export const Component = (props) => { }; return ( <> - + { useTitle(D.structuresTitle, structure?.labelLg1); - const [secondLang] = useSecondLang(); const { labelLg1, @@ -43,11 +41,7 @@ export const StructureView = ({ return ( <> - + {serverSideError && ( From b06aa82232445a327b455ec3a6e0e38a52b69339 Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Fri, 3 Jan 2025 20:54:30 +0100 Subject: [PATCH 12/12] fix: remove screen.debug --- .../visualization/links/CloseMatchLinks.spec.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx b/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx index 4c07ad420..5a934de89 100644 --- a/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx +++ b/src/packages/modules-concepts/visualization/links/CloseMatchLinks.spec.tsx @@ -20,7 +20,6 @@ describe('CloseMatchLinks', () => { screen.getByText(/Equivalent links/); const items = screen.queryAllByRole('listitem'); - screen.debug(); expect(items).toHaveLength(mockLinks.length + 1); mockLinks.forEach((link) => {