diff --git a/channels/webui/assets/css/chat/upload.css b/channels/webui/assets/css/chat/upload.css index 204deb0b..17d320ce 100644 --- a/channels/webui/assets/css/chat/upload.css +++ b/channels/webui/assets/css/chat/upload.css @@ -124,6 +124,36 @@ padding: 10px; } +/* Drop overlay */ +.drop-overlay { + position: absolute; + inset: 0; + background: color-mix(in srgb, var(--bg-primary) 85%, transparent); + border: 2px dashed var(--accent); + border-radius: var(--radius-md); + display: flex; + align-items: center; + justify-content: center; + z-index: 50; + pointer-events: none; + + .drop-overlay-content { + display: flex; + flex-direction: column; + align-items: center; + gap: 12px; + color: var(--accent); + font-size: 1.1rem; + font-weight: 500; + + svg { + width: 48px; + height: 48px; + opacity: 0.8; + } + } +} + /* Image preview modal */ .image-modal { position: fixed; diff --git a/channels/webui/assets/css/chat/window.css b/channels/webui/assets/css/chat/window.css index 9ab0a5e9..27bfc22b 100644 --- a/channels/webui/assets/css/chat/window.css +++ b/channels/webui/assets/css/chat/window.css @@ -5,6 +5,7 @@ width: 100%; min-width: 40%; max-height: 100%; + position: relative; border: 1px solid var(--border-sidebar); #messages { diff --git a/channels/webui/assets/js/stores/upload.js b/channels/webui/assets/js/stores/upload.js index 1ed2c8fc..f673d775 100644 --- a/channels/webui/assets/js/stores/upload.js +++ b/channels/webui/assets/js/stores/upload.js @@ -1,5 +1,33 @@ const UPLOAD_STORE = { files: [], + dragCount: 0, + + get isDragging() { + return this.dragCount > 0; + }, + + dragEnter() { + this.dragCount++; + }, + + dragLeave(event, el) { + if (event.relatedTarget && el.contains(event.relatedTarget)) return; + this.dragCount = Math.max(0, this.dragCount - 1); + }, + + dragOver(event) { + event.preventDefault(); + event.dataTransfer.dropEffect = 'copy'; + }, + + handleDrop(event) { + event.preventDefault(); + const droppedFiles = event.dataTransfer.files; + if (droppedFiles && droppedFiles.length > 0) { + this.files.push(...droppedFiles); + } + this.dragCount = 0; + }, addFile(event) { this.files.push(...event.target.files); diff --git a/channels/webui/templates/chat/drop_overlay.html b/channels/webui/templates/chat/drop_overlay.html new file mode 100644 index 00000000..972fc5cb --- /dev/null +++ b/channels/webui/templates/chat/drop_overlay.html @@ -0,0 +1,13 @@ +
diff --git a/channels/webui/templates/chat/index.html b/channels/webui/templates/chat/index.html index 2772828b..ca94c51b 100644 --- a/channels/webui/templates/chat/index.html +++ b/channels/webui/templates/chat/index.html @@ -1,3 +1,6 @@ + +{% include 'chat/drop_overlay.html' %} + {% if config.get('enable_chat_header') %} {% include 'chat/header.html' %} diff --git a/channels/webui/templates/index.html b/channels/webui/templates/index.html index bd2c5976..7c54f52e 100644 --- a/channels/webui/templates/index.html +++ b/channels/webui/templates/index.html @@ -95,7 +95,12 @@ {% endif %} -