Skip to content

Commit 6acdf5a

Browse files
committed
front: keep the '-' only if we have the second part
Signed-off-by: nncluzu <ngamenichaka@yahoo.fr>
1 parent e90c136 commit 6acdf5a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

front/src/applications/stdcm/components/StdcmForm/StdcmConsist.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ const StdcmConsist = ({ disabled = false }: StdcmConfigCardProps) => {
7272
}
7373
}, [towedRollingStock]);
7474

75-
const getLabel = (rs: LightRollingStockWithLiveries) =>
76-
`${rs.name} - ${rs.metadata?.series || rs.metadata?.reference || ''}`;
75+
const getLabel = (rs: LightRollingStockWithLiveries) => {
76+
const secondPart = rs.metadata?.series || rs.metadata?.reference || '';
77+
return secondPart ? `${rs.name} - ${secondPart}` : rs.name;
78+
};
7779

7880
const onInputClick = () => {
7981
if (rollingStock?.id !== undefined) {

0 commit comments

Comments
 (0)