refactor status some more

This commit is contained in:
Nolan Lawson 2018-02-04 10:50:39 -08:00
parent f9720dccba
commit 76e78e70e5
4 changed files with 31 additions and 21 deletions

View file

@ -6,21 +6,21 @@
<StatusHeader :notification :status /> <StatusHeader :notification :status />
{{/if}} {{/if}}
<StatusAuthor status="{{originalStatus}}" :isStatusInContext /> <StatusAuthor status="{{originalStatus}}" :isStatusInContext />
<Avatar account={{originalAccount}} className="status-sidebar" size="small" /> <StatusSidebar status="{{originalStatus}}" />
{{#if originalStatus.spoiler_text}} {{#if originalStatus.spoiler_text}}
<StatusSpoiler status="{{originalStatus}}" :spoilerShown on:recalculateHeight /> <StatusSpoiler status="{{originalStatus}}" :spoilerShown on:recalculateHeight />
{{/if}} {{/if}}
{{#if !originalStatus.spoiler_text || spoilerShown}} {{#if !originalStatus.spoiler_text || spoilerShown}}
<StatusContent status="{{originalStatus}}" /> <StatusContent status="{{originalStatus}}" />
{{/if}} {{/if}}
{{#if originalMediaAttachments && originalMediaAttachments.length}} {{#if originalStatusMediaAttachments && originalStatusMediaAttachments.length}}
<MediaAttachments <StatusMediaAttachments
status="{{originalStatus}}" status="{{originalStatus}}"
mediaAttachments="{{originalMediaAttachments}}" mediaAttachments="{{originalStatusMediaAttachments}}"
on:recalculateHeight on:recalculateHeight
/> />
{{/if}} {{/if}}
<Toolbar :status /> <StatusToolbar :status />
</article> </article>
<style> <style>
@ -45,11 +45,6 @@
background-color: var(--status-direct-background); background-color: var(--status-direct-background);
} }
:global(.status-sidebar) {
grid-area: status-sidebar;
margin: 0 10px 0 0;
}
@media (max-width: 767px) { @media (max-width: 767px) {
.status-article { .status-article {
padding: 10px 10px; padding: 10px 10px;
@ -58,33 +53,31 @@
} }
</style> </style>
<script> <script>
import Avatar from './Avatar.html' import StatusSidebar from './StatusSidebar.html'
import MediaAttachments from './MediaAttachments.html' import StatusHeader from './StatusHeader.html'
import StatusAuthor from './StatusAuthor.html' import StatusAuthor from './StatusAuthor.html'
import StatusContent from './StatusContent.html' import StatusContent from './StatusContent.html'
import Toolbar from './Toolbar.html' import StatusToolbar from './StatusToolbar.html'
import StatusHeader from './StatusHeader.html'
import StatusSpoiler from './StatusSpoiler.html' import StatusSpoiler from './StatusSpoiler.html'
import ExternalLink from '../ExternalLink.html' import StatusMediaAttachments from './StatusMediaAttachments.html'
import { store } from '../../_store/store' import { store } from '../../_store/store'
export default { export default {
components: { components: {
Avatar, StatusSidebar,
MediaAttachments,
Toolbar,
ExternalLink,
StatusHeader, StatusHeader,
StatusAuthor, StatusAuthor,
StatusContent, StatusContent,
StatusSpoiler StatusToolbar,
StatusSpoiler,
StatusMediaAttachments,
}, },
store: () => store, store: () => store,
computed: { computed: {
isStatusInContext: (timelineType, timelineValue, statusId) => timelineType === 'status' && timelineValue === statusId, isStatusInContext: (timelineType, timelineValue, statusId) => timelineType === 'status' && timelineValue === statusId,
originalStatus: (status) => status.reblog ? status.reblog : status, originalStatus: (status) => status.reblog ? status.reblog : status,
originalAccount: (originalStatus) => originalStatus.account, originalAccount: (originalStatus) => originalStatus.account,
originalMediaAttachments: (originalStatus) => originalStatus.media_attachments, originalStatusMediaAttachments: (originalStatus) => originalStatus.media_attachments,
statusId: (originalStatus) => originalStatus.id, statusId: (originalStatus) => originalStatus.id,
spoilerShown: ($spoilersShown, $currentInstance, statusId) => $spoilersShown && $spoilersShown[$currentInstance] && $spoilersShown[$currentInstance][statusId] spoilerShown: ($spoilersShown, $currentInstance, statusId) => $spoilersShown && $spoilersShown[$currentInstance] && $spoilersShown[$currentInstance][statusId]
} }

View file

@ -0,0 +1,17 @@
<Avatar account={{status.account}}
className="status-sidebar"
size="small" />
<style>
:global(.status-sidebar) {
grid-area: status-sidebar;
margin: 0 10px 0 0;
}
</style>
<script>
import Avatar from './Avatar.html'
export default {
components: {
Avatar
}
}
</script>