Skip to content

Commit

Permalink
front: fix stop time hours display + fix stop time center
Browse files Browse the repository at this point in the history
* Stop time didn't display the minutes component
* Stop time wasn't centered in the div

Signed-off-by: Ethan Perruzza <ethan.perruzza@gmail.com>
  • Loading branch information
EthanPERRUZZA committed Dec 18, 2024
1 parent ef69c8d commit ea61967
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ const StcdmResultsTable = ({
className={
step.duration !== 0 && !isLastStep ? 'stop-with-duration ml-n2' : 'stop'
}
style={{
width: `${step.duration < 600 && step.duration >= 60 ? 55 : 65}px`,
}}
>
{
// eslint-disable-next-line no-nested-ternary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('generateCodeNumber', () => {

describe('getStopDurationTime', () => {
it('should return correct time format', () => {
expect(getStopDurationTime(30)).toBe('30 sec');
expect(getStopDurationTime(120)).toBe('2 min');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ export function generateCodeNumber(): string {
}

export function getStopDurationTime(sec: number) {
const timeInMilliseconds = sec * 1000;
const time = new Date(timeInMilliseconds);

if (timeInMilliseconds < 60000) {
return `${time.getUTCSeconds()} sec`;
}
return `${time.getUTCMinutes()} min`;
return `${Math.round(sec / 60)} min`;
}

function secondsToTimeString(duration: number): string {
Expand Down
4 changes: 1 addition & 3 deletions front/src/styles/scss/applications/stdcm/_results.scss
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,8 @@
color: rgb(255, 255, 255);
background-color: rgb(33, 100, 130);
border-radius: 10px;
margin-top: 6px;
margin-bottom: 6px;
margin-right: 29px;
text-align: center;
padding: 1px 9px;
}
.weight {
width: 128px;
Expand Down

0 comments on commit ea61967

Please sign in to comment.