diff --git a/public/style/chat.css b/public/style/chat.css
index 6195a1f..7f019b1 100755
--- a/public/style/chat.css
+++ b/public/style/chat.css
@@ -501,6 +501,36 @@ body {
list-style: none;
}
+.file-upload-container {
+ margin: 10px 0;
+}
+
+.file-list {
+ margin-top: 10px;
+}
+
+.file-item {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 5px;
+ margin: 5px 0;
+ background: var(--background-color-secondary);
+ border-radius: 4px;
+}
+
+.remove-file {
+ background: none;
+ border: none;
+ color: var(--text-color);
+ cursor: pointer;
+ padding: 0 5px;
+}
+
+.remove-file:hover {
+ color: var(--error-color);
+}
+
#message-input {
width: 100%;
height: 50px;
diff --git a/src/pages/chat/chat.ts b/src/pages/chat/chat.ts
index 5d0eda1..a2413a6 100755
--- a/src/pages/chat/chat.ts
+++ b/src/pages/chat/chat.ts
@@ -1162,15 +1162,18 @@ class ChatElement extends HTMLElement {
`;
this.shadowRoot?.appendChild(modal);
-
+ this.handleFileClick(modal);
const closeButton = modal.querySelector('.close-modal');
closeButton?.addEventListener('click', () => {
modal.remove();
@@ -1179,6 +1182,31 @@ class ChatElement extends HTMLElement {
}
}
+ //function for the click on files in the modal
+ private handleFileClick(modal: HTMLDivElement) {
+ const fileInput = modal.querySelector('#file-input') as HTMLInputElement;
+ const fileList = modal.querySelector('#file-list');
+
+ fileInput?.addEventListener('change', () => {
+ if (fileList && fileInput.files) {
+ fileList.innerHTML = '';
+ Array.from(fileInput.files).forEach(file => {
+ const fileItem = document.createElement('div');
+ fileItem.className = 'file-item';
+ fileItem.innerHTML = `
+ ${file.name}
+
+ `;
+ fileList.appendChild(fileItem);
+
+ fileItem.querySelector('.remove-file')?.addEventListener('click', () => {
+ fileItem.remove();
+ });
+ });
+ }
+ });
+ }
+
private async generateMembersList(members: string[]) {
let html = '';
for (const member of members) {