From 1e158599946cdf28e2ebb9bc7d80c190566b6fea Mon Sep 17 00:00:00 2001 From: syuilo <syuilotan@yahoo.co.jp> Date: Thu, 22 Feb 2018 20:52:39 +0900 Subject: [PATCH] wip --- .../views/components/activity.calendar.vue | 2 +- .../desktop/views/components/activity.chart.vue | 10 ++++++---- .../desktop/views/components/friends-maker.vue | 10 +++++----- src/web/app/desktop/views/components/timeline.vue | 15 +++++++++++---- .../desktop/views/components/widgets/users.vue | 4 ++-- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/web/app/desktop/views/components/activity.calendar.vue b/src/web/app/desktop/views/components/activity.calendar.vue index d9b852315..72233e9ac 100644 --- a/src/web/app/desktop/views/components/activity.calendar.vue +++ b/src/web/app/desktop/views/components/activity.calendar.vue @@ -37,7 +37,7 @@ export default Vue.extend({ d.x = x; d.date.weekday = (new Date(d.date.year, d.date.month - 1, d.date.day)).getDay(); - d.v = d.total / (peak / 2); + d.v = peak == 0 ? 0 : d.total / (peak / 2); if (d.v > 1) d.v = 1; const ch = d.date.weekday == 0 || d.date.weekday == 6 ? 275 : 170; const cs = d.v * 100; diff --git a/src/web/app/desktop/views/components/activity.chart.vue b/src/web/app/desktop/views/components/activity.chart.vue index e64b181ba..5057786ed 100644 --- a/src/web/app/desktop/views/components/activity.chart.vue +++ b/src/web/app/desktop/views/components/activity.chart.vue @@ -62,10 +62,12 @@ export default Vue.extend({ methods: { render() { const peak = Math.max.apply(null, this.data.map(d => d.total)); - this.pointsPost = this.data.map((d, i) => `${(i * this.zoom) + this.pos},${(1 - (d.posts / peak)) * this.viewBoxY}`).join(' '); - this.pointsReply = this.data.map((d, i) => `${(i * this.zoom) + this.pos},${(1 - (d.replies / peak)) * this.viewBoxY}`).join(' '); - this.pointsRepost = this.data.map((d, i) => `${(i * this.zoom) + this.pos},${(1 - (d.reposts / peak)) * this.viewBoxY}`).join(' '); - this.pointsTotal = this.data.map((d, i) => `${(i * this.zoom) + this.pos},${(1 - (d.total / peak)) * this.viewBoxY}`).join(' '); + if (peak != 0) { + this.pointsPost = this.data.map((d, i) => `${(i * this.zoom) + this.pos},${(1 - (d.posts / peak)) * this.viewBoxY}`).join(' '); + this.pointsReply = this.data.map((d, i) => `${(i * this.zoom) + this.pos},${(1 - (d.replies / peak)) * this.viewBoxY}`).join(' '); + this.pointsRepost = this.data.map((d, i) => `${(i * this.zoom) + this.pos},${(1 - (d.reposts / peak)) * this.viewBoxY}`).join(' '); + this.pointsTotal = this.data.map((d, i) => `${(i * this.zoom) + this.pos},${(1 - (d.total / peak)) * this.viewBoxY}`).join(' '); + } }, onMousedown(e) { const clickX = e.clientX; diff --git a/src/web/app/desktop/views/components/friends-maker.vue b/src/web/app/desktop/views/components/friends-maker.vue index 61015b979..ab35efc75 100644 --- a/src/web/app/desktop/views/components/friends-maker.vue +++ b/src/web/app/desktop/views/components/friends-maker.vue @@ -3,20 +3,20 @@ <p class="title">気になるユーザーをフォロー:</p> <div class="users" v-if="!fetching && users.length > 0"> <div class="user" v-for="user in users" :key="user.id"> - <a class="avatar-anchor" :href="`/${user.username}`"> + <router-link class="avatar-anchor" :to="`/${user.username}`"> <img class="avatar" :src="`${user.avatar_url}?thumbnail&size=42`" alt="" v-user-preview="user.id"/> - </a> + </router-link> <div class="body"> - <a class="name" :href="`/${user.username}`" target="_blank" v-user-preview="user.id">{{ user.name }}</a> + <router-link class="name" :to="`/${user.username}`" v-user-preview="user.id">{{ user.name }}</router-link> <p class="username">@{{ user.username }}</p> </div> - <mk-follow-button user="user"/> + <mk-follow-button :user="user"/> </div> </div> <p class="empty" v-if="!fetching && users.length == 0">おすすめのユーザーは見つかりませんでした。</p> <p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%読み込んでいます<mk-ellipsis/></p> <a class="refresh" @click="refresh">もっと見る</a> - <button class="close" @click="$destroy" title="閉じる">%fa:times%</button> + <button class="close" @click="$destroy()" title="閉じる">%fa:times%</button> </div> </template> diff --git a/src/web/app/desktop/views/components/timeline.vue b/src/web/app/desktop/views/components/timeline.vue index a3f27412d..eef62104e 100644 --- a/src/web/app/desktop/views/components/timeline.vue +++ b/src/web/app/desktop/views/components/timeline.vue @@ -4,8 +4,15 @@ <div class="fetching" v-if="fetching"> <mk-ellipsis-icon/> </div> - <p class="empty" v-if="posts.length == 0 && !fetching">%fa:R comments%自分の投稿や、自分がフォローしているユーザーの投稿が表示されます。</p> - <mk-posts :posts="posts" ref="timeline"/> + <p class="empty" v-if="posts.length == 0 && !fetching"> + %fa:R comments%自分の投稿や、自分がフォローしているユーザーの投稿が表示されます。 + </p> + <mk-posts :posts="posts" ref="timeline"> + <div slot="footer"> + <template v-if="!moreFetching">%fa:comments%</template> + <template v-if="moreFetching">%fa:spinner .pulse .fw%</template> + </div> + </mk-posts> </div> </template> @@ -69,8 +76,8 @@ export default Vue.extend({ (this as any).api('posts/timeline', { until_id: this.posts[this.posts.length - 1].id }).then(posts => { + this.posts = this.posts.concat(posts); this.moreFetching = false; - this.posts.unshift(posts); }); }, onPost(post) { @@ -104,7 +111,7 @@ export default Vue.extend({ border solid 1px rgba(0, 0, 0, 0.075) border-radius 6px - > .mk-following-setuper + > .mk-friends-maker border-bottom solid 1px #eee > .fetching diff --git a/src/web/app/desktop/views/components/widgets/users.vue b/src/web/app/desktop/views/components/widgets/users.vue index 4a9ab2aa3..f3a1509cf 100644 --- a/src/web/app/desktop/views/components/widgets/users.vue +++ b/src/web/app/desktop/views/components/widgets/users.vue @@ -7,11 +7,11 @@ <p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p> <template v-else-if="users.length != 0"> <div class="user" v-for="_user in users"> - <router-link class="avatar-anchor" :href="`/${_user.username}`"> + <router-link class="avatar-anchor" :to="`/${_user.username}`"> <img class="avatar" :src="`${_user.avatar_url}?thumbnail&size=42`" alt="" v-user-preview="_user.id"/> </router-link> <div class="body"> - <a class="name" :href="`/${_user.username}`" v-user-preview="_user.id">{{ _user.name }}</a> + <router-link class="name" :to="`/${_user.username}`" v-user-preview="_user.id">{{ _user.name }}</router-link> <p class="username">@{{ _user.username }}</p> </div> <mk-follow-button :user="_user"/>