diff --git a/apis/chatApi.js b/apis/chatApi.js index 473edb2..debbf65 100644 --- a/apis/chatApi.js +++ b/apis/chatApi.js @@ -49,6 +49,9 @@ export default { updateAvatar: 'group/ed/avatar/', }, + entity:{ + get: "get", + }, // myMessages: { // list: "message/get/ext/", // create: 'message/set', diff --git a/components/chat/components/ChatList.vue b/components/chat/components/ChatList.vue index e049ebd..f83c30c 100644 --- a/components/chat/components/ChatList.vue +++ b/components/chat/components/ChatList.vue @@ -1459,25 +1459,26 @@ // import Vue from "vue"; // import VueRecord from "@codekraft-studio/vue-record"; import { mapState, mapActions } from "pinia"; +import { useChatStore } from "@chat/stores/chatStore"; +import { useCommonStore } from "@stores/commonStore"; +import chatApi from "@chat/apis/chatApi"; -import chatApi from "~/apis/chatApi"; - -import replayMixin from "~/chat/mixins/replayMixin"; -import createdMixin from "~/chat/mixins/createdMixin"; -import mountedMixin from "~/chat/mixins/mountedMixin"; -import fileMixin from "~/chat/mixins/fileMixin"; -import virtialListMixin from "~/chat/mixins/virtialListMixin"; -import headerMixin from "~/chat/mixins/headerMixin"; -import jahatMixin from "~/chat/mixins/jahatMixin"; -import forwardMixin from "~/chat/mixins/forwardMixin"; -import commonMixin from "~/chat/mixins/commonMixin"; -import messageMixin from "~/chat/mixins/messageMixin"; +import replayMixin from "@chat/mixins/replayMixin"; +import createdMixin from "@chat/mixins/createdMixin"; +import mountedMixin from "@chat/mixins/mountedMixin"; +import fileMixin from "@chat/mixins/fileMixin"; +import virtialListMixin from "@chat/mixins/virtialListMixin"; +import headerMixin from "@chat/mixins/headerMixin"; +import jahatMixin from "@chat/mixins/jahatMixin"; +import forwardMixin from "@chat/mixins/forwardMixin"; +import commonMixin from "@chat/mixins/commonMixin"; +import messageMixin from "@chat/mixins/messageMixin"; // import lobbiesContextMenu from "~/json/chat/json/lobbiesContextMenu.json"; -import VirtualList from "vue-virtual-scroll-list"; -import ChatListItem from "~/chat/components/ChatListItem"; +// import VirtualList from "vue-virtual-scroll-list"; +import ChatListItem from "@chat/components/chat/components/ChatListItem"; -import entityFields from "~/json/chat/json/entityFields.json"; +import entityFields from "@chat/json/entityFields.json"; // Vue.use(VueRecord); @@ -1684,7 +1685,7 @@ export default { }; }, computed: { - ...mapState([ + ...mapState(useCommonStore, [ "getPanelStatus", "isSidebarCollapsed", "sectionsGetter", @@ -1693,7 +1694,7 @@ export default { "isGuest", "sidebarListStatusGetter", ]), - ...mapState("list", ["listGetter"]), + ...mapState(useChatStore, ["listGetter"]), amIGroupAdmin() { if (this.listGetter?.admins) @@ -1725,8 +1726,11 @@ export default { }, }, methods: { - ...mapActions(["checkPermissions", "getUserPermissionTags"]), - ...mapActions([ + ...mapActions(useCommonStore, [ + "checkPermissions", + "getUserPermissionTags", + ]), + ...mapActions(useChatStore, [ "SET_SECTIONS", "SET_FORWARD_ITEM", "SET_AUTHORIZED_PAGES", diff --git a/components/chat/components/ChatListItem.vue b/components/chat/components/ChatListItem.vue new file mode 100644 index 0000000..efb0377 --- /dev/null +++ b/components/chat/components/ChatListItem.vue @@ -0,0 +1,804 @@ + + + + + + + + + + + + + + + + {{ userFullname(source.user) }} + + + + + + + + + {{ sectionItem?.lable }} + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ source.attachment.name }} + + + {{ formatBytes(source.attachment.size) }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #{{ tag }} + + + + + + + + + {{ subjectInput }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ labelItem.lable }} + + + + + + + + + + + + + + + + + + + + diff --git a/components/chat/components/Group.vue b/components/chat/components/Group.vue index 38188cc..188ffe3 100644 --- a/components/chat/components/Group.vue +++ b/components/chat/components/Group.vue @@ -331,14 +331,14 @@ @@ -411,14 +411,14 @@ @@ -492,14 +492,14 @@ @@ -1279,13 +1279,13 @@ import chatApi from "@chat/apis/chatApi"; import { mapState, mapActions } from "pinia"; -import privatesContextMenu from "@chat/json/chat/json/privatesContextMenu.json"; -import groupsContextMenu from "@chat/json/chat/json/groupsContextMenu.json"; +import privatesContextMenu from "@chat/json/privatesContextMenu.json"; +import groupsContextMenu from "@chat/json/groupsContextMenu.json"; -import lobbiesChildContextMenu from "@chat/json/chat/json/lobbiesChildContextMenu.json"; -import lobbiesParentContextMenu from "@chat/json/chat/json/lobbiesParentContextMenu.json"; +import lobbiesChildContextMenu from "@chat/json/lobbiesChildContextMenu.json"; +import lobbiesParentContextMenu from "@chat/json/lobbiesParentContextMenu.json"; -import menu from "@chat/json/chat/json/menu.json"; +import menu from "@chat/json/menu.json"; import { useCommonStore } from "@stores/commonStore"; import { useChatStore } from "@chat/stores/chatStore"; @@ -1308,7 +1308,7 @@ export default { $route: { handler: function (to) { if (this.getForwardItem) { - this.groupId = this.getForwardItem?.to.id; + this.groupId = this.getForwardItem?.to?.id; } this.isRedirectedFromOtherSystems = false; this.resetPagination(); @@ -1590,6 +1590,33 @@ export default { }, methods: { ...mapActions(useChatStore, ["SET_LIST", "SET_SIDEBAR_LIST_STATUS"]), + async getGroupAvatar(user = undefined) { + const res = (await import("~/assets/common/img/icomoon/PNG/eye.png")) + .default; + console.info(res); + + try { + if (user) { + if (isValidHttpUrl(user.avatar)) return user.avatar; + else { + if ("title" in user) { + const nameArray = user.title?.split(" "); + if (nameArray?.length > 1) { + const initials = + nameArray[0].charAt(0) + nameArray[1].charAt(0); + return generateAvatarFromChars(initials); + } else { + const initials = nameArray[0].charAt(0); + return generateAvatarFromChars(initials); + } + } else + return (await import("~/assets/common/img/default.svg")).default; + } + } else return (await import("~/assets/common/img/default.svg")).default; + } catch (err) { + return (await import("~/assets/common/img/default.svg")).default; + } + }, handleImageSrcOnError({ target }, isUserAvatar = true) { if (isUserAvatar) target.classList.add("human-avatar"); target.classList.add("error"); @@ -2030,11 +2057,11 @@ export default { markActive(groups, index) { try { if (this.prevSelectedItemIndex != index) { - this.$set(groups[this.prevSelectedItemIndex], "active", false); + groups[this.prevSelectedItemIndex], "active", false; } this.prevSelectedItemIndex = index; - this.$set(groups[index], "active", true); + groups[index], "active", true; } catch (err) { this.prevSelectedItemIndex = undefined; } @@ -2060,8 +2087,8 @@ export default { // برای دریافت درست پاسخ ها بایستی invite-id // در روت رو اصلاح کرد if (groupItem.redirectViaInviteLink) - this.$set(this.$route.query, "invite-id", this.listGetter?.invite_id); - else this.$set(this.$route.query, "invite-id", undefined); + this.$route.query, "invite-id", this.listGetter?.invite_id; + else this.$route.query, "invite-id", undefined; if (!this.redirectViaInviteLink) history.pushState( @@ -2072,8 +2099,8 @@ export default { this.isRedirectedFromOtherSystems = false; this.redirectViaInviteLink = false; - this.$set(this.$route.query, "group-id", undefined); - this.$set(this.$route.query, "message-id", undefined); + this.$route.query, "group-id", undefined; + this.$route.query, "message-id", undefined; // this.$route.query["group-id"] = undefined; // this.$route.query["message-id"] = undefined; if (groupItem.type == 0) @@ -2089,28 +2116,24 @@ export default { lobbyParentShowMessages(lobby, parentIndex, groupItem) { // اگر تالارثابت باشه و کاربر بر روی گروه های تالار کلیک کند. if (this.prevParentSelectedItemIndex == parentIndex) { - this.$set( - lobby[this.prevParentSelectedItemIndex].sub_groups[ - this.prevSelectedItemIndex - ], + lobby[this.prevParentSelectedItemIndex].sub_groups[ + this.prevSelectedItemIndex + ], "active", - false - ); + false; } // کاربر بر روی تالار دیگری کلیک کرده است. else if (this.prevParentSelectedItemIndex != parentIndex) { - this.$set( - lobby[this.prevParentSelectedItemIndex].sub_groups[ - this.prevSelectedItemIndex - ], + lobby[this.prevParentSelectedItemIndex].sub_groups[ + this.prevSelectedItemIndex + ], "active", - false - ); + false; } this.prevParentSelectedItemIndex = parentIndex; - this.$set(lobby[parentIndex], "active", true); + lobby[parentIndex], "active", true; this.SET_LIST(groupItem); this.$emit("update-messages"); @@ -2123,29 +2146,25 @@ export default { this.prevParentSelectedItemIndex == parentIndex && this.prevSelectedItemIndex != index ) { - this.$set( - lobby[this.prevParentSelectedItemIndex].sub_groups[ - this.prevSelectedItemIndex - ], + lobby[this.prevParentSelectedItemIndex].sub_groups[ + this.prevSelectedItemIndex + ], "active", - false - ); + false; } // کاربر بر روی تالار دیگری کلیک کرده است. else if (this.prevParentSelectedItemIndex != parentIndex) { - this.$set( - lobby[this.prevParentSelectedItemIndex].sub_groups[ - this.prevSelectedItemIndex - ], + lobby[this.prevParentSelectedItemIndex].sub_groups[ + this.prevSelectedItemIndex + ], "active", - false - ); + false; } this.prevSelectedItemIndex = index; this.prevParentSelectedItemIndex = parentIndex; - this.$set(lobby[parentIndex].sub_groups[index], "active", true); + lobby[parentIndex].sub_groups[index], "active", true; this.SET_LIST(groupItem); this.$emit("update-messages"); @@ -2437,7 +2456,7 @@ export default { .postRequest(url, payload) .then((res) => { // this.$route.query["invite-id"] = undefined; - this.$set(this.$route.query, "invite-id", undefined); + this.$route.query, "invite-id", undefined; this.groupId = res.data.id; this.resetPagination(); diff --git a/components/chat/components/MyVuePlyr.vue b/components/chat/components/MyVuePlyr.vue new file mode 100644 index 0000000..be93661 --- /dev/null +++ b/components/chat/components/MyVuePlyr.vue @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + {{ file.attachment.name }} + + + {{ formatBytes(file.attachment.length) }} + + + + + + + diff --git a/components/chat/modals/ChatAnswerModal.vue b/components/chat/modals/ChatAnswerModal.vue index 9c6b639..e8f2dbb 100644 --- a/components/chat/modals/ChatAnswerModal.vue +++ b/components/chat/modals/ChatAnswerModal.vue @@ -125,8 +125,8 @@
+ {{ formatBytes(source.attachment.size) }} +
+ {{ file.attachment.name }} +
+ {{ formatBytes(file.attachment.length) }} +
+ {{ source.attachment.name }} +
++ {{ formatBytes(source.attachment.size) }} +
+