Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix(331) - Stylo edit should appear even when observation is a long text #332

Merged
merged 21 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
811eb73
bugfix 331 - edit pen icon on long description
aleckvincent Sep 9, 2024
9c797ce
bugfix/329 add background hover on whole MissionItem and fix AEM repo…
aleckvincent Sep 9, 2024
ff6e5ec
remove true on isCompleteForStats
aleckvincent Sep 9, 2024
4080f1e
add test for bugfix hover missionItem
aleckvincent Sep 9, 2024
d5c0315
remove useless console.log
aleckvincent Sep 9, 2024
310940d
feature(action): dropdown add action
xtiannyeto Sep 4, 2024
cfbc7d8
feat(control-administrative): delay form mutation for 5 sec
xtiannyeto Aug 22, 2024
41fd1d9
feat(control): update orga files
xtiannyeto Aug 27, 2024
71a221e
feat(control): gens de mer update
xtiannyeto Aug 29, 2024
665a755
fix(buil): repair test fail
xtiannyeto Aug 29, 2024
770aa90
fix(test): have been call check box
xtiannyeto Sep 2, 2024
b029b98
feat(use-control): update handling of unitHasConfirm
xtiannyeto Sep 4, 2024
1569f6e
feat(control): refactor security and navigation
xtiannyeto Sep 4, 2024
a2eae17
fix(lodash): import only methods
xtiannyeto Sep 4, 2024
eea50bb
fix(aem): sovereign nbr hour at sea
xtiannyeto Sep 11, 2024
8a14abc
fix(test): safe not empty collection call
xtiannyeto Sep 12, 2024
97d9dbd
fix(front-dependencies): update dependencies build failed
xtiannyeto Sep 12, 2024
8edca0a
fix(build): msw vulnerability issue
xtiannyeto Sep 12, 2024
e519366
Fix(npm): override path-to-regex that is still faulty with msw
lwih Sep 12, 2024
c13f902
Merge branch 'main' into 331-stylo-edit-disparait-lorsque-phrase-trop…
lwih Sep 16, 2024
7944063
bugfix 331 - use flexbox to fix issue with ellipsis
aleckvincent Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,26 @@ describe('ActionStatus', () => {
render(<ActionStatus {...props(mock, previousActionMock)} />)
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(<ActionStatus {...props(mock, previousActionMock)} />);
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(<ActionStatus {...props(mock, previousActionMock)} />)

expect(screen.getByText('- ' + shortObservation)).toBeInTheDocument()
})
})
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -15,43 +15,39 @@ const ActionStatus: FC<MissionTimelineItemProps> = ({ action, previousActionWith
const prevActionData = previousActionWithSameType?.data as unknown as NavActionStatus
return (
<TimelineItemWrapper onClick={onClick} borderWhenSelected={false}>
<Stack direction={'column'} spacing={'0.2rem'} style={{ padding: '0.2rem 0' }}>
<Stack.Item alignSelf={'flex-start'}>
<Stack alignItems="center" spacing="0.5rem" style={{ width: '100%' }}>
<Stack.Item>
<StatusColorTag status={actionData?.status} />
</Stack.Item>
<Stack.Item style={{ maxWidth: 'calc(100% - 3rem)' }}>
<Text
as="h3"
weight="normal"
color={isSelected ? THEME.color.charcoal : THEME.color.slateGray}
decoration={isSelected ? 'underline' : 'normal'}
style={{
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis'
}}
>
<b>{`${mapStatusToText(actionData?.status)} - début${
!!actionData?.reason ? ' - ' + statusReasonToHumanString(actionData?.reason) : ''
}`}</b>
{!!actionData?.observations ? ' - ' + actionData?.observations : ''}
</Text>
aleckvincent marked this conversation as resolved.
Show resolved Hide resolved
</Stack.Item>
<Stack.Item>
<Icon.EditUnbordered size={20} color={THEME.color.slateGray} />
</Stack.Item>
</Stack>
</Stack.Item>
{!!prevActionData && (
<Stack.Item alignSelf={'flex-start'}>
<Text as={'h3'} color={THEME.color.slateGray} fontStyle={'italic'}>
{`${mapStatusToText(prevActionData?.status)} ${prevActionData?.reason ? `- ${statusReasonToHumanString(prevActionData?.reason)} ` : ''}- fin`}
<FlexboxGrid.Item style={{ width: '100%', padding: '0.2rem 0' }}>
<Stack direction="row" spacing="0.5rem">
<Stack.Item>
<StatusColorTag status={actionData?.status} />
</Stack.Item>
<Stack.Item alignSelf="flex-start" style={{ maxWidth: 'calc(100% - 3rem)' }}>
<Text
as="h3"
weight="medium"
color={isSelected ? THEME.color.charcoal : THEME.color.slateGray}
style={{
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis'
}}
data-testid="timeline-item-status-description"
>
<b>{`${mapStatusToText(actionData?.status)} - début${
!!actionData?.reason ? ' - ' + statusReasonToHumanString(actionData?.reason) : ''
}`}</b>
{!!actionData?.observations ? ' - ' + actionData?.observations : ''}
</Text>
</Stack.Item>
<Stack.Item>
<Icon.EditUnbordered size={20} color={THEME.color.slateGray} />
</Stack.Item>
</Stack>
{!!prevActionData && (
<Text as={'h3'} color={THEME.color.slateGray} fontStyle={'italic'}>
{`${mapStatusToText(prevActionData?.status)} ${prevActionData?.reason ? `- ${statusReasonToHumanString(prevActionData?.reason)} ` : ''}- fin`}
</Text>
)}
</Stack>
</FlexboxGrid.Item>
</TimelineItemWrapper>
)
}
Expand Down
Loading