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

[VO-1030] feat: Show time on last update with a tooltip #3231

Merged
merged 1 commit into from
Sep 10, 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
3 changes: 3 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -845,5 +845,8 @@
},
"OpenFolderButton": {
"label": "Open directory"
},
"LastUpdate": {
"titleFormat": "MMMM DD, YYYY, HH:MM"
}
}
3 changes: 3 additions & 0 deletions src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -846,5 +846,8 @@
},
"OpenFolderButton": {
"label": "Ouvrir le dossier"
},
"LastUpdate": {
"titleFormat": "DD MMMM YYYY, HH:MM"
}
}
22 changes: 15 additions & 7 deletions src/modules/filelist/cells/LastUpdate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ import cx from 'classnames'
import React from 'react'

import { TableCell } from 'cozy-ui/transpiled/react/deprecated/Table'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

import styles from 'styles/filelist.styl'

const _LastUpdate = ({ date, formatted = '—' }) => (
<TableCell
className={cx(styles['fil-content-cell'], styles['fil-content-date'])}
>
<time dateTime={date}>{formatted}</time>
</TableCell>
)
const _LastUpdate = ({ date, formatted = '—' }) => {
const { f, t } = useI18n()

return (
<TableCell
className={cx(styles['fil-content-cell'], styles['fil-content-date'])}
{...(formatted !== '—' && {
title: f(date, t('LastUpdate.titleFormat'))
})}
>
<time dateTime={date}>{formatted}</time>
</TableCell>
)
}

const LastUpdate = React.memo(_LastUpdate)

Expand Down
Loading