summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/views/pages/user/user.vue
blob: 64a4eaa8723e3a24a31d0c632d3d9ad03cdd8ee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<template>
<mk-ui>
	<div class="xygkxeaeontfaokvqmiblezmhvhostak" v-if="!fetching" :data-darkmode="$store.state.device.darkmode">
		<div class="is-suspended" v-if="user.isSuspended">%fa:exclamation-triangle% %i18n:@is-suspended%</div>
		<div class="is-remote" v-if="user.host != null">%fa:exclamation-triangle% %i18n:@is-remote%<a :href="user.url || user.uri" target="_blank">%i18n:@view-remote%</a></div>
		<main>
			<div class="main">
				<x-header :user="user"/>
				<mk-note-detail v-if="user.pinnedNote" :note="user.pinnedNote" :compact="true"/>
				<x-timeline class="timeline" ref="tl" :user="user"/>
			</div>
			<div class="side">
				<x-profile :user="user"/>
				<x-twitter :user="user" v-if="user.host === null && user.twitter"/>
				<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>
				<p v-if="user.host === null">%i18n:@last-used-at%: <b><mk-time :time="user.lastUsedAt"/></b></p>
			</div>
		</main>
	</div>
</mk-ui>
</template>

<script lang="ts">
import Vue from 'vue';
import parseAcct from '../../../../../../misc/acct/parse';
import getUserName from '../../../../../../misc/get-user-name';
import Progress from '../../../../common/scripts/loading';
import XHeader from './user.header.vue';
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';
import XTwitter from './user.twitter.vue';

export default Vue.extend({
	components: {
		XHeader,
		XTimeline,
		XProfile,
		XPhotos,
		XFollowersYouKnow,
		XFriends,
		XTwitter
	},
	data() {
		return {
			fetching: true,
			user: null
		};
	},
	watch: {
		$route: 'fetch'
	},
	created() {
		this.fetch();
	},
	methods: {
		fetch() {
			this.fetching = true;
			Progress.start();
			(this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => {
				this.user = user;
				this.fetching = false;
				Progress.done();
				document.title = getUserName(this.user) + ' | Misskey';
			});
		},

		warp(date) {
			(this.$refs.tl as any).warp(date);
		}
	}
});
</script>

<style lang="stylus" scoped>
root(isDark)
	width 980px
	padding 16px
	margin 0 auto

	> .is-suspended
	> .is-remote
		margin-bottom 16px
		padding 14px 16px
		font-size 14px
		border-radius 6px

		&.is-suspended
			color isDark ? #ffb4b4 : #570808
			background isDark ? #611d1d : #ffdbdb
			border solid 1px isDark ? #d64a4a : #e09696

		&.is-remote
			color isDark ? #ffbd3e : #573c08
			background isDark ? #42321c : #fff0db
			border solid 1px isDark ? #90733c : #dcbb7b

		> a
			font-weight bold

	> main
		display flex
		justify-content center

		> .main
		> .side
			> *:not(:last-child)
				margin-bottom 16px

		> .main
			flex 1
			min-width 0 // SEE: http://kudakurage.hatenadiary.com/entry/2016/04/01/232722
			margin-right 16px

			> .timeline
				border 1px solid rgba(#000, 0.075)
				border-radius 6px

		> .side
			width 275px
			flex-shrink 0

			> p
				display block
				margin 0
				padding 0 12px
				text-align center
				font-size 0.8em
				color #aaa

			> .nav
				padding 16px
				font-size 12px
				color #aaa
				background #fff
				border solid 1px rgba(#000, 0.075)
				border-radius 6px

				a
					color #999

				i
					color #ccc

.xygkxeaeontfaokvqmiblezmhvhostak[data-darkmode]
	root(true)

.xygkxeaeontfaokvqmiblezmhvhostak:not([data-darkmode])
	root(false)

</style>