diff --git a/packages/client/src/components/MkChatPreview.vue b/packages/client/src/components/MkChatPreview.vue new file mode 100644 index 000000000..e994d0ab3 --- /dev/null +++ b/packages/client/src/components/MkChatPreview.vue @@ -0,0 +1,193 @@ + + + + + + {{ message.group.name }} + + + + + @{{ acct(isMe(message) ? message.recipient : message.user) }} + + + + + {{ i18n.ts.you }}: + {{ + message.text + }} + 📎 + + + + + + + + + diff --git a/packages/client/src/pages/messaging/index.vue b/packages/client/src/pages/messaging/index.vue index e32d3defb..8119f34b1 100644 --- a/packages/client/src/pages/messaging/index.vue +++ b/packages/client/src/pages/messaging/index.vue @@ -80,7 +80,6 @@ import { Virtual } from 'swiper'; import { Swiper, SwiperSlide } from 'swiper/vue'; import MkChatPreview from '@/components/MkChatPreview.vue'; import MkPagination from '@/components/MkPagination.vue'; -import { acct } from '@/filters/user'; import * as os from '@/os'; import { stream } from '@/stream'; import { useRouter } from '@/router'; @@ -94,11 +93,23 @@ import 'swiper/scss/virtual'; const router = useRouter(); - let messages = $ref([]); let connection = $ref(null); -const getAcct = Acct.toString; +const dmsPagination = { + endpoint: 'messaging/history' as const, + limit: 20, + params: { + group: false, + }, +}; +const groupsPagination = { + endpoint: 'messaging/history' as const, + limit: 10, + params: { + group: true, + }, +}; const tabs = ['dms', 'groups']; let tab = $ref(tabs[0]); @@ -136,10 +147,6 @@ function syncSlide(index) { swiperRef.slideTo(index); } -function isMe(message) { - return message.userId === $i.id; -} - function onMessage(message) { if (message.recipientId) { messages = messages.filter(m => !(
+ {{ i18n.ts.you }}: + {{ + message.text + }} + 📎 +