diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-18 19:05:11 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-18 19:05:11 +0900 |
| commit | d9986b7a2fabffff50068f4114a16d315941591f (patch) | |
| tree | 7627c97a74a4e175cf8e0357cd380d21ac15b898 /src/client | |
| parent | Improve paging (diff) | |
| download | misskey-d9986b7a2fabffff50068f4114a16d315941591f.tar.gz misskey-d9986b7a2fabffff50068f4114a16d315941591f.tar.bz2 misskey-d9986b7a2fabffff50068f4114a16d315941591f.zip | |
Implement featured note injection
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/components/date-separated-list.vue | 12 | ||||
| -rw-r--r-- | src/client/components/note.vue | 7 | ||||
| -rw-r--r-- | src/client/components/notes.vue | 2 | ||||
| -rw-r--r-- | src/client/pages/my-settings/index.vue | 9 |
4 files changed, 25 insertions, 5 deletions
diff --git a/src/client/components/date-separated-list.vue b/src/client/components/date-separated-list.vue index c425c02dce..5c6917b3f9 100644 --- a/src/client/components/date-separated-list.vue +++ b/src/client/components/date-separated-list.vue @@ -2,7 +2,7 @@ <sequential-entrance class="sqadhkmv" ref="list" :direction="direction" :reversed="reversed"> <template v-for="(item, i) in items"> <slot :item="item" :i="i"></slot> - <div class="separator" :key="item.id + '_date'" v-if="i != items.length - 1 && new Date(item.createdAt).getDate() != new Date(items[i + 1].createdAt).getDate() && !item._prInjectionId_ && !items[i + 1]._prInjectionId_"> + <div class="separator" :key="item.id + '_date'" v-if="showDate(i, item)"> <p class="date"> <span><fa class="icon" :icon="faAngleUp"/>{{ getDateText(item.createdAt) }}</span> <span>{{ getDateText(items[i + 1].createdAt) }}<fa class="icon" :icon="faAngleDown"/></span> @@ -52,6 +52,16 @@ export default Vue.extend({ }); }, + showDate(i, item) { + return ( + i != this.items.length - 1 && + new Date(item.createdAt).getDate() != new Date(this.items[i + 1].createdAt).getDate() && + !item._prId_ && + !this.items[i + 1]._prId_ && + !item._featuredId_ && + !this.items[i + 1]._featuredId_); + }, + focus() { this.$refs.list.focus(); } diff --git a/src/client/components/note.vue b/src/client/components/note.vue index 3a02753c69..4d325f2806 100644 --- a/src/client/components/note.vue +++ b/src/client/components/note.vue @@ -10,7 +10,8 @@ <x-sub v-for="note in conversation" :key="note.id" :note="note"/> <x-sub :note="appearNote.reply" class="reply-to" v-if="appearNote.reply"/> <div class="info" v-if="pinned"><fa :icon="faThumbtack"/> {{ $t('pinnedNote') }}</div> - <div class="info" v-if="appearNote._prInjectionId_"><fa :icon="faBullhorn"/> {{ $t('promotion') }}<button class="_textButton hide" @click="readPromo()">{{ $t('hideThisNote') }}</button></div> + <div class="info" v-if="appearNote._prId_"><fa :icon="faBullhorn"/> {{ $t('promotion') }}<button class="_textButton hide" @click="readPromo()">{{ $t('hideThisNote') }} <fa :icon="faTimes"/></button></div> + <div class="info" v-if="appearNote._featuredId_"><fa :icon="faBolt"/> {{ $t('featured') }}</div> <div class="renote" v-if="isRenote"> <mk-avatar class="avatar" :user="note.user"/> <fa :icon="faRetweet"/> @@ -84,7 +85,7 @@ <script lang="ts"> import Vue from 'vue'; -import { faBullhorn, faStar, faLink, faExternalLinkSquareAlt, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faQuoteRight } from '@fortawesome/free-solid-svg-icons'; +import { faBolt, faTimes, faBullhorn, faStar, faLink, faExternalLinkSquareAlt, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faQuoteRight } from '@fortawesome/free-solid-svg-icons'; import { faCopy, faTrashAlt, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons'; import { parse } from '../../mfm/parse'; import { sum, unique } from '../../prelude/array'; @@ -141,7 +142,7 @@ export default Vue.extend({ replies: [], showContent: false, hideThisNote: false, - faBullhorn, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan + faBolt, faTimes, faBullhorn, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan }; }, diff --git a/src/client/components/notes.vue b/src/client/components/notes.vue index 2bf6327b09..dc93c1f6c4 100644 --- a/src/client/components/notes.vue +++ b/src/client/components/notes.vue @@ -15,7 +15,7 @@ </div> <x-list ref="notes" class="notes" :items="notes" v-slot="{ item: note }" :direction="reversed ? 'up' : 'down'" :reversed="reversed"> - <x-note :note="note" :detail="detail" :key="note._prInjectionId_ || note.id"/> + <x-note :note="note" :detail="detail" :key="note._featuredId_ || note._prId_ || note.id"/> </x-list> <div class="more" v-if="more && !reversed" style="margin-top: var(--margin);"> diff --git a/src/client/pages/my-settings/index.vue b/src/client/pages/my-settings/index.vue index 65300fac83..4742793f2b 100644 --- a/src/client/pages/my-settings/index.vue +++ b/src/client/pages/my-settings/index.vue @@ -13,6 +13,9 @@ <mk-switch v-model="$store.state.i.autoWatch" @change="onChangeAutoWatch"> {{ $t('autoNoteWatch') }}<template #desc>{{ $t('autoNoteWatchDescription') }}</template> </mk-switch> + <mk-switch v-model="$store.state.i.injectFeaturedNote" @change="onChangeInjectFeaturedNote"> + {{ $t('showFeaturedNotesInTimeline') }} + </mk-switch> </div> <div class="_content"> <mk-button @click="readAllNotifications">{{ $t('markAsReadAllNotifications') }}</mk-button> @@ -84,6 +87,12 @@ export default Vue.extend({ }); }, + onChangeInjectFeaturedNote(v) { + this.$root.api('i/update', { + injectFeaturedNote: v + }); + }, + readAllUnreadNotes() { this.$root.api('i/read_all_unread_notes'); }, |