Skip to content

Commit

Permalink
[Reportings] Corrections de style (#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
claire2212 authored Aug 24, 2023
2 parents ef20c1f + 087205e commit b417422
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
14 changes: 7 additions & 7 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"dependencies": {
"@dnd-kit/core": "^4.0.3",
"@dnd-kit/modifiers": "^4.0.0",
"@mtes-mct/monitor-ui": "9.0.0",
"@mtes-mct/monitor-ui": "9.0.1",
"@reduxjs/toolkit": "1.9.5",
"@rsuite/responsive-nav": "^5.0.1",
"@sentry/browser": "7.60.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ export const duplicateReporting = reportingId => async (dispatch, getState) => {
try {
const response = await dispatch(reportingToDuplicate.initiate(reportingId))
if ('data' in response) {
const duplicatedReporting = { ...response.data, id: undefined, reportingId: undefined }
const duplicatedReporting = {
...response.data,
createdAt: new Date().toISOString(),
id: undefined,
reportingId: undefined
}
if (isDirty) {
dispatch(reportingStateActions.setIsConfirmCancelDialogVisible(true))
dispatch(multiReportingsActions.setNextSelectedReporting(duplicatedReporting))
Expand Down
1 change: 1 addition & 0 deletions frontend/src/features/Reportings/Filters/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export function TableReportingsFiltersWithRef(
onChange={value => updateSourceTypeFilter(value)}
placeholder="Type de source"
renderValue={() => sourceTypeFilter && <OptionValue>{`Type (${sourceTypeFilter.length})`}</OptionValue>}
searchable={false}
size="sm"
style={tagPickerStyle}
value={sourceTypeFilter}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,7 @@ const StyledDropdown = styled(Dropdown)`
vertical-align: middle;
margin-right: 0px;
}
.rs-dropdown-item {
line-height: 20px;
}
`
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,14 @@ export function ReportingsTable({
const { rows } = table.getRowModel()
const rowVirtualizer = useVirtualizer({
count: rows.length,
estimateSize: () => 40,
estimateSize: () => 2,
getItemKey: useCallback((index: number) => `${rows[index]?.id}`, [rows]),
getScrollElement: () => tableContainerRef.current,
overscan: 10
})

const virtualRows = rowVirtualizer.getVirtualItems()
const [paddingTop, paddingBottom] =
virtualRows.length > 0
? [
Math.max(0, virtualRows[0]?.start || 0),
Math.max(0, rowVirtualizer.getTotalSize() - (virtualRows[virtualRows.length - 1]?.end || 0))
]
: [0, 0]
const paddingTop = virtualRows.length > 0 ? Math.max(0, virtualRows[0]?.start || 0) : 0

const selectedIds = useMemo(
() => table.getSelectedRowModel().rows.map(({ original }) => original.id),
Expand Down Expand Up @@ -143,11 +137,10 @@ export function ReportingsTable({
</TableWithSelectableRows.BodyTr>
)
})}
{paddingBottom > 0 && (
<tr>
<td style={{ height: `${paddingBottom}px` }} />
</tr>
)}

<tr>
<td style={{ height: '50px' }} />
</tr>
</tbody>
</TableWithSelectableRows.Table>
</StyledReportingsContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const FiltersWrapper = styled.div`
border-top: 2px solid ${p => p.theme.color.lightGray};
`
const TagWrapper = styled.div`
margin-top: 4px;
margin-top: 8px;
margin-bottom: 16px;
display: flex;
flex-wrap: wrap;
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/ui/ControlInfractionsTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export function ControlInfractionsTags({ actionNumberOfControls, infractions })
{ras > 0 && <Tag accent={Accent.PRIMARY}>{ras} RAS</Tag>}
{totalInfractions > 0 && <Tag accent={Accent.PRIMARY}>{totalInfractions} INF</Tag>}
{infractionsWithoutPV > 0 && <Tag accent={Accent.PRIMARY}>{infractionsWithoutPV} INF SANS PV</Tag>}
{infractionsWithWaitingPv > 0 && (
<Tag accent={Accent.PRIMARY}>{infractionsWithWaitingPv} INF AVEC PV EN ATTENTE</Tag>
)}
{infractionsWithWaitingPv > 0 && <Tag accent={Accent.PRIMARY}>{infractionsWithWaitingPv} PV EN ATTENTE</Tag>}
{med > 0 && <Tag accent={Accent.PRIMARY}>{med} MED</Tag>}
</TagGroup>
)
Expand Down

0 comments on commit b417422

Please sign in to comment.