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

add moon logo when the train passes after midnight #9111

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
@@ -1,7 +1,7 @@
import React from 'react';

import { Checkbox } from '@osrd-project/ui-core';
import { Duplicate, Pencil, Trash, Clock, Flame } from '@osrd-project/ui-icons';
import { Duplicate, Pencil, Trash, Clock, Flame, Moon } from '@osrd-project/ui-icons';
import cx from 'classnames';
import dayjs from 'dayjs';
import { omit } from 'lodash';
Expand Down Expand Up @@ -131,6 +131,12 @@ const TimetableTrainCard = ({
dispatch(updateTrainIdUsedForProjection(train.id));
};

/* TODO: delete the format when the date management PR has been passed */
const isAfterMidnight = dayjs(train.arrivalTime, 'D/MM/YYYY').isAfter(
emersion marked this conversation as resolved.
Show resolved Hide resolved
dayjs(train.startTime, 'D/MM/YYYY'),
'day'
);

return (
<div
data-testid="scenario-timetable-train"
Expand Down Expand Up @@ -181,14 +187,14 @@ const TimetableTrainCard = ({
</div>
{!train.invalidReason && (
<div className="train-time">
<div className="after-midnight" />
<div className="status-icon after-midnight">{isAfterMidnight && <Moon />}</div>
{train.isValid && (
<div className="scenario-timetable-train-departure" title={train.startTime}>
{/* TODO: delete the format when the date management `PR` has been passed */}
{dayjs(train.startTime, 'D/MM/YYYY HH:mm:ss').format('HH:mm')}
</div>
)}
<div className="not-honored-or-too-fast">
<div className="status-icon not-honored-or-too-fast">
{train.notHonoredReason &&
(train.notHonoredReason === 'scheduleNotHonored' ? <Clock /> : <Flame />)}
</div>
Expand Down
1 change: 1 addition & 0 deletions front/src/styles/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ $colors: (
'error80': #6b0000,
'grey60': #5c5955,
'grey80': #312e2b,
'info60': #216482,
'primary60': #1844ef,
'primary80': #1f0f96,
'selection20': #fff2b3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,27 +352,25 @@
align-items: center;
justify-content: right;

.after-midnight {
max-width: 1rem;
margin: 0 0.5rem;
}

.scenario-timetable-train-departure {
font-weight: 400;
font-size: 1rem;
}

.not-honored-or-too-fast {
.status-icon {
width: 1.5rem;
height: 1.5rem;
color: var(--warning60);
color: var(--info60);
theocrsb marked this conversation as resolved.
Show resolved Hide resolved
display: flex;
justify-content: center;
align-items: center;
margin: 0 0.25rem;
span {
padding-bottom: 0.25rem;
}
&.not-honored-or-too-fast {
color: var(--warning60);
}
}

.scenario-timetable-train-departure {
font-weight: 400;
font-size: 1rem;
}

.scenario-timetable-train-arrival {
Expand Down
Loading