diff options
| author | dakkar <dakkar@thenautilus.net> | 2024-05-12 13:14:44 +0100 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2024-06-21 11:17:11 +0100 |
| commit | 513a8e5de4272da24e70bb57e90ac4f25cab1f55 (patch) | |
| tree | bd5fcf72255e382d0ea3117acc2848c0fdd1eda0 /packages/frontend/src/components | |
| parent | merge: Misskey fixes & add button to see if notification dot works (!553) (diff) | |
| download | sharkey-513a8e5de4272da24e70bb57e90ac4f25cab1f55.tar.gz sharkey-513a8e5de4272da24e70bb57e90ac4f25cab1f55.tar.bz2 sharkey-513a8e5de4272da24e70bb57e90ac4f25cab1f55.zip | |
select note component in <setup>
this makes our templates much more similar to upstream's, making
merges simpler
changing note design is already marked as needing a reload, so having
non-reactive code that selects the note component is not a problem
Diffstat (limited to 'packages/frontend/src/components')
| -rw-r--r-- | packages/frontend/src/components/MkNotes.vue | 21 | ||||
| -rw-r--r-- | packages/frontend/src/components/MkNotifications.vue | 13 |
2 files changed, 11 insertions, 23 deletions
diff --git a/packages/frontend/src/components/MkNotes.vue b/packages/frontend/src/components/MkNotes.vue index 5240d64661..e9043995f5 100644 --- a/packages/frontend/src/components/MkNotes.vue +++ b/packages/frontend/src/components/MkNotes.vue @@ -15,7 +15,6 @@ SPDX-License-Identifier: AGPL-3.0-only <template #default="{ items: notes }"> <div :class="[$style.root, { [$style.noGap]: noGap }]"> <MkDateSeparatedList - v-if="defaultStore.state.noteDesign === 'misskey'" ref="notes" v-slot="{ item: note }" :items="notes" @@ -27,19 +26,6 @@ SPDX-License-Identifier: AGPL-3.0-only > <MkNote :key="note._featuredId_ || note._prId_ || note.id" :class="$style.note" :note="note" :withHardMute="true"/> </MkDateSeparatedList> - <MkDateSeparatedList - v-else-if="defaultStore.state.noteDesign === 'sharkey'" - ref="notes" - v-slot="{ item: note }" - :items="notes" - :direction="pagination.reversed ? 'up' : 'down'" - :reversed="pagination.reversed" - :noGap="noGap" - :ad="true" - :class="$style.notes" - > - <SkNote :key="note._featuredId_ || note._prId_ || note.id" :class="$style.note" :note="note" :withHardMute="true"/> - </MkDateSeparatedList> </div> </template> </MkPagination> @@ -47,14 +33,17 @@ SPDX-License-Identifier: AGPL-3.0-only <script lang="ts" setup> import { shallowRef, ref } from 'vue'; -import MkNote from '@/components/MkNote.vue'; -import SkNote from '@/components/SkNote.vue'; import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue'; import { i18n } from '@/i18n.js'; import { infoImageUrl } from '@/instance.js'; import { defaultStore } from '@/store.js'; +const MkNote = ( + (defaultStore.state.noteDesign === 'misskey') ? (await import('@/components/MkNote.vue')).default : + (defaultStore.state.noteDesign === 'sharkey') ? (await import('@/components/SkNote.vue')).default : + null); + const props = defineProps<{ pagination: Paging; noGap?: boolean; diff --git a/packages/frontend/src/components/MkNotifications.vue b/packages/frontend/src/components/MkNotifications.vue index 68bf1bf3d8..76dcb5f58d 100644 --- a/packages/frontend/src/components/MkNotifications.vue +++ b/packages/frontend/src/components/MkNotifications.vue @@ -14,14 +14,10 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <template #default="{ items: notifications }"> - <MkDateSeparatedList v-if="defaultStore.state.noteDesign === 'misskey'" v-slot="{ item: notification }" :class="$style.list" :items="notifications" :noGap="true"> + <MkDateSeparatedList v-slot="{ item: notification }" :class="$style.list" :items="notifications" :noGap="true"> <MkNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :key="notification.id + ':note'" :note="notification.note" :withHardMute="true"/> <XNotification v-else :key="notification.id" :notification="notification" :withTime="true" :full="true" class="_panel"/> </MkDateSeparatedList> - <MkDateSeparatedList v-else-if="defaultStore.state.noteDesign === 'sharkey'" v-slot="{ item: notification }" :class="$style.list" :items="notifications" :noGap="true"> - <SkNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :key="notification.id + ':note'" :note="notification.note" :withHardMute="true"/> - <XNotification v-else :key="notification.id" :notification="notification" :withTime="true" :full="true" class="_panel"/> - </MkDateSeparatedList> </template> </MkPagination> </MkPullToRefresh> @@ -32,8 +28,6 @@ import { onUnmounted, onDeactivated, onMounted, computed, shallowRef, onActivate import MkPagination from '@/components/MkPagination.vue'; import XNotification from '@/components/MkNotification.vue'; import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue'; -import MkNote from '@/components/MkNote.vue'; -import SkNote from '@/components/SkNote.vue'; import { useStream } from '@/stream.js'; import { i18n } from '@/i18n.js'; import { notificationTypes } from '@/const.js'; @@ -42,6 +36,11 @@ import { defaultStore } from '@/store.js'; import MkPullToRefresh from '@/components/MkPullToRefresh.vue'; import * as Misskey from 'misskey-js'; +const MkNote = ( + (defaultStore.state.noteDesign === 'misskey') ? (await import('@/components/MkNote.vue')).default : + (defaultStore.state.noteDesign === 'sharkey') ? (await import('@/components/SkNote.vue')).default : + null); + const props = defineProps<{ excludeTypes?: typeof notificationTypes[number][]; }>(); |