pinafore/routes/_components/status/StatusDetails.html
Nolan Lawson 543536409b
add application (client) name to statuses (#497)
* add application (client) name to statuses

fixes another thing in #6

* add domain blocking (#496)

* add domain blocking

fixes another thing from #6

* show "domain blocking" on profile page

* fix stuff
2018-08-26 15:38:45 -07:00

165 lines
4.4 KiB
HTML

<div class="status-details">
<ExternalLink className="status-absolute-date"
href={originalStatus.url}
showIcon={true}
ariaLabel="{formattedDate} (opens in new window)"
>
<time datetime={createdAtDate} title={formattedDate}>{formattedDate}</time>
</ExternalLink>
{#if applicationWebsite}
<ExternalLink className="status-application"
href={applicationWebsite}
showIcon={false}
ariaLabel="{applicationName} (opens in new window)">
<span class="status-application-span">
{applicationName}
</span>
</ExternalLink>
{:else}
<span class="status-application status-application-span">
{applicationName}
</span>
{/if}
<a class="status-favs-reblogs status-reblogs"
href="/statuses/{originalStatusId}/reblogs"
aria-label={reblogsLabel}>
<svg class="status-favs-reblogs-svg">
<use xlink:href="#fa-retweet"/>
</svg>
<span>{numReblogs}</span>
</a>
<a class="status-favs-reblogs status-favs"
href="/statuses/{originalStatusId}/favorites"
aria-label={favoritesLabel}>
<svg class="status-favs-reblogs-svg">
<use xlink:href="#fa-star" />
</svg>
<span>{numFavs}</span>
</a>
</div>
<style>
.status-details {
grid-area: details;
display: grid;
grid-template-columns: minmax(0, max-content) min-content min-content min-content;
grid-gap: 20px;
align-items: center;
justify-content: left;
margin: 0 5px 10px;
}
:global(.status-absolute-date) {
font-size: 1.1em;
min-width: 0;
}
:global(.status-absolute-date time) {
word-wrap: break-word;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
:global(.status-application) {
word-wrap: break-word;
overflow: hidden;
white-space: pre-wrap;
font-size: 1.1em;
}
:global(.status-application, a.status-application, a.status-application:hover) {
color: var(--deemphasized-text-color);
}
:global(a.status-application) {
display: inline-flex;
align-items: center;
}
.status-application-span {
word-wrap: break-word;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.status-favs-reblogs {
font-size: 1.1em;
display: flex;
flex-direction: row;
align-items: center;
}
.status-favs-reblogs span {
margin-left: 5px;
}
.status-favs-reblogs,
.status-favs-reblogs:hover,
.status-favs-reblogs:visited {
color: var(--deemphasized-text-color);
}
.status-favs-reblogs-svg {
fill: var(--deemphasized-text-color);
width: 18px;
height: 18px;
}
:global(.status-absolute-date, .status-absolute-date:hover, .status-absolute-date:visited) {
color: var(--deemphasized-text-color);
}
@media (max-width: 479px) {
:global(.status-absolute-date) {
font-size: 1em;
}
.status-favs-reblogs {
font-size: 1em;
}
:global(.status-application) {
font-size: 1em;
}
.status-details {
grid-gap: 5px;
justify-content: space-between;
}
}
</style>
<script>
import ExternalLink from '../ExternalLink.html'
import { store } from '../../_store/store'
import { getDateFormatter, getShortDateFormatter } from '../../_utils/formatters'
export default {
store: () => store,
computed: {
application: ({ originalStatus }) => originalStatus.application,
applicationName: ({ application }) => ((application && application.name) || 'Web'),
applicationWebsite: ({ application }) => (application && application.website),
createdAtDate: ({ originalStatus }) => originalStatus.created_at,
numReblogs: ({ originalStatus }) => originalStatus.reblogs_count || 0,
numFavs: ({ originalStatus }) => originalStatus.favourites_count || 0,
formattedDate: ({ createdAtDate, $isMobileSize }) => {
let formatter = $isMobileSize ? getShortDateFormatter() : getDateFormatter()
return formatter.format(new Date(createdAtDate))
},
reblogsLabel: ({ numReblogs }) => {
// TODO: intl
return numReblogs === 1
? `Boosted ${numReblogs} time`
: `Boosted ${numReblogs} times`
},
favoritesLabel: ({ numFavs }) => {
// TODO: intl
return numFavs === 1
? `Favorited ${numFavs} time`
: `Favorited ${numFavs} times`
}
},
components: {
ExternalLink
}
}
</script>