pinafore/routes/_components/timeline/PinnedStatuses.html

38 lines
1.1 KiB
HTML
Raw Normal View History

2018-02-19 17:17:22 +00:00
<div role="feed" aria-label="Pinned toots" class="pinned-statuses">
{{#each pinnedStatuses as status, index @id}}
<Status :status
timelineType="pinned"
timelineValue="{{accountId}}"
:index
length="{{pinnedStatuses.length}}"
/>
{{/each}}
2018-02-11 18:35:25 +00:00
</div>
<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 18:35:25 +00:00
export default {
2018-04-20 04:38:01 +00:00
async oncreate () {
on('updatePinnedStatuses', this, () => this.updatePinnedStatuses())
await this.updatePinnedStatuses()
2018-02-11 18:35:25 +00:00
},
computed: {
pinnedStatuses: ($pinnedStatuses, $currentInstance, accountId) => {
return ($pinnedStatuses[$currentInstance] && $pinnedStatuses[$currentInstance][accountId]) || []
2018-02-11 18:35:25 +00:00
}
},
store: () => store,
components: {
2018-02-12 07:10:07 +00:00
Status
},
methods: {
async updatePinnedStatuses () {
let { accountId } = this.get()
await updatePinnedStatusesForAccount(accountId)
}
2018-02-11 18:35:25 +00:00
}
}
</script>