pinafore/routes/_components/timeline/PinnedStatuses.html

41 lines
1.2 KiB
HTML
Raw Normal View History

{#if pinnedStatuses.length }
<h1 class="sr-only">Pinned statuses</h1>
<div role="feed" aria-label="Pinned statuses" class="pinned-statuses">
{#each pinnedStatuses as status, index (status.id)}
<Status {status}
timelineType="pinned"
timelineValue={accountId}
{index}
length={pinnedStatuses.length}
/>
{/each}
</div>
{/if}
2018-02-11 19:35:25 +01:00
<script>
import { store } from '../../_store/store'
import Status from '../status/Status.html'
import { updatePinnedStatusesForAccount } from '../../_actions/pinnedStatuses'
import { on } from '../../_utils/eventBus'
2018-02-11 19:35:25 +01:00
export default {
2018-04-20 06:38:01 +02:00
async oncreate () {
on('updatePinnedStatuses', this, () => this.updatePinnedStatuses())
await this.updatePinnedStatuses()
2018-02-11 19:35:25 +01:00
},
computed: {
pinnedStatuses: ({ $pinnedStatuses, $currentInstance, accountId }) => {
return ($pinnedStatuses[$currentInstance] && $pinnedStatuses[$currentInstance][accountId]) || []
2018-02-11 19:35:25 +01:00
}
},
store: () => store,
components: {
2018-02-12 08:10:07 +01:00
Status
},
methods: {
async updatePinnedStatuses () {
let { accountId } = this.get()
await updatePinnedStatusesForAccount(accountId)
}
2018-02-11 19:35:25 +01:00
}
}
</script>