2019-02-23 12:32:00 -08:00
|
|
|
<a id={elementId}
|
|
|
|
class="status-relative-date {isStatusInNotification ? 'status-in-notification' : '' }"
|
2018-05-01 17:05:36 -07:00
|
|
|
href="/statuses/{originalStatusId}"
|
2019-02-13 18:40:02 -08:00
|
|
|
rel="prefetch"
|
2019-09-24 22:30:26 -07:00
|
|
|
{tabindex}
|
2018-02-10 13:57:04 -08:00
|
|
|
>
|
2021-03-21 18:06:45 -04:00
|
|
|
<time datetime={createdAtDate} title={formattedDateTitle}
|
2020-11-29 14:13:27 -08:00
|
|
|
aria-label={createdAtLabel}>
|
2021-03-21 18:06:45 -04:00
|
|
|
{formattedDate}
|
2018-03-15 20:04:24 -07:00
|
|
|
</time>
|
2018-02-09 22:55:11 -08:00
|
|
|
</a>
|
|
|
|
<style>
|
|
|
|
.status-relative-date {
|
|
|
|
grid-area: relative-date;
|
|
|
|
align-self: center;
|
|
|
|
margin-left: 5px;
|
|
|
|
margin-right: 10px;
|
|
|
|
font-size: 1.1em;
|
|
|
|
text-align: right;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
.status-relative-date, .status-relative-date:hover, .status-relative-date:visited {
|
|
|
|
color: var(--deemphasized-text-color);
|
|
|
|
}
|
|
|
|
|
|
|
|
.status-relative-date.status-in-notification,
|
|
|
|
.status-relative-date.status-in-notification:hover,
|
|
|
|
.status-relative-date.status-in-notification:visited {
|
|
|
|
color: var(--very-deemphasized-text-color);
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<script>
|
2020-11-29 14:13:27 -08:00
|
|
|
import { formatIntl } from '../../_utils/formatIntl'
|
|
|
|
|
2018-02-09 22:55:11 -08:00
|
|
|
export default {
|
|
|
|
computed: {
|
2019-09-24 22:30:26 -07:00
|
|
|
elementId: ({ uuid }) => `status-relative-date-${uuid}`,
|
|
|
|
tabindex: ({ $disableTapOnStatus }) => (
|
|
|
|
// If you can't tap on the entire status, then you need some way to click on it. Otherwise it's
|
|
|
|
// just a duplicate link in the focus order.
|
|
|
|
$disableTapOnStatus ? '0' : '-1'
|
2020-11-29 14:13:27 -08:00
|
|
|
),
|
2021-03-21 18:06:45 -04:00
|
|
|
formattedDateTitle: ({ $disableRelativeTimestamps, absoluteFormattedDate }) => {
|
|
|
|
if ($disableRelativeTimestamps) {
|
|
|
|
return ''
|
|
|
|
} else {
|
|
|
|
return absoluteFormattedDate
|
|
|
|
}
|
|
|
|
},
|
|
|
|
createdAtLabel: ({ formattedDate }) => (
|
|
|
|
formatIntl('intl.clickToShowThread', { time: formattedDate })
|
|
|
|
),
|
|
|
|
formattedDate: ({ $disableRelativeTimestamps, timeagoFormattedDate, absoluteFormattedDate }) => {
|
|
|
|
if ($disableRelativeTimestamps) {
|
|
|
|
return absoluteFormattedDate
|
|
|
|
} else {
|
|
|
|
return timeagoFormattedDate
|
|
|
|
}
|
|
|
|
}
|
2018-02-09 22:55:11 -08:00
|
|
|
}
|
|
|
|
}
|
2019-01-13 15:56:39 -08:00
|
|
|
</script>
|