diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5a0290c..6f8567657 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to - ♿️(frontend) announce formatting shortcuts for screen readers #2070 - ✨(frontend) add markdown copy icon for Copy as Markdown option #2096 - ♻️(backend) skip saving in database a document when payload is empty #2062 +- ♻️(frontend) refacto Version modal to fit with the design system #2091 ### Fixed @@ -22,7 +23,7 @@ and this project adheres to - 💫(frontend) fix the help button to the bottom in tree #2073 - ♿️(frontend) fix aria-labels for table of contents #2065 - 🐛(backend) allow using search endpoint without refresh token enabled #2097 -- 🐛(frontend) fix close panel when click on subdoc +- 🐛(frontend) fix close panel when click on subdoc #2094 - 🐛(frontend) fix leftpanel button in doc version #9238 ## [v4.8.2] - 2026-03-19 diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-version.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-version.spec.ts index ded53e4d3..2f52f139c 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/doc-version.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-version.spec.ts @@ -164,11 +164,16 @@ test.describe('Doc Version', () => { await expect(modal.getByText('World')).toBeHidden(); await page.getByRole('button', { name: 'Restore', exact: true }).click(); - await expect(page.getByText('Your current document will')).toBeVisible(); - await page.getByText('If a member is editing, his').click(); + await expect( + page.getByText( + "The current document will be replaced, but you'll still find it in the version history.", + ), + ).toBeVisible(); await page.getByLabel('Restore', { exact: true }).click(); + await page.waitForTimeout(500); + await expect(page.getByText('Hello')).toBeVisible(); await expect(page.getByText('World')).toBeHidden(); }); diff --git a/src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalConfirmationVersion.tsx b/src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalConfirmationVersion.tsx index a0002661a..3dc8c52a7 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalConfirmationVersion.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalConfirmationVersion.tsx @@ -5,8 +5,8 @@ import { VariantType, useToastProvider, } from '@gouvfr-lasuite/cunningham-react'; -import { useRouter } from 'next/router'; import { useTranslation } from 'react-i18next'; +import { createGlobalStyle } from 'styled-components'; import { Box, Text } from '@/components'; import { @@ -21,15 +21,22 @@ import { KEY_LIST_DOC_VERSIONS } from '../api/useDocVersions'; import { Versions } from '../types'; import { revertUpdate } from '../utils'; -interface ModalConfirmationVersionProps { - onClose: () => void; - docId: Doc['id']; +const ModalStyle = createGlobalStyle` + .c__modal__title { + margin-bottom: var(--c--globals--spacings--sm); + } +`; +interface ModalConfirmationVersionProps { + docId: Doc['id']; + onClose: () => void; + onSuccess: () => void; versionId: Versions['version_id']; } export const ModalConfirmationVersion = ({ onClose, + onSuccess, docId, versionId, }: ModalConfirmationVersionProps) => { @@ -39,14 +46,13 @@ export const ModalConfirmationVersion = ({ }); const { t } = useTranslation(); const { toast } = useToastProvider(); - const { push } = useRouter(); const { provider } = useProviderStore(); const { mutate: updateDoc } = useUpdateDoc({ listInvalidQueries: [KEY_LIST_DOC_VERSIONS], onSuccess: () => { const onDisplaySuccess = () => { toast(t('Version restored successfully'), VariantType.SUCCESS); - void push(`/docs/${docId}`); + onSuccess(); }; if (!provider || !version?.content) { @@ -64,6 +70,10 @@ export const ModalConfirmationVersion = ({ }, }); + if (!version) { + return null; + } + return ( } - size={ModalSize.SMALL} + size={ModalSize.MEDIUM} title={ - {t('Warning')} + {t('Restoring an older version')} } > + - - {t('Your current document will revert to this version.')} - - - {t('If a member is editing, his works can be lost.')} + + {t( + "The current document will be replaced, but you'll still find it in the version history.", + )} diff --git a/src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalSelectVersion.tsx b/src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalSelectVersion.tsx index bd8c1cc0b..df4a28273 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalSelectVersion.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalSelectVersion.tsx @@ -114,7 +114,8 @@ export const ModalSelectVersion = ({ $height="calc(100vh - 2em - 12px)" $css={css` overflow-y: hidden; - border-left: 1px solid var(--c--globals--colors--gray-200); + border-left: 1px solid + var(--c--contextuals--border--surface--primary); `} > @@ -155,7 +157,8 @@ export const ModalSelectVersion = ({