1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-14 03:05:41 +01:00
Pinafore-Web-Client-Frontend/routes/_components/status/Status.html
2018-02-09 22:01:44 -08:00

97 lines
3.9 KiB
HTML

<article class="status-article {{getClasses(originalStatus, timelineType, isStatusInOwnThread)}}"
tabindex="0"
aria-posinset="{{index}}" aria-setsize="{{length}}"
on:recalculateHeight>
{{#if (notification && (notification.type === 'reblog' || notification.type === 'favourite')) || status.reblog}}
<StatusHeader :notification :status :isStatusInNotification />
{{/if}}
<StatusAuthor status="{{originalStatus}}" :isStatusInOwnThread :isStatusInNotification />
<StatusSidebar status="{{originalStatus}}" />
{{#if originalStatus.spoiler_text}}
<StatusSpoiler status="{{originalStatus}}" :contextualStatusId :isStatusInNotification on:recalculateHeight />
{{/if}}
{{#if !originalStatus.spoiler_text || spoilerShown}}
<StatusContent status="{{originalStatus}}" :isStatusInOwnThread :isStatusInNotification />
{{/if}}
{{#if originalStatus.media_attachments && originalStatus.media_attachments.length}}
<StatusMediaAttachments status="{{originalStatus}}" :contextualStatusId on:recalculateHeight />
{{/if}}
<StatusToolbar :status />
</article>
<style>
.status-article {
max-width: calc(100vw - 40px);
padding: 10px 20px;
display: grid;
grid-template-areas:
"....... header header header"
"sidebar author-name author-handle author-date"
"sidebar spoiler spoiler spoiler"
"sidebar spoiler-button spoiler-button spoiler-button"
"sidebar content content content"
"media media media media"
"....... toolbar toolbar toolbar";
grid-template-columns: min-content minmax(0, max-content) 1fr min-content;
}
.status-article.status-in-timeline {
width: 560px;
border-bottom: 1px solid var(--main-border);
}
.status-article.status-direct {
background-color: var(--status-direct-background);
}
@media (max-width: 767px) {
.status-article {
padding: 10px 10px;
max-width: calc(100vw - 20px);
}
}
</style>
<script>
import StatusSidebar from './StatusSidebar.html'
import StatusHeader from './StatusHeader.html'
import StatusAuthor from './StatusAuthor.html'
import StatusToolbar from './StatusToolbar.html'
import StatusMediaAttachments from './StatusMediaAttachments.html'
import StatusContent from './StatusContent.html'
import StatusSpoiler from './StatusSpoiler.html'
import { store } from '../../_store/store'
import identity from 'lodash/identity'
export default {
components: {
StatusSidebar,
StatusHeader,
StatusAuthor,
StatusToolbar,
StatusMediaAttachments,
StatusContent,
StatusSpoiler
},
store: () => store,
helpers: {
getClasses(originalStatus, timelineType, isStatusInOwnThread) {
return [
originalStatus.visibility === 'direct' && 'status-direct',
timelineType !== 'search' && 'status-in-timeline',
isStatusInOwnThread && 'status-in-own-thread'
].filter(identity).join(' ')
}
},
computed: {
originalStatus: (status) => status.reblog ? status.reblog : status,
statusId: (originalStatus) => originalStatus.id,
contextualStatusId: ($currentInstance, timelineType, timelineValue, status, notification) => {
return `${$currentInstance}/${timelineType}/${timelineValue}/${notification ? notification.id : ''}/${status.id}`
},
originalAccount: (originalStatus) => originalStatus.account,
isStatusInOwnThread: (timelineType, timelineValue, statusId) => timelineType === 'status' && timelineValue === statusId,
isStatusInNotification: (status, notification) => notification && notification.status && notification.type !== 'mention' && notification.status.id === status.id,
spoilerShown: ($spoilersShown, contextualStatusId) => !!$spoilersShown[contextualStatusId]
}
}
</script>