diff --git a/frontend/src/features/pam/mission/components/elements/timeline/item/timeline-item-status.test.tsx b/frontend/src/features/pam/mission/components/elements/timeline/item/timeline-item-status.test.tsx index a71cd37b2..4bfc0e61a 100644 --- a/frontend/src/features/pam/mission/components/elements/timeline/item/timeline-item-status.test.tsx +++ b/frontend/src/features/pam/mission/components/elements/timeline/item/timeline-item-status.test.tsx @@ -80,4 +80,26 @@ describe('ActionStatus', () => { render() expect(screen.queryByText('Indisponibilité - Technique - fin')).toBeInTheDocument() }) + test('should apply ellipsis when observations exceed container width', () => { + const longObservation = 'This is a an observation'; + + const mock = { ...actionMock, data: { ...actionMock.data, observations: longObservation } }; + render(); + const textElement = screen.getByTestId('timeline-item-status-description') + const style = window.getComputedStyle(textElement); + + expect(style.whiteSpace).toBe('nowrap'); + expect(style.textOverflow).toBe('ellipsis'); + expect(style.overflow).toBe('hidden'); + }); + + + it('should display observations as is a short description', () => { + const shortObservation = 'This is short.' + + const mock = { ...actionMock, data: { ...actionMock.data, observations: shortObservation } } + render() + + expect(screen.getByText('- ' + shortObservation)).toBeInTheDocument() + }) }) diff --git a/frontend/src/features/pam/mission/components/elements/timeline/item/timeline-item-status.tsx b/frontend/src/features/pam/mission/components/elements/timeline/item/timeline-item-status.tsx index 9c5a7a594..968967d47 100644 --- a/frontend/src/features/pam/mission/components/elements/timeline/item/timeline-item-status.tsx +++ b/frontend/src/features/pam/mission/components/elements/timeline/item/timeline-item-status.tsx @@ -1,6 +1,6 @@ -import { FC } from 'react' +import React, { FC } from 'react' import { Icon, THEME } from '@mtes-mct/monitor-ui' -import { Stack } from 'rsuite' +import { FlexboxGrid, Stack } from 'rsuite' import { ActionStatus as NavActionStatus } from '../../../../../../common/types/action-types.ts' import { StatusColorTag } from '../../../ui/status-selection-dropdown.tsx' import { mapStatusToText, statusReasonToHumanString } from '../../../../utils/status-utils.ts' @@ -15,43 +15,39 @@ const ActionStatus: FC = ({ action, previousActionWith const prevActionData = previousActionWithSameType?.data as unknown as NavActionStatus return ( - - - - - - - - - {`${mapStatusToText(actionData?.status)} - début${ - !!actionData?.reason ? ' - ' + statusReasonToHumanString(actionData?.reason) : '' - }`} - {!!actionData?.observations ? ' - ' + actionData?.observations : ''} - - - - - - - - {!!prevActionData && ( - - - {`${mapStatusToText(prevActionData?.status)} ${prevActionData?.reason ? `- ${statusReasonToHumanString(prevActionData?.reason)} ` : ''}- fin`} + + + + + + + + {`${mapStatusToText(actionData?.status)} - début${ + !!actionData?.reason ? ' - ' + statusReasonToHumanString(actionData?.reason) : '' + }`} + {!!actionData?.observations ? ' - ' + actionData?.observations : ''} + + + + + {!!prevActionData && ( + + {`${mapStatusToText(prevActionData?.status)} ${prevActionData?.reason ? `- ${statusReasonToHumanString(prevActionData?.reason)} ` : ''}- fin`} + )} - + ) }