Skip to content

Commit

Permalink
front: pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Wadjetz committed Jan 2, 2025
1 parent 27863a4 commit 8643c88
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import cx from 'classnames';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';

import { extractMarkersInfo } from 'applications/stdcm/utils';
import useStdcmTowedRollingStock from 'applications/stdcm/hooks/useStdcmTowedRollingStock';
import { extractMarkersInfo } from 'applications/stdcm/utils';
import {
validateMaxSpeed,
validateTotalLength,
Expand Down Expand Up @@ -217,9 +217,14 @@ const StdcmConfig = ({
})}
label={t('simulation.getSimulation')}
onClick={startSimulation}
isDisabled={disabled || !showBtnToLaunchSimulation || !!consistErrors.totalMass || !!consistErrors.totalLength || !!consistErrors.maxSpeed}
isDisabled={
disabled ||
!showBtnToLaunchSimulation ||
!!consistErrors.totalMass ||
!!consistErrors.totalLength ||
!!consistErrors.maxSpeed
}
/>
!!consistErrors.maxSpeed
{formErrors && (
<StdcmWarningBox
errorInfos={formErrors}
Expand Down
20 changes: 5 additions & 15 deletions front/src/applications/stdcm/components/StdcmForm/StdcmConsist.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useEffect } from 'react';

import { Input, ComboBox } from '@osrd-project/ui-core';
import cx from 'classnames';
import { useTranslation } from 'react-i18next';

import useStdcmTowedRollingStock from 'applications/stdcm/hooks/useStdcmTowedRollingStock';
Expand Down Expand Up @@ -163,13 +162,7 @@ const StdcmConsist = ({ consistErrors = {}, disabled = false }: StdcmConfigCardP
}}
/>
</div>
<div
className={cx({
'stdcm-consist__properties': !consistErrors.totalMass && !consistErrors.totalLength,
'stdcm-consist__properties--with-errors':
!!consistErrors.totalMass || !!consistErrors.totalLength,
})}
>
<div className="stdcm-consist__properties">
<Input
id="tonnage"
label={t('consist.tonnage')}
Expand Down Expand Up @@ -215,12 +208,7 @@ const StdcmConsist = ({ consistErrors = {}, disabled = false }: StdcmConfigCardP
}
/>
</div>
<div
className={cx({
'stdcm-consist__properties': !consistErrors.maxSpeed,
'stdcm-consist__properties--with-errors': !!consistErrors.maxSpeed,
})}
>
<div className="stdcm-consist__properties">
<SpeedLimitByTagSelector
disabled={disabled}
selectedSpeedLimitByTag={speedLimitByTag}
Expand All @@ -242,7 +230,9 @@ const StdcmConsist = ({ consistErrors = {}, disabled = false }: StdcmConfigCardP
status: 'warning',
message: t(consistErrors.maxSpeed, {
low: CONSIST_MAX_SPEED_MIN,
high: Math.floor(msToKmh(Math.min(rollingStock?.max_speed ?? kmhToMs(CONSIST_MAX_SPEED_MIN)))),
high: Math.floor(
msToKmh(Math.min(rollingStock?.max_speed ?? kmhToMs(CONSIST_MAX_SPEED_MIN)))
),
}),
}
: undefined
Expand Down
7 changes: 0 additions & 7 deletions front/src/styles/scss/applications/stdcm/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,6 @@
margin-top: 11px;
}

.stdcm-consist__properties--with-errors {
display: flex;
flex-direction: column;
padding-block: 8px;
gap: 8px;
}

.stdcm-consist__properties {
display: grid;
grid-template-columns: 139px 147px;
Expand Down

0 comments on commit 8643c88

Please sign in to comment.