Pinafore-Web-Client-Frontend/routes/_components/status/StatusAuthor.html

99 lines
2.6 KiB
HTML
Raw Normal View History

2018-02-10 07:01:44 +01:00
<a
class="status-author-name {{getClass(isStatusInNotification)}}"
href="/accounts/{{status.account.id}}"
>
{{status.account.display_name || status.account.username}}
</a>
<span class="status-author-handle {{getClass(isStatusInNotification)}}"
>
{{'@' + status.account.acct}}
</span>
{{#if isStatusInOwnThread}}
<ExternalLink class="status-author-date" href="{{status.url}}" showIcon="true">
<time datetime={{createdAtDate}} title="{{relativeDate}}">{{relativeDate}}</time>
</ExternalLink>
{{else}}
<a class="status-author-date {{getClass(isStatusInNotification)}}"
href="/statuses/{{status.id}}"
>
<time datetime={{createdAtDate}} title="{{relativeDate}}">{{relativeDate}}</time>
</a>
{{/if}}
2018-02-04 19:23:18 +01:00
<style>
.status-author {
2018-02-10 05:07:48 +01:00
grid-area: author;
2018-02-04 19:23:18 +01:00
align-items: center;
min-width: 0;
}
2018-02-10 07:01:44 +01:00
.status-author-name {
grid-area: author-name;
align-self: center;
margin-left: 5px;
font-size: 1.1em;
2018-02-04 19:23:18 +01:00
min-width: 0;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
2018-02-10 07:01:44 +01:00
.status-author-name, .status-author-name:hover, .status-author-name:visited {
2018-02-04 19:23:18 +01:00
color: var(--body-text-color);
}
.status-author-handle {
2018-02-10 07:01:44 +01:00
grid-area: author-handle;
align-self: center;
2018-02-04 19:23:18 +01:00
margin-left: 5px;
2018-02-10 07:01:44 +01:00
color: var(--deemphasized-text-color);
font-size: 1.1em;
min-width: 0;
2018-02-04 19:23:18 +01:00
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
2018-02-10 07:01:44 +01:00
.status-author-date {
grid-area: author-date;
align-self: center;
2018-02-04 19:23:18 +01:00
margin-left: 5px;
2018-02-10 07:01:44 +01:00
margin-right: 10px;
font-size: 1.1em;
text-align: right;
2018-02-04 19:23:18 +01:00
white-space: nowrap;
}
2018-02-10 07:01:44 +01:00
.status-author-date, .status-author-date:hover, .status-author-date:visited {
2018-02-04 19:23:18 +01:00
color: var(--deemphasized-text-color);
}
2018-02-04 21:49:42 +01:00
2018-02-10 07:01:44 +01:00
.status-author-in-notification, .status-author-in-notification:hover, .status-author-in-notification:visited {
2018-02-04 21:49:42 +01:00
color: var(--very-deemphasized-text-color);
}
2018-02-04 19:23:18 +01:00
</style>
<script>
import IntlRelativeFormat from 'intl-relativeformat'
import ExternalLink from '../ExternalLink.html'
import { mark, stop } from '../../_utils/marks'
const relativeFormat = new IntlRelativeFormat('en-US');
export default {
2018-02-10 07:01:44 +01:00
helpers: {
getClass: isStatusInNotification => isStatusInNotification ? 'status-author-in-notification' : ''
},
2018-02-04 19:23:18 +01:00
computed: {
createdAtDate: (status) => status.created_at,
relativeDate: (createdAtDate) => {
mark('compute relativeDate')
let res = relativeFormat.format(new Date(createdAtDate))
stop('compute relativeDate')
return res
}
},
components: {
ExternalLink
}
}
</script>