pinafore/routes/accounts/[accountId].html

63 lines
2.2 KiB
HTML
Raw Normal View History

2018-01-23 06:16:27 +01:00
<:Head>
<title>{{'Pinafore ' + (cachedProfileName || profileName || '')}}</title>
</:Head>
<Layout page='tags'
dynamicPage="{{cachedProfileName || profileName || ''}}"
dynamicHref="/accounts/{{params.accountId}}"
dynamicLabel="{{cachedShortProfileName || shortProfileName || ''}}"
dynamicIcon="#fa-user" >
{{#if $isUserLoggedIn}}
<DynamicPageBanner title="{{cachedProfileName || profileName || ''}}" />
<LazyTimeline timeline='account/{{params.accountId}}' />
{{else}}
<HiddenFromSSR>
<FreeTextLayout>
<h1>Profile</h1>
<p>A user timeline will appear here when logged in.</p>
</FreeTextLayout>
</HiddenFromSSR>
{{/if}}
</Layout>
<script>
import Layout from '../_components/Layout.html'
import LazyTimeline from '../_components/LazyTimeline.html'
import FreeTextLayout from '../_components/FreeTextLayout.html'
import { store } from '../_utils/store.js'
import HiddenFromSSR from '../_components/HiddenFromSSR'
import DynamicPageBanner from '../_components/DynamicPageBanner.html'
import { getAccount } from '../_utils/mastodon/user'
export default {
async oncreate() {
let currentInstance = this.store.get('currentInstance')
let accessToken = this.store.get('accessToken')
let accountId = this.get('params').accountId
let account = await getAccount(currentInstance, accessToken, accountId)
this.set({account: account})
},
store: () => store,
computed: {
profileName: (account) => {
return account && ('@' + account.acct)
},
shortProfileName: (account) => {
return account && ('@' + account.username)
},
cachedProfileName: ($cachedAccountNames, params) => {
return $cachedAccountNames && $cachedAccountNames[params.accountId] && ('@' + $cachedAccountNames[params.accountId].acct)
},
cachedShortProfileName: ($cachedAccountNames, params) => {
return $cachedAccountNames && $cachedAccountNames[params.accountId] && ('@' + $cachedAccountNames[params.accountId].username)
}
},
components: {
Layout,
LazyTimeline,
FreeTextLayout,
HiddenFromSSR,
DynamicPageBanner
}
}
</script>