From 22c61707879891db048aed1bcace5db6a44fa153 Mon Sep 17 00:00:00 2001 From: adb Date: Fri, 9 Apr 2021 01:02:18 +0200 Subject: [PATCH 01/18] extract event from timeline.vue to message.vue & message.vue -> event.vue --- src/components/event.vue | 134 ++++++++++++++++++++++++++++++++++++ src/components/message.vue | 91 ------------------------ src/components/timeline.vue | 65 +++-------------- 3 files changed, 145 insertions(+), 145 deletions(-) create mode 100644 src/components/event.vue delete mode 100644 src/components/message.vue diff --git a/src/components/event.vue b/src/components/event.vue new file mode 100644 index 0000000..1d33677 --- /dev/null +++ b/src/components/event.vue @@ -0,0 +1,134 @@ + + + + + \ No newline at end of file diff --git a/src/components/message.vue b/src/components/message.vue deleted file mode 100644 index 5186bf6..0000000 --- a/src/components/message.vue +++ /dev/null @@ -1,91 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/components/timeline.vue b/src/components/timeline.vue index 78f70bc..661dc22 100644 --- a/src/components/timeline.vue +++ b/src/components/timeline.vue @@ -24,38 +24,23 @@ > {{calcUserName(group[0].sender)}} -
- -
- {{event.content.body}} - {{getTime(event.origin_server_ts)}} -
-
- {{membershipEvents[event.content.membership]}} - {{getTime(event.origin_server_ts)}} -
-
unknown event - {{getTime(event.origin_server_ts)}}
-
+ :type="event.sender === user?'send':'receive'" + :event="event" + :on-update="()=>onUpdate()" + /> @@ -137,24 +112,6 @@ export default { margin-left: 1rem; font-weight: bold; } - .event{ - .info { - font-style: italic; - margin-top: 0.5rem; - margin-bottom: 0.5rem; - margin-left: 0.5rem; - .time { - font-size: 0.7rem; - } - } - .notice{ - margin-top: 0.5rem; - margin-bottom: 0.5rem; - .time{ - font-size: 0.7rem; - } - } - } .indent{ margin-left: 2.5rem; } From 30a7e4da81ebabf59a7fd650009b494d415dee8d Mon Sep 17 00:00:00 2001 From: adb Date: Fri, 9 Apr 2021 01:03:11 +0200 Subject: [PATCH 02/18] fix login userid regex --- src/views/login.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/login.vue b/src/views/login.vue index 713ab5d..45570ee 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -42,7 +42,7 @@ export default { } if (this.password === '') { this.loginError = 'password is empty'; return; - } if (!(this.user.match(/^@[a-zA-Z0-9]+:[a-z0-9]+\.[a-z]/))) { + } if (!(this.user.match(/^@[a-zA-Z0-9_.+-]+:[a-z0-9.-]+\.[a-z]+$/))) { this.loginError = 'username is in wrong style'; return; } From 8a9b5a478ba68ad5bc9cdc76eaecad09bcf7ab37 Mon Sep 17 00:00:00 2001 From: adb Date: Fri, 9 Apr 2021 21:05:33 +0200 Subject: [PATCH 03/18] fix setReply / add manageScrollBottom --- src/components/timeline.vue | 4 ++-- src/views/chat.vue | 29 +++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/components/timeline.vue b/src/components/timeline.vue index 661dc22..6dd2444 100644 --- a/src/components/timeline.vue +++ b/src/components/timeline.vue @@ -29,10 +29,10 @@ :key="event.origin_server_ts" :class="groupTimeline?'indent event':'event'" :title="`${group[0].sender} at ${getTime(event.origin_server_ts)}`" - @contextmenu.prevent="setReplyTo(event)" + @contextmenu.prevent.native="setReplyTo(event)" :type="event.sender === user?'send':'receive'" :event="event" - :on-update="()=>onUpdate()" + :on-update="onUpdate" /> diff --git a/src/views/chat.vue b/src/views/chat.vue index df6c343..faeaee0 100644 --- a/src/views/chat.vue +++ b/src/views/chat.vue @@ -7,16 +7,17 @@ - + @@ -28,6 +29,7 @@ import {matrix} from '@/main'; import splitArray from '@/lib/splitArray.js' import timeline from '@/components/timeline'; import scrollHandler from '@/lib/scrollHandler'; +import {getUser} from "@/lib/matrixUtils"; export default { name: 'chat', @@ -48,8 +50,9 @@ export default { if (this.$refs.timelineContainer.scrollTop < 400 && this.loadingStatus !== 'loading') this.loadEvents(); this.showScrollBtn = this.scroll.getScrollBottom() > 500; }, - resize(height = this.$refs.newMessage.clientHeight){ + resize(height = this.$refs.newMessage.$refs.newMessageBanner.clientHeight){ this.$refs.chatContainer.style.height = `calc(100% - ${height}px - 3.5rem)`; + this.manageScrollBottom(); }, isGroup(){ return Object.keys(this.room.currentState.members).length > 2; @@ -61,9 +64,19 @@ export default { this.loadingStatus = 'load more'; this.scroll.setScrollBottom(scrollBottom) }, - getUser(userId){ - return matrix.client.getUser(userId); + setReplyTo(event){ + this.replyTo=event; + this.$refs.newMessage.focusInput(); + this.$nextTick(this.resize); }, + resetReplyTo(){ + this.replyTo=undefined; + this.$nextTick(this.resize); + }, + manageScrollBottom(){ + if(this.scroll.getScrollBottom() < 400 && this.loadingStatus !== 'loading') this.scroll.scrollToBottom(); + }, + getUser, splitArray }, data(){ @@ -76,7 +89,7 @@ export default { } }, updated(){ - if(this.scroll.getScrollBottom() < 400 && this.loadingStatus !== 'loading') this.scroll.scrollToBottom(); + this.manageScrollBottom(); }, mounted(){ this.scroll = new scrollHandler(this.$refs.timelineContainer); From dfaa87f5e773be9fc2331aa44106928ef38ae3b8 Mon Sep 17 00:00:00 2001 From: adb Date: Sun, 11 Apr 2021 00:22:13 +0200 Subject: [PATCH 04/18] fix getMXC add getMediaUrl / fix link color --- src/App.vue | 3 +++ src/components/avatar.vue | 6 +++--- src/lib/getMxc.js | 8 +++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index da08dba..79a747d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -39,6 +39,9 @@ input:focus{ color: #000; background-color: #fff; } +a{ + color: #00BCD4; +} *{ scrollbar-width: thin; scrollbar-color: #42b983 #2220; diff --git a/src/components/avatar.vue b/src/components/avatar.vue index 04ba8cf..a447cd5 100644 --- a/src/components/avatar.vue +++ b/src/components/avatar.vue @@ -1,11 +1,11 @@ + + \ No newline at end of file From 01fe023d0688c32b5b84218bf8789d682b29918c Mon Sep 17 00:00:00 2001 From: adb Date: Sun, 11 Apr 2021 01:39:25 +0200 Subject: [PATCH 06/18] fix if prop undefined for getMxc and event --- src/components/event.vue | 2 +- src/lib/getMxc.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/event.vue b/src/components/event.vue index 9b632e6..86657f4 100644 --- a/src/components/event.vue +++ b/src/components/event.vue @@ -1,7 +1,7 @@ + + \ No newline at end of file diff --git a/src/views/rooms.vue b/src/views/rooms.vue index 3a9bc23..494d7f5 100644 --- a/src/views/rooms.vue +++ b/src/views/rooms.vue @@ -6,16 +6,35 @@

[chat]

[c]

-
- rooms ↴

+ +
+

users ↴

+ +

suggestions ↴

+
+

create chat: {{search}} ➤

+

join room: {{search}} ➤

+

create room: {{search}} ➤

+ +
Please select a room to be displayed.
+
+ + \ No newline at end of file diff --git a/src/components/newMessage.vue b/src/components/newMessage.vue index 73f0dd4..d9f61bd 100644 --- a/src/components/newMessage.vue +++ b/src/components/newMessage.vue @@ -1,57 +1,69 @@