diff --git a/src/assets/css/_variables.scss b/src/assets/css/_variables.scss index 42d9106..06679d4 100644 --- a/src/assets/css/_variables.scss +++ b/src/assets/css/_variables.scss @@ -23,4 +23,6 @@ $poll-hilite-color: #6360f0; $poll-hilite-color-bg: #d6d5fc; $alert-bg-color: #FF3300; -$min-touch-target: 48px; \ No newline at end of file +$min-touch-target: 48px; +$large-button-height: $min-touch-target; +$small-button-height: 36px; diff --git a/src/assets/css/chat.scss b/src/assets/css/chat.scss index 7ccc21c..c1ebdc2 100644 --- a/src/assets/css/chat.scss +++ b/src/assets/css/chat.scss @@ -3,7 +3,6 @@ @use "@/assets/css/variables" as *; @use "@/assets/css/main.scss" as *; @use "@/assets/css/vendors/v-emoji-picker" as *; -@use "@/assets/css/filedrop.scss" as *; @use "@/assets/css/channel.scss" as *; @use "sass:map"; diff --git a/src/assets/css/filedrop.scss b/src/assets/css/filedrop.scss deleted file mode 100644 index f3e10b0..0000000 --- a/src/assets/css/filedrop.scss +++ /dev/null @@ -1,367 +0,0 @@ -@use "@/assets/css/variables" as *; - -$large-button-height: $min-touch-target; -$small-button-height: 36px; - -.file-drop-root { - $hiliteColor: #4642f1; - font-family: "Inter", sans-serif; - position: absolute; - top: 0px; - left: 0; - right: 0; - bottom: 0; - margin: 0; - background-color: var(--v-background-color); - color: var(--v-foreground-color); - overflow: hidden; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - text-align: center; - padding: 16px; - - .file-drop-title { - color: #fff; - text-align: center; - font-size: 11.54 * $chat-text-size; - font-family: "Inter", sans-serif; - font-weight: 700; - line-height: 140%; - letter-spacing: 0.34px; - text-transform: uppercase; - margin-top: 13px; - margin-bottom: 25px; - } - .background { - width: 100%; - height: 50%; - background-color: #181719; - &.drop-target { - background-color: #383739; - } - border-radius: 19px; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - } - - .file-format-info { - opacity: 0.6; - color: #fff; - text-align: center; - font-size: 11 * $chat-text-size; - font-family: "Inter", sans-serif; - line-height: 117%; - letter-spacing: 0.4px; - margin-top: 13px; - background: transparent; - } - - .v-btn { - font-family: "Inter", sans-serif; - font-weight: 700; - font-size: 11.54 * $chat-text-size; - line-height: 140%; - color: white; - background-color: $hiliteColor !important; - border-radius: $small-button-height * 0.5; - min-height: 0; - height: $small-button-height !important; - margin-top: $chat-standard-padding-xs; - margin-bottom: $chat-standard-padding-xs; - &.large { - padding: 16px 23px; - height: $large-button-height; - border-radius: $large-button-height * 0.5; - } - } - - textarea { - color: rgba(white, 80%) !important; - } - textarea::placeholder { - color: rgba(white, 80%) !important; - } - - .attachment-wrapper { - width: 100%; - flex: 0 0 100%; - overflow-y: auto; - } - .file-drop-current-item { - width: 100%; - height: 70%; - background-color: #181719; - &.drop-target { - background-color: #383739; - } - border-radius: 19px; - overflow: hidden; - .v-img { - width: 100%; - height: 100%; - object-fit: cover; - } - .filename { - width: 100%; - height: 100%; - display: flex; - align-items: center; - justify-content: center; - } - } - .file-drop-thumbnail-container { - width: 100%; - padding: 13px 20px 15px 20px; - height: 74px; - overflow-x: auto; - overflow-y: hidden; - white-space: nowrap; - text-align: start; - - /* Hide scrollbar for Chrome, Safari and Opera */ - &::-webkit-scrollbar { - display: none; - } - /* Hide scrollbar for IE, Edge and Firefox */ - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ - - .file-drop-thumbnail { - width: 46px; - height: 46px; - border-radius: 9px; - overflow: hidden; - background-color: #242424; - border: 2px solid white; - display: inline-block; - position: relative; - &.current { - border: 2px solid #4642f1; - } - &.noborder { - border: 2px solid transparent; - } - .v-img { - width: 100%; - height: 100%; - object-fit: cover; - } - margin-right: 8px; - - .add, - .remove { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - display: flex; - align-items: center; - justify-content: center; - .v-icon { - width: 14px; - height: 15.75px; - } - } - .remove { - // Slight background to make visible - background-color: rgba(black, 0.2); - } - } - } - - .file-drop-section { - margin-top: 20px; - padding: 16px 18px; - background-color: #181719; - border-radius: 19px; - } - - .file-drop-input-container, - .file-drop-sending-input-container, - .file-drop-sent-input-container { - position: relative; - width: 100%; - min-height: 20%; - background-color: #181719; - border-radius: 19px; - display: flex; - flex-direction: column; - .input-area-text { - flex: 0 0 auto; - width: 100%; - margin-bottom: 50px; - padding: 16px 18px; - font-family: "Inter", sans-serif; - font-weight: 300; - } - .v-btn { - position: absolute; - right: 8px; - bottom: 10px; - } - } - - @keyframes fadeInStackItem { - from {opacity: 0;} - to {opacity: 1;} - } - - // Sending - // - .file-drop-sent-stack { - width: 100%; - height: 30%; - display: flex; - align-items: center; - justify-content: center; - .no-items { - display: flex; - align-items: center; - justify-content: center; - div { - position: absolute; - } - .file-drop-stack-item { - transform: rotate(-4.4deg); - } - color: #fff; - text-align: center; - font-size: 21 * $chat-text-size; - font-family: "Poppins", sans-serif; - font-weight: 700; - letter-spacing: 0.34px; - } - .items-sent { - z-index: 1000; - display: flex; - align-items: center; - justify-content: center; - div, .v-icon { - position: absolute; - } - .v-icon, .v-icon__component { - width: 30%; - height: 30%; - } - } - .file-drop-stack-item { - background: #3a3a3c; - position: absolute; - overflow: hidden; - opacity: 0; - .v-img { - width: 100%; - height: 100%; - object-fit: cover; - } - &.direct { - opacity: 1 !important; - } - &.animated { - animation-name: fadeInStackItem; - animation-fill-mode: both; - animation-duration: 1.5s; - } - } - } - - .file-drop-sending-container { - width: 100%; - padding: 13px 0px 15px 0px; - height: 50%; - overflow-x: hidden; - overflow-y: auto; - white-space: nowrap; - text-align: start; - - /* Hide scrollbar for Chrome, Safari and Opera */ - &::-webkit-scrollbar { - display: none; - } - /* Hide scrollbar for IE, Edge and Firefox */ - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ - - .file-drop-sending-item { - width: 100%; - height: 64px; - overflow: hidden; - background-color: #242424; - border-radius: 12px; - background: linear-gradient(0deg, #26242b 0%, #26242b 100%), #fff; - position: relative; - padding: 8px; - .v-img { - width: $min-touch-target; - height: $min-touch-target; - border-radius: 8px; - object-fit: cover; - flex: 0 0 $min-touch-target; - margin-right: 8px; - } - margin-bottom: 8px; - display: flex; - align-items: center; - .filename { - position: absolute; - top: 18px; - left: 8px; - font-size: 0.7em; - } - .v-progress-linear { - align-self: flex-end; - } - .file-drop-cancel { - position: absolute; - right: 8px; - width: 17px; - height: 17px; - color: green !important; - background: #2e2e3b; - border-radius: 8.5px; - display: flex; - align-items: center; - justify-content: center; - } - } - } - - .file-drop-sending-input-container { - .v-btn { - .v-progress-circular { - margin-left: 8px; - } - background: linear-gradient(0deg, #000 0%, #000 100%), #4642f1; - } - } - - .file-drop-files-sent { - width: 100%; - color: #fff; - text-align: center; - font-size: 21 * $chat-text-size; - font-family: "Poppins", sans-serif; - font-weight: 700; - letter-spacing: 0.34px; - text-align: center; - } - - .file-drop-sent-input-container { - background-color: transparent; - .v-btn { - right: unset; - left: 8px; - background: linear-gradient(0deg, #000 0%, #000 100%), #4642f1; - &.close { - right: 8px; - left: unset; - background: $hiliteColor !important; - } - } - } -} diff --git a/src/assets/css/sendattachments.scss b/src/assets/css/sendattachments.scss index a3094bf..2a2fc65 100644 --- a/src/assets/css/sendattachments.scss +++ b/src/assets/css/sendattachments.scss @@ -1,8 +1,5 @@ @use "@/assets/css/variables" as *; -$large-button-height: $min-touch-target; -$small-button-height: 36px; - $background: #000000; $backgroundSection: #181719; $backgroundHilite: #383739; @@ -23,52 +20,9 @@ $hiliteColor: #4642f1; overflow: hidden; display: flex; flex-direction: column; - align-items: center; - justify-content: center; text-align: center; padding: 16px; - .send-attachments__title { - color: $text; - text-align: center; - font-size: 11.54 * $chat-text-size; - font-family: "Inter", sans-serif; - font-weight: 700; - line-height: 140%; - letter-spacing: 0.34px; - text-transform: uppercase; - margin-top: 13px; - margin-bottom: 25px; - } - - .background { - width: 100%; - height: 50%; - background-color: $background; - - &.drop-target { - background-color: $backgroundHilite; - } - - border-radius: 19px; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - } - - .file-format-info { - opacity: 0.6; - color: $text; - text-align: center; - font-size: 11 * $chat-text-size; - font-family: "Inter", sans-serif; - line-height: 117%; - letter-spacing: 0.4px; - margin-top: 13px; - background: transparent; - } - .v-btn { font-family: "Inter", sans-serif; font-weight: 700; @@ -89,6 +43,20 @@ $hiliteColor: #4642f1; } } + .back-button { + position: absolute; + top: 16px; + left: 16px; + margin: 0; + z-index: 1; + } + + .send-button { + position: absolute; + top: 4px; + right: 4px; + } + textarea { color: rgba($text, 80%) !important; } @@ -97,15 +65,7 @@ $hiliteColor: #4642f1; color: rgba($text, 80%) !important; } - .attachment-wrapper { - width: 100%; - flex: 0 0 100%; - overflow-y: auto; - display: flex; - flex-direction: column; - } - - .file-drop-current-item { + .send-attachments__selecting__current-item { width: 100%; flex: 1 1 100%; background-color: $backgroundSection; @@ -134,27 +94,6 @@ $hiliteColor: #4642f1; } } - .send-attachments__current-item__info { - flex: 0 0 80px; - text-align: start; - margin: 18px 20px; - padding: 0; - position: relative; - - .send-attachments__current-item__info__size { - white-space: pre; - overflow: hidden; - margin-right: 36px; - text-overflow: ellipsis; - } - - .send-attachments__current-item__info__size__filename { - opacity: 0.7; - font-size: 0.8em; - } - - } - .file-drop-thumbnail-container { width: 100%; padding: 13px 20px 15px 20px; @@ -175,6 +114,23 @@ $hiliteColor: #4642f1; scrollbar-width: none; /* Firefox */ + .v-badge { + margin-right: 8px; + } + + .v-badge__badge { + top: 0; + width: 12px; + height: 12px; + padding: 0; + min-width: 12px; + user-select: none; + span { + width: 100%; + height: 100%; + } + } + .file-drop-thumbnail { width: 46px; height: 46px; @@ -264,7 +220,7 @@ $hiliteColor: #4642f1; flex: 0 0 auto; width: 100%; margin-bottom: 50px; - padding: 16px 18px; + padding: 6px 8px; font-family: "Inter", sans-serif; font-weight: 300; diff --git a/src/components/Chat.vue b/src/components/Chat.vue index b6e5b3e..4f46401 100644 --- a/src/components/Chat.vue +++ b/src/components/Chat.vue @@ -26,13 +26,14 @@ -
{ - this.sendingAttachments = []; - this.currentFileInputs = []; - this.sendingStatus = "initial" - }) - .catch((err) => { - if (err.name === "AbortError" || err === "Abort") { - this.currentSendError = null; - this.currentSendErrorExceededFile = null; - } else { - this.currentSendError = err.LocaleString(); - this.currentSendErrorExceededFile = err.LocaleString(); - } - }); - } - }, - - cancelSendAttachment() { - this.$refs.attachment.value = null; - if (this.sendingStatus != "initial") { - this.cancelSendAttachments(); - } - this.currentFileInputs = []; - this.currentSendError = null; - this.currentSendErrorExceededFile = null; - this.sendingStatus = "initial"; - }, - - resetAttachments() { - this.cancelSendAttachment(); - }, - /** * Called by message components that need to change their layout. This will avoid "jumping" in the UI, because * we remember scroll position, apply the layout change, then restore the scroll. @@ -1885,19 +1846,22 @@ export default { }, onVoiceRecording(event) { - this.currentSendShowSendButton = false; - // TODO - refactor - this.currentFileInputs = Array.isArray(this.currentFileInputs) ? [...this.currentFileInputs, event.file] : [event.file]; + const batch = this.$matrix.attachmentManager.createUpload(this.room); + batch.addAttachment(this.$matrix.attachmentManager.createAttachment(event.file)); var text = undefined; if (this.currentInput && this.currentInput.length > 0) { text = this.currentInput; this.currentInput = ""; } - this.sendAttachment(text); - this.showRecorder = false; - - // Log event - this.$analytics.event("Audio", "Voice message sent"); + batch.send(text) + .then(() => { + this.showRecorder = false; + // Log event + this.$analytics.event("Audio", "Voice message sent"); + }) + .catch((err) => { + console.error("Failed to send voice message", err); + }) }, closeRoomWelcomeHeader() { @@ -1973,7 +1937,8 @@ export default { }, closeFileMode() { - this.resetAttachments(); + this.uploadBatch?.cancel(); + this.uploadBatch = undefined; this.$matrix.leaveRoomAndNavigate(this.room.roomId) .catch((err) => { console.log("Error leaving", err); diff --git a/src/components/file_mode/FileDropLayout.vue b/src/components/file_mode/FileDropLayout.vue deleted file mode 100644 index dd94468..0000000 --- a/src/components/file_mode/FileDropLayout.vue +++ /dev/null @@ -1,216 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/components/file_mode/SendAttachmentsLayout.vue b/src/components/file_mode/SendAttachmentsLayout.vue index d65ff2a..81fd029 100644 --- a/src/components/file_mode/SendAttachmentsLayout.vue +++ b/src/components/file_mode/SendAttachmentsLayout.vue @@ -1,170 +1,139 @@