pinafore/routes/_components/status/StatusHeader.html
2018-02-12 22:34:03 -08:00

92 lines
2.4 KiB
HTML

<div class="status-header {{isStatusInNotification ? 'status-in-notification' : ''}}">
<svg>
<use xlink:href="{{icon}}"/>
</svg>
<span>
{{#if timelineType === 'pinned'}}
Pinned toot
{{else}}
<a href="/accounts/{{account.id}}"
focus-key="{{focusKey}}" >
{{account.display_name || ('@' + account.username)}}
</a>
{{#if notification && notification.type === 'reblog'}}
boosted your status
{{elseif notification && notification.type === 'favourite'}}
favorited your status
{{elseif notification && notification.type === 'follow'}}
followed you
{{elseif status && status.reblog}}
boosted
{{/if}}
{{/if}}
</span>
</div>
<style>
.status-header span {
margin-left: 5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
:global(
.status-header span,
.status-header a,
.status-header a:visited,
.status-header a:hover
) {
color: var(--deemphasized-text-color);
}
:global(
.status-header.status-in-notification span,
.status-header.status-in-notification a,
.status-header.status-in-notification a:visited,
.status-header.status-in-notification a:hover
) {
color: var(--body-text-color);
}
.status-header {
grid-area: header;
margin: 5px 10px 5px 5px;
display: flex;
align-items: center;
}
.status-header svg {
width: 18px;
height: 18px;
fill: var(--deemphasized-text-color);
}
.status-header.status-in-notification svg {
fill: var(--body-text-color);
}
</style>
<script>
export default {
computed: {
statusId: (status) => status && status.id,
notificationId: (notification) => notification && notification.id,
focusKey: (statusId, notificationId) => `status-header-${statusId}-${notificationId}`,
icon: (notification, status, timelineType) => {
if (timelineType === 'pinned') {
return '#fa-thumb-tack'
} else if ((notification && notification.type === 'reblog') || (status && status.reblog)) {
return '#fa-retweet'
} else if (notification && notification.type === 'follow') {
return '#fa-user-plus'
}
return '#fa-star'
},
account: (notification, status) => {
if (notification && notification.account) {
return notification.account
}
return status.account
}
}
}
</script>