This commit is contained in:
syuilo 2018-04-16 15:13:31 +09:00
parent 52b74c35f2
commit 8ff8f14d4e
3 changed files with 16 additions and 15 deletions

View file

@ -13,9 +13,7 @@
<p class="location" v-if="user.host === null && user.profile.location">%fa:map-marker%{{ user.profile.location }}</p> <p class="location" v-if="user.host === null && user.profile.location">%fa:map-marker%{{ user.profile.location }}</p>
</div> </div>
<footer> <footer>
<router-link :to="user | userPage" :data-active="$parent.page == 'home'">%fa:home%概要</router-link> <router-link :to="user | userPage" :data-active="$parent.page == 'home'">%fa:home%ホーム</router-link>
<router-link :to="user | userPage('media')" :data-active="$parent.page == 'media'">%fa:image%メディア</router-link>
<router-link :to="user | userPage('graphs')" :data-active="$parent.page == 'graphs'">%fa:chart-bar%グラフ</router-link>
</footer> </footer>
</div> </div>
</div> </div>

View file

@ -3,6 +3,7 @@
<header> <header>
<span :data-is-active="mode == 'default'" @click="mode = 'default'">投稿</span> <span :data-is-active="mode == 'default'" @click="mode = 'default'">投稿</span>
<span :data-is-active="mode == 'with-replies'" @click="mode = 'with-replies'">投稿と返信</span> <span :data-is-active="mode == 'with-replies'" @click="mode = 'with-replies'">投稿と返信</span>
<span :data-is-active="mode == 'with-media'" @click="mode = 'with-media'">メディア</span>
</header> </header>
<div class="loading" v-if="fetching"> <div class="loading" v-if="fetching">
<mk-ellipsis-icon/> <mk-ellipsis-icon/>
@ -31,16 +32,16 @@ export default Vue.extend({
date: null date: null
}; };
}, },
watch: {
mode() {
this.fetch();
}
},
computed: { computed: {
empty(): boolean { empty(): boolean {
return this.notes.length == 0; return this.notes.length == 0;
} }
}, },
watch: {
mode() {
this.fetch();
}
},
mounted() { mounted() {
document.addEventListener('keydown', this.onDocumentKeydown); document.addEventListener('keydown', this.onDocumentKeydown);
window.addEventListener('scroll', this.onScroll); window.addEventListener('scroll', this.onScroll);
@ -63,7 +64,8 @@ export default Vue.extend({
(this as any).api('users/notes', { (this as any).api('users/notes', {
userId: this.user.id, userId: this.user.id,
untilDate: this.date ? this.date.getTime() : undefined, untilDate: this.date ? this.date.getTime() : undefined,
with_replies: this.mode == 'with-replies' includeReplies: this.mode == 'with-replies',
withMedia: this.mode == 'with-media'
}).then(notes => { }).then(notes => {
this.notes = notes; this.notes = notes;
this.fetching = false; this.fetching = false;
@ -75,7 +77,8 @@ export default Vue.extend({
this.moreFetching = true; this.moreFetching = true;
(this as any).api('users/notes', { (this as any).api('users/notes', {
userId: this.user.id, userId: this.user.id,
with_replies: this.mode == 'with-replies', includeReplies: this.mode == 'with-replies',
withMedia: this.mode == 'with-media',
untilId: this.notes[this.notes.length - 1].id untilId: this.notes[this.notes.length - 1].id
}).then(notes => { }).then(notes => {
this.moreFetching = false; this.moreFetching = false;

View file

@ -44,15 +44,15 @@
</header> </header>
<nav> <nav>
<div class="nav-container"> <div class="nav-container">
<a :data-is-active=" page == 'home' " @click="page = 'home'">%i18n:@overview%</a> <a :data-is-active="page == 'home'" @click="page = 'home'">%i18n:@overview%</a>
<a :data-is-active=" page == 'notes' " @click="page = 'notes'">%i18n:@timeline%</a> <a :data-is-active="page == 'notes'" @click="page = 'notes'">%i18n:@timeline%</a>
<a :data-is-active=" page == 'media' " @click="page = 'media'">%i18n:@media%</a> <a :data-is-active="page == 'media'" @click="page = 'media'">%i18n:@media%</a>
</div> </div>
</nav> </nav>
<div class="body"> <div class="body">
<x-home v-if="page == 'home'" :user="user"/> <x-home v-if="page == 'home'" :user="user"/>
<mk-user-timeline v-if="page == 'notes'" :user="user"/> <mk-user-timeline v-if="page == 'notes'" :user="user" key="tl"/>
<mk-user-timeline v-if="page == 'media'" :user="user" with-media/> <mk-user-timeline v-if="page == 'media'" :user="user" :with-media="true" key="media"/>
</div> </div>
</main> </main>
</mk-ui> </mk-ui>