diff --git a/package.json b/package.json index 55e1b58..35aea72 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@capacitor/preferences": "^5.0.7", "@fontsource/roboto": "^5.0.12", "@mdi/font": "^7.4.47", + "dayjs": "^1.11.10", "dompurify": "^3.0.11", "marked": "^12.0.1", "nprogress": "^0.2.0", diff --git a/src/components/chat/ChatMessage.vue b/src/components/chat/ChatMessage.vue index 0722648..207b8e1 100644 --- a/src/components/chat/ChatMessage.vue +++ b/src/components/chat/ChatMessage.vue @@ -2,11 +2,9 @@
- + + {{ props.item?.reply_to?.content }} - - from {{ props.item?.reply_to?.sender.account.name }} -
@@ -21,7 +19,11 @@
-
{{ props.item?.sender.account.nick }}
+
+ {{ props.item?.sender.account.nick }} + {{ createdAt }} + #{{ props.item?.id }} +
{{ props.item?.content }}
- - + +
@@ -48,6 +52,8 @@ import { useChannels } from "@/stores/channels" import { useUserinfo } from "@/stores/userinfo" import { computed } from "vue" +import dayjs from "dayjs" +import relativeTime from "dayjs/plugin/relativeTime" import MessageAttachment from "@/components/chat/renderer/MessageAttachment.vue" const id = useUserinfo() @@ -55,7 +61,15 @@ const channels = useChannels() const props = defineProps<{ item: any }>() +dayjs.extend(relativeTime) + const isOwned = computed(() => props.item?.sender?.account_id === id.userinfo.idSet.messaging) +const createdAt = computed(() => dayjs(props.item?.created_at).fromNow()) + +const replyingFromPicture = computed(() => props.item?.reply_to.sender.account?.avatar ? + props.item?.reply_to.sender.account?.avatar : + null +) function replyMessage() { channels.related.messages.reply_to = JSON.parse(JSON.stringify(props.item)) diff --git a/src/components/common/SnackbarProvider.vue b/src/components/common/SnackbarProvider.vue index 5b71c14..721df7d 100644 --- a/src/components/common/SnackbarProvider.vue +++ b/src/components/common/SnackbarProvider.vue @@ -1,7 +1,15 @@ @@ -12,7 +20,7 @@ import { useUI } from "@/stores/ui" const ui = useUI() -