Skip to content

Commit

Permalink
front: make rs label shorter
Browse files Browse the repository at this point in the history
Signed-off-by: nncluzu <ngamenichaka@yahoo.fr>
  • Loading branch information
kmer2016 committed Nov 28, 2024
1 parent 4158136 commit 2ccaf91
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions front/src/applications/stdcm/components/StdcmForm/StdcmConsist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,8 @@ const StdcmConsist = ({ disabled = false }: StdcmConfigCardProps) => {
}, [towedRollingStock]);

const getLabel = (rs: LightRollingStockWithLiveries) => {
let res = '';
const { metadata, name } = rs;

if (metadata) {
const series = metadata.series ?? metadata.reference;
const subseries =
metadata.series && metadata.series !== metadata.subseries
? metadata.subseries
: metadata.detail;
if (series) res += series;
if (subseries) res += series ? ` (${subseries})` : subseries;
}
if (name) res += ` -- ${name}`;
return res;
const secondPart = rs.metadata?.series || rs.metadata?.reference || '';
return secondPart ? `${rs.name} - ${secondPart}` : rs.name;
};

const onInputClick = () => {
Expand Down

0 comments on commit 2ccaf91

Please sign in to comment.