-
Notifications
You must be signed in to change notification settings - Fork 29
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 two-line timestamp and remove dayjs #1333
Conversation
overflow: hidden; | ||
text-overflow: ellipsis; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes ellipsis truncation in the nested timestamp div
s
@@ -519,6 +521,7 @@ $spinner-color-light: #000; | |||
padding: 0 $cell-padding; | |||
align-items: center; | |||
width: 100%; | |||
height: 100%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes vertical centering in cells whose contents aren't full height via line-height
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 2. probably makes more sense to change the header. |
const timeFormatter = new Intl.DateTimeFormat([], { | ||
hour: '2-digit', | ||
minute: '2-digit' | ||
}) | ||
const dateFormatter = new Intl.DateTimeFormat([], { | ||
dateStyle: 'medium' | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -73,16 +80,21 @@ const getColumns = (columns: MetricOrParam[]): Column<Experiment>[] => | |||
if (!value || value === '') { | |||
return null | |||
} | |||
const time = dayjs(value) | |||
const date = new Date(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to push this further up into data parsing, but this will do for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep definitely move it in case we need to use this timestamp somewhere else. We should also standardise all dates in the extension to look the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can follow up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do the follow-up for pushing new Date
up into webview parsing, I'm not sure where else we display date timestamps though.
<div className={styles.headerCellContentsWrapper}> | ||
<span | ||
ref={provided.innerRef} | ||
{...provided.draggableProps} | ||
{...provided.dragHandleProps} | ||
data-testid="rendered-header" | ||
style={provided.draggableProps.style} | ||
className={cx(styles.cellContents, { | ||
[styles.draggingColumn]: snapshot.isDragging, | ||
[styles.staticColumn]: !snapshot.isDragging, | ||
[styles.isDroppedColumn]: snapshot.isDropAnimating | ||
})} | ||
> | ||
{column.render('Header')} | ||
</span> | ||
</div> | ||
<span | ||
ref={provided.innerRef} | ||
{...provided.draggableProps} | ||
{...provided.dragHandleProps} | ||
data-testid="rendered-header" | ||
style={provided.draggableProps.style} | ||
className={cx(styles.cellContents, { | ||
[styles.draggingColumn]: snapshot.isDragging, | ||
[styles.staticColumn]: !snapshot.isDragging, | ||
[styles.isDroppedColumn]: snapshot.isDropAnimating | ||
})} | ||
> | ||
{column.render('Header')} | ||
</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
headerCellContentWrapper
is pushed into header render functions so it can be left off of Timestamp to enable selective rtl/ltr truncation.
return ( | ||
<div className={styles.headerCellContentsWrapper}> | ||
<span title={name}>{name}</span> | ||
</div> | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
headerCellContentsWrapper
pushed here to apply to all normal headers.
@mattseddon Good points! I did 1 with a slight tweak to time formatter options and 2 with a slightly larger refactor. On the same line of thought as matching CLI, I changed the date formatting to |
Screen.Recording.2022-02-17.at.10.36.02.AM.movFrom the UI tests, seems like the header of experiment and timestamp aren't aligned vertically anymore. |
Code Climate has analyzed commit 6e78980 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (85% is the threshold). This pull request will bring the total coverage in the repository to 96.2% (0.0% change). View more on Code Climate. |
I re-added the same padding that normal headers have to the Experiment and Timestamp cells, then grabbed a screenshot from the latest Chromatic build to ensure that Timestamp and Experiment cells are now at the same vertical alignment: There's still a diff highlight, I guess because the baseline got updated to the previous commit, but from that check I'd say the issue's been solved. Thanks for pointing it out @sroy3! |
Accepted the latest Chromatic diff myself and will merge, still open to any further changes in follow-ups! |
This PR changes the experiment table's timestamp format to have two lines, one prominent one with the time and a smaller sub-line below it with the date. We've talked in meetings about using a consistent timestamp between products, but from looking at those products (DVC CLI and Studio) it seems like most use the date format we've had previously so whatever we go with will need to be something new.
The formatting is also changed to use native JS
Date
and itstoLocaleDate
andtoLocaleTime
methods. Since this removes the last remaining usage ofdayjs
, this PR also removes the library. The logic of using different formats depending on whether the date is today or before is also removed, and all dates are now displayed consistently regardless of their position relative to the current day.I'm absolutely open to any criticism and/or requested changes, this is just a shot in the dark from what I assume would be a good way to display all the necessary information.
Newest demo:
new-timestamp-demo.mp4
Old demo:
new-timestamp-demo.mp4
Fixes #1270