2018-03-14 00:14:57 +00:00
|
|
|
<DynamicPageBanner title="Pinned toots" icon="#fa-thumb-tack" />
|
|
|
|
<div class="pinned-toots-page">
|
2018-05-02 01:05:36 +01:00
|
|
|
{#if loading}
|
2018-03-14 00:14:57 +00:00
|
|
|
<LoadingPage />
|
2018-05-02 01:05:36 +01:00
|
|
|
{:elseif statuses && statuses.length}
|
2018-03-14 00:14:57 +00:00
|
|
|
<ul class="pinned-toots-results">
|
2018-05-02 01:05:36 +01:00
|
|
|
{#each statuses as status, index}
|
|
|
|
<StatusSearchResult {status} {index} length={statuses.length} />
|
|
|
|
{/each}
|
2018-03-14 00:14:57 +00:00
|
|
|
</ul>
|
2018-05-02 01:05:36 +01:00
|
|
|
{/if}
|
2018-03-14 00:14:57 +00:00
|
|
|
</div>
|
|
|
|
<style>
|
|
|
|
.pinned-toots-page {
|
|
|
|
padding: 20px 20px;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
.pinned-toots-results {
|
|
|
|
list-style: none;
|
|
|
|
box-sizing: border-box;
|
|
|
|
border: 1px solid var(--main-border);
|
|
|
|
border-radius: 2px;
|
|
|
|
}
|
|
|
|
@media (max-width: 767px) {
|
|
|
|
.pinned-toots-page {
|
|
|
|
padding: 20px 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import { store } from '.././_store/store'
|
|
|
|
import LoadingPage from '.././_components/LoadingPage.html'
|
|
|
|
import StatusSearchResult from '.././_components/search/StatusSearchResult.html'
|
|
|
|
import { toast } from '.././_utils/toast'
|
|
|
|
import DynamicPageBanner from '.././_components/DynamicPageBanner.html'
|
|
|
|
import { getPinnedStatuses } from '.././_api/pinnedStatuses'
|
|
|
|
import { updateVerifyCredentialsForInstance } from '.././_actions/instances'
|
|
|
|
|
|
|
|
export default {
|
2018-04-20 05:38:01 +01:00
|
|
|
async oncreate () {
|
2018-03-14 00:14:57 +00:00
|
|
|
try {
|
2018-04-19 17:37:05 +01:00
|
|
|
let { currentInstance } = this.store.get()
|
2018-03-14 00:14:57 +00:00
|
|
|
await updateVerifyCredentialsForInstance(currentInstance)
|
2018-04-19 17:37:05 +01:00
|
|
|
let { accessToken, currentVerifyCredentials } = this.store.get()
|
|
|
|
let statuses = await getPinnedStatuses(currentInstance, accessToken, currentVerifyCredentials.id)
|
2018-03-14 00:14:57 +00:00
|
|
|
this.set({ statuses: statuses })
|
|
|
|
} catch (e) {
|
|
|
|
toast.say('Error: ' + (e.name || '') + ' ' + (e.message || ''))
|
|
|
|
} finally {
|
2018-08-30 05:42:57 +01:00
|
|
|
this.set({ loading: false })
|
2018-03-14 00:14:57 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data: () => ({
|
|
|
|
loading: true,
|
|
|
|
accounts: []
|
|
|
|
}),
|
|
|
|
store: () => store,
|
|
|
|
components: {
|
|
|
|
LoadingPage,
|
|
|
|
StatusSearchResult,
|
|
|
|
DynamicPageBanner
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|