Sharkey/src/client/app/desktop/views/pages/user/user.vue

158 lines
3.6 KiB
Vue
Raw Normal View History

2018-02-14 17:32:13 +02:00
<template>
<mk-ui>
2018-09-28 08:26:20 +03:00
<div class="xygkxeaeontfaokvqmiblezmhvhostak" v-if="!fetching">
<div class="is-suspended" v-if="user.isSuspended"><fa icon="exclamation-triangle"/> {{ $t('@.is-suspended') }}</div>
<div class="is-remote" v-if="user.host != null"><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a></div>
2018-06-20 19:46:35 +03:00
<main>
<div class="main">
<x-header :user="user"/>
2018-09-18 00:29:47 +03:00
<mk-note-detail v-for="n in user.pinnedNotes" :key="n.id" :note="n" :compact="true"/>
2018-06-20 19:46:35 +03:00
<x-timeline class="timeline" ref="tl" :user="user"/>
</div>
<div class="side">
<div class="instance" v-if="!$store.getters.isSignedIn"><mk-instance/></div>
2018-06-20 19:46:35 +03:00
<x-profile :user="user"/>
2018-11-04 15:03:55 +02:00
<x-twitter :user="user" v-if="!user.host && user.twitter"/>
<x-github :user="user" v-if="!user.host && user.github"/>
2018-06-20 19:46:35 +03:00
<mk-calendar @chosen="warp" :start="new Date(user.createdAt)"/>
<mk-activity :user="user"/>
<x-photos :user="user"/>
<x-friends :user="user"/>
<x-followers-you-know v-if="$store.getters.isSignedIn && $store.state.i.id != user.id" :user="user"/>
<div class="nav"><mk-nav/></div>
</div>
</main>
2018-02-14 17:32:13 +02:00
</div>
</mk-ui>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../../i18n';
2018-07-07 13:19:00 +03:00
import parseAcct from '../../../../../../misc/acct/parse';
2018-02-19 07:29:42 +02:00
import Progress from '../../../../common/scripts/loading';
2018-02-20 18:39:51 +02:00
import XHeader from './user.header.vue';
2018-06-20 13:55:34 +03:00
import XTimeline from './user.timeline.vue';
import XProfile from './user.profile.vue';
import XPhotos from './user.photos.vue';
import XFollowersYouKnow from './user.followers-you-know.vue';
import XFriends from './user.friends.vue';
2018-06-23 16:55:32 +03:00
import XTwitter from './user.twitter.vue';
2018-11-04 15:03:55 +02:00
import XGithub from './user.github.vue'; // ?MEM: Don't fix the intentional typo. (XGitHub -> `<x-git-hub>`)
2018-02-14 17:32:13 +02:00
export default Vue.extend({
i18n: i18n(),
2018-02-19 07:29:42 +02:00
components: {
2018-02-20 18:39:51 +02:00
XHeader,
2018-06-20 13:55:34 +03:00
XTimeline,
XProfile,
XPhotos,
XFollowersYouKnow,
2018-06-23 16:55:32 +03:00
XFriends,
2018-11-04 15:03:55 +02:00
XTwitter,
XGithub // ?MEM: Don't fix the intentional typo. (see L41)
2018-02-14 17:32:13 +02:00
},
data() {
return {
fetching: true,
user: null
};
},
2018-02-20 15:53:34 +02:00
watch: {
$route: 'fetch'
},
2018-02-22 14:15:24 +02:00
created() {
this.fetch();
},
2018-02-20 15:53:34 +02:00
methods: {
fetch() {
this.fetching = true;
Progress.start();
2018-11-09 01:13:34 +02:00
this.$root.api('users/show', parseAcct(this.$route.params.user)).then(user => {
2018-02-20 15:53:34 +02:00
this.user = user;
this.fetching = false;
Progress.done();
});
2018-06-20 13:55:34 +03:00
},
warp(date) {
(this.$refs.tl as any).warp(date);
2018-02-20 15:53:34 +02:00
}
2018-02-14 17:32:13 +02:00
}
});
</script>
2018-06-20 13:55:34 +03:00
<style lang="stylus" scoped>
2018-09-28 08:26:20 +03:00
.xygkxeaeontfaokvqmiblezmhvhostak
2018-06-20 13:55:34 +03:00
width 980px
padding 16px
margin 0 auto
2018-06-20 19:46:35 +03:00
> .is-suspended
> .is-remote
margin-bottom 16px
padding 14px 16px
font-size 14px
2018-09-22 14:39:12 +03:00
box-shadow var(--shadow)
border-radius var(--round)
2018-06-20 13:55:34 +03:00
2018-06-20 19:46:35 +03:00
&.is-suspended
2018-09-28 08:26:20 +03:00
color var(--suspendedInfoFg)
background var(--suspendedInfoBg)
2018-06-20 13:55:34 +03:00
2018-06-20 19:46:35 +03:00
&.is-remote
2018-09-28 08:26:20 +03:00
color var(--remoteInfoFg)
background var(--remoteInfoBg)
2018-06-20 13:55:34 +03:00
2018-06-20 19:46:35 +03:00
> a
font-weight bold
2018-06-20 13:55:34 +03:00
2018-06-20 19:46:35 +03:00
> main
display flex
justify-content center
2018-06-20 13:55:34 +03:00
2018-06-20 19:46:35 +03:00
> .main
> .side
> *:not(:last-child)
margin-bottom 16px
2018-06-20 13:55:34 +03:00
2018-06-20 19:46:35 +03:00
> .main
flex 1
2018-06-22 12:47:23 +03:00
min-width 0 // SEE: http://kudakurage.hatenadiary.com/entry/2016/04/01/232722
2018-06-20 19:46:35 +03:00
margin-right 16px
2018-06-20 13:55:34 +03:00
2018-06-20 19:46:35 +03:00
> .timeline
2018-09-22 14:39:12 +03:00
box-shadow var(--shadow)
2018-06-20 13:55:34 +03:00
2018-06-20 19:46:35 +03:00
> .side
width 275px
2018-06-22 12:47:23 +03:00
flex-shrink 0
2018-06-20 19:46:35 +03:00
> p
display block
margin 0
padding 0 12px
text-align center
font-size 0.8em
color #aaa
> .instance
box-shadow var(--shadow)
border-radius var(--round)
2018-06-20 19:46:35 +03:00
> .nav
padding 16px
font-size 12px
2018-09-28 08:26:20 +03:00
color var(--text)
background var(--face)
2018-09-22 14:39:12 +03:00
box-shadow var(--shadow)
border-radius var(--round)
2018-06-20 19:46:35 +03:00
a
2018-09-28 08:26:20 +03:00
color var(--text)99
2018-06-20 19:46:35 +03:00
i
2018-09-28 08:26:20 +03:00
color var(--text)
2018-06-20 13:55:34 +03:00
</style>